Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Regarding BAPI_DOCUMENT_CREATE

former_member508729
Active Participant
0 Likes
2,024

Hi All,

I am trying to do archiving of files to PO line item for which I am calling BAPI_DOCUMENT_CREATE to create the document first.

After execution of BAPI i am getting document number but when i check the same through CV03N then it gives me error as document does not exist in system.

Pls guide me whether anything else is required to do here so that document is created in system.

This is very urgent so pls helo ASAP.

Points will be rewarded....

Regards,

Ashutosh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,254

Hi,

I think we need to use FM BAPI_TRANSACTION_COMMIT intored to ssave to database tablle.

After the FM BAPI_DOCUMENT_CREATE process is done explcity we need to have commit work FM

Reward if helpful.

Regards

Chandralekha

6 REPLIES 6
Read only

Former Member
0 Likes
1,255

Hi,

I think we need to use FM BAPI_TRANSACTION_COMMIT intored to ssave to database tablle.

After the FM BAPI_DOCUMENT_CREATE process is done explcity we need to have commit work FM

Reward if helpful.

Regards

Chandralekha

Read only

peter_ruiz2
Active Contributor
0 Likes
1,254

hi,

you need to run BAPI_TRANSACTION_COMMIT after executing BAPI_DOCUMENT_CREATE

regards,

Peter

Read only

Former Member
0 Likes
1,254

hi...

use the following BAPI.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'

IMPORTING

return = i_return1.

This is neceessary after every BAPI called for creation of document.

whatever document number is generated will get generated in the system as well after this function module..

Read only

Former Member
0 Likes
1,254

Make sure you are using the CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

Also make sure its not running in test mode.

thanks

Read only

Former Member
0 Likes
1,254

Hi,

Use the Bapi's latest version i.e "BAPI_DOCUMENT_CREATE2" and then call the Commit function module.

Sample code given below.....

CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'

EXPORTING

documentdata = wa_docdata

pf_http_dest = c_http_dest

IMPORTING

documenttype = v_doc_type

documentnumber = v_doc_number

documentversion = v_doc_version

return = v_return

TABLES

documentdescriptions = i_documentdescriptions

documentfiles = documentfiles

objectlinks = objectlinks

longtexts = longtexts.

IF v_return-type CA 'EA'.

ROLLBACK WORK.

ELSE.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

ENDIF.

Thanks and Regards

Senthil Kumar A

Read only

Sidh_M
Participant
0 Likes
1,254

hi ashutosh,

Try using simple COMMIT WORK also after execution of BAPI.

Regards,

SUDHIR MANJAREKAR