Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
ajaycwa1981
Active Contributor

Hello Everyone

I would like to share a small, but useful tip to make the COPA reporting more inclusive.

Cash Discount to Customers as per the Payment Terms (GL maintained in OBXI) and Customer write-off during Cash Application in F-28 (GL maintained in OBXL) is a common business process. Many clients charge off this Discount or Payment difference to a Cost Center, unaware that it can be tracked at Customer Level or Customer / Product Level, etc

This requires an enhancement using exit COPA0005. SAP note 137552 offers a sample code, in which the GL Account is hard coded. I would like to present a re-usable snippet of code using FI SETS

In the present example, the Cash Discount is identified at Customer Level in COPA. If you wish, you can post it to Customer / Product level by reading those characteristics from the associated invoice.


DATA: i_ce1 LIKE ce1XXXX .                "Replace XXXX with the Op. Concern name




DATA:   lt_setvalues  TYPE TABLE OF rgsb4,


        gt_setvalues  TYPE TABLE OF rsdsselopt,


        lt_setval     TYPE TABLE OF rgsb4,


        gt_setval     TYPE TABLE OF rsdsselopt,


        lwa_setvalues TYPE rgsb4,


        lwa_values    TYPE rsdsselopt,


        lwa_setval    TYPE rgsb4,


        lwa_val       TYPE rsdsselopt.




DATA: lo_salesorder TYPE vbelv,


      lo_delivery   TYPE vbelv,


      lo_kunnr      TYPE kunnr,


      lo_kunag      TYPE kunnr.




"FM to get the values from SET ZFI_CASHDED. Include the OBXI and OBXL GL accounts in this SET



CALL FUNCTION 'G_SET_GET_ALL_VALUES'


  EXPORTING


    client        = sy-mandt


    setnr         = 'ZFI_CASHDED'


    table         = 'BSEG'


    class         = '0000'


    fieldname     = 'HKONT'


  TABLES


    set_values    = lt_setvalues


  EXCEPTIONS


    set_not_found = 1


    OTHERS        = 2.




IF sy-subrc <> 0.


  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno


          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.


ELSE.


  LOOP AT lt_setvalues  INTO lwa_setvalues .


    lwa_values-sign   = 'I' .


    lwa_values-option = 'EQ' .


    lwa_values-low    = lwa_setvalues-from .


    lwa_values-high   = lwa_setvalues-to .


    APPEND lwa_values TO gt_setvalues .


  ENDLOOP.


ENDIF.



CASE i_erkrs .                            "of your operating concern



  WHEN 'XXXX' .                           "Replace XXXX with Op. Concern name 


    i_ce1 = i_item .


    IF t_accit-hkont IN   gt_setvalues .


      LOOP AT t_accit WHERE koart = 'D' . "look for the receivable


      ENDLOOP .


      IF sy-subrc = 0 AND NOT t_accit-kunnr IS INITIAL .


        i_ce1-kndnr = t_accit-kunnr .


      ENDIF.


      CLEAR i_ce1-paobjnr .


    ENDIF.


i_item = i_ce1 .


ENDCASE.


e_item = i_item .


Note

1) This Code will populate the Customer # in the COPA document. The Profitability Segment in FI Document will continue to have a Blank Customer

2) Once the Cash Discount, Bad Debts or Payment Differences are identified at Customer level, you can optionally perform Top Down Distribution to take it down to Product level

Hope you find this re-usable asset useful

Best Regards

Ajay Maheshwari

11 Comments
Labels in this area