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 Itab where .........

Former Member
0 Likes
613

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
Read only

Former Member
0 Likes
567

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
Read only

Former Member
0 Likes
568

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****************&

Read only

Former Member
0 Likes
567

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

Read only

former_member156446
Active Contributor
0 Likes
567

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.

Read only

Former Member
0 Likes
567

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.