Deleting from Internal Table (dynamic)

Hi,
I have an Internal table, which will contain daily movements for plants per material.
The internal table will contain 4 plants per material, with more than 1 material.
Now, i have four columns. If all of those columns for that material and for all plants for that material equal zero, i want to delete the specific record.
For example
Material     Plant      Daily 1  Daily 2  Daily 3  Daily 4
102            1           0          0           0          0
102            2           0          0           0          0
102            3           0          0           0          0
102            4           0          0           0          0
So, these 4 records should be deleted. However, say on of the daily columns will equal 1, then keep the 4 records (they are linked by material and plant.)
How do I do this?
Points will be rewarded and all help will be greatly appreciated.
Thanks,
John

Check this.
DATA: BEGIN OF itab OCCURS 0,
        matnr LIKE marc-matnr,
        werks LIKE marc-werks,
        daily1 TYPE i,
        daily2 TYPE i,
        daily3 TYPE i,
        daily4 TYPE i.
DATA: END OF itab.
DATA: itab_per_matnr LIKE itab OCCURS 0 WITH HEADER LINE,
      wa_itab        LIKE itab.
itab_per_matnr[] = itab[].
LOOP AT itab INTO wa_itab.
*-- check if there is at least one non-zero record for this material
  LOOP AT itab_per_matnr WHERE matnr = wa_itab-matnr
                           AND ( daily1 > 0 OR
                                 daily2 > 0 OR
                                 daily3 > 0 OR
                                 daily4 > 0 ).
    EXIT
  ENDLOOP.
  IF sy-subrc <> 0.
    DELETE itab WHERE matnr = wa_itab-matnr.
  ENDIF.
ENDLOOP.

