‎2008 Dec 30 12:15 AM
Hi all,
I have a requirement which requires me to validate the data entered in the selection screen when the data entered in the selection screen is saved as a variant.
That is, when the save button in the selection screen is clicked, then the data entered in the selection screen should be validated.
Can anyone please tell me how to achive the above.
Regards,
Vijay
‎2008 Dec 30 12:08 PM
Hi,
Check the below sample code.Here the validation is value should be less than 100.
selection-screen begin of block b1 with frame title text-001.
parameters : p_p1 type i.
selection-screen end of block b1.
at selection-screen.
if sy-ucomm eq 'SPOS'.
if p_p1 gt 100.
message 'value should be less than 100' type 'E'.
endif.
endif.
Regards.
‎2008 Dec 30 1:01 AM
Just code under initialization
WHEN 'SPOS'"function code for Saving variant
validate here...
‎2008 Dec 30 2:24 AM
‎2008 Dec 30 2:29 AM
‎2008 Dec 30 11:38 AM
While creating Infoset, (TCode SQ02)
Using the Code Tab, you have to specify your code under INITIALIZATION using this below SPOS condition.
If sy-ucomm = 'SPOS'.
"Specify your condition"
Endif.
‎2008 Dec 30 11:41 AM
Hi,
In AT SELECTION-SCREEN event check the sy-ucomm value for "SPOS " and write the validation code under it.
Regards,
Shafi
‎2008 Dec 30 12:08 PM
Hi,
Check the below sample code.Here the validation is value should be less than 100.
selection-screen begin of block b1 with frame title text-001.
parameters : p_p1 type i.
selection-screen end of block b1.
at selection-screen.
if sy-ucomm eq 'SPOS'.
if p_p1 gt 100.
message 'value should be less than 100' type 'E'.
endif.
endif.
Regards.
‎2008 Dec 30 12:20 PM
Hi Bala,
As also said by others do it like this way as the example below:
Parameters:
p_kunnr type kna1-kunnr.
Data:
lw_kunnr type kna1-kunnr.
At Selection-screen.
Case sy-ucomm.
When 'SPOS'.
Select Single kunnr
from kna1
into lw_kunnr
where kunnr eq p_kunnr.
If sy-subrc ne 0.
Message 'enter correct customer number' type 'E'.
Endif.
Endcase.With luck,
Pritam.
‎2008 Dec 30 4:50 PM
Hi all,
Thanks for all your responses. It really helped me.
Here is what I wrote and it worked:
AT SELECTION-SCREEN.
if sy-ucomm eq 'SPOS'.
IF p_test EQ '0000000100'.
MESSAGE i002(ZMESSAGE).
ENDIF.
endif.
I am awarding points to all of you.
Regards,
Vijay