Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Validate between caps and small alphabets

Former Member
0 Likes
1,235

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' )

-


.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,069

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' )

-


.

6 REPLIES 6
Read only

Former Member
0 Likes
1,069

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.

Read only

Former Member
0 Likes
1,069

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

Read only

Former Member
0 Likes
1,069

try this..

LOOP AT zt_itab INTO zx_itab.

IF NOT ( zx_itab-field IN (  'A' , 'a' , 'D' , 'd' ) ).

ENDIF.

Read only

Former Member
0 Likes
1,069

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

Read only

0 Likes
1,069

Thanks,

It really helped me.

Read only

Former Member
0 Likes
1,070

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