on 04-08-2008 7:43 AM
Hi,
can anybody help me how can I map / pass the following POSTING KEY in BAPI_ACC_DOCUMENT_POST?
Type Posting Key Positive or Negative
GL 40 +ve (debit)
GL 50 -ve (credit)
AP 21 +ve (debit)
AP 31 -ve (credit)
AR 01 +ve (debit)
AR 11 -ve (credit)
thank you in advance!!!
james evert lising
Hi,
For passing the posting key you need to use the extention structure of BAPI_ACC_DOCUMENT_POST and then use BADI ACC_DOCUMENT
with the other parameters you have to populate the extension table of bapi
data : it_ bapiparex type table of bapiparex,
wa_bapiparex type bapiparex
* Populate the Extension table
wa_bapiparex-structure = 'POSTING_KEY'.
wa_bapiparex-valuepart1 = '10'. " Item number
wa_bapiparex-valuepart2 = '40'. " Posting Key
APPEND wa_bapiparex TO it_bapiparex.
* Call the Bapi to post the document
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = wa_docheader
TABLES
accountgl = it_bapiacgl09
accountpayable = it_bapiacap09
currencyamount = it_bapiaccr09
return = it_bapiret2
extension2 = it_bapiparex
Now create an implementation of BADI ACC_DOCUMENT in SE19 and
write the following code in method CHANGE of BADI
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.
Hope this solves your problem
Regards,
Gaurav
.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you very much Jagya, it's really worked out!
DATA:
accountpayable LIKE bapiacap09 OCCURS 0 WITH HEADER LINE,
currencyamount LIKE bapiaccr09 OCCURS 0 WITH HEADER LINE.
positive amount of currencyamount-amt_doccur will get a debit posting key: 21.
negative amount of currencyamount-amt_doccur will get a credit posting key: 31.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
No need to pass the posting key explicitly, since system will be determined automatically based on debit and credit data entries at item level.
IF ls_post-newbs = '40'.
ls_currency-amt_doccur = ls_post-dmbe2.
ELSEIF ls_post-newbs = '50'.
ls_currency-amt_doccur = ls_post-dmbe2 * -1.
ENDIF.
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You do not need to pass a posting key to the BAPI - SAP knows the kind of line item by the table type (ACCOUNTGL, ACCOUNTRECEIVABLE etc.) and the sign on the dollar amount - credits are to be sent as negative dollar amounts in CURRENCYAMOUNT table. No need to make or use an entension.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.