2006 Oct 04 12:08 PM
Hello All.
I need to prevent a user from saving a contract (VA41 or VA42) when the Increase date field is not entered,
But the users normaly use the Edit->Log of incomplete items
menu path and then presses save.
If I post an error message the screen is frozen unless I use the following code:
IF ok_code <> 'SICH'.
CLEAR: ok_code.
LEAVE TO SCREEN sy-dynnr.
ENDIF.
But that does not take the user back to the previous screen, it saves the contract.
Any help will be appreciated.
Hello All.
I need to prevent a user from saving a contract (VA41 or VA42) when the Increase date field is not entered,
But the users normaly use the Edit->Log of incomplete items
menu path and then presses save.
If I post an error message the screen is frozen unless I use the following code:
IF ok_code <> 'SICH'.
CLEAR: ok_code.
LEAVE TO SCREEN sy-dynnr.
ENDIF.
But that does not take the user back to the previous screen, it saves the contract.
Any help will be appreciated.
2006 Oct 04 12:20 PM
Hi,
Why don't you write an error message if you want to prevent user from saving:
if datefield is initial.
MESSAGE 'Date field can not be empty' TYPE 'E'.
endif.
Regards,
Dharitree
2006 Oct 04 12:25 PM
2006 Oct 04 12:32 PM
2006 Oct 04 12:38 PM
Does anybody know where to find the SD BADI's (sorry in
one of my previous messages I typed BAPI)
Thank you
2006 Oct 04 12:27 PM
you need to give an error message.
for eg :
message E398(00) with 'Please enter date field'.
Regards,
Preema
*Reward points for helpful answers
2006 Oct 04 12:33 PM
JJ, I have used an érror'message, as you say the screen does 'freeze' but only once....when the user hits enter normal service is then resumed.
But anyway, shouldn't your code be??:
IF ok_code
=
'SICH'.CLEAR: ok_code.
LEAVE TO SCREEN sy-dynnr.
ENDIF.
2006 Oct 04 12:41 PM
Neil, If I press Enter the Error message is displayed.
I tried to Leave to the screen by checking the sy-ucomm code if it is not 'SICH'. Then it does not go to the previous screen, the contract is saved.
2006 Oct 04 12:47 PM
JJ, what is your code? The okcode will always be 'sich' in this routine (unless you have cleared it yourself).
I think it should be something like:
If error situation.....
message...
leave to screen sy-dynnr.
endif.
2006 Oct 04 1:11 PM
Neil,
The problem is that after the message statement the program does not return to the line below it. In your code, it will execute the leave to screen statement.
If you put he leave to screen statement before the message, then it will not execute the message.
2006 Oct 04 1:17 PM
Hi,
In this case don't write an error message write 'I' or 'W' mesage and then leave the screen.
Regards,
Dharitree
2006 Oct 04 1:27 PM
2006 Oct 05 12:04 AM
ok, so you need to set a flag indicating an error has occurred.
So in your logic:
1. if your flag is set: clear it and the okcode and leave to screen sy-dynnr.
2. Then have your error test. If it's true set the flag and then issue the message.
2006 Oct 05 5:18 AM
Hi,
I think you want to go back to the previous screen after error/warning message gets displayed,
then why are you giving sy-dynnr.
Instead of this you should give the previous Screen number. If you give the current screen, system will again check the date field & find that it is intial & again dispay the warning message & so on..
Regards,
Dharitree
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |