Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Posting Key issue in BAPI_ACC_DOCUMENT_POST

0 Kudos

Hi,

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

method IF_EX_ACC_DOCUMENT~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.
ENDIF.
ENDIF.
ENDLOOP.
endmethod.

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
CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
EXPORTING
documentheader = gd_documentheader
customercpd = gd_customercpd
contractheader = gd_fica_hd
TABLES
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,

Thanks,

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

Did you fill SP_GL_IND in ACCOUNTRECEIVABLE?

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.

9 REPLIES 9

raymond_giuseppi
Active Contributor
0 Kudos

Did you fill SP_GL_IND in ACCOUNTRECEIVABLE?

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.

0 Kudos

When I pass an initial value to GL_ACCOUNT field in ACCOUNTRECEIVABLE work fine , but I need to pass POSTING KEY as '19' . Currently the BAPI update the posting as 11 by automatically .

I disabled the BADI in this case.

Regards

0 Kudos

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.

0 Kudos

Hi.

I am filling SP_GL_IND with value A in table ACCOUNTRECEIVABLE

This generated error:

0 Kudos

Try to pass an initial value to GL_ACCOUNT field in ACCOUNTRECEIVABLE.

0 Kudos

Hi

I solved the issue passing an initial value to GL_ACCOUNT field in ACCOUNTRECEIVABLE.

However when I am using other type 'Special G/L Indicator' for example F the system is generating the following error:

Tipo: E Nro.: 613 BAPI call with wrong business transaction RFBU RFBU DOCUMENTHEADER

Regards

0 Kudos

The Note already provided contains a sample for noted item (like F for vendor) so open it and look for noted_item.txt. Also read carefully the note as there should be a note/minimal SP required to use the BAPI for those kind of document.

Former Member
0 Kudos

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.

erico_bispo
Discoverer
0 Kudos

Excuse me if the time is really later, but I had a problem with BAPI_ACC_DOCUMENT_POST and I read your message to understand and create my own solution.

However, I don't use the BADI.

I found the field SP_IND_GL in the table ACCOUNTPAYABLE and I fill it with the content of my original document. Only to explain, my goal was convert all open documents in AP in some company to other. It works well.