‎2010 Jul 02 3:04 PM
Hi guys,
I've have a need do delete an uncertain number of entrys from a dynamic table.
* Dinamic tables
create data ref_c type table of (tabname).
assign ref_c->* to <fs_c>.
try.
select * from (tabname) into table <fs_c>
where (lv_query1) .
catch cx_sy_dynamic_osql_syntax.
endtry.so far no problem.
but the volume of data is huge and i've got an dynamic range
loop at <fs_c> assigning <fs_gc>.
lv_index = sy-tabix.
assign component 'FIELD' of structure <fs_gc> to <fs_del_caract>.
if <fs_del_caract> in lr_range.
move-corresponding <fs_gc> to ls_colectt.
collect ls_colectt into lt_colectt.
else.
delete <fs_v> index lv_index.
endif.
endloop.this code can take much time.
is there any any to delete dynamic using delete table and dynamic tables?
Regards
Jaime
‎2010 Jul 02 4:14 PM
‎2010 Jul 02 4:20 PM
Hi Keshav,
Thats the root of the trouble it cant be in the select.
thazs
‎2010 Jul 02 4:23 PM
You can specify dynamic WHERE clause in the DELETE statement. Check this SAP online documentation for the same: [http://help.sap.com/abapdocu_70/en/ABAPDELETE_ITAB_LINES.htm#!ABAP_ADDITION_4@4@].
Try this:
DATA: V_COND TYPE STRING.
V_COND = 'FIELD NOT IN LR_RANGE'.
DELETE <FS_C> WHERE ( V_COND ).
‎2010 Jul 02 4:43 PM
Hi Suhas,
I've tried that and it trows this error on activation
In "LOOP ... WHERE ..." the row type of the table must be statically defined .
Thanks
‎2010 Jul 02 4:44 PM
Hi,
delete <fs_tab> where <field> not in lr_range.
This is what Suhas meant.
your error comes because you are using dynamic wheer clause in the loop.
‎2010 Jul 02 4:53 PM
>
> your error comes because you are using dynamic wheer clause in the loop.
Dynamic WHERE condition in the LOOP statement is currently supported by SAP.
@OP: Which version of ABAP are you using ?
BR,
Suhas
‎2010 Sep 21 4:07 PM
‎2010 Sep 22 9:03 AM
Hi,
with dinamic subroutine pool
[http://help.sap.com/saphelp_nw04/helpdata/en/9f/db999535c111d1829f0000e829fbfe/content.htm]
Hope it helps you
Regards
Jaime