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: 

Delete Itab where .........

Former Member
0 Kudos

Hi,

I want to delete an itab and the condition is the filed name TEXT first 2 char is ne select option and also not to delete if the first 2 char is 'GE'.so how to write the code in this condition.Pls help to solve this issue

Thanks,

Deesanth

1 ACCEPTED SOLUTION

former_member598013
Active Contributor
0 Kudos

Hi Deesanth,

Here is the solution.



Loop at itab.
 IF itab-text+0(2) NE  S_OPTION-LOW 
     or itab-text+0(2) GE  S_OPTION-LOW.

  Delete itab index sy-tabix.

 ENDIF.
Endloop.

&*******************Reward Point if helpful****************&

4 REPLIES 4

former_member598013
Active Contributor
0 Kudos

Hi Deesanth,

Here is the solution.



Loop at itab.
 IF itab-text+0(2) NE  S_OPTION-LOW 
     or itab-text+0(2) GE  S_OPTION-LOW.

  Delete itab index sy-tabix.

 ENDIF.
Endloop.

&*******************Reward Point if helpful****************&

Former Member
0 Kudos

Hi,

Try this.

data : w_2(2) type c,

index type sy-tabix.

Loop at itab.

index = sy-tabix.

w_2 = itab-text + 0(2).

If w_2 ne s_option-low and w_2 gt s_option-high.

delete itab index index.

endif.

clear : w_2, index.

endloop.

Reward pts if useful.

Regards,

Dhan

former_member156446
Active Contributor
0 Kudos

I want to delete an itab and the condition is the filed name TEXT first 2 char is ne select option and also not to delete if the first 2 char is 'GE'.so how to write the code in this condition.Pls help to solve this issue


loop at itab into wa_itab.
if text+0(2) eq 'GE' and text+0(2) in so_options.
skip.
else.
delete itab index sy-tabix.
endif.
endloop.

Former Member
0 Kudos

REPORT Z_DELETE.

tables : vbap.

types : begin of ty_vbap,

vbeln type vbeln_va,

posnr type posnr_va,

matnr type matnr,

end of ty_vbap.

data : it_vbap type standard table of ty_vbap initial size 0,

wa_vbap type ty_vbap.

selection-screen : begin of block b1 with frame title text-001.

select-options : s_vbeln for vbap-vbeln.

selection-screen : end of block b1.

start-of-selection.

select vbeln

posnr

matnr

from vbap

into table it_vbap

where vbeln in s_vbeln.

if sy-subrc ne 0.

  • do nothing

endif.

delete it_vbap where ( vbeln0(2) ne s_vbeln ) and ( vbeln0(2) ge s_vbeln ).

loop at it_vbap into wa_vbap.

write : / wa_vbap-vbeln,

wa_vbap-posnr,

wa_vbap-matnr.

endloop.