Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

GSBER is empty via BAPI_ACC_DOCUMENT_POST

Hello!

Could you help?

I'm creating the financial document through BAPI_ACC_DOCUMENT_POST with two tax positions.

  PE_DOCUMENTHEADER-BUS_ACT = 'RFBU'.
  PE_DOCUMENTHEADER-USERNAME = SY-UNAME.
  PE_DOCUMENTHEADER-HEADER_TXT = PI_BKTXT.
  PE_DOCUMENTHEADER-COMP_CODE = '40'.
  PE_DOCUMENTHEADER-DOC_DATE = '20080901'.
  PE_DOCUMENTHEADER-PSTNG_DATE = '20080901'.
  PE_DOCUMENTHEADER-FISC_YEAR = '09'.
  PE_DOCUMENTHEADER-FIS_PERIOD = '01'.
  PE_DOCUMENTHEADER-DOC_TYPE = 'SA'.
  PE_DOCUMENTHEADER-REF_DOC_NO = PI_XBLNR.

  LWA_ACCOUNTTAX-ITEMNO_ACC = '0000000001'. 
  LWA_ACCOUNTTAX-GL_ACCOUNT = '1420-'. 
  LWA_ACCOUNTTAX-TAX_CODE = 'NX'. 
  append LWA_ACCOUNTTAX to PET_ACCOUNTTAX. 
  LWA_ACCOUNTTAX-ITEMNO_ACC = '0000000002'. 
  LWA_ACCOUNTTAX-GL_ACCOUNT = '1420-20'. 
  LWA_ACCOUNTTAX-TAX_CODE = 'RT'. 
  append LWA_ACCOUNTTAX to PET_ACCOUNTTAX. 

  LWA_CURRENCYAMOUNT-ITEMNO_ACC = '0000000001'. 
  LWA_CURRENCYAMOUNT-CURRENCY = 'KZT'.
  LWA_CURRENCYAMOUNT-AMT_DOCCUR = '819809,65'. 
  LWA_CURRENCYAMOUNT-AMT_BASE = '6306228,10'. 
  append LWA_CURRENCYAMOUNT to PET_CURRENCYAMOUNT.
  LWA_CURRENCYAMOUNT-ITEMNO_ACC = '0000000002'. 
  LWA_CURRENCYAMOUNT-CURRENCY = 'KZT'.
  LWA_CURRENCYAMOUNT-AMT_DOCCUR = '-819809.65 '. 
  LWA_CURRENCYAMOUNT-AMT_BASE = '-6306228.10 '. 
  append LWA_CURRENCYAMOUNT to PET_CURRENCYAMOUNT.

  LWA_EXTENSION1-FIELD1+0 (5) = 'ID001'.
  LWA_EXTENSION1-FIELD1+5 (5) = 'DOC02'.
  LWA_EXTENSION1-FIELD1+10 (10) = '0000000001'. 
  LWA_EXTENSION1-FIELD1+20 (4) = '4001'.
  LWA_EXTENSION1-FIELD2 = PI_SGTXT.
  append LWA_EXTENSION1 to PET_EXTENSION1.
  LWA_EXTENSION1-FIELD1+0 (5) = 'ID001'.
  LWA_EXTENSION1-FIELD1+5 (5) = 'DOC02'.
  LWA_EXTENSION1-FIELD1+10 (10) = '0000000002'. 
  LWA_EXTENSION1-FIELD1+20 (4) = '4001'.
  LWA_EXTENSION1-FIELD2 = PI_SGTXT.
  append LWA_EXTENSION1 to PET_EXTENSION1.

    call function 'BAPI_ACC_DOCUMENT_POST'
      exporting
        DOCUMENTHEADER = PI_DOCUMENTHEADER
      tables
        ACCOUNTTAX = PIT_ACCOUNTTAX
        CURRENCYAMOUNT = PIT_CURRENCYAMOUNT
        EXTENSION1 = PIT_EXTENSION1
        RETURN = PET_RETURN.
    commit work.

In 'Customer Exit'

  read table EXTENSION index 1.
  case EXTENSION-FIELD1+0 (5).
    when 'ID001.' " ZFIAM_LIZING
        loop at EXTENSION.
  case EXTENSION-FIELD1+5 (5).
    when 'DOC01'.
      read table IT_ACCIT with key POSNR = EXTENSION-FIELD1+10 (10).
      if SY-SUBRC is initial and EXTENSION-FIELD1+20 (2) ne SPACE.
        IT_ACCIT-BSCHL = EXTENSION-FIELD1+20 (2).
      endif.
      modify IT_ACCIT index SY-TABIX.
    when 'DOC02'.
      read table IT_ACCIT with key POSNR = EXTENSION-FIELD1+10 (10).
      if SY-SUBRC is initial.
        if EXTENSION-FIELD1+20 (4) ne SPACE.
          IT_ACCIT-GSBER = EXTENSION-FIELD1+20 (4).
        endif.
        if EXTENSION-FIELD2 is not initial.
          IT_ACCIT-SGTXT = EXTENSION-FIELD2.
        endif.
        modify IT_ACCIT index SY-TABIX.
      endif.
  endcase.
        endloop.
endcase.

In Customer exit I put Business Area into IT_ACCIT-GSBER but in the created document Business Area is empty.

When I create the same document through transaction FB01, Business Area is not empty.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question