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

Sales order Validations before save

Former Member
0 Likes
3,967

Hi ,

I need to check the customer of the sales order and for the particular customer,only certain materials are allowed.If other materials are entered,then I need to give an error message.I have written the code in USEREXIT_SAVE_DOCUMENT_PREPARE and it is working fine.But now i need to do the same validation after entering the items and before clicking save.Is there a way to do the validations before clicking save (any user exit that will be triggered at item level).

Thanks and Regards,

Rohini

6 REPLIES 6
Read only

Sougata
Active Contributor
0 Likes
2,459

What will you be clicking on instead of the save button? I don't understand what difference does it make when the check is already working correctly on save?

Read only

Former Member
0 Likes
2,458

HI,

If the user clicks "Enter" after typing the material number,then my logic should be executed.This is required otherwise the user will enter everything(for example after entering 10 materials)  and then find that the order cannot be saved.

Thanks,

Rohini

Read only

Former Member
0 Likes
2,458

Hi,

use the same userexit form.

You have access to vbap, eg:

   loop at xvbap.

.....

  endloop.

or

  USEREXIT_MOVE_FIELD_TO_VBAP    .

Read only

madhu_vadlamani
Active Contributor
0 Likes
2,458

Hi Rohini,

You can try in MV45AFZZ,USEREXIT_SAVE_DOCUMENT.

In the loop of xvbap read with key posex. Append those lines to final. Display messages depending on your criteria.

Regards,

Madhu.

Read only

former_member585060
Active Contributor
0 Likes
2,458

Hi,

Try the User Exit 'USEREXIT_CHECK_VBAP' in the Include MV45AFZB. You will have Item detail in VBAP and all items in XVBAP[].

Thanks & Regards

Bala Krishna

Read only

Former Member
2,458

Hi Rohini,

I dont think you need to use any User Exits for Blocking the Materials based on the Customer.

All you can do is to use the Material Inclusion/Exclusion rule based on the Customer in VB01/VB02/VB03 transaction for Create/Change and Display.

Steps

1) Enter the List/Excl Type as Listing in VB01 and Enter

2) Enter the Customer Code and the validity period and enter all the list of materials that the customer is allowed and save the entries

3) On creation of the SO, only these materials will be allowed for the Customer.

Note : System checks for the Exclusion List first and then checks for the Listing (Inclusion List)

Rewards points if helpful.

Regards,

AyyamPerumal