‎2007 Nov 28 1:41 PM
Hello experts!!
I am trying to create an FI doc. using the bapi BAPI_ACC_DOCUMENT_POST but if i leave header-object_type & header-object_key blanc (as i read in some other posts in the forum) i am always getting an error. I also tried using object_type = 'BKPFF' but i am still getting errors and the posting is not successful..
Please help!!
‎2007 Nov 28 1:45 PM
Hi,
You need to pass even Object Key and Logical system.
Regards,
Satish
‎2007 Nov 28 1:45 PM
Hi,
Take a look at the following code :
[code]
documentheader-obj_type = 'BKPFF'.
documentheader-obj_key = '$'.
CONCATENATE sy-sysid sy-mandt INTO documentheader-obj_sys.
documentheader-username = sy-uname.
documentheader-bus_act = 'RFBU'.
documentheader-header_txt = s_notilus-header_txt.
documentheader-comp_code = s_notilus-comp_code.
documentheader-fisc_year = s_notilus-pstng_date(4)."
documentheader-doc_date = s_notilus-doc_date.
documentheader-pstng_date = s_notilus-pstng_date.
documentheader-doc_type = s_notilus-doc_type.
documentheader-ref_doc_no = s_notilus-ref_doc_no.
...
call BAPI-function in this system
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = documentheader
IMPORTING
obj_type = l_type
obj_key = l_key
obj_sys = l_sys
TABLES
accountgl = accountgl
accountpayable = accountpayable
currencyamount = currencyamount
accounttax = accounttax
extension1 = extension1
return = return.
[/code]
Hope this helps,
Erwan
‎2008 Feb 06 4:35 AM
Hi,
it is very usefull input for me but how you get the value of object key
suvangkar
‎2007 Nov 28 1:52 PM
First of all, thank you for your answers!
I tried it, since i had not filled the 'obj-sys' but still i'm getting the error.
I am also using the function OWN_LOGICAL_SYSTEM_GET to ensure the system.
‎2008 Feb 06 4:37 AM
Hi
Hope this code will solve ur issue.
pls reward if help.*
BAPI_ACC_GL_POSTING_CHECK
CALL FUNCTION 'BAPI_ACC_GL_POSTING_CHECK'
EXPORTING
documentheader = w_documentheader
TABLES
accountgl = it_accountgl
currencyamount = it_currencyamount
return = it_return.
Populate the corresponding tables with the data you have.
For the Date do convert it.
PERFORM convert_date USING it_header-bldat
CHANGING w_documentheader-doc_date.
w_documentheader-comp_code = 'z998'
w_documentheader-doc_type = 'SA'
"and fill the respective tables this way .
<b>
BAPI_ACC_GL_POSTING_POST
</b>
call function 'BAPI_ACC_GL_POSTING_POST'
exporting
documentheader = doc_header
IMPORTING
OBJ_TYPE = l_objtype
OBJ_KEY =
OBJ_SYS =
tables
accountgl = t_accountgl
currencyamount = t_curramt
return = t_return
EXTENSION1 =
.