on 05-16-2006 7:00 AM
Hi All,
in which table that specifies the field for posting key for BAPI_ACC_DOCUMENT_POST
I have the same question to you,,,
have you solved your problem?
After refering to the source code of BAPI_ACC_DOCUMENT_POST ,,
i found out the posting key is determine by the ACCT_KEY of table ACCOUNTGL ...
to get what posting key it will retrieve, i refer to T030B ... i still cant solve my problem, how about you ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Mohammed,
If i'm not wrong you are asking about the posting key in the BAPI_ACC_DOCUMENT_POST.
In the above BAPI, we can pass the posting key only with in the EXtension2 strucutre, that will be useful in BADI implementation (BADI_ACC_DOCUMENT).
We can decide the posting keys by using the above BADI, otherwise the BAPI, it self decides the posting key based on the Amount.
if you still any doubts, please search sdn for my posts on this BAPI.
Thanks,
Adi.
Hello Kokwei Wong,
I once had the same problem and the only way out was to implement the BTE process RWBAPI01 which is called whenever you use the extension1 table of the BAPI_ACC_DOCUMENT_POST.
In my custom program I added this code
CONCATENATE 'PDR' 'BSCHL' INTO st_extension-field1 SEPARATED BY '-'. CONDENSE st_extension-field1 NO-GAPS.
APPEND st_extension TO t_extension.
and passed the t_extension table in the bapi tables extension1.
then I activated the BTE process RWBAPI01 (transaction FIBF) and in the function module I developed this code.
IF it_accit-blart = 'AI'. "So that this would work only for this doc. type
LOOP AT extension.
SPLIT extension AT '-' INTO w_flusso w_campo.
IF w_flusso = 'PDR' AND w_campo = 'BSCHL'.
EXIT.
ELSE.
CLEAR: w_flusso, w_campo.
ENDIF.
ENDLOOP.
IF w_flusso = 'PDR' AND w_campo = 'BSCHL'.
LOOP AT it_accit WHERE koart = 'D'.
IF it_accit-shkzg = 'H'.
it_accit-bschl = '15'.
ELSE.
it_accit-bschl = '06'.
ENDIF.
MODIFY it_accit.
ENDLOOP.
ENDIF.
ENDIF.
of course this worked for my specific case but maybe this solution may be useful to you too.
let us know!
If you want to pass posting key then you have to enhance the BAPI and then use the extension / entension2. This is not a standard way to doing things.
My suggestion is to populate the accountsreceivable table when you want the customer to be credited. This is specially helpful for balancing out bad debts and clearing them.
In the example below, I have collated the data in such a way that the data is grouped together. There is a flag that a record is a customer record and if it is a customer then we will accounts receivable instead of glaccount.
CLEAR lv_item.
LOOP AT lt_collate INTO lwa_collate.
* Increment item number
lv_item = lv_item + 1.
IF lwa_collate-cust IS INITIAL.
* Fill Account GL if it is GL account
CLEAR lwa_bapi_acctgl.
lwa_bapi_acctgl-itemno_acc = lv_item.
lwa_bapi_acctgl-gl_account = lwa_collate-hkont.
lwa_bapi_acctgl-comp_code = gv_bukrs.
lwa_bapi_acctgl-pstng_date = gv_bldat.
lwa_bapi_acctgl-doc_type = lco_doctype.
lwa_bapi_acctgl-costcenter = lwa_collate-kostl.
lwa_bapi_acctgl-item_text = lwa_collate-name1.
lwa_bapi_acctgl-tax_code = lco_tax_code.
APPEND lwa_bapi_acctgl TO lt_bapi_acctgl.
ELSE.
* Fill Account receivable if it is a customer
CLEAR lwa_bapi_acctrcv.
lwa_bapi_acctrcv-itemno_acc = lv_item.
lwa_bapi_acctrcv-customer = lwa_collate-kunnr.
lwa_bapi_acctrcv-gl_account = lwa_collate-hkont.
lwa_bapi_acctrcv-comp_code = gv_bukrs.
lwa_bapi_acctrcv-item_text = lwa_collate-name1.
APPEND lwa_bapi_acctrcv TO lt_bapi_acctrcv.
ENDIF.
* Fill amounts
CLEAR lwa_currencyamount.
lwa_currencyamount-itemno_acc = lv_item.
lwa_currencyamount-currency = lwa_collate-waers.
lwa_currencyamount-amt_doccur = lwa_collate-wrbtr.
APPEND lwa_currencyamount TO lt_currencyamount.
ENDLOOP.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
EXPORTING
documentheader = lwa_bapi_docheader
TABLES
accountgl = lt_bapi_acctgl
accountreceivable = lt_bapi_acctrcv
currencyamount = lt_currencyamount
return = lt_return.
* Check if the document is okay to post
READ TABLE lt_return INTO lwa_return INDEX 1.
IF lwa_return-type = lco_bapiret_s.
* Post the account document
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = lwa_bapi_docheader
IMPORTING
obj_key = lv_objkey
TABLES
accountgl = lt_bapi_acctgl
accountreceivable = lt_bapi_acctrcv
currencyamount = lt_currencyamount
return = lt_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
If you use GLaccount only you will get results with posting key 40 and 50 for debit and credit accordingly. But if you use accountsreceivale instead for customers you will get debit and credit memos with pkey 1 / 11... you can check the generated document in fb03
hope this helps you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
somewhere i seen same posting , just search in this forum , and in sapfans.com.
and my suggesion is find out where-used list og that FM so u will come to know how to use this FM
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 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.