2008 Sep 05 6:27 AM
Hi All,
we are populating internal table T_FINAL from tables VBAP and VBRP,We want to remove certain rows
of data from T_FINAL based on some Order types in VBAK table.
2008 Sep 05 6:29 AM
Hi,
you can use READ and DELETE statement for this.
syntax
T_FINAL based on some Order types in VBAK table
loop at T_FINAL.
if (set the condition).
DELETE itab INDEX sy-tabix.
end loop.
ref:
for READ STATEMANT
http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb35f8358411d1829f0000e829fbfe/content.htm
for DELETE STATEMENT
http://help.sap.com/saphelp_nw70/helpdata/en/06/aafd54fc4011d195280000e8353423/content.htm
regards,
anirban
2008 Sep 05 6:30 AM
You can use DELETE itab WHERE (condition) if itab has a header work
2008 Sep 05 6:30 AM
HI,
U CAN USE DELETE STATEMENT BY CHECKING THE ORDER TYPES FROM INTERNAL TABLE.
2008 Sep 05 6:31 AM
Karthik
Do following:
Delete T_Final where ( AUART = 'XYZ' ).
Thanks
Amol Lohade
2008 Sep 05 6:35 AM
we did try this option within a loop but amount of data we are dealing here is huge and loop is taking lotof time so any other suggestion will be helpful
2008 Sep 05 6:40 AM
I try using DELETE itab WHERE field = value., this stament is more performance.
Sry for my bad english
2008 Sep 05 6:33 AM
Hi,
Use the Code below for deleting the particular line asper your requirement.
LOOP AT itab.
*Deleting the field which is selected.
DELETE itab WHERE (condition).
ENDLOOP.
2008 Sep 05 6:40 AM
Hello boss plz do check ur code ... U R DELETING WITHIN LOOP THATS ALSO WITH CONDITION...
remove the loop.... single loop within loop is enough
2008 Sep 05 6:35 AM
hi
AUART is the fiiels of document type let ur internal table have this fiels as order_type
do like this
LOOP AT T_FINAL INTO wa_final.
IF wa_final-order_type = ' order type '.
DELETE T_FINAL INDEX sy-tabix.
ENDIF.
ENDLOOP.
Cheers
Snehi
2008 Sep 05 6:35 AM
Hi ,
U can use
Delete i_tab where order_type = something ...
am i right or u r expecting something else ....
2008 Sep 05 6:39 AM
Hi,
plz try this way to delete a particular line from internal table :
LOOP AT T_FINAL WHERE AUART = 'some value'.
DELETE T_FINAL
ENDLOOP.
.
thanx.
Edited by: Dhanashri Pawar on Sep 5, 2008 7:48 AM
2008 Sep 05 6:49 AM
This is the code we had written for the condition
LOOP AT FPT_VBRP INTO WA_VBRP.
L_TABIX = SY-TABIX.
READ TABLE FPT_VBAP INTO WA_VBAP WITH KEY VBELN = WA_VBRP-AUBEL
POSNR = WA_VBRP-AUPOS.
IF SY-SUBRC <> 0.
DELETE FPT_VBRP INDEX L_TABIX.
ENDIF.
CLEAR L_TABIX.
ENDLOOP.
This processing inside the LOOP .......ENDLOOP takes lot of time.Because it is dealing with 4 lakhs data in FPT_VBRP and almost the same in FPT_VBAP.
Ideally it should not take more than 10 minutes, but in this case it is working as infinite loop.
please look into this
2008 Sep 05 7:30 AM
Hi,
You can solve this issue in two ways.
1)By usiing the condition in the select statement where condition.
2)create a new table which of same type of your final internal table and follow this process.
field-symbols: <fs_t_new> type wa_new.
unassign <fs_t_new>.
loop at t_final assigning wa_final.
check <fs_t_new> is assigned.
check <fs_t_new>-ordertype ne 'condition'.
append <fs_t_new> to t_new.
endloop.
Please careful while using field symbols. If you are not familiar with that, you can use workarea like this.
loop at t_final into wa_final.
if wa_final-ordertype ne 'condition'.
append wa_final to t_new(new table of same type t_final).
clear wa_final.
endif.
endloop.
use this t_new table for remaining purpose which consists of the data satisfying your condition
2008 Sep 05 7:43 AM
Hi Karthik,
You are populating T_FINAL from VBAK & VBRK so T_FINAL would be having data of VBAK.you can delete
directly using following statement:
Delete t_final where order type = <order type>
Regards,
Hemant
2008 Sep 05 7:52 AM
Hi Karthik,
Firstly create an internal table with the data from VABK, say t_vbak.
Check this Sample, which might give you an idea:
Loop at t_final.
w_index = sy-tabix.
READ TABLE t_vbak with key <condition>.
if sy-subrc eq 0.
delete t_final index w_index.
endif.
Endloop.
Regards,
Chandra Sekhar