ā2013 May 08 3:07 PM
Dear All,
i am displaying an error message in VA41 and VA42 using a Pricing routine.
After error display i want the user to correct the entries and process the Contract for Save.
I am displaying the error and fields become non editable and When i press ENTER twice i am able make the fields editable.
My concern is when i Press 'SAVE' i am able to restrict the contract for SAVE ,but the fields become grayed (non-editable).
And when i press 'ENTER' more than twice after the 'SAVE' the contract gets saved automatically.
if xkwert GT gd_var----(this is my condition) .
MESSAGE 'The Difference is Greater than 50' TYPE 'W' DISPLAY LIKE 'E'.
-------For restricting the save.
if sy-ucomm = 'SICH' "function code for Save.
set SCREEN sy-dynnr.
exit.
endif.
endif.
have gone thru all the relevant posts but could not solve my issue.
regards,
ā2013 May 08 3:42 PM
Hi Naren,
Please use like this
MESSAGE 'The Difference is Greater than 50' TYPE 'S' DISPLAY LIKE 'E'.
leave to screen sy-dnnr.
I think it can solve your problrm.
Regards,
Ruhul
ā2013 May 08 11:33 PM
Hi,
MESSAGE 'The Difference is Greater than 50' TYPE 'I' DISPLAY LIKE 'E'.
This should work.
Cheers,
Arindam
ā2013 May 09 4:44 AM
Hi,
Only when you use a message of type "E", no further processing will take place. So please try giving your message statement as below:
Message '<Your Message>' TYPE 'E' Display Like 'S'.
Regards,
Kartik
ā2013 May 09 4:47 AM
Hi Please respond to actual user who asked the question
Cheers,
Arindam
ā2013 May 09 5:01 AM
Hi Naren,
You can try this as I have used this before for a similar requirement and it has worked.
MESSAGE <YOUR MESSAGE> TYPE I DISPLAY LIKE E.
SET SCREEN 0.
LEAVE SCREEN.
Hope this helps!
ā2013 May 09 5:12 AM
Hi Naren ,
Check this :
MESSAGE 'The Difference is Greater than 50' TYPE 'W' DISPLAY LIKE 'E'.
LEAVE TO SCREEN sy-dynnr.
Regard's
Smruti
ā2013 May 09 5:20 AM
I think you can use the suggestions given above...
also it might be happening because the sy-ucomm value would be changing when you press enter twice or so as it is only a warning message the If condition would be executed and it would be failing... so it is being saved.... you can put a break point just before the if statement and check the values of sy-ucomm ... hope it helps...
ā2013 May 09 6:25 AM
Hi
First of all can you please provide the details of which exit,badi etc you have used to display the error message? W
Thanks
Nabheet
ā2013 May 09 7:54 AM
hi All ,
thanks for your replies...i have tried all the suggestions but im ending in an SAVING the contract.
the process how im getting the screens
1. when i try to open a existing contract, the contract is displayed with values in conditions tab.
2. i am changing values in a condition and press 'ENTER' the error message is displayed.second time when i press 'ENTER' the fields become editable to change.
3. Till here it is fine,now when i press 'SAVE' after changing the values, the error message(warning message) is displayed as error and screen is in non-editable.
4. Now if i press 'ENTER' more than thrice the contract gets saved.
5. In the Debug the Sy-ucomm value is 'SICH' for save even if i press enter any number of times.
my requirement is to Stop the contract from saving and make the fields editable.
i have used SET SCREEN and LEAVE SCREEN .
this is my code in the VOFM routine.
if xkwert GT gd_var----(this is my condition) .
MESSAGE 'The Difference is Greater than 50' TYPE 'W' DISPLAY LIKE 'E'.
-------For restricting the save.
if sy-ucomm = 'SICH' "function code for Save.
set SCREEN sy-dynnr.
exit.
endif.
endif.
regards,
ā2013 May 09 8:16 AM
Hi,
Not sure if it works but try to clear sy-ucomm in that case and see what happens.
Thanks & Regards,
Swarna
ā2013 May 09 8:17 AM
Hi,
Try doing a ROLLBACK WORK after the message to stop the save and check if the COMMIT happens before the message.
Cheers,
Arindam
ā2013 May 09 8:26 AM
Hi
Why dont you use MV45AFZZ pricing sub routines for validating your requirment and throw your error messages at the right place.
Put a break point in document_prepare or pricing one.
Thanks
ā2013 May 09 10:01 AM
hi All,
the MV45AFZZ does not trigger in this case.
i have tried the ROLLBACK both before the message and after the message but still contract gets saved. and clearing the sy-ucomm also did not work.
ā2013 May 09 11:09 AM
Hi,
Try doing Chain and Endchain and in that call the field validation. Do this in the PAI of the screen, the PAI modules ( Include MV45AIZZ ). This should address the first issue of field greying out on error and thus allow the user to correct entries. Check the link below for details info on the exits available.
http://help.sap.com/saphelp_46c/helpdata/en/1c/f62c7dd435d1118b3f0060b03ca329/content.htm
Sample code should look like this. In the module have your normal error message of TYPE 'E' no DISPLAY LIKE required.
CHAIN.
FIELD <field-name> MODULE <validation_mod>.
ENDCHAIN.
Cheers,
Arindam