2007 May 18 3:46 AM
I have a program to upload excel to internal table and then to ztable.
I need to validate the inputs .
I have fields that have character inputs.
the system takes the input entered in caps and small as different items.
How do i differentiate between .
Do i have to write like the code below or is there any code?
thanks in advance
LOOP AT zt_itab INTO zx_itab.
IF NOT ( zx_itab-field EQ 'A' OR zx_itab-field EQ 'a' OR zx_itab-field EQ 'D'
OR zx_itab-fieldEQ 'd' )
-
.
2007 May 18 4:28 AM
hi
might try this...build a range with capital letters, if the field is not in the range, it's a small letter, if not, it's capital
ranges : r_caps for qals-stat35.
r_caps-low = 'A'.
perform append.
r_caps-low = 'B'.
perform append.
.
.
r_caps-low = 'Z'.
perform append.
LOOP AT zt_itab INTO zx_itab.
IF NOT ( zx_itab-field in r_caps )
write zx_itab-field, 'is a small letter'.
else.
write zx_itab-field, 'is a capital letter'.
endif.
form append.
r_caps-sign = 'I'.
r_caps-option = 'EQ'.
append r_caps.
endform.
if helpful, reward
Sathish. R
I have a program to upload excel to internal table and then to ztable.
I need to validate the inputs .
I have fields that have character inputs.
the system takes the input entered in caps and small as different items.
How do i differentiate between .
Do i have to write like the code below or is there any code?
thanks in advance
LOOP AT zt_itab INTO zx_itab.
IF NOT ( zx_itab-field EQ 'A' OR zx_itab-field EQ 'a' OR zx_itab-field EQ 'D'
OR zx_itab-fieldEQ 'd' )
-
.
2007 May 18 3:53 AM
You can either change everything to lower case or upper case and then check.
LOOP AT zt_itab INTO zx_itab.
TRANSLATE zx_itab TO UPPER CASE.
IF NOT ( zx_itab-field EQ 'A' OR OR zx_itab-field EQ 'D')
...
ENDIF.
ENDLOOP.
2007 May 18 3:54 AM
use system variable sy-abcde.
declare variables :
data : v_data(52) type c,
v_data1(26) type c
v_data2(26) type c.
start-of-selection.
v_data = sy-abcde.
v_data(1) = v_data+0(26).
v_data(2) = v_data+26(52).
and do compare what ever you want now
Reward Points if it is useful
Thanks
Seshu
2007 May 18 3:59 AM
try this..
LOOP AT zt_itab INTO zx_itab.
IF NOT ( zx_itab-field IN ( 'A' , 'a' , 'D' , 'd' ) ).
ENDIF.
2007 May 18 4:02 AM
Just translate everything to upper case
TRANSLATE zx_itab TO UPPER CASE.
now you can simple compare as
LOOP AT zt_itab INTO zx_itab.
if zx_itab-field EQ zx_itab-field.
Message iZXX 'The data is same no difference'
else.
Message 'different'
endif.
ENDLOOP
2007 May 18 6:32 AM
2007 May 18 4:28 AM
hi
might try this...build a range with capital letters, if the field is not in the range, it's a small letter, if not, it's capital
ranges : r_caps for qals-stat35.
r_caps-low = 'A'.
perform append.
r_caps-low = 'B'.
perform append.
.
.
r_caps-low = 'Z'.
perform append.
LOOP AT zt_itab INTO zx_itab.
IF NOT ( zx_itab-field in r_caps )
write zx_itab-field, 'is a small letter'.
else.
write zx_itab-field, 'is a capital letter'.
endif.
form append.
r_caps-sign = 'I'.
r_caps-option = 'EQ'.
append r_caps.
endform.
if helpful, reward
Sathish. R
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |