08-25-2008 9:39 AM
Hi All,
I have a to upload the GL using bapi BAPI_ACC_GL_POSTING_POST..the exact requirement is as below..
1. Read the flat file from the specified location(may be from Apllication server or a file of Presentation layer) into internal table.
2. Read the internal table and perform the upload activity. Create the GL's using BAPI_ACC_GL_POSTING_POST.
3. send all error records to BDC session.
4. Display the created GL account in the report (cal be ALV).
The flat file layout contains Header record, Detail record, and Trailer record.
can i any one suggest me on this regard.(If it will be any code similler to above requirement that would be a gr8 help).
Thank you a lot in advance!!!
warm regards,
Kiran
08-25-2008 10:07 PM
Hi,
Just check if you can get any help from it. It will explain you to use the BAPI and passing parameters to it.
Parameters: p_bktxt like bkpf-bktxt default 'Test Bapi'.
Parameters: p_acct1 like bseg-hkont default '17699'.
Parameters: p_acct2 like bseg-hkont default '17699'.
DATA: doc_header LIKE bapiache08,
doc_item LIKE bapiacgl08 OCCURS 0 WITH HEADER LINE,
doc_values LIKE bapiaccr08 OCCURS 0 WITH HEADER LINE,
return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,
extension1 like BAPIEXTC occurs 0 with header line,
obj_type LIKE bapiache08-obj_type,
obj_key LIKE bapiache02-obj_key,
obj_sys LIKE bapiache02-obj_sys,
docnum LIKE bkpf-belnr.
Fill Document Header
doc_header-username = sy-uname.
doc_header-header_txt = p_bktxt.
doc_header-comp_code = 'US01'.
doc_header-doc_date = sy-datlo.
doc_header-pstng_date = sy-datlo.
doc_header-doc_type = 'SA'.
Fill Line 1 of Document Item
doc_item-itemno_acc = '1'.
doc_item-gl_account = p_acct1.
doc_item-pstng_date = sy-datlo.
doc_item-item_text = 'TEST POSTING DEBIT ITEM'.
*doc_item-costcenter = '0000006300'.
*doc_item-orderid = 'M5253'.
APPEND doc_item.
CLEAR doc_item.
Fill Line 2 of Document Item
doc_item-itemno_acc = '2'.
doc_item-gl_account = p_acct2.
*doc_item-profit_ctr = 'INTUS01'.
doc_item-pstng_date = sy-datlo.
doc_item-item_text = 'TEST POSTING CREDIT ITEM'.
APPEND doc_item.
CLEAR doc_item.
Fill Line 1 of Document Value.
doc_values-itemno_acc = '1'.
doc_values-currency_iso = 'USD'.
doc_values-amt_doccur = '1.11'.
APPEND doc_values.
CLEAR doc_values.
Fill Line 2 of Document Value
doc_values-itemno_acc = '2'.
doc_values-currency_iso = 'USD'.
doc_values-amt_doccur = '1.11-'.
APPEND doc_values.
CLEAR doc_values.
Add tax code in extension1 table.
*extension1-field1 = 'BAPI CALL'.
*APPEND EXTENSION1.
All tables filled - now call BAPI.
CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'
EXPORTING
documentheader = doc_header
IMPORTING
OBJ_TYPE = doc_header-obj_type
OBJ_KEY = doc_header-obj_key
OBJ_SYS = doc_header-obj_sys
TABLES
accountgl = doc_item
currencyamount = doc_values
return = return
EXTENSION1 = EXTENSION1.
LOOP AT return WHERE type = 'E'.
EXIT.
ENDLOOP.
IF sy-subrc EQ 0.
WRITE: / 'BAPI call failed - debug and fix!'.
ELSE.
CLEAR return.
REFRESH return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT =
IMPORTING
return = return.
WRITE: / 'BAPI call worked!!'.
WRITE: / doc_header-obj_key, ' posted'.
ENDIF.
Thanks,
Kartavya
08-27-2008 11:52 AM
Hi,
Thanq Kartavya for your quick response.
I have multiple headers in my flat file.can u tell me how to use update using BAPI in that case.
I have some more doubts here..
1. How to update the Tax code and Tax currency for each document item (thru user exit ACBAPI01).
2. In document item(bapiacgl08-itemno_acc) and in Documet value ( bapiaccr08-itemno_acc) we have itemno_acc field.how to update this field or value for this filed will be system generated?. In later case how to link these to tables..
please help me in this regard...
With regards,
Ravi
08-27-2008 9:48 PM
For multiple headers in my flat file -
You have to Use this BAPI within LOOP at Itab ENDLOOP. where ITAB contains your records (header and Item level). Populate Header and Item data within the loop.
For your other doubts -
1. How to update the Tax code and Tax currency for each document item (thru user exit ACBAPI01).
Activate the project and user exit and make changes in INCLUDE ZXACCU15.
Use T_ACCIT table to find the appropriate tax code and tax currency (probably MWSKZ and PYCUR).
2. In document item(bapiacgl08-itemno_acc) and in Documet value ( bapiaccr08-itemno_acc) we have itemno_acc field.how to update this field or value for this filed will be system generated?. In later case how to link these to tables..
itemno_acc are mandatory passing into the BAPI, thts how it will recognize the line items.
The system creates a link to the relevant line item via the line item number ITEMNO_ACC, which for this reason must be unique for each line item.
Thanks,
Kartavya
10-06-2013 3:56 PM
Hi,
But can you tell how to display the document numbers which are created.
10-07-2013 12:10 PM
Hi,
I have similar type of urgent requirement so can you please tell how to display the document numbers which got posted through this bapi.
10-07-2013 12:17 PM