Similar Messages

  • Delete from internal table

    Hi,
    I want to delete from internal table some regords.
    I write code:
    delete  isrot where bldat < '01.09.2005'.
    it doesn't work, what is wrong?
    regards,
    Joanna

    hi,
    you write the statement like....
    <b>delete FROM isrot where bldat < '01.09.2005'.</b>
    now it will work...
    To select the lines that you want to delete using a condition, use the following:
    <b>DELETE FROM <target> WHERE <cond> .</b>
    All of the lines in the database table that satisfy the conditions in the WHERE clause are deleted. The FROM expression must occur between the keyword and the database table.
    You should take particular care when programming the WHERE clause to ensure that you do not delete the wrong lines. For example, if you specify an empty internal table in a dynamic WHERE clause, all of the lines in the table are deleted.
    If at least one line is deleted, the system sets SY-SUBRC to 0, otherwise to 4. SY-DBCNT contains the number of lines deleted.
    follow this link for more information on internal table operation.
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3aef358411d1829f0000e829fbfe/content.htm
    regards,
    Ashok Reddy
    Message was edited by:
            Ashok Reddy

  • Deleting from Internal table.....

    Hi All,
    I have two internal tables with same structure like: IT_REC_LIST and IT_REC_LIST_DEL.
    I have 10 records in this internal table: IT_REC_LIST and same 5 records in this internal table: IT_REC_LIST_DEL. I don’t have any key fields.
    So I want to delete those 5 records from IT_REC_LIST. Could you please let me know hw to write the code, when I write like below its going for dump.
    DELETE IT_REC_LIST [] FROM IT_REC_LIST_DEL [].
    Akhitha.

    Hello,
    You can do like :
    loop at IT_REC_LIST .
    read table IT_REC_LIST_del with key field1 = IT_REC_LIST-field1.
    if sy-subrc eq 0.
    delete IT_REC_LIST.
    endif.
    endloop.
    <REMOVED BY MODERATOR>
    Vasanth
    Edited by: Alvaro Tejada Galindo on Feb 19, 2008 5:28 PM

  • Deletion from internal table

    Hi,
      My requirement is that I have to delete the duplicate values before doing any manupilation of data.. so for this I have written the code...
    *Deleting all the duplicate entries comparing group code, GL *& GL Suffix
      IT_INPUT_TEMP[] = IT_INPUT[].
      SORT IT_INPUT_TEMP BY GRCODE GL GLSUF.
      DELETE ADJACENT DUPLICATES
             FROM IT_INPUT_TEMP COMPARING GRCODE GL GLSUF.
    Now with the remaining values in the internal table I have to check the 3rd field i.e. GLSUF & if it = '00000' (5 zeros)... i have to delete those entries...
    For this I have written...
    Deleting enteries where the GL Suffix is zero.
      IF IT_INPUT_TEMP-GLSUF = 00000.              
        DELETE IT_INPUT_TEMP.                      
      ENDIF.                                                                               
    It gives me a dump saying "Invalid_Table_Index"...
    Prior to this I have also checked up by using Index function.
    Deleting enteries where the GL Suffix is zero.
      IF IT_INPUT_TEMP-GLSUF = 00000.              
        DELETE IT_INPUT_TEMP index l_tabix.                      
      ENDIF.
    Can anyone tell me where I am wrong??..
    Thank You & Regards,
    -S.

    Hi S,
    Your code extract
    * Deleting enteries where the GL Suffix is zero.
    IF IT_INPUT_TEMP-GLSUF = 00000.
      DELETE IT_INPUT_TEMP.
    ENDIF.
    Either this should be in a loop(which is unnecessary if all you are trying to achieve is deleting records), or you can try the option with 'WHERE' clause as mentioned in the above post.
    DELETE FROM IT_INPUT_TEMP WHERE GLSUF = '00000'.
    Regards,
    Srinivas

  • Retrieve data from internal table dynamically

    Hi every body,
    I have an internal table which is generated by a function, this table contains two fields:  id_field and value_field.
    when the internal table is created, it will be completed as follows:
    id_field
    value_field
    |________________|__________________________|                    
    |  PARTNER           |     0020023658                           |               
    TYPE
    type 1
    BPKIND
    val1
    BU_GROUP
    val2
    BPEXT
    val3
    |________________|__________________________|     
    I want to retrieve the values of each field in id_field in a structure, like this:
    ls_struct-partner      =  '0020023658'.
    ls_struct-type          =  'type 1'. 
    ls_struct-bpkind       =  'val1'.
    ls_struct-bu_group   =  'val2'.
    ls_struct-bpext        =  'val3'.
    and it should dynamically, because I have more than one partner and I have lot of fields.
    If you have any idea, help !
    Mll Mat

    >
    mll mat wrote:
    > Hi every body,
    >
    > I have an internal table which is generated by a function, this table contains two fields:  id_field and value_field.
    > when the internal table is created, it will be completed as follows:
    > ___________________________________________
    > |  id_field                |      value_field                         |
    > |________________|__________________________|                    
    > |  PARTNER           |     0020023658                           |               
    > |  TYPE                  |     type 1                               |
    > |  BPKIND              |     val1                                   |
    > |  BU_GROUP        |     val2                                   |
    > |  BPEXT                |     val3                                   |
    > |________________|__________________________|     
    >
    > I want to retrieve the values of each field in id_field in a structure, like this:
    >
    > ls_struct-partner      =  '0020023658'.
    > ls_struct-type          =  'type 1'. 
    > ls_struct-bpkind       =  'val1'.
    > ls_struct-bu_group   =  'val2'.
    > ls_struct-bpext        =  'val3'.
    >
    Check the following code:
    data: itab_struct type standard table of struct,
            ls_struct type struct.
    Let itab_fm be the internal table that will be populated after executing the FM and wa_fm be the work area of the same.
    Let struct be the structure of the ls_struct that you have mentioned containing id_field and value_field as elements.
    Loop at itab_fm into wa_fm.
          ls_struct-(wa_fm-id_field) = wa_fm-value_field.
    endloop.
    append ls_struct to itab_struct.
    Hope this helps. This is without field-symbols for your ease.
    Thanks & Regards,
    Anand Patil

  • Deleting from Internal Tables

    Hi SDN Friends... Today I bring an easy question. But I still reward as always.
    Supose I have two internal tables of same type. Only one field.
    They re filled like the example below.
    Itab1
    01
    02
    03
    04
    05
    06
    Itab2
    02
    04
    06
    08
    10
    I want to remain only with the register that are containned in both table.
    FinalItab
    02
    04
    06
    What is the best way to do this in case of performance?
    Message was edited by:
            Jose Oliveira

    Let me join this funny
    Copy all above and these to conpare performance also!
    REPORT ZTEST.
    *[ DECLARE ]*******************
    DATA: begin of tab01 occurs 0,
            value type I,
          end of tab01.
    DATA: begin of tab02 occurs 0,
            value type I,
          end of tab02.
    *[ PREPARE ]*******************
    tab01-value = '1'.
    append tab01.
    tab01-value = '2'.
    append tab01.
    tab01-value = '3'.
    append tab01.
    tab01-value = '4'.
    append tab01.
    tab01-value = '5'.
    append tab01.
    tab01-value = '6'.
    append tab01.
    tab02-value = '2'.
    append tab02.
    tab02-value = '4'.
    append tab02.
    tab02-value = '6'.
    append tab02.
    *[ BEFORE ]*********************
    Write 'TAB01'.
    Loop at tab01.
      write / tab01-value.
    endloop.
    Write / 'TAB02'.
    Loop at tab02.
      write / tab02-value.
    endloop.
    *[ PROCESS ]********************
    data: min like tab02-value,
          max like tab02-value.
    sort: tab01, tab02.
    loop at tab02.
      max = tab02-value.
      DELETE tab01 where value > min and value < max.
      min = tab02-value.
    endloop.
    *[ AFTER ]**********************
    Write /'** AFTER DELETE **'.
    Write 'TAB01'.
    Loop at tab01.
      write / tab01-value.
    endloop.
    Write / 'TAB02'.
    Loop at tab02.
      write / tab02-value.
    endloop.

  • To get recent timestamp records from internal table

    hi all,
      i have one requirment
      i'm storing error messages in one table  while creating a sales order basing on timestamp
      which is of this format yyyy-mm-dd hh:mm:ss (random Number) 
      if i want to see the error messages left i'm getting all the error messages displayed
      for example i have created a sales order
    i got 10 errors displayed
    i have rectified 5 errors ... if i again display error messages the 10 errors + the 5 errors is getting displayed
    i want to display the 5 error messages only not the previous messages from internal table
    basing on timestamp current one has to displayed remaining has to deleted from internal table.

    I thought we used Sales Order Incompletion process for this....  but, if you're recreating the errors list every time you save with a create or change transaction then, at save, delete all rows in your error table for this document.   Then get your errors and update your db table from your current errors table.   From this viewpoint, the timestamp is not relevant.

  • Dynamic record deletion from database table

    Hi,
    I need to delete selected records from database table(dynamic names). Table names are being passed from main program with some of their field names. The record to be deleted from the database table is being decided based on the fields passed for the table and their contains passed from the main program.
    It is not possible to write dynamic where clause for DELETE statement directly.
    So, I created a dynamic internal table and i am trying to fetch all records using SELECT statement(for which we can write dynamic where condition, something like...SELECT...WHERE (itab).  ) which need to be deleted in the iternal table.
    Piece of code :
              CONCATENATE c_im v_tablefield1 INTO v_imprtfield1.
              CONCATENATE v_tablefield1 c_in v_imprtfield1
                       into s_condition separated by space.
              APPEND s_condition TO t_condition.
              PERFORM GET_DYNAMIC_ITAB USING s_flds_agtab-tabname
                                    changing t_itab.
              ASSIGN t_itab->* TO <itab>.
    *Select the data (to be deleted) from the database table
               SELECT * FROM (s_flds_agtab-tabname) INTO TABLE <itab>
                 WHERE (t_condition).
    *Delete the records from the table
               IF SY-SUBRC = 0.
                 DELETE (s_flds_agtab-tabname) FROM TABLE <itab>.
               ENDIF.
    Here t_condition is of standard table of WHERETXT.
    t_condition at the run time before giving dump was:
    SPART IN IM_SPART
    AND KUNNR IN IM_KUNNR
    Here IM_SPART is renge type of SPART and IM_KUNNR is renge of KUNNR.
    I am getting a DUMP:
    The WHERE condition has an unexpected format.
    Error analysis                                                                               
    The current ABAP/4 program attempted to execute an ABAP/4 Open SQL
    statement containing a WHERE condition of the form WHERE (itab) or
    WHERE ... AND (itab). The part of the WHERE condition specified at
    runtime in the internal table itab contains the operator         
             IN (v1, ..., vn)                                        
    in incomplete form.                                              
    How to correct the error
    If the error occurred in a non-modified SAP program, you may be  
    able to find a solution in the SAP note system.                  
    If you have access to the note system yourself, use the following
    search criteria:                                                 
    "SAPSQL_IN_ILLEGAL_LIST"                               
    "SAPLZSD_TAB_REFRESH " or "LZSD_TAB_REFRESHU01 "       
    "Z_SD_REFRESH_AGTABLES"                                
    If you cannot solve the problem yourself, please send the
    following documents to SAP:                             
    I would like to know whether "IN" operator is allowed in (itab) of WHERE clause. While testing I changed the "IN" to "=" specifying a suitable value there. It worked. So please let me know if i can give "IN" operator using renge table in the dynamic where clause.
    Thanking you,
    Surya

    Hi again,  so if you can not use the IN in a dynamic where clause you might be forced to dynamically build the entire select statement,  Here is a sample program which may give you some ideas, notice that we are writing the select statement code, putting it in another program and generating the subroutine at runtime, then call this routine.  I'm sure that this will help you see what you need to do.
    report zrich_0003 .
    tables: kna1.
    types: t_source(72).
    data: routine(32) value 'DYNAMIC_SELECT',
                 program(8),
                 message(128),
                 line type i.
    data: isource type table of t_source,
                xsource type t_source.
    ranges:
            r_kunnr for kna1-kunnr.
    data: ikna1 type table of kna1.
    data: xkna1 type kna1.
    r_kunnr-sign = 'I'.
    r_kunnr-option = 'EQ'.
    r_kunnr-low    = '0001000500'.
    append r_kunnr.
    xsource = 'REPORT ZTEMP.'.
    insert xsource  into isource index 1.
    xsource = 'FORM dynamic_select'.
    insert xsource  into isource index 2.
    xsource = 'Tables r_kunnr ikna1.'.
    append xsource to isource.
    xsource = 'select * into table ikna1 from kna1'.
    append xsource to isource.
    xsource = 'where kunnr in r_kunnr.'.
    append xsource to isource.
    xsource = 'ENDFORM.'.
    append xsource to isource.
    generate subroutine pool isource name program
                             message message
                             line line.
    if sy-subrc = 0.
      perform (routine) in program (program) tables r_kunnr
                                                    ikna1.
    else.
      write:/ message.
    endif.
    loop at ikna1 into xkna1.
      write:/ xkna1-kunnr.
    endloop.
    Regards,
    Rich Heilman

  • Deleting entry from internal table

    Hi Experts,
    i have the following internal table:
    data :    it_result1            TYPE   crmt_object_guid_tab
    and work area
    data : wa_result1 type crmt_object_guid.
    i have to delete a guid from internal table based on some condition.
    loop at it_resul1 into wa_result1
    if lv_priority eq priority.
    delete     this entry from internal table.
    endif.
    endloop..
    i tried using  delete table it_result with table key CRMT_OBJECT_GUID = wa_result. but this is giving syntax error.
    what should be done to delete the entry?
    Thanks and regards
    Shilpi

    Hi
    Check Syntax for DELETE operator on pressing F1
    1. DELETE itab.
    2. DELETE TABLE itab WITH TABLE KEY k1 = v1 ... kn = vn.
    3. DELETE TABLE itab [FROM wa].
    4. DELETE itab INDEX idx.
    5. DELETE itab FROM idx1 TO idx2.
    6. DELETE itab WHERE logexp.
    7. DELETE ADJACENT DUPLICATES FROM itab.
    delete table it_result with table key CRMT_OBJECT_GUID = wa_result
    this is wrong
    delete  it_result where CRMT_OBJECT_GUID = wa_result
    Edited by: Lavanya K on Apr 22, 2009 10:20 AM

  • How to choose in Delete Duplicates from internal table?

    Now I need to delete Duplicates from internal table,
    So at first I sort
    than I delete duplicate
    Sort itab1 BY Company_Code  Asset_No Capital_Date.
          DELETE ADJACENT DUPLICATES FROM itab1 COMPARING Company_Code  Asset_No  Capital_Date
    Company_Code
    Asset_No
    Capital_Date
    Remark
    BC35
    1515593
    20021225
    Helen
    BC35
    1515593
    20021225
    Common Asset
    BC35
    1515594
    20030109
    Judy
    BC35
    1515594
    20030109
    Common Asset
    But here comes my problem~If I want to delete the Common Asset in Remark Column,how I let it choose the right one to do it?

    Hi Jack
    Try the below coding..
    Report zsamp.
    types: begin of t_tab,
            comp_code(4) type c,
            ***_no(7) type n,
            cap_date type d,
            remark type string,
            end of t_tab.
    data: i_tab type TABLE OF t_tab,
           w_tab type t_tab.
    w_tab-comp_code = 'BC35'.
    w_tab-***_no = '1515593'.
    w_tab-cap_date = '20021225'.
    w_tab-remark = 'Helen'.
    append w_tab to i_tab.
    w_tab-comp_code = 'BC35'.
    w_tab-***_no = '1515593'.
    w_tab-cap_date = '20021225'.
    w_tab-remark = 'Common Asset'.
    append w_tab to i_tab.
    w_tab-comp_code = 'BC35'.
    w_tab-***_no = '1515594'.
    w_tab-cap_date = '20030109'.
    w_tab-remark = 'Judy'.
    append w_tab to i_tab.
    w_tab-comp_code = 'BC35'.
    w_tab-***_no = '1515594'.
    w_tab-cap_date = '20030109'.
    w_tab-remark = 'Common Asset'.
    append w_tab to i_tab.
    sort i_tab by remark.
    delete ADJACENT DUPLICATES FROM i_tab COMPARING remark.

  • To delete duplicate records from internal table

    hi friends,
    i have to delete records from internal table based on following criterion.
    total fields are 7.
    out of which  if 4 fields are same and 5th field is different,then both records must be deleted.
    in case all five fields are same,the program should do nothing.
    for example.
    if there are 3 records as follows
    a1 b1 c1 d1 e1 f g
    a1 b1 c1 d1 e2 w r
    a1 b1 c1 d1 e1 j l
    then first two records should be deleted as four fields are same but fifth(e) field differs.
    but third record should remain as it is evenif first five fields are same for first and third record.
    values of last two fields need not to be consider for deleting the records.

    LOOP AT ITAB.
      V_FILED5 = ITAB-F5. "to compare later
      V_TABIX = SY-TABIX. "used to delete if condition not matches
      READ TABLE ITAB WITH KEY F1 = ITAB-F1
                               F2 = ITAB-F2
                               F3 = ITAB-F3
                               F4 = ITAB-F4.
      IF SY-SUBRC = 0.
        IF ITAB-F5 <> V_FIELD5.
    *--both the records to be deleted,as Field5 is different.
          DELETE ITAB INDEX SY-TABIX. "deletes that record
          DELETE ITAB INDEX V_TABIX. "deletes the current record
        ENDIF.
      ENDIF.
    ENDLOOP.
    Message was edited by: Srikanth Kidambi
    added comments
    Message was edited by: Srikanth Kidambi

  • Creation of internal table dynamically based on the Date Range entered

    Hi SAPgurus,
    I have been facing one issue i.e creation of internal table dynamically based on the date range entered in the selection screen. For example the date range I am giving as 06/2006 to 08/2006, it should display the Fieldcatelog dynamically, this part i have completed but the only issue I am facing is to populate the sales data into that fields.
    Right now my program is displaying the ALV like this.
    Ex:
    <b>CSR    District   06/2006  07/2006  08/2006  totals</b>      
    Shiva      New York                             10.00
    Shiva      new york                             30.00
    Shiva      new york                             40.00
    but it should display like this
    <b>CSR    District 06/2006 07/2006 08/2006 totals</b>
    Shiva  New York  10.00   30.00 40.00
    80.00                 
    Please help me in this scenario, how to acheive like this..
    Thanks & Regards,
    Sivaram Kandula

    Hi Sivaram,
                 I also got the same requirement . i saw rich and your code whatever you have uploaded.i have created dynamic internal table but i am facing the issue to populating the data to my dynamic internal table.
    Sivaram, can you please explain your code after this.
    *<dyn_table>
    *tab_item.
      LOOP AT tab_item.
        ASSIGN COMPONENT 1 OF STRUCTURE <dyn_wa> TO <dyn_table>.
        ASSIGN COMPONENT 2 OF STRUCTURE <dyn_wa> TO <dyn_table>.
    *    <dyn_wa> = tab_item-bztxt.
    *    <dyn_wa> = tab_item-total.
    *    APPEND <dyn_wa> TO <dyn_table>.
    **    <dyn_wa> = tab_item-total.
    **    ASSIGN tab_item-bezei  TO <dyn_wa>.
    *  APPEND <dyn_table>.
      ENDLOOP.
    how you are puting the loop at tab_item. but tab_item is already commented.
    can you send me the code after that.
    i am sending some part of my code.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
       EXPORTING
         it_fieldcatalog = gt_fCAT1
       IMPORTING
         ep_table        = new_table.
    ASSIGN new_table->* TO <dyn_table>.
       create data new_line like line of <dyn_table>.
       assign new_line->* to <dyn_wa>.
    select vbeln
            fkart
            vkorg
            vtweg
            fkdat
            spart
            fksto
            from vbrk
            client specified
            into table gt_vbrk
            where mandt = sy-mandt
            and fkart in ('ZF5','ZFR')
            and vkorg = '1100'
            and vtweg = '20'
            and fkdat in s_fkdat
            and spart = '06'
            and fksto = ' '.
       if gt_vbrk[] is not initial.
      select  vbeln
              fkimg
              prsdt
              netwr
              matnr
              arktx
              werks
              mwsbp
              from vbrp
              client specified
              into table gt_vbrp
              for all entries in gt_vbrk
              where vbeln = gt_vbrk-vbeln
              and werks in s_werks
              and matnr in s_matnr.
      endif.
    select mnr ltx spras from t247
    into table it_t247
    where spras = 'E'.
    data: lv_month1 type vbrp-prsdt,
           name1(3) type c,
           s_month type string,
            s_month1 type string,
             s_month2 type string.
    *      lv_netwr1 type vbrp-netwr,
    *          lv_mwsbp1 type vbrp-mwsbp.
          loop at gt_vbrp into gs_vbrp.
            gs_final2-matnr = gs_vbrp-matnr.
            gs_final2-arktx = gs_vbrp-arktx.
            gs_final2-fkimg = gs_vbrp-fkimg.
           lv_month1 = gs_vbrp-prsdt.
            read table it_t247 into wa_t247 with key mnr = lv_month1+4(2).
            if sy-subrc eq 0.
            name1 =  wa_t247-ltx.
            endif.
             concatenate  name1
                       lv_month1(4) into s_month SEPARATED BY '_' .
             CONCATENATE S_MONTH 'QTY' INTO S_MONTH1 SEPARATED BY ''.
              CONCATENATE S_MONTH 'VALUE' INTO S_MONTH2 SEPARATED BY ''.
             gs_final2-month = s_month.
              lv_netwr1 = gs_vbrp-netwr.
            lv_mwsbp1 = gs_vbrp-mwsbp.
            gs_final2-MONTH_QTY = S_MONTH1.
            GS_FINAL2-MONTH_VAL = S_MONTH2.
            gs_final2-value = lv_netwr1 + lv_mwsbp1.
           append gs_final2 to gt_final2.
           clear: gs_final2. "lv_name2.
           endloop.
           if gt_final2[] is not initial.
             sort gt_final2 by matnr month ascending .
             loop at gt_final2 into gs_final2.
            gs_final2_01 = gs_final2.
         collect gs_final2_01 into gt_final2_01.
        endloop.
           endif.
       ENDIF..
    Regards
    Ankur

  • Problem creating an internal table dynamically

    Hi,
    I'm trying to create an internal table dynamically as i would be able to determine the structure of the table based on the user input.
    I've used the sample code from this forum ...
    REPORT  ZRICH_0003       .
    type-pools: slis.
    field-symbols: <dyn_table> type standard table,
                   <dyn_wa>,
                   <dyn_field>.
    data: alv_fldcat type slis_t_fieldcat_alv,
                   it_fldcat type lvc_t_fcat.
                   type-pools : abap.
    data : it_details type abap_compdescr_tab,
           wa_details type abap_compdescr.
    data : ref_descr type ref to cl_abap_structdescr.
    data: new_table type ref to data,
          new_line  type ref to data,
          wa_it_fldcat type lvc_s_fcat.
          selection-screen begin of block b1 with frame title text.
    parameters: p_table(30) type c.
    selection-screen end of block b1.
    Get the structure of the table.
    ref_descr ?= cl_abap_typedescr=>describe_by_name( p_table ).
    it_details[] = ref_descr->components[].
    loop at it_details into wa_details.
      clear wa_it_fldcat.
      wa_it_fldcat-fieldname = wa_details-name .
      wa_it_fldcat-datatype = wa_details-type_kind.
      wa_it_fldcat-inttype = wa_details-type_kind.
      wa_it_fldcat-intlen = wa_details-length.
      wa_it_fldcat-decimals = wa_details-decimals.
      append wa_it_fldcat to it_fldcat .
      endloop.
    Create dynamic internal table and assign to FS
    call method cl_alv_table_create=>create_dynamic_table
                exporting
                it_fieldcatalog = it_fldcat
                importing
                ep_table        = new_table.
    assign new_table->* to <dyn_table>.
    Create dynamic work area and assign to FS
    create data new_line like line of <dyn_table>.
    assign new_line->* to <dyn_wa>.
    <b>* Select Data from table.
    select * into table <dyn_table>           from
    (p_table).</b>
    Write out data from table.
    loop at <dyn_table> into <dyn_wa>.
    do.
    assign component  sy-index  of structure <dyn_wa> to <dyn_field>.
    if sy-subrc <> 0.
    exit.
    endif.
    if sy-index = 1.
    write:/ <dyn_field>.
    else.
    write: <dyn_field>.
    endif.
    enddo.
    endloop.
    I'm able to get the structure of the table that i want, but when i'm trying to select data from the table into this internal table..as highlighted in the sample code above..i'm getting a short dump...saying that ' the database table is 600 bytes wide but the internal table is only 576 bytes wide.
    The internal table is declared as
    field-symbols: <dyn_table> type standard table..
    Could anyone please tell me how to rectify this.
    Thanks in advance,
    Harsha.

    Hi Smitha,
    I'm building the internal table by getting the structure using the method
    cl_abap_typedescr=>describe_by_name( p_table ).
    where p_table is the table name determined dynamically..
    Now using this structure, i'm building an internal table by calling the method
    call method cl_alv_table_create=>create_dynamic_table
    I've checked all the fields after the internal table has been created .. and it contains all the fields of the table that i'm supplying initially..
    But when i read data into that internal table, it gives me that dump..I've described it in this post earlier.
    Any more suggestions would be very helpful.
    Thanks,
    Harsha

  • How to create internal table dynamically based on a table entry

    hi Experts,
      I have table yprod_cat. It has product categories.
      In my ABAP program I need to create internal table dynamically based on the number of entries in the table.
      For example:
      If the table has 3 entries for product category
      1. Board
      2. Micro
      3. Syst
    Then create three (3) internal tables.
    i_board
    i_micro
    i_syst
    How can we do this? Any sample code will be very usefull
    Thanks & Regards
    Gopal
    Moderator Message: No sample codes can be given. Please search for them or work it!
    Edited by: kishan P on Jan 19, 2011 4:22 PM

    Our APEX version is 4.2We are using below SQL query to display radio groups dynamically..
    SELECT APEX_ITEM.RADIOGROUP (1,deptno,'20',dname) dt
    FROM dept
    ORDER BY 1;
    Created a form using SQL type and given abouve SQL query as source.. But when we run the page, there were no radio groups displayed in the page..
    Below is the output of the query..
    <input type="radio" name="f01" value="10" />ACCOUNTING
    <input type="radio" name="f01" value="20" checked="checked" />RESEARCH
    <input type="radio" name="f01" value="30" />SALES
    <input type="radio" name="f01" value="40" />OPERATIONS
    >
    If Tabular Form:
    Edit Region > Report Attributes > Edit Column > Change the Column type to "Standard Report Column"
    If normal Page Item:
    Edit Page Item > Security > Escape special characters=No.
    Pl read the help on that page item to understand the security risk associated with =NO.
    Cheers,
    Edited by: Prabodh on Dec 3, 2012 5:59 PM

  • Update databse from internal table statement not using index

    Hi Guys,
    We are updating a databse table from a file. The file has a couple of fields which have data different from what the database has (non-primary fields :). We upload the file data into an internal table and then update the database table from internal table. At a time, internal table is supposed to have 10,000 records. I did SQL trace and found that the update statement is not making use of the databse index.
    Should not the update statement here be using the table index (for primary key)?
    Regards,
    Munish

    ... as often there are recommendations in this forum which makes me wonder, how people overestimate their knowledge!!!
    Updates and Deletes do of course use indexes, as can be seen in the SQL Trace (use explain).
    Inserts don't use indexes, because in many databases inserts are just done somewhere, But also with the INSERT, the primary key is the constraint for the uniqueness condition, duplicate keys are not allowed.
    Coming to the original question, what is you actually coding for the update?
    What is the table, which fields are in the internal table and what are the indexes?
    Siegfried

Maybe you are looking for

  • Mailboxes STILL empty after importing from 10.3.9 to 10.4.11

    Hi... I've been spending the last couple of days trawling the web (incl. this site) for solutions and have found similar postings, but they were either unresolved, or didn't really match my situation. So please excuse me if this is partially repetiti

  • Login error in OIM 11.1.1.5

    Hi, I am getting the below error when trying to login on OIM application. Earlier it was working fine. Message: Automation server can't create object Line: 5689 Char: 2 Code: 0 URI: http://HostName:14000/oim/afr/partition/ie/default/opt/boot-11.1.1.5

  • Where can I find Export/Import scripts?

    Hello, I have read in Oracle9iAS Portal Export/Import document about these scripts: secexp.csh contexp.csh pageexp.csh, but I can't find them.....can you help me? In which directory are they? Thanks in advance.

  • SAP MM BOM without PP

    Hello, i need help Our company need functionality to create BOM in SAP MM module(we don't have PP and SD) something like internal manufacture. This BOM must be transfer between storage location and take own value - what i mean. What is situation: - w

  • I have a Sony PRS-300, is Adobe Digital Editions compatable with it?

    My PRS-300 is not on the list of compatable e-readers... but the PRS-350 is.  Is my PRS-300 compatable?