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

CHECK STMT.

Former Member
0 Likes
573

hi all,

LOOP AT it_objk INTO wa_objk .

CHECK wa_objk-sernr+2(1) NE 'S'.

IF wa_objk-sernr+2(1) = 1 .

m1 = m1 + wa_objk-zzpmax.

m11 = m11 + 1.

MODIFY it_objk FROM wa_objk.

.

.

.

..

ENDLOOP.

I am checking this stmt. if 3rd charcter is "S". Come out of loop.

I want to check at a time if 3rd charcter is any alphabets or sysmbols. should come out of loop.

it should accept only numbers.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
539

Hi,

Try this,


LOOP AT it_objk INTO wa_objk .

CHECK wa_objk-sernr+2(1) CO '0123456789'.
IF wa_objk-sernr+2(1) = 1 .
m1 = m1 + wa_objk-zzpmax.
m11 = m11 + 1.
MODIFY it_objk FROM wa_objk.
.
.
.
..
ENDLOOP.

Make sure sernr is defined as type string

Regards,

Vikranth

hi all,

LOOP AT it_objk INTO wa_objk .

CHECK wa_objk-sernr+2(1) NE 'S'.

IF wa_objk-sernr+2(1) = 1 .

m1 = m1 + wa_objk-zzpmax.

m11 = m11 + 1.

MODIFY it_objk FROM wa_objk.

.

.

.

..

ENDLOOP.

I am checking this stmt. if 3rd charcter is "S". Come out of loop.

I want to check at a time if 3rd charcter is any alphabets or sysmbols. should come out of loop.

it should accept only numbers.

3 REPLIES 3
Read only

Former Member
0 Likes
539

hai sudhir then waht is th eproblem

write the condition in check statement if it is satisfied it goes else comes out of the loop for that iteration

if u want to come complete out of loop then use if statement and if the condtion is not satisfied exit then it will come out of loop completely

m.a

Read only

Former Member
0 Likes
540

Hi,

Try this,


LOOP AT it_objk INTO wa_objk .

CHECK wa_objk-sernr+2(1) CO '0123456789'.
IF wa_objk-sernr+2(1) = 1 .
m1 = m1 + wa_objk-zzpmax.
m11 = m11 + 1.
MODIFY it_objk FROM wa_objk.
.
.
.
..
ENDLOOP.

Make sure sernr is defined as type string

Regards,

Vikranth

Read only

faisalatsap
Active Contributor
0 Likes
539

Hi, Gsudhir

Please check the following Sample Code hope will help you to solve out your problem,

TYPES:  BEGIN OF ty,
        char(10),
        END OF ty.
DATA: it TYPE STANDARD TABLE OF ty WITH HEADER LINE.

it-char = 'AS2F123456'. APPEND it.
it-char = 'AS$F123456'. APPEND it.
it-char = 'ASDF123456'. APPEND it.

LOOP AT it.
  IF it-char+2(1) CA 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~!@#$%^&*()_+'. " You can add here any more Special Char
    EXIT.
  ENDIF.
  WRITE: it-char.
ENDLOOP.

Please reply if any issue,

Faisal