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 from wa

Former Member
0 Likes
17,502

Hi Every one,

Now i am working in ECC6.0

but the following the code is showing an error while i am trying to delete from the internal table. pls anybody try and see me the proper code to delete from intenal table .

types : begin of t_vbrk,

vbeln type vbeln ,

fkart type fkart,

end of t_vbrk.

data : i_vbrk type table of t_vbrk with key fkart ,

i_inv type table of zinv_typ with default key .

data :w1 type t_vbrk , w2 type zinv_typ.

select vbeln fkart from vbrk into table i_vbrk up to 5 rows.

select * from zinv_typ into table i_inv .

sort i_inv by fkart.

loop at i_vbrk into w1.

read table i_inv into w2 with key fkart = w1-fkart binary search.

if sy-subrc ne 0.

delete i_vbrk from w1.

endif.

endloop.

LOOP AT I_VBRK INTO W1.

WRITE:/ W1-VBELN, W1-FKART.

ENDLOOP.

pls its urgent ...

let me know anyone.

Regards..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
5,658

can u try this..

delete table i_vbrk from w1

with table key fkart = i_vbrk-fkart.

regds,

kiran

Hi Every one,

Now i am working in ECC6.0

but the following the code is showing an error while i am trying to delete from the internal table. pls anybody try and see me the proper code to delete from intenal table .

types : begin of t_vbrk,

vbeln type vbeln ,

fkart type fkart,

end of t_vbrk.

data : i_vbrk type table of t_vbrk with key fkart ,

i_inv type table of zinv_typ with default key .

data :w1 type t_vbrk , w2 type zinv_typ.

select vbeln fkart from vbrk into table i_vbrk up to 5 rows.

select * from zinv_typ into table i_inv .

sort i_inv by fkart.

loop at i_vbrk into w1.

read table i_inv into w2 with key fkart = w1-fkart binary search.

if sy-subrc ne 0.

delete i_vbrk from w1.

endif.

endloop.

LOOP AT I_VBRK INTO W1.

WRITE:/ W1-VBELN, W1-FKART.

ENDLOOP.

pls its urgent ...

let me know anyone.

Regards..

9 REPLIES 9
Read only

RaymondGiuseppi
Active Contributor
0 Likes
5,658

replace "delete i_vbrk from w1" with "delete i_vbrk."

Abap interprets w1 as an index.

Regards

Read only

Former Member
0 Likes
5,658

hi Madhavi,

table is missing..

delete <b>table</b> i_vbrk from w1.

Read this before using

The values for the table key are taken from the corresponding components of the (structured) field wa. The field must be <b>compatible with the table line of itab</b>. This method allows you to delete from a table without the table key having to be known in advance. If the internal table has a header line, you can leave out the FROM wa addition; the system then takes the key values from the header line.

Regards,

satnosh

Read only

Former Member
0 Likes
5,658

Hi Madhavi,

Try like this...

loop at i_vbrk into w1.

gv_index = sy-tabix.

read table i_inv into w2 with key fkart = w1-fkart binary search.

if sy-subrc ne 0.

delete i_vbrk index gv_index.

endif.

endloop.

Regards,

Satya

Read only

Former Member
0 Likes
5,658

just change it to

DELETE <b>TABLE</b> I_VBRK FROM W1

Read only

Former Member
0 Likes
5,658

Hi Madhavi,

Try to use delete i_vbrk index sy-tabix.

Pls reward if found useful.

Thanks

Shyam

Read only

Former Member
0 Likes
5,658

hi madavi,

it is not good deleting a record inside the loop. instead create field symblol.. then clear the content of the recod..

FIELD-SYMBOLS <WA_W1> TYPE t_vbrk 

loop at i_vbrk ASSIGNING <WA_W1>.

*read table i_inv into w2 with key fkart = w1-fkart binary search.
read table i_inv into w2 with key fkart = <WA_W1>-fkart binary search.
if sy-subrc ne 0.
*delete i_vbrk from w1.
CLEAR <WA_W1>.
endif.
endloop.

SORT i_vbrk.
DLELTE i_vbrk WHERE vbeln IS INITIAL.

the last statement delete the blank records form the table, because when u use CLEAR <WA_W1>. it clears the content but..do not delete the record form the table.. that why i am removing them at last afte the loop

Message was edited by:

Naresh Reddy

Read only

Former Member
0 Likes
5,659

can u try this..

delete table i_vbrk from w1

with table key fkart = i_vbrk-fkart.

regds,

kiran

Read only

Former Member
0 Likes
5,658

loop at i_vbrk into w1.

<b>v_tabix = sy-tabix.</b>

read table i_inv into w2 with key fkart = w1-fkart binary search.

if sy-subrc ne 0.

<b>delete i_vbrk index v_tabix.</b>endif.

endloop.

Read only

0 Likes
5,658

Hi,

Thank you very much for every response.

byee.