2010 Oct 06 6:50 AM
Hi,
Need an advice how to compare single value with ranges. For below code it return error
Incorrect logical expression: Comparison / SELECT-OPTION can only be
followed by "AND", "OR" or ")".
For eg.
s_hkont = '2410000'
r6_hkont-low = '0000889901'.
r6_hkont-high = '0000889903'.
r6_hkont-sign = 'I'.
r6_hkont-option = 'BT'.
append r6_hkont.
IF s_hkont IN r6_hkont.
STOP.
ENDIF.
2010 Oct 06 7:03 AM
HI ,
s_hkont = '2410000'
r6_hkont-low = '0000889901'.
r6_hkont-high = '0000889903'.
r6_hkont-sign = 'I'.
r6_hkont-option = 'BT'.
append r6_hkont.
IF s_hkont IN r6_hkont.
STOP.
ENDIF.
Always select data in query using either r6_hkont OR s_hkont and match that data with other
Regards
Deepak.
HI ,
s_hkont = '2410000'
r6_hkont-low = '0000889901'.
r6_hkont-high = '0000889903'.
r6_hkont-sign = 'I'.
r6_hkont-option = 'BT'.
append r6_hkont.
IF s_hkont IN r6_hkont.
STOP.
ENDIF.
Always select data in query using either r6_hkont OR s_hkont and match that data with other
Regards
Deepak.
2010 Oct 06 7:03 AM
HI ,
s_hkont = '2410000'
r6_hkont-low = '0000889901'.
r6_hkont-high = '0000889903'.
r6_hkont-sign = 'I'.
r6_hkont-option = 'BT'.
append r6_hkont.
IF s_hkont IN r6_hkont.
STOP.
ENDIF.
Always select data in query using either r6_hkont OR s_hkont and match that data with other
Regards
Deepak.
2010 Oct 06 7:03 AM
Hi
you can loop through the table r6_hknot and then write your if condition inside the loop.
I hope it will work.
thanks
lalit
2010 Oct 06 7:03 AM
Hi,
Try this
s_hkont = '2410000'.
R6_HKONT-LOW = '0000889901'.
r6_hkont-high = '0000889903'.
r6_hkont-sign = 'I'.
r6_hkont-option = 'BT'.
APPEND r6_hkont.
IF s_hkont-low IN r6_hkont.
STOP.
ENDIF.
Regards,
Nagaraj
2010 Oct 06 7:06 AM
Hi,
Since there will be multiple values in Select-option i think you have to loop on it and then compare it as below.
LOOP AT s_hkont.
IF s_hkont-low IN r6_hkont or s_hkont-high IN r6_hkont.
STOP.
ENDIF.
ENDLOOP.Regards,
Pawan
2010 Oct 06 7:28 AM
hi thanks for the quick reply,
how about if s_hkont is also ranges data type, how to compare two ranges
IF s_hkont IN r5_hkont ?
2010 Oct 06 7:34 AM
Hi
you can loop through the r6_hknot table and check the values of s_hknot against r6_hknot values. like:
loop at r6_hknot.
if s_hknot-low = r6_hknot-low or
if s_hknot-high = r6_hknot-high.
then your code.
endif.
endloop.
thanks
Lalit
2010 Oct 06 7:37 AM
Hi,
Use it like this IF for select options :
if s_matnr-low in r_matnr or s_matnr-high in r_matnr .
code
endif.
its the same for both.
there is not much of a difference between ranges and select options.
select-options are used on selection screen and ranges for internally in the code.
both have same structure and both create internal tables.
regards,
Sakshi
2010 Oct 06 8:12 AM
Hi,
try this:
TABLES: SKA1.
*
RANGES: R0_HKONT FOR SKA1-SAKNR.
RANGES: R1_HKONT FOR SKA1-SAKNR.
*
CLEAR: R0_HKONT.
R0_HKONT-LOW = '0000241000'.
R0_HKONT-SIGN = 'I'.
R0_HKONT-OPTION = 'EQ'.
APPEND R0_HKONT.
*
CLEAR: R1_HKONT.
R1_HKONT-LOW = '0000889901'.
R1_HKONT-HIGH = '0000889903'.
R1_HKONT-SIGN = 'I'.
R1_HKONT-OPTION = 'BT'.
APPEND R1_HKONT.
*
SELECT * FROM SKA1 WHERE SAKNR IN R0_HKONT
AND SAKNR IN R1_HKONT.
*
WRITE: / SKA1-SAKNR, 'is in R0 and R1'.
*
ENDSELECT.
*
* OR ->
* SELECT SINGLE * FROM SKA1 WHERE SAKNR IN R0_HKONT
* AND SAKNR IN R1_HKONT.
*
IF SY-SUBRC <> 0.
WRITE: / 'R0 and R1 does not match'.
ENDIF.
Regards, Dieter
2010 Oct 06 8:17 AM
>
>
kont IN r6_hkont. > STOP. > ENDIF. > >
Normally with single value you can use
CHECK kont IN r6_hkont.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |