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

help in delete

Former Member
0 Likes
668

hi,

i have internal table lt_vbak and i wont to delete from itab rows where field auart =

YAN77

YCR0

YCR1

YCR7

YCR8

YDR0

YCR1

YCR6

YCR9

YDR13

what is the best way to do that?

Regards

1 ACCEPTED SOLUTION
Read only

ferry_lianto
Active Contributor
0 Likes
627

Hi,

Please try this.


tables: vbak.

ranges: r_auart for vbak-auart.

r_auart-sign = 'I'.
r_auart-option = 'EQ'.
r_auart-low = 'YAN77'.
append r_auart.

r_auart-low = 'YCR0'.
append r_auart.

...

r_auart-low = 'YDR13'.
append r_auart.

delete it_vbak where auart in r_auart.

Regards,

Ferry Lianto

5 REPLIES 5
Read only

Former Member
0 Likes
627

try this..

delete lt_vbak where ( auart = 'YAN77' or
                                auart = 'YCR0' or
auart = 'YCR1' or
auart = 'YCR7' or
auart = 'YCR8' or
auart = 'YDR0' or
auart = 'YCR1' or
auart = 'YCR6'  or
auart = 'YDR13' ).

Arya

Read only

varma_narayana
Active Contributor
0 Likes
627

Hi

delete lt_vbak where

auart = 'YAN77' or

auart = 'YCR0' or

auart = 'YCR1' or

auart = 'YCR7' or

auart = 'YCR8' or

auart = 'YDR0' or

auart = 'YCR1' or

auart = 'YCR6' or

auart = 'YDR13' .

<b><REMOVED BY MODERATOR></b>

Message was edited by:

Alvaro Tejada Galindo

Read only

Former Member
0 Likes
627

Create a range like this...


TYPES: BEGIN OF ty_range,
        sign   TYPE c LENGTH 1,
        option TYPE c LENGTH 2,
        low    TYPE string,
        high   TYPE string,
       END OF ty_range.

DATA: t_range TYPE STANDARD TABLE OF ty_range,
      w_range LIKE LINE OF t_range.

w_range-sign = 'I'.
w_range-option = 'EQ'.
w_range-low = 'YAN77'.
APPEND w_range TO t_range.
w_range-low = 'YCR0'.
APPEND w_range TO t_range.

Then do this...


DETELE TABLE WHERE FIELD IN T_RANGE.

Greetings,

Blag.

Read only

ferry_lianto
Active Contributor
0 Likes
628

Hi,

Please try this.


tables: vbak.

ranges: r_auart for vbak-auart.

r_auart-sign = 'I'.
r_auart-option = 'EQ'.
r_auart-low = 'YAN77'.
append r_auart.

r_auart-low = 'YCR0'.
append r_auart.

...

r_auart-low = 'YDR13'.
append r_auart.

delete it_vbak where auart in r_auart.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
627

Eliminate duplicates from the condition and put it in order:

DELETE it_vbak WHERE auart = 'YAN77' OR
                     auart = 'YCR0'  OR
                     auart = 'YCR1'  OR
                     auart = 'YCR6'  OR
                     auart = 'YCR7'  OR
                     auart = 'YCR8'  OR
                     auart = 'YCR9'  OR
                     auart = 'YDR0'  OR
                     auart = 'YDR13'.

Rob