10-14-2008 4:03 PM
Hi ,
In my selection-screen one select-option is there.i want to validate my select-option field.
i have written the query like
select single * from ekpo into ekpo where ebeln in s_ebeln.
if sy-subrc ne 0.
message e999 with 'enter the valid po'.
endif.
but in my selection screen i want to enter 2 correct values and 2 wrong values.
it has to stop while the wrong values execution.but i am not getting that.i am getting the correct 2 values.
how can i validate & what is the perfect validation procedure during the select-option?
Please help me.
Thanks in advance.
Regards,
Venkat.
10-14-2008 4:06 PM
[check this post|http://www.sap-img.com/abap/difference-between-select-options-ranges.htm]
10-14-2008 4:07 PM
You need to loop the select options table and validate. but this should be avoided. but select option entries can be single, multiple, patterns, includes, excludes. so it is not a good idea to loop the selection table. the way you coded will give error when all the entries are wrong. if one entry is correct then it will not give the error. it is up to you how you validate using loop or with out loop.
10-14-2008 4:53 PM
Hi Vnekat,
You can do this if you are considering only Multiple Values and no ranges ....but in case there are ranges, Excludes, it becomes really difficult, confusing and complex.....
Anyway as per standards, there is no use of validating each & Every Valur in Select Options.....
Just keep going as you are doing.....
You can refer to any standard SAP report for the same and you will find that SAP is also doing the same way.
10-14-2008 8:36 PM
Hi,
Please tell me the package name for watching the sap standard code.
Regards,
Venkat.
10-14-2008 8:38 PM
11-06-2008 11:29 PM
Hi,
You can code this way:-
IF s_bukrs-sign EQ 'I' AND s_bukrs-option EQ 'EQ'.
LOOP AT S_BUKRS.
Do the select single from database using s_bukrs-low and give error message.
ENDLOOP.
ENDIF.
IF s_bukrs-sign EQ 'I' AND s_bukrs-option EQ 'BT'.
If it is arange, Do the select single from database using s_bukrs-low and su_bukrs-high and store in another internal table, loop through this internal table and repeart above procedure...
ENDIF.
11-07-2008 3:55 AM
Hi,
Check this code....
DATA: r_ebeln TYPE RANGE OF ekpo-ebeln WITH HEADER LINE.
SELECT-OPTIONS: s_ebeln FOR ekpo-ebeln.
AT SELECTION-SCREEN ON s_ebeln.
LOOP AT s_ebeln.
APPEND s_ebeln TO r_ebeln.
SELECT *
FROM ekpo
WHERE ebeln IN r_ebeln.
ENDSELECT.
IF sy-subrc NE 0.
MESSAGE 'Wrong Entry' TYPE 'E'.
ENDIF.
REFRESH r_ebeln.
ENDLOOP.