Skip to Content
1
Former Member
Jul 23, 2007 at 03:21 AM

BAPI_ACC_document_post

75 Views

Hallo abaper guru,

i use this function to create FI Doc... it's going well..

but if i make entry data for profit segment, unfortunately the system do not create the profit segment document number, although i can see the data in FI line item document that i have entried before..

i dont't know why the system do not create profit segment document number..

please help me..

thank you very much for help and infos,

angela

this is my coding code for this example :

Z_HEADER-BUS_ACT = 'RFBU'.

Z_HEADER-USERNAME = 'USER30'.

Z_HEADER-HEADER_TXT = 'HEADER TEXT'.

Z_HEADER-COMP_CODE = '5010'.

Z_HEADER-DOC_DATE = '20070719'.

Z_HEADER-PSTNG_DATE = '20070719'.

Z_HEADER-FISC_YEAR = '2007'.

Z_HEADER-DOC_TYPE = 'SA'.

APPEND Z_HEADER.

Z_GL_ACCOUNT-ITEMNO_ACC = '0000000001'.

Z_GL_ACCOUNT-GL_ACCOUNT = '0500001000'.

Z_GL_ACCOUNT-ITEM_TEXT = 'item text 1'.

Z_GL_ACCOUNT-REF_KEY_1 = 'REF1'.

Z_GL_ACCOUNT-REF_KEY_2 = 'REF2'.

Z_GL_ACCOUNT-REF_KEY_3 = 'REF3'.

Z_GL_ACCOUNT-COMP_CODE = '5010'.

Z_GL_ACCOUNT-FISC_YEAR = '2007'.

Z_GL_ACCOUNT-PSTNG_DATE = '20070719'.

APPEND Z_GL_ACCOUNT.

Z_GL_ACCOUNT-ITEMNO_ACC = '0000000002'.

Z_GL_ACCOUNT-GL_ACCOUNT = '0500005000'.

Z_GL_ACCOUNT-ITEM_TEXT = 'item text 2'.

Z_GL_ACCOUNT-REF_KEY_1 = 'REF11'.

Z_GL_ACCOUNT-REF_KEY_2 = 'REF22'.

Z_GL_ACCOUNT-REF_KEY_3 = 'REF33'.

Z_GL_ACCOUNT-COMP_CODE = '5010'.

Z_GL_ACCOUNT-FISC_YEAR = '2007'.

Z_GL_ACCOUNT-PSTNG_DATE = '20070719'.

APPEND Z_GL_ACCOUNT.

Z_CURR_AMOUNT-ITEMNO_ACC = '0000000001'.

Z_CURR_AMOUNT-CURRENCY = 'USD'.

Z_CURR_AMOUNT-AMT_DOCCUR = '-1000' .

APPEND Z_CURR_AMOUNT.

Z_CURR_AMOUNT-ITEMNO_ACC = '0000000002'.

Z_CURR_AMOUNT-CURRENCY = 'USD'.

Z_CURR_AMOUNT-AMT_DOCCUR = '1000'.

APPEND Z_CURR_AMOUNT.

<b>Z_CRITERIA-ITEMNO_ACC = '0000000001'.

Z_CRITERIA-FIELDNAME = 'WW004'.

Z_CRITERIA-CHARACTER = 'A1000'.

APPEND z_Criteria.

Z_CRITERIA-ITEMNO_ACC = '0000000001'.

Z_CRITERIA-FIELDNAME = 'WW007'.

Z_CRITERIA-CHARACTER = 'LOCAL'.

APPEND z_Criteria.

Z_CRITERIA-ITEMNO_ACC = '0000000001'.

Z_CRITERIA-FIELDNAME = 'WW008'.

Z_CRITERIA-CHARACTER = 'ID'.

APPEND z_Criteria.

Z_CRITERIA-ITEMNO_ACC = '0000000001'.

Z_CRITERIA-FIELDNAME = 'WW009'.

Z_CRITERIA-CHARACTER = '810'.

APPEND z_Criteria.

Z_CRITERIA-ITEMNO_ACC = '0000000001'.

Z_CRITERIA-FIELDNAME = 'WW011'.

Z_CRITERIA-CHARACTER = 'XYZ'.

APPEND z_Criteria.

Z_CRITERIA-ITEMNO_ACC = '0000000001'.

Z_CRITERIA-FIELDNAME = 'WW012'.

Z_CRITERIA-CHARACTER = '001'.

APPEND z_Criteria.

Z_CRITERIA-ITEMNO_ACC = '0000000001'.

Z_CRITERIA-FIELDNAME = 'KNDNR'.

Z_CRITERIA-CHARACTER = 'TAT001'.

APPEND z_Criteria.</b>

<b>Z_VALUEFIELD-ITEMNO_ACC = '0000000001'.

Z_VALUEFIELD-FIELDNAME = 'ERLOS'.

Z_VALUEFIELD-CURRENCY = 'USD'.

Z_VALUEFIELD-AMT_VALCOM = '1000'.

APPEND Z_VALUEFIELD.</b>

*bold = the profit segment data

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = Z_HEADER

  • CUSTOMERCPD =

  • CONTRACTHEADER =

  • IMPORTING

  • OBJ_TYPE =

  • OBJ_KEY =

  • OBJ_SYS =

tables

ACCOUNTGL = Z_GL_ACCOUNT

  • ACCOUNTRECEIVABLE =

  • ACCOUNTPAYABLE =

  • ACCOUNTTAX =

currencyamount = Z_CURR_AMOUNT

CRITERIA = Z_CRITERIA

VALUEFIELD = Z_VALUEFIELD

  • EXTENSION1 =

return = Z_RETURN

  • PAYMENTCARD =

  • CONTRACTITEM =

  • EXTENSION2 =

  • REALESTATE =

  • ACCOUNTWT =

.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

IMPORTING

RETURN = Z_RETURN1

.

LOOP AT Z_RETURN1.

ENDLOOP.