04-18-2008 12:47 PM
My scenaio is like ths :
If The company has 4 brands of product and according to their sales policy customer must order all 4 brands then only they accept the sales order.
In VA01 when we create sales order, when we enter material in 2nd creen, If all 4 brand is entered then only we can proceed for next step , if one of the brand is missing it will give error mease as ' all brand is not orderd'.
Also exit name is MV45AFZZ - USEREXIT_MOVE_FIELD_TO_VBAP.
Can anybody explain me how to do with coding as material will be entered in table control in VA01.
thanks
naresh
04-18-2008 1:11 PM
Hi,
Please note that you can not use the FORM mentioned by you since control goes there for each & every item of the sales order. Instead use FORM USEREXIT_SAVE_DOCUMENT_PREPARE.
of the same EXIT, as control comes here when user presses 'SAVE' button. All Item keyed in bu the user in table control are available in XVBAP. So just loop at xvbap & chekc if he has keyed in all the four materials.
I hope this helps,
Regards
Raju Chitale
04-18-2008 2:07 PM
Hi Naresh,
Using the routines USEREXIT_SAVE_DOCUMENT and USEREXIT_SAVE_DOCUMENT_PREPARE in the include we can have our logic to see if all the 4 brands have been entered or not.
During runtime of the sales order application all the details with respect to Sales Order are available in XVBAK, XVBAP, XVBKD, XVBPA, XVBFA etc... In order to accomplish your requirement you need to scan through all the items available in XVBAP and then if the requirement is met you can proceed further otherwise issue the message All brands are not ordered.
But inorder to do this you need to have the access key to modify MV45AFZZ. This access key will be given by the BASIS people.
If useful reward accordingly.
Thanks and Regards,
Maddineni Bharath.
04-19-2008 5:18 AM
My scenaio is like ths :
If The company has 4 brands of product and according to their sales policy customer must order all 4 brands then only they accept the sales order.
In VA01 when we create sales order, when we enter material in 2nd creen, If all 4 brand is entered then only we can proceed for next step , if one of the brand is missing it will give error mease as ' all brand is not orderd'.
Also exit name is MV45AFZZ - USEREXIT_MOVE_FIELD_TO_VBAP.
Can anybody explain me how to do with coding as material will be entered in table control in VA01.
I got suggestion like :
During runtime of the sales order application all
the details with respect to Sales Order are available
in XVBAK, XVBAP, XVBKD, XVBPA, XVBFA etc... In order to
accomplish your requirement you need to scan through all
the items available in XVBAP and then if the requirement
is met you can proceed further otherwise issue the message
All brands are not ordered.
But can I know what are XVBAK, XVBAP, XVBKD, XVBPA, XVBFA .
Can anybody explain me with simple coding ?
thanks
naresh
04-19-2008 5:19 AM
My scenaio is like ths :
If The company has 4 brands of product and according to their sales policy customer must order all 4 brands then only they accept the sales order.
In VA01 when we create sales order, when we enter material in 2nd creen, If all 4 brand is entered then only we can proceed for next step , if one of the brand is missing it will give error mease as ' all brand is not orderd'.
Also exit name is MV45AFZZ - USEREXIT_MOVE_FIELD_TO_VBAP.
Can anybody explain me how to do with coding as material will be entered in table control in VA01.
I got suggestion like :
During runtime of the sales order application all
the details with respect to Sales Order are available
in XVBAK, XVBAP, XVBKD, XVBPA, XVBFA etc... In order to
accomplish your requirement you need to scan through all
the items available in XVBAP and then if the requirement
is met you can proceed further otherwise issue the message
All brands are not ordered.
But can I know what are XVBAK, XVBAP, XVBKD, XVBPA, XVBFA .
Can anybody explain me with simple coding ?
thanks
naresh
04-19-2008 6:12 AM
Hi Naresh,
Xvbap contains all data which are meant to be transferred to VBAP on saving..similarly on all cases...just remove the 'X' and you get the tabl to which the data is suppose to be updated
Consider the following case..you need to check for four brand in item...right?i am giving you a sample code as requested..you can use a different logic but the basic idea remains the same...
in the user exit.....userexit_save_document_prepare
All item are stored in XVBAP which is seen in the table control
in the item level...
data : workarea type vbap.
data : flag1 type c,
flag2 type c,
flag3 type c,
flag4 type c.
clear : workarea,flag1,flag2,flag3,flag4.
Loop at XVBAP into workarea. * take each item
case Xvbap-brand(whichever field ou require for the brand)
Assume ONE/TWO/THREE/FOUR are your required brands
when 'ONE'.
flag1 = X.
when 'TWO'.
flag2 = X.
when 'THREE'.
flag3 = X.
when FOUR.
flag4 = X.
endcase.
endloop.
*check if any of the flag is not set..means that brand is missing.
if flag1 is initial or
flag2 is initial or
flag3 is initial or
flag4 is initial.
messsage 'all 4 brands not mentioned' type 'E'.
endif.
Pls check and revert
Reward if helpful
Regards
Byju
04-19-2008 5:40 AM