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 lines from iternal table

Former Member
0 Likes
1,172

Hi All!

The problem what I'm having is I have to delete

all the entries from the internal table which are

lets say equal 'XXXXXX'

regards

sas

data lt_itab type standard table of IS_PDATFU.

data wa_itab type IS_PDATFU.

data: lt_roles type BAPIBUS1006_BPROLES occurs 0 with header line,

lt_return type standard table of BAPIRET2,

lv_partner type BU_PARTNER.

lt_itab[] = l_pdatfu_tab[].

LOOP AT lt_itab into wa_itab.

CALL FUNCTION 'BUPA_ROLES_GET_2'

EXPORTING

IV_PARTNER = wa_itab-IPPERS 'PersID

  • IV_PARTNER_GUID =

  • IV_DATE = SY-DATLO

TABLES

ET_PARTNERROLES = lt_roles

ET_RETURN = lt_return.

IF lt_roles-PARTNERROLE EQ 'XXXXXX'.

delete this lines from lt_itab[] ????

?????

ENDIF.

ENDLOOP.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,138

loop at lt_itab into wa_itab where it_roles-PARTNERROLE EQ 'XXXXXX'.

delete wa_itab.

update wa_itab to it_itab.

clear wa_itab.

endloop.

7 REPLIES 7
Read only

Former Member
0 Likes
1,138

delete itab where field = 'XXXXXX'.

this will work.

thnkx

Read only

Former Member
0 Likes
1,138

you can simply delete those lines by using delete statement.

for e.g. delete itab where field = 'XXXX'.

Read only

Former Member
0 Likes
1,138

please notice I'm in a loop

Regards

sas

Read only

0 Likes
1,138

So u need to use DELETE ITAB:

LOOP AT lt_itab into wa_itab.

CALL FUNCTION 'BUPA_ROLES_GET_2'

EXPORTING

IV_PARTNER = wa_itab-IPPERS 'PersID

IV_PARTNER_GUID =

IV_DATE = SY-DATLO

TABLES

ET_PARTNERROLES = lt_roles

ET_RETURN = lt_return.

IF lt_roles-PARTNERROLE EQ 'XXXXXX'.

delete lt_itab.

ENDIF.

ENDLOOP.

Max

Edited by: max bianchi on Feb 12, 2008 6:17 PM

Read only

Former Member
0 Likes
1,138

It's a bit dangerous to delete records in a loop. I'd do as the others have suggested after the loop completes. If you must do it in the loop:

  IF lt_roles-partnerrole EQ 'XXXXXX'.
    DELETE  lt_itab.
  ENDIF.

ENDLOOP.

Rob

Read only

Former Member
0 Likes
1,138

Hi,

You can use the below code :


IF lt_roles-PARTNERROLE EQ 'XXXXXX'.
   delete lt_itab.
   clear lt_itab.
endif.

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
1,139

loop at lt_itab into wa_itab where it_roles-PARTNERROLE EQ 'XXXXXX'.

delete wa_itab.

update wa_itab to it_itab.

clear wa_itab.

endloop.