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 record from internal table

Former Member
0 Kudos

hi,

i want to delete record from internal table compring the 2nd field.

for example:

x 5

y 5

then the second record should be deleted . the comparision should be on the basis of 2nd field.

regards

nilabichi

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi..

your requirment is not clear please provide more detail

watever i understood from question on that basis u shd.

sort the table and then loop it...

regards

vivek

7 REPLIES 7

Former Member
0 Kudos

Hi..

your requirment is not clear please provide more detail

watever i understood from question on that basis u shd.

sort the table and then loop it...

regards

vivek

Former Member
0 Kudos

hii

delete itab-y where y = 5.

thanks

Former Member
0 Kudos

Try this out

DELETE itab WHERE 2ndfield = ' value ' .

Regards,

Linda

former_member206439
Contributor
0 Kudos

Hi

sort itab.

delete adjacent duplecates comparing (that second filed)

try this one

Former Member
0 Kudos

Hi,

Use

DELETE ADJACENT DUPLICATES FROM itab comparing field2.

Regrads,

Dhan

Subhankar
Active Contributor
0 Kudos

Hi

please see this example..

DATA: i_mara TYPE STANDARD TABLE OF mara INITIAL SIZE 0,

wa_mara TYPE mara.

SELECT *

UP TO 10 ROWS

FROM mara

INto TABLE i_mara.

READ TABLE i_mara INTO wa_mara INDEX 2.

if wa_mara-ERSDA <> 'ABC'.

delete i_mara index 2 .

endif.

LOOP at i_mara INTO wa_mara.

WRITE: / wa_mara-matnr.

ENDLOOP.

Former Member
0 Kudos

HI



data:
  w_temp1 like itab-f2,
  w_temp2 like itab-f2.

loop at itab.
 w_temp1 = itab-f2.
   if w_temp1 eq w_temp2.
      delete itab.
   endif.
 w_temp2 = w_temp1.
endloop

Regards,

Sunil Kumar M