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

Choosing the program & userexit

Former Member
0 Likes
650

I want to learn how to choose the correct program & userexit.

(To give a specific example) Business requirement is to have determination of storage location (VBAP-LGORT) in a sales order, by the system (i.e. automatically).

I can think of writing the code in

1. Program MV45AFZB, USEREXIT_CHECK_VBAP

2. Program MV45AFZZ, USEREXIT_SAVE_DOCUMENT_PREPARE

Which one would be the right?

What would be the difference is writing the same code in 1 in comparision to 2?

Thank you!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
621

Well, first of all, you need to determine if the check_vbap would allow you to change the vbap or xvbap content (vbap after any edits), and you might want to consider where and how many times the routine would be entered.  If you put it in the save_document_prepare, that's the last possible point for modifying anything, since the user has pressed save at that point.  If you do it here, you need to consider if you're going to generate an error message, and be sure your users know how to back out to return to the screen.  And generally speaking, the code will be executed only once for each VBAP row here.

I want to learn how to choose the correct program & userexit.

(To give a specific example) Business requirement is to have determination of storage location (VBAP-LGORT) in a sales order, by the system (i.e. automatically).

I can think of writing the code in

1. Program MV45AFZB, USEREXIT_CHECK_VBAP

2. Program MV45AFZZ, USEREXIT_SAVE_DOCUMENT_PREPARE

Which one would be the right?

What would be the difference is writing the same code in 1 in comparision to 2?

Thank you!

3 REPLIES 3
Read only

Former Member
0 Likes
622

Well, first of all, you need to determine if the check_vbap would allow you to change the vbap or xvbap content (vbap after any edits), and you might want to consider where and how many times the routine would be entered.  If you put it in the save_document_prepare, that's the last possible point for modifying anything, since the user has pressed save at that point.  If you do it here, you need to consider if you're going to generate an error message, and be sure your users know how to back out to return to the screen.  And generally speaking, the code will be executed only once for each VBAP row here.

Read only

0 Likes
621

if you're going to generate an error message, and be sure your users know how to back out to return to the screen.

What do you mean by "back out to return to the screen"?

Could you please give an example?

In my above case:

1. the code shall extract the storage location from a table (please see determination in OVL3).

2. If no storage location is maintained in OVL3, then there would be an error message.

3. User would have to manually give the storage location, for each line item.

And generally speaking, the code will be executed only once for each VBAP row here.

Please explain this.

Read only

0 Likes
621

Hi,

Have you checked the SAP help on "Use Exits in Sales document Processing" ?