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

wrong itab line

Former Member
0 Likes
872

Hi Everbody!

DELETE lt_itab removes the wrong line

from internal table because the

number of lv_tabix is not equally with

the really affected line of internal table which has

to be deleted. Do you know a better

way to do that.

Thanks in advance

sas

data: lt_itab type standard table of IS_PDATFU,

wa_itab type IS_PDATFU,

lt_roles type standard table of BAPIBUS1006_BPROLES,

wa_roles type BAPIBUS1006_BPROLES,

lt_return type standard table of BAPIRET2,

lv_partner type BU_PARTNER,

lv_tabix type i value 1.

lt_itab = l_pdatfu_tab.

LOOP AT lt_itab into wa_itab.

CALL FUNCTION 'BUPA_ROLES_GET_2'

EXPORTING

IV_PARTNER = wa_itab-IPPERS

  • IV_PARTNER_GUID =

  • IV_DATE = SY-DATLO

TABLES

ET_PARTNERROLES = lt_roles

ET_RETURN = lt_return.

read table lt_roles into wa_roles index 1.

IF wa_itab-IPPERSGRP EQ 'C' AND wa_roles-PARTNERROLE EQ 'IKOS' .

DELETE lt_itab INDEX lv_tabix.

ENDIF.

clear wa_roles.

lv_tabix = lv_tabix + 1.

ENDLOOP.

l_pdatfu_tab = lt_itab.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
848

Hi,

Try this

DELETE TABLE lt_itab FROM wa_itab..

7 REPLIES 7
Read only

Former Member
0 Likes
849

Hi,

Try this

DELETE TABLE lt_itab FROM wa_itab..

Read only

Former Member
0 Likes
848

Also try this

LOOP AT lt_itab into wa_itab.

lv_tabix = SY-TABIX.

and the use DELETE as you had used

Read only

0 Likes
848

Hi

In loop place" lv_tabix = SY-TABIX."

then,

DELETE TABLE lt_itab FROM wa_itab..

It will b of format

LOOP AT lt_itab into wa_itab.

lv_tabix = SY-TABIX."

DELETE TABLE lt_itab FROM wa_itab index lv_tabix..

Endloop.

Read only

Former Member
0 Likes
848

Hi,

when u delete the record then select that record and send it to another internal table after compltion of ur

task in that table then do this logic.

loop at it_temp.

loop at it_tab where field1 = it_temp.

delete it_tab with sy-tabix.

endloop.

endloop.

Plzz reward points if it helps.

Read only

Former Member
0 Likes
848

Chandrasekhar I thank you very much .

You are the best !!

DELETE TABLE lt_itab FROM wa_itab..

was the solution.

Bye

sas

Read only

Former Member
0 Likes
848

Hello erdem sas ,

Really good Question. The Answer againest you question mark by other users are also good to adopt. But I have one another solution.

tries it out.

Don't delete the table by using the folowing statment

DELETE lt_itab INDEX lv_tabix.

out side the loop you try this. from the side of performance this one is really good.

Sort it_itab by IPPERSGRP IPPERSGRP.

Delete it_itab where IPPERSGRP EQ 'C' and PARTNERROLE EQ 'IKOS' .

Please Chcek the syntex error , because I am outside office and type the code.

Regards

Swati...

Read only

Former Member
0 Likes
848

erdem,

Instead of index use SY-TABIX.

You are in loop of internal table So use

DELETE lt_itab INDEX SY-TABIX.

Don't forget to reward if useful...