06-15-2006 1:14 PM
Dear all,
I will require to post through FB01 transaction, not through BDC, but through BAPI or some other function module. We have identified BAPI_ACC_DOCUMENT_POST for posting.I have following input parameters:
1. Document Date
2. Posting Date
3. Reference
4. Doc. Header Text
5. Company Code
6. Currency
7. Document Type
For line Item
1. Posting Key
2. Account
3. Amount
4. Business Area
5. Profit Center
6. Profitability segment
7. Assignment
8. Text
I am not able to map some of the fields eg. Posting Key, Account, Currency in header etc.
Can you please suggest if there is any other function module through which FB01 posting can be done. We want to avoid BDC.
Thanks and regards,
Atanu
06-15-2006 1:29 PM
Check with the below FMs
<b>BAPI_ACC_GL_POSTING_POST
BAPI_ACC_BILLING_POST
BAPI_ACC_INVOICE_RECEIPT_POST
POSTING_INTERFACE_DOCUMENT</b>
rgds,
TM.
06-15-2006 2:31 PM
Thank you for your reply. Is there any provision for giving Posting Key in any of the function module
06-15-2006 3:04 PM
Hi,
the posting key is determined automatically in the BAPIs - don't care for it. Even if you have confused order of items, the BAPI will know what to do according to account, sign of amount, document type and whatever.
We used function 'BAPI_ACC_GL_POSTING_POST'.
Here is a code snippet you may derive how to map:
<pre>
ls_documentheader-obj_type = 'BKPFF'.
ls_documentheader-obj_sys = lv_logsys.
ls_documentheader-obj_key = '$'.
ls_documentheader-username = sy-uname.
ls_documentheader-header_txt = 'Notes reconciliation'(a04).
ls_documentheader-comp_code = ps_alv_display-rbukrs.
ls_documentheader-doc_date = sy-datum.
ls_documentheader-fisc_year = sy-datum(4).
ls_documentheader-pstng_date = p_budat.
ls_documentheader-fis_period = p_bper .
ls_documentheader-doc_type = p_blart.
ls_accountgl-itemno_acc = 1.
ls_accountgl-gl_account = ps_alv_display-racctnote.
ls_accountgl-comp_code = ps_alv_display-rbukrs.
ls_accountgl-item_text = 'Notes reconciliation'(a04).
ls_accountgl-profit_ctr = ps_alv_display-prctr.
APPEND ls_accountgl TO lt_accountgl.
ls_accountgl-itemno_acc = 2.
ls_accountgl-gl_account = p_gkont.
ls_accountgl-comp_code = ps_alv_display-rbukrs.
ls_accountgl-item_text = 'Notes reconciliation'(a04).
ls_accountgl-profit_ctr = ps_alv_display-prctr.
APPEND ls_accountgl TO lt_accountgl.
Company Code Currency
ls_currencyamount-curr_type = '10'. "Company code currency
ls_currencyamount-itemno_acc = 1.
ls_currencyamount-currency = ps_alv_display-hwaer.
ls_currencyamount-amt_doccur = ps_alv_display-diff_h.
APPEND ls_currencyamount TO lt_currencyamount.
ls_currencyamount-itemno_acc = 2.
ls_currencyamount-amt_doccur = - ps_alv_display-diff_h.
APPEND ls_currencyamount TO lt_currencyamount.
Transaction Currency
ls_currencyamount-curr_type = '00'. "Transaction currency
ls_currencyamount-itemno_acc = 1.
ls_currencyamount-currency = ps_alv_display-rtcur.
ls_currencyamount-amt_doccur = ps_alv_display-diff_t.
APPEND ls_currencyamount TO lt_currencyamount.
ls_currencyamount-itemno_acc = 2.
ls_currencyamount-amt_doccur = - ps_alv_display-diff_t.
APPEND ls_currencyamount TO lt_currencyamount.
CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'
EXPORTING
documentheader = ls_documentheader
IMPORTING
obj_type = lv_obj_type
obj_key = lv_obj_key
obj_sys = lv_obj_sys
TABLES
accountgl = lt_accountgl
currencyamount = lt_currencyamount
return = lt_return
</pre>
Note: All data come prom an ALV list, thus the name ps_alv_display of the structure passing data. In our scenario two accounts were posted, one of them with the negative amount. Some strings should be adjusted because they are scenario-specific.
The function is really nice, all errors occuring otherwise online in FB01 are reported in return table.
Hope it helps,
regards,
Clemens
06-15-2006 2:52 PM
Hi Atanu,
In order to find function modules, try to find them on tx SE80, with your tx´s proogram name, in case you don´t find them go to an upper level and check the pakcage´S FM.
Usually they are grouped by transactions.
Hope this helps
Gabriel P.
06-15-2006 2:58 PM
Hi Atanu,
There is no field as such for psotinf key in BAPI_ACC_DOCUMENT_POST. Based on the GL account and the corresponding amount (debit or credit) u enter for the items, the posting key will be automatically determined. Try posting one document.
Sreedhar