Skip to Content
Author's profile photo Ajay Maheshwari

Post Cash Discount to COPA at Customer Level

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

Assigned Tags

      11 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Thanks Ajay Sir for sharing such useful information with us.

      I can refer this in future if any such requirement appears.

      Regards,

      Sharu.

      Author's profile photo Ajay Maheshwari
      Ajay Maheshwari
      Blog Post Author

      Thanks Sharu. You are more than welcome 😉

      Author's profile photo Former Member
      Former Member

      Very useful Ajay, keep sharing knowledge.

      Regards,

      Ibrahim Mohamed

      Author's profile photo Ajay Maheshwari
      Ajay Maheshwari
      Blog Post Author

      Thanks Ibrahim for the feedback

      Author's profile photo Srinatha Polati
      Srinatha Polati

      Thanks for sharing this. It is very useful.

      Regards,

      Srinath

      Author's profile photo Ajay Maheshwari
      Ajay Maheshwari
      Blog Post Author

      Thank you Srinath

      Author's profile photo Former Member
      Former Member

      Hi Ajay Maheshwari,

      Thanks for sharing useful information.

      Thanks & Regards

      Sesi Rekha Reddy.

      Author's profile photo Ajay Maheshwari
      Ajay Maheshwari
      Blog Post Author

      Thanks Sesi Rekha

      Author's profile photo Former Member
      Former Member

      Hi Ajay Sir,

       

      Thanks for sharing.

      But i would like to what is a difference between your code and standard functionality of splitting cash discount by profitability characteristics.

      We have activated following  functionality which splits cash discount by  copa segment

      Financial Accounting (New)-General Ledger Accounting (New)-Business Transactions-Document Splitting-Define Document Splitting Characteristics for Controlling.

       

      Thanks

      Rahul Kulkarni

      Author's profile photo Abdullah Galal
      Abdullah Galal

      Thanks a lot Mr. Ajay, this is something frequently requested by customers

      Author's profile photo Amit Singh
      Amit Singh

      Thanks Ajay.

      I would like to know if this can be used for account based COPA as well?