2007 Jan 26 10:34 AM
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..
2007 Jan 26 11:07 AM
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..
2007 Jan 26 10:40 AM
2007 Jan 26 10:45 AM
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
2007 Jan 26 10:56 AM
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
2007 Jan 26 10:56 AM
2007 Jan 26 10:57 AM
Hi Madhavi,
Try to use delete i_vbrk index sy-tabix.
Pls reward if found useful.
Thanks
Shyam
2007 Jan 26 10:58 AM
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
2007 Jan 26 11:07 AM
can u try this..
delete table i_vbrk from w1
with table key fkart = i_vbrk-fkart.
regds,
kiran
2007 Jan 26 11:35 AM
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.
2007 Jan 26 11:46 AM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |