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

Difference between MOVE_FIELD_TO_VBAK and SAVE_DOCUMENT_PREPARE?

former_member202077
Participant
0 Likes
1,240

Hello Experts,

To meet one of the busisness requirements, I need to auto populate a standard SAP field in VBAP while VA01/VA02 process.

So, I tried by using USER_EXIT_MOVE_FIELD_TO_VBAK and USER_EXIT_SAVE_DOCUMENT_PREPARE user-exits and populated in debugging mode....it worked well that I can see my data in that field of VBAP in SE16.

Pls. let me know what is the difference between MOVE_FIELD_TO_VBAK and SAVE_DOCUMENT_PREPARE?

Thank you

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,068

Difference would be when called...save_document_prepare is triggered after SAVE button. And, I think you'd want the move to VBAP, rather than VBAK, since VBAK references header data.

Hello Experts,

To meet one of the busisness requirements, I need to auto populate a standard SAP field in VBAP while VA01/VA02 process.

So, I tried by using USER_EXIT_MOVE_FIELD_TO_VBAK and USER_EXIT_SAVE_DOCUMENT_PREPARE user-exits and populated in debugging mode....it worked well that I can see my data in that field of VBAP in SE16.

Pls. let me know what is the difference between MOVE_FIELD_TO_VBAK and SAVE_DOCUMENT_PREPARE?

Thank you

4 REPLIES 4
Read only

Former Member
0 Likes
1,069

Difference would be when called...save_document_prepare is triggered after SAVE button. And, I think you'd want the move to VBAP, rather than VBAK, since VBAK references header data.

Read only

0 Likes
1,068

Sorry, you are right, its typo.

But, i guess, still am suspecting some differences would be there or what would you suggest for me (with which user-exit i should go among these 2)?

Thank you

Read only

0 Likes
1,068

Hi,

If you want move any defaulted values use the move_fields_to_vbap. this is for line item,

for header data use move_fields_to_vbak.

Save_document_prepare gets triggered when the order is saved.

Thanks,

Rohan

Read only

0 Likes
1,068

still am suspecting some differences would be there

Exactly right.

what would you suggest for me

It depends on which fields you are populating. USEREXIT_SAVE_DOCUMENT_PREPARE is ok but only if you don't expect any validation to occur on the field values, there are no dependencies on the field values (such as pricing, sourcing, etc.) and you don't want the user to see or interact with the values set in the exit. If you are populating values that need to be validated by configuration or viewed by the user, go with the line item exit. Keep in mind that there are also 'better' user exits for some item values - for example, USEREXIT_SOURCE_DETERMINATION for plant and item category.