Search This Blog

Add reversal date in BAPI_ACC_GL_POSTING_POST for FBS1

This can be achieved using table EXTENSION1 of the BAPI. In case EXTENSION1 table is not present in the BAPI - check OSS [Note 487722 - Using EXTENSION1 for accounting BAPIs]

Implementing CMOD/SMOD exit ACBAPI01 with enhancement structure EXTENSION1:
Transaction CMOD: Select your project or create one.Assign enhancement ACBAPI01 to the project.You can branch to the source code via "Components".Navigate to function module EXIT_SAPLACC4_001.This function module indicates the parameters that are available to change the document.In INCLUDE ZXACCU15 (Customer namespace), carry out your implementation as an ABAP program.

In INCLUDE - add your code to populate the new field
DATAwa_ext LIKE extension. 
LOOP AT extension INTO wa_ext.
  IF wa_ext-field1 'STODT'.
    LOOP AT t_accit.
      t_accit-stodt wa_ext-field2.
      MODIFY t_accit.
    ENDLOOP.
  ENDIF.
ENDLOOP.


When calling the BAPI - populate t_extension table's FIELD1 with <field name> i.e. STODT in this example and FIELD2 with <field vale> i.e. reversal date in this case
  * Add reversal date
      w_extension1-field1 'STODT'.
      w_extension1-field2 l_date.
      APPEND w_extension1 TO t_extension1.


  * Calling BAPI to post the document
      CALL FUNCTION BAPI_ACC_GL_POSTING_POST
        EXPORTING
          documentheader w_documentheader
        IMPORTING
          obj_key        g_objkey
        TABLES
          accountgl      t_accountgl
          currencyamount t_currencyamount
          return         t_return
          extension1     t_extension1.