09-13-2006 8:14 PM
Hey everyone,
I was trying to use the function BAPI_ACC_DOCUMENT_POST. When I run the function by manually enter the value in the table, it runs successfully.
Then I use a program to enter all the values (hard code values to be exact same as I run the function), and call the function. It returns a error message. Message number 609, and the text is "Error in document: BKPFF $ 522AD1R3"
Following this are the errors number 602... "Required field was not transferred in parameter DOCUMENTHEADER"
In the program, I didn't hard code OBJ_TYPE, OBJ_KEY, and OBJ_SYS. I figure those should be picked up automatically.
Anyone have any idea why this is happening? Please help. And thank you in advance.
Amy
09-13-2006 9:36 PM
obj_key should be passed with the document number as it does not generate automatically.
you can use FM - NUMBER_GET_NEXT to get the next available number.
09-13-2006 8:15 PM
09-13-2006 9:36 PM
obj_key should be passed with the document number as it does not generate automatically.
you can use FM - NUMBER_GET_NEXT to get the next available number.
09-13-2006 10:40 PM
Do you mean I should also pass GS_DOCUMENTHEADER-AC_DOC_NO using the NUMBER_GET_NEXT function?
09-13-2006 10:41 PM
Hi
I don't believe it, you have to check if some fields is setted as obligatory in FI customizing.
This is the code of my program and it works fine:
BAPIACHE09-BUS_ACT = 'RFBU'.
BAPIACHE09-USERNAME = SY-UNAME.
BAPIACHE09-COMP_CODE = P_BUKRS.
BAPIACHE09-DOC_DATE = P_BUDAT.
BAPIACHE09-PSTNG_DATE = P_BUDAT.
BAPIACHE09-DOC_TYPE = P_BLART.
These are the fields you have to fill, but perhaps for your document type you need to transfer a reference (XBLNR) or a text.
Max
09-13-2006 11:38 PM
The following is my code. Any one see anything that I am missing? Why it's NOT giving me OBJ_KEY value but only "$"? Any idea? Thanks for help.
Amy
data: gs_DOCUMENTHEADER like BAPIACHE09.
data: begin of gt_DOCUMENTHEADER occurs 0.
include structure BAPIACHE09.
data: end of gt_DOCUMENTHEADER.
data: gs_accountgl like BAPIACGL09.
data: begin of gt_accountgl occurs 0.
include structure BAPIACGL09.
data: end of gt_accountgl.
data: gs_accountpayable like BAPIACAP09.
data: begin of gt_accountpayable occurs 0.
include structure BAPIACAP09.
data: end of gt_accountpayable.
DATA: gs_currencyamount like BAPIACCR09.
data: begin of gt_currencyamount occurs 0.
include structure BAPIACCR09.
data: end of gt_currencyamount.
data: begin of gt_return occurs 0.
include structure BAPIRET2.
data: end of gt_return.
DATA: gv_obj_type LIKE BAPIACHE09-OBJ_TYPE,
gv_obj_key LIKE BAPIACHE09-OBJ_KEY,
gv_obj_sys LIKE BAPIACHE09-OBJ_SYS.
gs_documentheader-bus_act = 'RFBU'.
gs_documentheader-username = sy-uname.
gs_documentheader-header_txt = 'test'.
gs_documentheader-comp_code = '3100'.
gs_documentheader-doc_date = '08282006'.
gs_documentheader-pstng_date = '08282006'.
gs_documentheader-doc_type = 'KA'.
append gs_documentheader to gt_documentheader.
gs_accountpayable-itemno_acc = '2'.
gs_accountpayable-vendor_no = '0060001439'.
APPEND gs_accountpayable TO gt_accountpayable.
gs_accountgl-itemno_acc = '1'.
gs_accountgl-gl_account = '0000825100'.
gs_accountgl-costcenter = '0000010500'.
APPEND gs_accountgl TO gt_accountgl.
gs_currencyamount-itemno_acc = '1'.
gs_currencyamount-currency = 'USD'.
gs_currencyamount-amt_doccur = '350.00'. "i_tab-repval.
APPEND gs_currencyamount TO gt_currencyamount.
gs_currencyamount-itemno_acc = '2'.
gs_currencyamount-currency = 'USD'.
gs_currencyamount-amt_doccur = '-350.00'. "i_tab-repval.
APPEND gs_currencyamount TO gt_currencyamount.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = gt_documentheader
IMPORTING
obj_type = gv_obj_type
obj_key = gv_obj_key
obj_sys = gv_obj_sys
TABLES
accountgl = gt_accountgl
accountpayable = gt_accountpayable
currencyamount = gt_currencyamount
return = gt_return.
09-14-2006 1:02 AM
In the BAPI call you are passing gt_documentheader which is a table but you are supposed to pass a structure. Pass <b>gs_documentheader</b> instead.
09-14-2006 1:03 AM
Right now, you are just passing the table header which is empty - I believe this is the reason for return-errors.
09-13-2006 9:46 PM
The function module documentation says that the following header fields MUST be filled:
OBJ_TYPE - Object Type
OBJ_KEY - Object Key
OBJ_SYS - Object System
COMP_CODE - Company Code
PSTNG_DATE - Posting Date
BUS_ACT - Business Transaction
USERNAME - Created By
05-14-2014 11:31 AM
05-14-2014 1:14 PM
Hi Kirti,
Please share your code and error message too.
Regards,
Rafi