on 2008 May 30 3:02 PM
Need ur help in writing a IF condition logic.
I have written a code like
IF itab-amt between 100 and 200.
Result = itab-sales.
endif.
Now i want to change the logic to
If itab-amt between 100 and 200 excluding 110 120 122 134.....
result = itab-sales.
endif.
can u give me the code with correct syntax
Regards..
Balaji
thanks..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Try to do it using a range table:
* After the declaration of the data object itab.
DATA:
lr_range LIKE RANGE TABLE OF itab-amt,
ls_range LIKE LINE OF lr_range.
ls_range-sign = 'I'.
ls_range-option = 'BT'.
ls_range-low = '100'.
ls_range-high = '200'.
APPEND ls_range to lr_range.
ls_range-sign = 'E'.
ls_range-option = 'EQ'.
ls_range-low = '110'.
APPEND ls_range to lr_range.
ls_range-low = '120'.
APPEND ls_range to lr_range.
ls_range-low = '122'
APPEND ls_range to lr_range.
ls_range-low = '134'.
APPEND ls_range to lr_range.
IF itab-amt IN lr_range.
ENDIF.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you may also create a range for the numbers (r_numb) which are to be neglected and use the condition
IF itab-amt >= 100
AND itab-amt <= 200
AND itab-amt NOT IN r_numb.
" processing
endif.
regards,
teja.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
define a range for the values to exclude
ranges : r_amt for itab_amt
r_amt-sign = 'I'
r_amt-option = 'NE'
r_amt-low = 110
append r_amt.
r_amt-low = 120.
append r_amt... and so on for all the values.
If ( itab-amt between 100 and 200 )
and itab-amr in r_amt
result = itab-sales.
endif.
regards,
Advait
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if ( itab-amt >= 100
and itab-amt <= 200 )
and ( itab-amt <> 110
and itab-amt <> 120
and itab-amt <> 122
and itab-amt <> 134 ).
endif.
Regards,
Rich Heilman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
33 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.