2013 Jun 17 10:00 AM
I have some requirement where i have to update few local fields in VBAK table i do not want to do that by directly update the VBAK table . But i did some thigns like below .
I am calling the below FM in SAVE_document exit of SAPMV45A
CALL FUNCTION '/LGC/SDFGWW_VBAK_UPDATE' in update task
EXPORTING
i_vbak = vbak
i_sdtv45a = sdtv45a (Local structure which value i want to update in vbak)
i_vbeln = vbak-vbeln.
Code inside the FM .
i_vbak-/lgc/banknum = I_SDTV45A-zcheqbsbno.
i_vbak-/lgc/bankaccnum = I_SDTV45A-bankn.
i_vbak-/lgc/cheqnum = I_SDTV45A-zcheqno.
i_vbak-/lgc/cheqname = I_SDTV45A-zcheqna.
Please have a look into it and let me know where i am doing wrong.
Thanks,
Satya
2013 Jun 17 12:29 PM
Hi Satya,
1. USe FORM USEREXIT_MOVE_FIELD_TO_VBAK for updating VBAK table
2. May be some issue in u r FM
3. try to assign directly like
* READ THE TABL
read table it_cpy into wa_cpy index 1.
* MOVE DATA TO HEADER VALUES
vbak-zindcp = wa_cpy-zindcp.
vbak-zindmo = wa_cpy-zindmo.
vbak-zindemail = wa_cpy-zindemail.
vbak-zshcp = wa_cpy-zshcp
hope it will work
Suresh
2013 Jun 17 10:20 AM
Hi Satya,
didn't you try to check in debug if you already see your field in the VBAK structure ??
regards
Fred
2013 Jun 17 10:33 AM
Hi,
Yes i can see all the custom fields but the value is not updating in the VBAK table .
Thanks,
Satya
2013 Jun 17 11:54 AM
Have you try to put your code into this form :
USEREXIT_MOVE_FIELD_TO_VBAK.
Fred
2013 Jun 17 10:40 AM
You should also add the foll statement after the update function call.
COMMIT WORK.
2013 Jun 17 10:57 AM
Hi Susmitha,
I am not sure where you want me to write the Commit statement. Could you pelase let me elaborate.
Thanks,
Satya
2013 Jun 17 11:06 AM
You need to add the commit work statement after the function module is executed. Not inside FM.
Till then its stored in ABAP memory and without Commit work, the program will exit without saving to database.
Check this link for reference.
http://help.sap.com/abapdocu_702/en/abapcall_function_update.htm
2013 Jun 17 11:16 AM
Hi Susmitha,
Sorry to say it is not working for me . Please have a look into my code inside the FM and let me know if i am doing something wrong .
Thanks for your help.
Satya
2013 Jun 17 11:25 AM
How could you expect that SAP will allow you to update the data if maybe, the data is still not created ??
in VA01 your data wouldn't be created
regards
Fred
2013 Jun 17 11:42 AM
Ok , then can you use COMMIT WORK AND WAIT ?
CALL FUNCTION '/LGC/SDFGWW_VBAK_UPDATE' in update task
EXPORTING
i_vbak = vbak
i_sdtv45a = sdtv45a (Local structure which value i want to update in vbak)
i_vbeln = vbak-vbeln.
commit work and wait.
Also as Fred has mentioned, Does it have the data for updation?
2013 Jun 17 11:48 AM
Hi Susmita,
I tried it before but this is also not working for me. If you have any other idea pelase let me know .
Thanks for your help!
-Satya
2013 Jun 17 12:14 PM
Try using BAPI_SALESORDER_CHANGE
You can see the sample code in this thread.
2013 Jun 17 12:16 PM
Witch sales order number will you put if you are in VA01 ?? $0000000001 ???
2013 Jun 17 12:38 PM
Stumbled upon this article. Thought it was related.
http://www.erpgenie.com/sap-technical/abap/updating-custom-fields-on-vbap-and-vbak-using-a-bapi-call
2013 Jun 17 12:29 PM
Hi Satya,
1. USe FORM USEREXIT_MOVE_FIELD_TO_VBAK for updating VBAK table
2. May be some issue in u r FM
3. try to assign directly like
* READ THE TABL
read table it_cpy into wa_cpy index 1.
* MOVE DATA TO HEADER VALUES
vbak-zindcp = wa_cpy-zindcp.
vbak-zindmo = wa_cpy-zindmo.
vbak-zindemail = wa_cpy-zindemail.
vbak-zshcp = wa_cpy-zshcp
hope it will work
Suresh
2013 Jun 18 5:27 AM
hi satya,
u r issue closed or not?
if yes close the thread
suresh
2013 Jun 18 6:13 AM
Hi ,
Problem is solved . I pass all the value in SAVE_Document_prepare to vbak table and now it is working correctly . Thanks to al for your suggestion.
Thanks,
Satya