cancel
Showing results for 
Search instead for 
Did you mean: 

Changing Document in aftersave method in Badi document_main01

Former Member
0 Kudos

Hi All,

i am trying to change the source document when i save a document in BADI AFTER_SAVE Method.

i am using FM BAPI_DOCUMENT_CHANGE2, but some have the document data that i am trying to change doesnt get changed.

Please can any one of you help me if am doing something wrong.

Thanks in Advance..

Regards,

Sud

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

Sud,

Please check status, while running bapi.

I think IN DC10 for specific document type u should not maintain any staus and run Bapi.

I think it will change.

Benakaraj

??P

Former Member
0 Kudos

Hi Raj,

im trying to change the document whose status is dummy which doesnt have any tick in DC10, and i presume it should change the document in that status because when i run the FM BAPI_DOCUMENT_CHANGE2 and test that with the same status it doesnt give any error.

plz correct me if am wrong.

Thanks.

christoph_hopf
Advisor
Advisor
0 Kudos

Hi Sud,

for using the BAPI_DOCUMENT_CHANGE2 successfully I would recommend you to call first the BAPI_DOCUMENT_GETDETAIL2. This BAPI will enable you to read all document info record data and then you can modify them and hand them over to the

CHANGE2 BAPI. After this CHANGE2 BAPI please execute also BAPI_TRANSACTION_COMMIT which will save the changed data in the database.

Best regards,

Christoph

Former Member
0 Kudos

Hi Christoph,

Thanks for the response, i used commit after changing the document. but i don't understand the reason why its not working for me.

Plz Note: i am executing the change(BAPI_DOCUMENT_CHANGE2) Bapi in back ground because in After_save method i cannot execute the same in foreground as it throws a runtime error"Commit in Perform on Commit". i use the Commit work as well in back ground. does this make any difference in changing the document?

Thanks,

Sud

Edited by: Sud on Jul 15, 2009 10:46 AM

Edited by: Sud on Jul 15, 2009 10:50 AM

Answers (0)