2006 Jun 21 4:59 PM
Hi,
I'm using the 'BAPI_ACC_GL_POSTING_POST' to do the same as tran saction FBS1, having a few problems with the code in terms of values I should be using.
When using FBs1 the values I use are from the following 2 lines:
Po Number, Item, DELv. Date, Descr., Undelvd. Val., GL ACCount, Cost centre, last field being internal order
4500011114 10 23.05.2006 pallet of photo paper 5,000.00 476000 2-1000
And
4500011114 50 20.05.2006 marketing assistants 500.00 417000 400157
Not sure what values I should use for the following
documentheader-obj_key = '000000000100000038'.
documentheader-obj_type = 'BKPFF'.
*documentheader-obj_key = '180000000010002004'.
documentheader-obj_sys = 'RD1CLNT200'.
documentheader-username = sy-uname.
documentheader-header_txt = 'Test using BAPI'.
documentheader-comp_code = '2000'.
The error I get is:
E |RW |609 |Error in document: BKPFF 0000000001000000<
and E |F5 |702 |Balance in transaction currency
The code is below:
DATA:
obj_type LIKE bapiache02-obj_type,
obj_key LIKE bapiache02-obj_key,
obj_sys LIKE bapiache02-obj_sys,
documentheader LIKE bapiache08,
accountgl LIKE bapiacgl08
OCCURS 0 WITH HEADER LINE,
currencyamount LIKE bapiaccr08
OCCURS 0 WITH HEADER LINE,
return LIKE bapiret2
OCCURS 0 WITH HEADER LINE,
extension1 LIKE bapiextc
OCCURS 0 WITH HEADER LINE,
t_edidd LIKE edidd OCCURS 0 WITH HEADER LINE,
bapi_retn_info LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: error_flag.
*documentheader-obj_type = 'BKPFF'.
documentheader-obj_key = '000000000100000038'.
documentheader-obj_type = 'BKPFF'.
*documentheader-obj_key = '180000000010002004'.
documentheader-obj_sys = 'RD1CLNT200'.
documentheader-username = sy-uname.
documentheader-header_txt = 'Test using BAPI'.
documentheader-comp_code = '2000'.
*documentheader-ac_doc_no
*documentheader-fisc_year = '2005'.
documentheader-doc_date = '20060506'.
documentheader-pstng_date = '20060506'.
*documentheader-trans_date
*documentheader-fis_period
documentheader-doc_type = 'SA'.
*documentheader-ref_doc_no
*documentheader-compo_acc
*documentheader-reason_rev
accountgl-itemno_acc = '1'.
accountgl-gl_account = '0000476000'.
accountgl-comp_code = '2000'.
accountgl-pstng_date = '20060506'.
accountgl-doc_type = 'SA'.
accountgl-profit_ctr = '2-1000'.
*accountgl-
APPEND accountgl.
accountgl-itemno_acc = '2'.
accountgl-gl_account = '0000476000'.
accountgl-comp_code = '2000'.
accountgl-pstng_date = '20060506'.
accountgl-doc_type = 'SA'.
accountgl-profit_ctr = '2-1000'.
*accountgl-
APPEND accountgl.
accountgl-itemno_acc = '3'.
accountgl-gl_account = '0000417000'.
accountgl-comp_code = '2000'.
accountgl-pstng_date = '20060506'.
accountgl-doc_type = 'SA'.
accountgl-profit_ctr = '0000400157'.
APPEND accountgl.
accountgl-itemno_acc = '4'.
accountgl-gl_account = '0000417000'.
accountgl-comp_code = '2000'.
accountgl-pstng_date = '20060506'.
accountgl-doc_type = 'SA'.
accountgl-profit_ctr = '0000400157'.
APPEND accountgl.
*AC_DOC_NO
*FISC_YEAR
*FIS_PERIOD
*accountgl-STAT_CON = 'X'.
*REF_KEY_1
*REF_KEY_2
*REF_KEY_3
*CUSTOMER
*VENDOR_NO
*ALLOC_NMBR
*ITEM_TEXT
*BUS_AREA
*COSTCENTER
*ACTTYPE
*ORDERID
*ORIG_GROUP
*COST_OBJ
*PROFIT_CTR
*PART_PRCTR
*WBS_ELEMENT
*NETWORK
*ROUTING_NO
*ORDER_ITNO
currencyamount-itemno_acc = '1'.
currencyamount-currency = 'EUR'.
currencyamount-amt_doccur = '5000.00'.
APPEND currencyamount.
currencyamount-itemno_acc = '2'.
currencyamount-currency = 'EUR'.
currencyamount-amt_doccur = '-5000.00'.
APPEND currencyamount.
currencyamount-itemno_acc = '3'.
currencyamount-currency = 'EUR'.
currencyamount-amt_doccur = '-500.00'.
APPEND currencyamount.
currencyamount-itemno_acc = '4'.
currencyamount-currency = 'EUR'.
currencyamount-amt_doccur = '-500.00'.
APPEND currencyamount.
call BAPI-function in this system
CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'
EXPORTING
documentheader = documentheader
importing
obj_type = obj_type
obj_key = obj_key
obj_sys = obj_sys
TABLES
accountgl = accountgl
currencyamount = currencyamount
return = return
extension1 = extension1
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE e999(re) WITH 'Problem occured'.
ELSE.
LOOP AT return.
IF NOT return IS INITIAL.
CLEAR bapi_retn_info.
MOVE-CORRESPONDING return TO bapi_retn_info.
IF return-type = 'A' OR return-type = 'E'.
error_flag = 'X'.
ENDIF.
APPEND bapi_retn_info.
ENDIF.
ENDLOOP.
IF error_flag = 'X'.
MESSAGE e999(re) WITH 'Problem occured'.
ROLLBACK WORK.
ELSE.
COMMIT WORK.
ENDIF.
ENDIF.
Many Thanks
Regards Sims
2006 Jun 21 5:05 PM
Try using FM POSTING_INTERFACE_DOCUMENT instead BAPI.
Regards.
2006 Jun 21 5:05 PM
2006 Jun 21 11:18 PM
hi,
is there is an example of how to use FM POSTING_INTERFACE_DOCUMENT, I guess, one of my issues is trying to work out the parameters I need to use?
Many Thanks
Regards Sims
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |