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: 

deleting internal table records with pattern

Former Member
0 Kudos
7,237

Hi experts

I need to delete the internal table records where vbeln like '40%'.

all the vbeln atarting with the number 40 i need to delete. if i use the like in where clause i am getting error.

Please suggest some solution on this

thanks in advance

sai

1 ACCEPTED SOLUTION

sridhar_meesala
Active Contributor
0 Kudos
1,711

Hi,

Try this.

DELETE itab WHERE vbeln = '40%'

.

Thanks,

Sri.

7 REPLIES 7

former_member156446
Active Contributor
0 Kudos
1,711

build a range table and use

data: ra_vbeln type standard table of selopt,
         wa_vbeln type selopt.

wa_vbeln-sign = 'I'.
wa_vbeln-option = 'EQ'.
wa_vbeln-low = '40*'
append wa_vbeln to ra_vbeln.

delete tabe itab where vbeln in ra_vbeln.

sridhar_meesala
Active Contributor
0 Kudos
1,712

Hi,

Try this.

DELETE itab WHERE vbeln = '40%'

.

Thanks,

Sri.

Former Member
0 Kudos
1,711

Hello ,

you can use this trick ....

data: var1 type char2 .

loop at itab .

var1 = itab-vbeln+0(2) .

if var1 = '40' .

delete itab .

enidf.

endloop.

Thanks and regards..

Priyank

Former Member
0 Kudos
1,711

Hi,

You can try this way...

vbeln-sign = 'I'.
vbeln-option = 'CP'.        " You sould use Contains Pattern when you use * 
vbeln-low = '40*'
append vbeln .
 
delete tabe itab where vbeln in vbeln.

Former Member
0 Kudos
1,711

Hi,

use, DELETE itab where vbeln+0(2) = '40'.

Hope it works!!

Rgds,

Pavan

0 Kudos
1,711

tables : vbak.

data: itab TYPE standard TABLE OF vbak.

start-of-selection.

SORT itab BY vbeln DESCENDING.

DELETE itab where vbeln = '40*'.

Former Member
0 Kudos
1,711

Hi .

I hope this code solved your problem .

Loop at itab where vbeln(2) = '40' .

delete itab .

continue .

endloop .