Register Login

How to add reversal date in FBS1 through BAPI_ACC_GL_POSTING_POST

Updated May 18, 2018

When posting accrual document through BAPI_ACC_GL_POSTING_POST  to FBS1 - reveral date (BKPF-STODT) can be passed using table EXTENSION1 of the BAPI. (Note - Similarly any other field not passed by BAPI can be passed ) 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 ZXACCU15 - add your code to populate the new field - reversal dat in this case
DATA: wa_ext LIKE extension. 
READ TABLE extension INTO wa_ext WITH KEY field1 = 'STODT'.
  IF sy-subrc EQ 0.
    LOOP AT t_accit.
      t_accit-stodt = wa_ext-field2.
      MODIFY t_accit.
    ENDLOOP.
  ENDIF.
ENDLOOP.

When calling the BAPI in your main program - populate t_extension table's FIELD1 with i.e. STODT in this case and FIELD2 with i.e. reversal date in this case
  ***** Add reversal date
      wa_extension-field1 = 'STODT'.
      wa_extension-field2 = l_date.
      APPEND wa_extension TO t_extension1.

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


Comments

  • 01 Oct 2016 4:36 am Guest

    above code din't work form me !! Filled extension with date field and implemented BADI to fill t_accit with the extension field value. Still due to some reason reversal date is not being displayed in document header !! any suggestions pls..


×