Skip to Content
author's profile photo Former Member
Former Member

Delete dynamic table with dynamic range - problem

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Jul 02, 2010 at 03:14 PM

    Cant we restrict it from the select query itself ?

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 02, 2010 at 03: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 ).

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 02, 2010 at 03: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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 21, 2010 at 03:07 PM

    hi jaime,

    i got the same problem. did u solve it?

    martin

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.