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

Udate VBAK table.

Former Member
0 Likes
2,165

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

1 ACCEPTED SOLUTION
Read only

former_member198834
Participant
0 Likes
2,063

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

16 REPLIES 16
Read only

FredericGirod
Active Contributor
0 Likes
2,063

Hi Satya,

didn't you try to check in debug if you already see your field in the VBAK structure ??

regards

Fred

Read only

0 Likes
2,063

Hi,

Yes i can see all the custom fields but the value is not updating in the VBAK table .

Thanks,

Satya

Read only

0 Likes
2,063

Have you try to put your code into this form :

USEREXIT_MOVE_FIELD_TO_VBAK.

Fred

Read only

Former Member
0 Likes
2,063

You should also add the foll statement after the update function call.

COMMIT WORK.

Read only

0 Likes
2,063

Hi Susmitha,

I am not sure where you want me to write the Commit statement. Could you pelase let me elaborate.

Thanks,

Satya

Read only

0 Likes
2,062

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

Read only

0 Likes
2,062

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

Read only

0 Likes
2,062

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

Read only

0 Likes
2,062

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?

Read only

0 Likes
2,062

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

Read only

0 Likes
2,062

Try using   BAPI_SALESORDER_CHANGE

You can see the sample code in this thread.

https://scn.sap.com/thread/149859

Read only

0 Likes
2,062

Witch sales order number will you put if you are in VA01 ??    $0000000001  ???

Read only

former_member198834
Participant
0 Likes
2,064

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

Read only

0 Likes
2,062

hi satya,

u r issue closed or not?

if yes close the thread

suresh

Read only

0 Likes
2,062

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