‎2006 Mar 22 4:50 AM
Please let me know how do I validate a parameter on a selection screen by using messaging options.
for eg..
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_mru FOR te422-termschl.
SELECTION-SCREEN END OF BLOCK b1.
PARAMETER : p_ins TYPE i DEFAULT 150.
suppose I need to validate for both the fields
1. s_mru (it should not accept a value which is not in the table field te422-termschl)
2. p_ins (the output screen should not come if the value of p_ins is less than 1)
kindly show me the flow of code ....
thx...
‎2006 Mar 22 4:59 AM
Hi Pradipta,
U can validate the selection-screen in the event At Selection-Screen.
in ur case u can write as:
AT SELECTION-SCREEN.
IF S_MRU IS NOT INITIAL.
SELECT TERMSCHL FROM TE422 INTO S_MRU.
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE E001(ZZ).
ENDIF.
ELSE.
MESSAGE E002(ZZ).
ENDIF.
IF P_INS < 1.
MESSAGE E003(ZZ).
ENDIF.
ZZ-IS THE MESSAGE CLASS.
E001,E002,E003 ARE THE MESSAGES U WOULD LIKE TO DISPLAY.
HOPE THIS HELPS,
THANKS,
PRIYA
Message was edited by: Priya
‎2006 Mar 22 5:05 AM
Hi Pradipta,
Try these code sample .
1. s_mru (it should not accept a value which is not in the table field te422-termschl)
<b>At selection-screen .</b>
*Select termschl from te422 table present in select option
select termschl from te422 into table it_termschl
where termschl in s_mru.
*If not found
if sy-subrc <> 0.
*Message that value not found
message i008(Message class).
STOP
Endif.
2. p_ins (the output screen should not come if the value of p_ins is less than 1)
the output screen should not come means that the report output should not be displayed , correct me if i am wrong .
In that case
You can use
If p_ins < 1.
Message e008(Message class)
Endif.
Hopw these will help you , let me know if you still have some doubts.
Cheers
Sunny
Rewrd points, if found helpful
Message was edited by: Sunny
‎2006 Mar 22 5:14 AM
hai pradipta,
this way can be used for validation of selection screen.
AT SELECTION-SCREEN ON s_mru.
IF s_mru IS NOT INITIAL.
LOOP AT SCREEN .
IF screen-group1 = 'M02' .
screen-required = '1'.
MODIFY SCREEN .
ENDIF.
ENDLOOP.
ENDIF.
AT SELECTION-SCREEN ON p_ins.
IF p_ins IS NOT INITIAL.
LOOP AT SCREEN .
IF screen-group1 = 'M01' .
screen-required = '1'.
MODIFY SCREEN .
ENDIF.
ENDLOOP.
ENDIF.
hope its helpful.
regards,
praba.
‎2006 Mar 22 5:50 AM
Hello Pradipta,
For the selection screen validation you can use the <b>AUTHORITY-CHECK</b> at AT SELECTION-SCREEN.
this check can be applied for s_mru
source code.
AT selection-screen.
authority-check object 'TERMSCHL'
id 'TERMSCHL' field s_mru.
if sy-subrc <> 0.
MESSAGE ID 'message class' TYPE 'E' NUMBER XX with s_mru.
endif.
if p_ins lt 1.
MESSAGE ID 'message class' TYPE 'E' NUMBER XX.
endif.
i hope this will be helpful
regards,
Kinshuk Saxena
‎2006 Mar 22 9:12 AM
hi Pradipta,
As per form etiquette's
If you are satisfied , please close the thread by rewarding appropriate points to the helpful answers.
Cheers
Sunny
‎2006 Mar 24 9:31 AM
How do I check validation of a field in the selection screen ?
for eg.
suppose I check for field ADRC-ADDRNUMBER from the adrc table in the selection screen. I need to check for two conditions:
1. the value of the field should not be negative
2. the program should not run on any value type other than the data type defined in the transparent table.
‎2006 Mar 24 9:39 AM
Hi Pradipta,
You can do these check on
<b>at selection-screen </b> event.
Cheers
Sunny
Rewrd points, if found helpful
Message was edited by: Sunny
‎2006 Mar 24 10:08 AM
Report test.
AT SELECTION-SCREEN.
*Validate addrnumber
AT SELECTION-SCREEN ON p_addr.
PERFORM f1003_validate_addr.
*********
&----
*& Form f1003_validate_addr
&----
Validate addr
----
FORM f1003_validate_addr.
DATA lv_addr TYPE ADRC-ADDRNUMBER.
Check for valid addr
CHECK NOT p_addr IS GE 0.
CLEAR lv_addr.
SELECT SINGLE addrnumber INTO lv_addr FROM adrc WHERE
ADDRNUMBER IN p_addr.
IF sy-subrc NE 0.
MESSAGE e000 WITH text-016.
ENDIF.
ENDFORM. " f1003_validate_addr
Regards,
Anjali