Skip to Content

Posting Key issue in BAPI_ACC_DOCUMENT_POST


I have problem to pass posting to BAPI BAPI_ACC_DOCUMENT_POST...

I need to pass POSTING KEY as '19' . Currently the BAPI update the posting as 11 by automatically .

Special G/L Indicator for the Next Line Item = A.

I have implemented the BADI ACC_DOCUMENT, Method CHANGE

DATA: wa_extension TYPE bapiparex,
wa_accit TYPE accit.
LOOP AT c_extension2 INTO wa_extension.
* Extend BAPI to have Posting Keys defined by user
IF wa_extension-structure = 'POSTING_KEY'.
CLEAR wa_accit.
READ TABLE c_accit INTO wa_accit
WITH KEY posnr = wa_extension-valuepart1.
IF sy-subrc = 0.
wa_accit-bschl = wa_extension-valuepart2.
MODIFY c_accit FROM wa_accit INDEX sy-tabix TRANSPORTING bschl.

My Program.

* Populate the Extension table
wa_bapiparex-structure = 'POSTING_KEY'.
wa_bapiparex-valuepart1 = ' 0000000001'. " Item number
wa_bapiparex-valuepart2 = '19'. " Posting Key
APPEND wa_bapiparex TO it_bapiparex.

* Valida consistencia de información
documentheader = gd_documentheader
customercpd = gd_customercpd
contractheader = gd_fica_hd
accountgl = it_accountgl
accountreceivable = it_accountreceivable
accountpayable = it_accountpayable
* accounttax = it_accounttax
currencyamount = it_currencyamount
* criteria = it_criteria
* valuefield = it_valuefield
extension1 = it_ext
return = it_return
* paymentcard = it_paymentcard
* contractitem = it_fica_it
extension2 = it_bapiparex.
* realestate = it_re.
APPEND LINES OF it_return TO it_allreturn.

The system show this message of error:

Special G/L indicator not defined or incorrect 19

Can you please help me to solve it,


bapi.jpg (17.1 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Sep 18, 2017 at 05:53 AM


    NB: Most of the time I use the 'Special G/L Indicator' field for AP/AR accounts and the 'Transaction Key' field for G/L accounts to automatically change the posting key.

    Add comment
    10|10000 characters needed characters exceeded

    • Read 2083799 - Composite SAP Note: Postings with Accounting BAPIs, look for '7. Special G/L transactions'. you should read 'The structures ACCOUNTRECEIVABLE and ACCOUNTPAYABLE contain the field SP_GL_IND, which you can use to post a special G/L transaction. The BAPI then derives the posting key of this open item accordingly.' So if that's not what you get, look for your Customizing or some substition/change/BAdi which could cause the problem, look also for OSS notes available for your version.

  • avatar image
    Former Member
    Sep 19, 2017 at 10:05 AM

    BAPI will automatically assign posting key on the basis of 1) account receivable or payable and 2) amount passed to it. Just check it in SE37 with some test cases. There is no need of BADI in this case.

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 18, 2017 at 09:21 PM


    I am filling SP_GL_IND with value A in table ACCOUNTRECEIVABLE

    This generated error:

    Add comment
    10|10000 characters needed characters exceeded