‎2006 Aug 21 7:46 PM
Hi friends,
Could u please send me the details
to validate the selection-option field which is restricted the values either 'E' or 'X' field name is <b>bskez</b> from <b>mara</b> table
for this i written the code
DATA:BEGIN OF G_BESKZ,
BESKZ LIKE MARC-BESKZ,
END OF G_BESKZ.
SELECT SINGLE BESKZ
FROM MARC
INTO G_BESKZ
WHERE BESKZ IN S_BESKZ AND ( BESKZ EQ 'E' OR BESKZ EQ 'X' ).
IF SY-SUBRC <> 0.
MESSAGE E001(ZLOT).
ENDIF.
But it is validating for only LOW in Selection-options.
But it is not performing any Validations for HIGH in Selection-options.
i need to perofrm Validations for HIGH also
Regards
Srinu
‎2006 Aug 21 7:51 PM
Sorry did not get your problem clearly...
when you use BESKZ IN S_BESKZ, it validates the low as well as high. If you have entered in the value in S_BESKZ for E and X, u dont need to specify the AND ( BESKZ EQ 'E' OR BESKZ EQ 'X' ) condition.
Regards
Anurag
‎2006 Aug 21 7:51 PM
Sorry did not get your problem clearly...
when you use BESKZ IN S_BESKZ, it validates the low as well as high. If you have entered in the value in S_BESKZ for E and X, u dont need to specify the AND ( BESKZ EQ 'E' OR BESKZ EQ 'X' ) condition.
Regards
Anurag
‎2006 Aug 21 7:57 PM
hi Anurag ,
thanks a lot for ur soon reply But I need to Validate Values Only 'E' OR 'X' But if i Written the code that field (beskz) field accepting remaining values also
I need to Validate only 'E' OR 'X'.
Please Suggest me Wating for ur soon reply
Thanks and Regards
Srinu
‎2006 Aug 21 7:59 PM
SELECT * from marc
where beskz CA 'EX'.
OR
SELECT * from marc
where beskz in ('E','X').
Try the above ..also do you plan to have it as a select-option or u just need it as a where condition.
-- Please note when you use SELECT SINGLE you need to use the full key otherwise it would result in error.
Message was edited by: Anurag Bankley
Message was edited by: Anurag Bankley
‎2006 Aug 21 8:15 PM
hi Anurag ,
thanks alot for ur soon reply
BUT GIVEN THE INPUT '<b>F'</b> It showing the output
Actually when i press the f4 help it showing the 'E' and 'F' and 'X' But i dont want 'F' when i Given the input 'F' in LOw selection-option and HIGH select-option it displaying the out put
if i enter the values other than 'E' and 'X' that input Field should not accept
Please help me
Regards
srinu
‎2006 Aug 21 7:55 PM
Hi,
If the Low value is there in the database the select query will return SY-SUBRC = 0. So pass the S_BESKZ-LOW and S_BESKZ-HIGH seperately in the select query and check for sy-subrc value.
Regards,
Prakash.
‎2006 Aug 21 7:56 PM
The reason is because, if you put just a value in the HIGH field on the selection screen, you can usee that it actually creates a BT condition in the select-options table, therefore it is picking up the "E" in the G_BESKZ table. Do you need to have the HIGH field on the selection screen? If not, you can get rid of it by adding no intervals.
select-options: s_beskz for g_beskz-beskz no intervals.Regards,
Rich Heilman
‎2006 Aug 21 8:00 PM
Hi Srinu,
As you need either values E or X for BESKZ so try as follows.
DATA:BEGIN OF G_BESKZ,
BESKZ LIKE MARC-BESKZ,
END OF G_BESKZ.
SELECT SINGLE BESKZ
FROM MARC
INTO G_BESKZ
<b>WHERE BESKZ IN ( 'E' , 'X' ).</b>
IF SY-SUBRC <> 0.
MESSAGE E001(ZLOT).
ENDIF.
Thanks,
Vinay
‎2006 Aug 21 8:22 PM
Please check the sample coding, this will check each value in the select-options table , the LOW and the HIGH.
report zrich_0001.
tables: marc.
ranges: r_beskz for marc-beskz.
select-options: s_beskz for marc-beskz.
at selection-screen .
clear r_beskz. refresh r_beskz.
r_beskz-sign = 'I'.
r_beskz-option = 'EQ'.
r_beskz-low = 'E'.
append r_beskz.
r_beskz-sign = 'I'.
r_beskz-option = 'EQ'.
r_beskz-low = 'X'.
append r_beskz.
loop at s_beskz.
if not s_beskz-low in r_beskz
and not s_beskz-low is initial.
message e001(00) with 'Somethings not right'.
endif.
if not s_beskz-high in r_beskz
and not s_beskz-high is initial.
message e001(00) with 'Somethings not right'.
endif.
endloop.
REgards,
Rich Heilman