2016 Jan 18 3:54 AM
Hi,
I have field with 'Char' format, but i used to input an integer value. Are possible if I use that value to filter data?
Example:
IF FIELD > 70.
FIELD2 = 'More than 70'.
Thank you.
2016 Jan 18 4:25 AM
You can.. Just move your char data to a int variable.
Sample:
DATA: v_char TYPE char10,
v_int TYPE i.
v_char = 71.
MOVE v_char TO v_int.
IF v_int > 70.
WRITE: 'More than 70'.
ENDIF.
2016 Jan 18 5:06 AM
Thank for the reply, but i use an internal table.
I have an internal table with it_vbkd like vbkd.
in field POSEX_E default format field is char, but i want use to filter by Integer. Can I convert field in internal table as you suggest?
2016 Jan 18 5:45 AM
Yes. Just create a loop passing to work area and move the posex_e field to an integer variable then validate.
Loop at it_vkbd INTO wa_vbkd
MOVE wa_vbkd-posex_e TO v_int.
<add condition here>
Endloop.
2016 Jan 18 6:42 AM
Hi Elzkie,
Thanks for the answer. Its work fine for me with less modify.
2016 Jan 18 5:48 AM
Hi. Check abap help for comparison between different types. It will help you to understand your problem - Comparisons Between Different Data Types - ABAP Programming (BC-ABA) - SAP Library
Char and int will be compared as numbers.
So if you have data i1 type i value 123 and data c1(10) value ' 123' and data c2(10) value '00000123', i1 will be equal to c1 and c2.
2016 Jan 18 6:58 AM
Hi,
You can use single quote for character like IF FIELD > '70' for comparison.
Thanks.