10-08-2014 10:59 AM
Hi All,
I am working on FORM USEREXIT_FIELD_MODIFICATION.my requirement is that when user uses VA02 to change a sale order and suppose he forget to fill the entry in "Tax classification" it should show an error.I have added following enhancement code in the user exit 'MV45AFZZ' .now its working.
ENHANCEMENT 313 OIU_LO_SAPMV45A. "inactive version
if sy-tcode = 'VA02' .
IF VBAP-TAXM1 = ' ' '.
MESSAGE ' Enter Tax classifc ..... ' type 'E'.
ENDIF.
endif.
But m facing one problem now.suppose I enter tcode VA02.Fill the order no. and press enter.It shows sale order now if i select a line item press SAVE button directly without making any chages it showing the same error.Can anyone help me with this problem.
Thanks in advance.
10-08-2014 11:15 AM
Hi,
in your code, instead of checking values in VBAP, check values in XVBAP as below
if sy-tcode = 'VA02' .
loop at xvbap.
IF XVBAP-TAXM1 = ' ' '.
MESSAGE ' Enter Tax classifc ..... ' type 'E'.
ENDIF.
endloop.
endif.
Its becuse XVBAP contains the data.
-Regards
Rohit
10-08-2014 11:05 AM
Go to program MV45AFZZ, check tables XVBUK,XVBUP & YVBUK,YVBUP, there you can view the old values and new values of overall status changes. I hope it may work out . debug with both the scenario
10-08-2014 11:19 AM
Hello anoop,
Actually the problem is not with the values.Its with the coding.Tcode gives correct error message if i make "Tax classification" field empty its showing error and after filling it program saved.
problem is that whenever i open new sale order click on any line item and click SAVE it shows the same error.which is not supposed to give because I didnt make any changes in "Tax classification".It should save the sale order without showing error.
Thanks for reply
10-08-2014 11:15 AM
Hi,
in your code, instead of checking values in VBAP, check values in XVBAP as below
if sy-tcode = 'VA02' .
loop at xvbap.
IF XVBAP-TAXM1 = ' ' '.
MESSAGE ' Enter Tax classifc ..... ' type 'E'.
ENDIF.
endloop.
endif.
Its becuse XVBAP contains the data.
-Regards
Rohit
10-08-2014 11:16 AM
Hi Sam,
Your code should ideally be a LOOP on XVBAP structure and each line item should be checked for the taxm1.
Also, do you want the message to be triggered only when the user changes something in the line item?. Then what happens in the scenario where they do not change anything but taxm1 is still empty-is that supposed to be okay?.
If that is indeed the case, the use the updkz indicator value in the loop to decide which line item to check and which to not check. The updkz will be blank when user has not made any changes to the line item.
Regards,
Shashi Thakur
10-08-2014 11:21 AM
Hi,
I am not wrong;
your requirement is if TAXM1 is missing then it should prompt error to user on changed data then follow below.
See, we have 2 table XVBAP and YVBAP, XVBAP contains the latest data and YVBAP contains the old data.
You can check the records with these to tables if you get any changed record then trigger your message.
or
If you want to give error on all the items where TAXM1 is missing, just follow loop.
-Regards
Rohit
10-08-2014 11:22 AM
10-08-2014 11:55 AM
10-08-2014 1:23 PM
Hi all,
Thanks all for your help.Rohit i m sorry you were right.Problem solved.
10-09-2014 5:55 AM
Please close the thread, and reward point if your query is solved.
-Regards
Rohit