2013 Nov 05 11:49 AM
Hi all,
how can I write this correctly?
if order >= '0003A0000'
and order <= '0003Z9999'.
so in other words if the order is something like '0003B0000' then the it would do the processing.
Now when I write this, program runs into an error.
Thanks,
Tim
2013 Nov 05 11:58 AM
Hi,
Try below this.
if order BETWEEN '0003A0000' and '0003Z9999'.
Regards,
Arivazhagan S
2013 Nov 05 11:58 AM
Hi,
Try below this.
if order BETWEEN '0003A0000' and '0003Z9999'.
Regards,
Arivazhagan S
2013 Nov 05 11:59 AM
Hello Tim,
That should work perfectly fine. Problably is the type of the order variable that is wrong?
Try using a Char type.
This works:
data: order type vbeln.
order = '0003B0000'.
if order >= '0003A0000'and order <= '0003Z9999'.
write 'ok'.
endif.
2013 Nov 05 12:04 PM
2013 Nov 05 12:15 PM
What is the data type of order?
For data type String and character (c), it should work.
DATA: l_one(15) type c,
l_two(15) TYPE c,
l_find(15) TYPE c.
l_one = '0003A0000'.
l_two = '0003Z9999'.
l_find = '0003B0000'.
IF l_find >= l_one
AND l_find <= l_two.
WRITE 'ok'.
else.
write 'not found'.
ENDIF.
2013 Nov 05 12:18 PM
Hi Tim,
You code is working fine for me.. What is the error that you get? Make sure order is a character field.
data : aufnr_l like vbrp-aufnr VALUE '0003A0000'.
data : aufnr_h like vbrp-aufnr VALUE '0003Z9999'.
PARAMETERS p_aufnr LIKE vbrp-aufnr.
if p_aufnr LT aufnr_h and p_aufnr GT aufnr_l.
*if p_aufnr <= '0003Z9999' and p_aufnr => '0003A0000'.
write : 'Within limit'.
else.
write : 'Outside limit'.
endif.
2013 Nov 05 12:21 PM
if wa_datatab1-row >= '11' and wa_datatab1-row >= '12'.
ENDIF.
2013 Nov 05 12:22 PM
Thanks for all your quick answers. The program actually worked fine in that part, exception was raised because of a different error and I assumed it is because of the above.
2013 Nov 05 12:24 PM
Perform some search on Abap online documentation : log_exp - Comparison Operators for Character-Like Data Types
Also check the actual internal format of the order number
Regards,
Raymond
PS: hint : look for "CP" and "wildcard".
PPS: hint : leading zeroes and actual length (or define constants with correct type)