‎2006 Jun 22 3:01 PM
Hello,
When using BAPI_ACC_GL_POSTING_POST
how do I determine:
documentheader-obj_type =
documentheader-obj_sys =
documentheader-obj_key =
I believe the object type is 'BKPF', but how do I work out what the other values should be?
Regards Sanj
‎2006 Jun 22 3:05 PM
documentheader-obj_type =
documentheader-obj_sys =
documentheader-obj_key =
The above fields are exporting parameters for the FM(I mean importing for the program calling the bapi).
YOu do not need to pass anything here.
The bapi will return those values.
Regards,
Ravi
‎2006 Jun 22 3:05 PM
documentheader-obj_type =
documentheader-obj_sys =
documentheader-obj_key =
The above fields are exporting parameters for the FM(I mean importing for the program calling the bapi).
YOu do not need to pass anything here.
The bapi will return those values.
Regards,
Ravi
‎2006 Jun 22 3:38 PM
Hi,
I keep getting the following message when running the program below:
E |RW |609 |Error in document: <
E |RW |602 |Required field OBJ_TYP was not transferre<
E |RW |602 |Required field OBJ_KEY was not transferre<
E |RW |602 |Required field OBJ_SYS was not transferre<
&----
*& Report ZSimm *
*& *
&----
*& *
*& *
&----
REPORT zsimm .
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_key = '000000000100000038'.
*documentheader-obj_type = 'BKPFF'.
*documentheader-obj_sys = 'RD1CLNT200'.
documentheader-username = sy-uname.
documentheader-doc_date = '310506'.
documentheader-doc_type = 'SA'.
documentheader-comp_code = 2000.
documentheader-pstng_date = '310506'.
documentheader-ref_doc_no = 'Accrual Post'.
documentheader-reason_rev = '05'.
documentheader-ac_doc_no = 476000.
*documentheader-obj_key = 40.
*documentheader-ac_doc_no
*documentheader-fisc_year = '2005'.
*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-costcenter = '2-1000'.
APPEND accountgl.
accountgl-itemno_acc = '2'.
accountgl-gl_account = '0000476000'.
accountgl-comp_code = '2000'.
accountgl-pstng_date = '20060506'.
accountgl-doc_type = 'SA'.
accountgl-costcenter = '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.
I can't understand hy then?
‎2006 Jun 22 3:54 PM
Hi Sims,
right, the mentioned fields are export parameters too, because i.e. part of the OBJ_KEY is the document number which is created for the document. SAP uses a $ sign in this case. Complete and working solution (no comment from chatterer):
<pre>
DATA:
ls_documentheader TYPE bapiache08,
lv_logsys TYPE t000-logsys.
SELECT SINGLE logsys INTO lv_logsys FROM t000 WHERE mandt = sy-mandt.
ls_documentheader-obj_type = 'BKPFF'.
ls_documentheader-obj_sys = lv_logsys.
ls_documentheader-obj_key = '$'.
</pre>
If you need more information posting with this BAPI: We used in in several situations including the use of extension to get fields posted what are not in the interface structures.
But if you overcome this obj_* barrier, the rest is comparably easy.
Regards,
Clemens
‎2006 Jun 22 3:57 PM
Hi,
just another thing: Keep close to the standard and use
FM BAPI_TRANSACTION_COMMIT and BAPI_TRANSACTION_ROLLBACK.
Regards,
Clemens