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

delete lines from internal tables problem

Former Member
0 Likes
2,138

HI

LOOP at itab2.

IF itab2-fieldA+0(1) = 'Z' or

itab2-fieldA+0(2) = 'R2'.

WRITE: / itab2-fieldA, itab2-fieldZ.

ENDIF.

ENDLOOP.

Working well and return lines:

Z 54

R2 76

A 34

but this loop:

LOOP at itab2.

IF itab2-fieldA+0(1) = 'Z' or

itab2-fieldA+0(2) = 'R2'.

DELETE itab2 from itab2.

ENDIF.

ENDLOOP.

return error "UC_OBJECTS_NOT_NUMLIKE".

How to resolve this problem?

Regards

PWnuk

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
545

try this:


LOOP at itab2.
IF itab2-fieldA+0(1) = 'Z' or
itab2-fieldA+0(2) = 'R2'.
 DELETE itab2.
ENDIF.
ENDLOOP.

or


data: wa_itab2 like line of itab2.
LOOP at itab2 into wa_itab2.
IF wa_itab2-fieldA+0(1) = 'Z' or
wa_itab2-fieldA+0(2) = 'R2'.
 DELETE itab2 from wa_itab2.
ENDIF.
ENDLOOP.

3 REPLIES 3
Read only

Former Member
0 Likes
546

try this:


LOOP at itab2.
IF itab2-fieldA+0(1) = 'Z' or
itab2-fieldA+0(2) = 'R2'.
 DELETE itab2.
ENDIF.
ENDLOOP.

or


data: wa_itab2 like line of itab2.
LOOP at itab2 into wa_itab2.
IF wa_itab2-fieldA+0(1) = 'Z' or
wa_itab2-fieldA+0(2) = 'R2'.
 DELETE itab2 from wa_itab2.
ENDIF.
ENDLOOP.

Read only

Former Member
0 Likes
545

Use this code..

LOOP at itab2.

IF itab2-fieldA+0(1) = 'Z' or

itab2-fieldA+0(2) = 'R2'.

DELETE itab2.

ENDIF.

ENDLOOP.

Read only

Former Member
0 Likes
545

THX boys.