Application Development 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: 

type conversion

Former Member
0 Kudos

hi iwant to checj a field (EQUI-SERNR)

if there is any character in that or not.

how to do this.

thanks

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi sai,

1. simple.

2. we have to use SY-ABCDE

3. just copy paste in new program.

It will tell u the result.

4.

report abc.

*----


parameters : equnr like equi-equnr.

if equnr ca sy-abcde.

write 😕 'Contains character'.

else.

write 😕 'DOES NOT Contains character'.

endif.

regards,

amit m.

4 REPLIES 4

Former Member
0 Kudos

data : i1 type i,
       j type i,
       k type i
       l type i.

i1 = 0.
j = 1.
k = 0.
l = 1.

len = strlen(equi-sernr).

do len times.

   do 26 times.
        if equi-sernr+k(l) = sy-abcde+i1(j).
          if sy-subrc eq 0.
          *one char field found
           endif.
             i1 = i1 + 1. 
             j = j + 1.
        endif.
          enddo.
k = k + 1.
       l = l + 1.

enddo.

Message was edited by: Sekhar

Former Member
0 Kudos

Hi sai,

1. simple.

2. we have to use SY-ABCDE

3. just copy paste in new program.

It will tell u the result.

4.

report abc.

*----


parameters : equnr like equi-equnr.

if equnr ca sy-abcde.

write 😕 'Contains character'.

else.

write 😕 'DOES NOT Contains character'.

endif.

regards,

amit m.

Former Member
0 Kudos

HI,

DATA: V_TEST(6) TYPE C VALUE '908',

V_LEN TYPE I.

START-OF-SELECTION.

IF V_TEST CA SY-ABCDE.

WRITE 😕 'ALPHA-NUMERIC'.

ELSE.

WRITE 😕 'NUMBER'.

ENDIF.

Regards,

Sailaja.

Former Member
0 Kudos

Hi Ram

You can check the character by looping through it. I am including a simple program for your reference.

data sernr(18) type c value '00345df68234'.

data: len type i,

ch type c,

flag.

len = strlen( sernr ).

do len times varying ch from sernr0(1) next sernr1(1) range sernr.

case ch.

when '1' or '2' or '3' or '4' or '5' or '6' or '7' or '8' or '9' or '0'.

continue.

when others.

move 'X' to flag.

exit.

endcase.

enddo.

if flag = 'X'.

write: / 'Characters exists'.

endif.