Deleting selected record in Dynamic Internal table

Hi Friends,
I want to delete selected row from a dynamic internal table. The selected entry should be deleted from Adobe and as well as Webdynpro abap.
Kindly help me how to solve this problem.
Thanks in advance.
Regards,
Phani.

Hi Matthias,
Thanks a lot for responding.
In my adobe i kept a check box to delete the record. It should delete the selected ones. But right now, its deleting one by one.
I have coded following script for delete button:
IT_TIME_SHEET --> is my internal table
G_ROW_STATUS is the field to track the action performed.
var tlength = xfa.resolveNodes("IT_TIME_SHEET.DATA[*]").length;
for ( var i=0; i<tlength; i++
if(xfa.resolveNode("IT_TIME_SHEET.DATA["i"].FLAG").rawValue ==
1 )
IT_TIME_SHEET.DATA.instanceManager.removeInstance(i);
G_ROW_STATUS.rawValue = "DELETE";
In the Webdynpro abap following code I wrote:
    row_count = 1.
    FIELD-SYMBOLS <wa> TYPE zshr_time_sheet_time.
    LOOP AT it_time_sheet ASSIGNING <wa>.
      <wa>-srl_no = row_count.
      row_count = row_count + 1.
    ENDLOOP.
    last_row = <wa>-srl_no.
      DELETE it_time_sheet WHERE srl_no EQ last_row.
Suppose if two records checkboxes are selected I can loop at the internal table IT_TIME_SHEET in webdynpro and delete where checkbox is selected.
But problem is once user deletes records, adobe is deleting only one record and if i delete two records from webdynpro it looks like something wrong for the user.
Please help me how to solve this problem.
Regards,
Phani.

Similar Messages

  • How to delete records from dynamic internal table.

    Hi Experts,
    Need urgent help!!!
    Issue is with Dynamic internal tables.
    Below is code written by me :
    FORM select_query USING Lw_tabnam
                      TYPE  t682i-kotabnr.
      DATA :  lw_line  TYPE REF TO data,
              lw_line1 TYPE REF TO data.
        CREATE DATA Lw_line    TYPE (lw_TABNAM).
        ASSIGN      Lw_line->* TO   <WA_tbl>.
        CREATE DATA LW_LINE    TYPE STANDARD TABLE OF (Lw_tabnam)
                               WITH NON-UNIQUE DEFAULT KEY.
        ASSIGN      Lw_line->* TO <TBL>.
        SELECT * FROM  (Lw_tabnam)
                 INTO CORRESPONDING FIELDS OF TABLE <TBL>
                 WHERE (t_keys).
    Endform.
    code is working fine.
    here even the table name and where condition are dynamic,everything is fine upto this point.
    Now i have to delete some record from <TBL> based on some conditons.
         for ex : ( here lc_fieldname is KUNNR)
          loop at t_kunnr.
              lw_tabix = sy-tabix.
            Read table <tbl>
                    with key (lc_fieldname) = t_kunnr-kunnr ASSIGNING <wa_tbl>.
            If sy-subrc = 0.
            *Delete
            delete <tbl> from <wa_tbl>
    delete <tbl> index  lw_tabix.
            Endif.
         Endloop.
    The above delete statement doesn't work ,even we can't use index as it gives a syntax error " something related to "index is not allowed in standard table or hash table.
    Can you help me ab't how to delete records in Dynamic internal table?
    Other option that i am thinking of is to create a static table of type dynamic table.
    means, data itab type standard table of <tbl> .I know the syntax is wrong ,however is there any way to do this?
    Thanks in advance ,
    If you have any suggestion ab't this then do let me know.
    bye,
    Gaurav.

    Hi
    I wrote this code and it works fine:
    DATA LW_TABNAM(10) VALUE 'LFA1'.
    DATA : LW_LINES TYPE REF TO DATA,
           LW_LINE  TYPE REF TO DATA.
    FIELD-SYMBOLS: <TABLE> TYPE TABLE,
                   <WA>    TYPE ANY.
    CREATE DATA LW_LINES TYPE TABLE OF (LW_TABNAM)
    WITH NON-UNIQUE DEFAULT KEY.
    ASSIGN LW_LINES->* TO <TABLE>.
    CREATE DATA LW_LINE TYPE (LW_TABNAM).
    ASSIGN LW_LINE->* TO <WA>.
    DO 10 TIMES.
      APPEND INITIAL LINE TO <TABLE>.
    ENDDO.
    SY-TABIX = 4.
    DELETE <TABLE> INDEX SY-TABIX.
    WRITE SY-SUBRC.
    I hope it help you
    Max

  • Hide or Delete Empty columns in dynamic internal table

    Hi,
                                I am having an dynamic internal table which contains more than 100 columns.
             I need to delete empty column from that table, can any one help this.

    Hello,
    If you are talking about ALV then you can just the the table for empty columns before populating fieldcataloge and hide the columns.
    If your query is still not answered please provide a detail requirement.

  • Deleting a record in an internal table

    hi,
      loop at itab,
       ..... if a particular record alone matches a condition then that particular record alone has to be deleted.
    endloop.
    only the particular record which matches the  condition inside the loop should be deleted. remaining records should be there in that internal table itself.
    can anyone explain me how to do this.
    Regards,
    Phyrose.

    hi,
    u can specify the condition in th loop statement itself..
    loop at itab where condition.
    delete itab.  " itab - internal table with header line
    endloop.
    else if u want to specify it inside the loop..
    loop at itab.
    if condition.
    delete itab.
    endif.
    endloop.
    hope it answers ur requirement...
    Regards,
    Viji

  • Need urgent help on dynamic internal table.

    Hi experts,
    I got an editable dynamic internal table. When the value in 1 of the editable field has been changed, I will fire the the DATA_CHANGED event. In this event, I can get the row ID where the changes occur, but the problem is, how can I select back the data from the dynamic internal table using the row ID since index is not permitted to be used? I need to get the rest of the records form the ROW and then perform a database update accordingly. How can I select from the dynamic internal table given the row ID? THanks in advance.

    Hi
    I suppose it depends on the kind of internal table assigned to fieldsymbol, this sample works fine:
    FIELD-SYMBOLS: <FS> TYPE TABLE,
                   <WA> TYPE ANY.
    DATA: BEGIN OF ITAB OCCURS 0,
            FIELD,
          END   OF ITAB.
    DO 10 TIMES.
      ITAB-FIELD = 'a'.
      APPEND ITAB.
    ENDDO.
    ASSIGN ITAB[] TO <FS>.
    READ TABLE <FS> ASSIGNING <WA> INDEX 1.
    WRITE <WA>.
    It can't use the index with internal table of kind HASHED.
    Max

  • Filling Data in Dynamic internal table

    Hello,
    I have 2 internal tables TAB1 and TAB2.
    I have Created Dynamic internal table From TAB1 rows.
    Now I want to fill that Dynm. internal table from TAB2.
    But TAB2  have more Rows with diffarant  names.  I want to move particular field of TAB2 to particular field.of dynamic IT.
    kindly help.

    Hi,
    I am sending the dynamic alv report for your referenece.
    REPORT  YMS_DYNAMICALV.
    type-pools: slis.
    field-symbols: <dyn_table> type standard table,
                   <dyn_wa>.
    data: alv_fldcat type slis_t_fieldcat_alv,
          it_fldcat type lvc_t_fcat.
    selection-screen begin of block b1 with frame title text-001.
    parameters: p_flds(5) type c.
    selection-screen end of block b1.
    start-of-selection.
    build the dynamic internal table
      perform build_dyn_itab.
    write 5 records to the alv grid
      do 5 times.
        perform build_report.
      enddo.
    call the alv grid.
      perform call_alv.
    Build_dyn_itab
    form build_dyn_itab.
      data: new_table type ref to data,
            new_line  type ref to data,
            wa_it_fldcat type lvc_s_fcat.
    Create fields .
      do p_flds times.
        clear wa_it_fldcat.
        wa_it_fldcat-fieldname = sy-index.
        wa_it_fldcat-datatype = 'CHAR'.
        wa_it_fldcat-intlen = 5.
        append wa_it_fldcat to it_fldcat .
      enddo.
    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>.
    endform.
         Form  build_report
    form build_report.
      data: fieldname(20) type c.
      data: fieldvalue(5) type c.
      data: index(3) type c.
      field-symbols: <fs1>.
      do p_flds times.
        index = sy-index.
    Set up fieldvalue
        concatenate 'FLD' index into
                 fieldvalue.
        condense   fieldvalue no-gaps.
      <b> assign component  index  of structure <dyn_wa> to <fs1>.
       <fs1> =  fieldvalue.</b>
      enddo.
    Append to the dynamic internal table
      append <dyn_wa> to <dyn_table>.
    endform.
    CALL_ALV
    form call_alv.
      data: wa_cat like line of alv_fldcat.
      do p_flds times.
        clear wa_cat.
        wa_cat-fieldname = sy-index.
        wa_cat-seltext_s = sy-index.
        wa_cat-outputlen = '5'.
        append wa_cat to alv_fldcat.
      enddo.
    Call ABAP List Viewer (ALV)
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                it_fieldcat = alv_fldcat
           tables
                t_outtab    = <dyn_table>.
    endform.
    Thanks,
    Shankar

  • Creating Dynamic internal table

    Hi,
    Can we create a dynamic internal table using data of an existing internal table.
    i.e. if itab1 is have data like :
    row                  col                     value
    1                      1                        ab
    1                      2                        cd
    1                      3                        ef
    2                      1                        gh
    2                      2                        ij
    2                      3                        kl
    and I want to create itab2 dynamically like this :
    row                  col1                     col2                    col3
    1                       ab                        cd                       ef
    2                       gh                          ij                        kl
    The issue lies only while creating internal table using non DDIC structure i.e. internal table of program.
    Thanks
    Vipin

    Hi,
    This is the sample report for DYNAMIC ALV report.
    REPORT  YMS_DYNAMICALV.
    TYPE-POOLS: SLIS.
    FIELD-SYMBOLS: <DYN_TABLE> TYPE STANDARD TABLE,
                   <DYN_WA>.
    DATA: ALV_FLDCAT TYPE SLIS_T_FIELDCAT_ALV,
          IT_FLDCAT TYPE LVC_T_FCAT.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETERS: P_FLDS(5) TYPE C.
    SELECTION-SCREEN END OF BLOCK B1.
    START-OF-SELECTION.
    build the dynamic internal table
      PERFORM BUILD_DYN_ITAB.
    write 5 records to the alv grid
      DO 5 TIMES.
        PERFORM BUILD_REPORT.
      ENDDO.
    call the alv grid.
      PERFORM CALL_ALV.
    Build_dyn_itab
    FORM BUILD_DYN_ITAB.
      DATA: NEW_TABLE TYPE REF TO DATA,
            NEW_LINE  TYPE REF TO DATA,
            WA_IT_FLDCAT TYPE LVC_S_FCAT.
    Create fields .
      DO P_FLDS TIMES.
        CLEAR WA_IT_FLDCAT.
        WA_IT_FLDCAT-FIELDNAME = SY-INDEX.
        WA_IT_FLDCAT-DATATYPE = 'CHAR'.
        WA_IT_FLDCAT-INTLEN = 5.
        APPEND WA_IT_FLDCAT TO IT_FLDCAT .
      ENDDO.
    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>.
    ENDFORM.                    "build_dyn_itab
         Form  build_report
    FORM BUILD_REPORT.
      DATA: FIELDNAME(20) TYPE C.
      DATA: FIELDVALUE(5) TYPE C.
      DATA: INDEX(3) TYPE C.
      FIELD-SYMBOLS: <FS1>.
      DO P_FLDS TIMES.
        INDEX = SY-INDEX.
    Set up fieldvalue
        CONCATENATE 'FLD' INDEX INTO
                 FIELDVALUE.
        CONDENSE   FIELDVALUE NO-GAPS.
      <b> assign component  index  of structure <dyn_wa> to <fs1>.
       <fs1> =  fieldvalue.</b>
      ENDDO.
    Append to the dynamic internal table
      APPEND <DYN_WA> TO <DYN_TABLE>.
    ENDFORM.                    "build_report
    CALL_ALV
    FORM CALL_ALV.
      DATA: WA_CAT LIKE LINE OF ALV_FLDCAT.
      DO P_FLDS TIMES.
        CLEAR WA_CAT.
        WA_CAT-FIELDNAME = SY-INDEX.
        WA_CAT-SELTEXT_S = SY-INDEX.
        WA_CAT-OUTPUTLEN = '5'.
        APPEND WA_CAT TO ALV_FLDCAT.
      ENDDO.
    Call ABAP List Viewer (ALV)
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          IT_FIELDCAT = ALV_FLDCAT
        TABLES
          T_OUTTAB    = <DYN_TABLE>.
    ENDFORM.                    "call_alv
    Thanks,
    Sankar M

  • How to delete data from dynamic internal table

    Hi,
    I have dynamic internal table and I have some slection screen fields , using these selection screen fields
    (select -options), I have to filter the data? assigning will work with READ , but I have select options not the parametre,
    and also delete will not work for dynamic table..
    as we cannot use assigning with delete..
    So how to do this?
    and one more thing is , I cannot filter the data while selection( in select, I cannot filter the data-> as it's not coming directly from table, it's coming from buffer),
    so now after selection of data, I need to filter the data from dynamic table.
    Is there any way to do this?
    Regards,
    Mrunal

    Hi matt,
    I tried with below code as  you said. But I am getting dump. can you help?
    here is my piece of code.
    FIELD-SYMBOLS: <LS_DATA> type any,
                               <LT_DATA> TYPE table,
                                <L_FIELD> type any.
        ASSIGN <l_buffer_entry>-dataptr->* TO <LS_DATA>.
        ASSIGN <l_buffer_entry>-dataptr->* TO <LT_DATA>.
    LOOP AT <LT_DATA> ASSIGNING <LS_DATA>.
    ASSIGN COMPONENT 'BUKRS' OF STRUCTURE <LS_DATA> TO <L_FIELD>.
    IF <L_FIELD> NOT IN SO_BUKRS.
    DELETE <LT_DATA>.
    ENDIF.
    UNASSIGN <L_FIELD>.
    ASSIGN COMPONENT 'BELNR' OF STRUCTURE <LS_DATA> TO <L_FIELD>.
    IF <L_FIELD> NOT IN SO_BELNR.
    DELETE <LT_DATA>.
    ENDIF.
    UNASSIGN <L_FIELD>.
    ENDLOOP.
    and here is the description of my dump:->>>
    You attempted to access an unassigned field symbol
    (data segment 32772).
    This error may occur for any of the following reasons:
    - You address a typed field symbol before it is set using ASSIGN
    - You address a field symbol that points to a line in an internal table
      that has been deleted
    - You address a field symbol that had previously been reset using
      UNASSIGN, or that pointed to a local field that no longer exists
    - You address a global function interface parameter, even
      though the relevant function module is not active,
      that is it is not in the list of active calls. You can get the list
      of active calls from the this short dump.

  • Delete records in a internal table

    I Have an ALV in which I have selected several lines to delete (icon "-").
    The method get_selected_rows returns the index of the selected lines.
    In a loop I try to delete the lines of the internal table by the index. But I have a problem because when I delete a line, the index number is updated, therefore the second record that I try to delete doesn´t work because the index has changed.
    does there exist the possibility that the index is not updated?
    Thanks

    hi
    try to delete like this
    loop at itab
    delete itab                    
    endloop
    it deletes all the records in the internal table
    outside of the loop
    delete itab index 2   -
    > it deletes the record of index 2
    put it into the while or do while
    i =1.
    while i < 5
    i = i+ 1.
    delete itab index i.
    endwhile.
    it deletes 5 records in the internal table

  • Deleting from Dynamic Internal table

    Hi,
    How can we delete data from dynamic internal table...
    I have a dynamic internal table <fs_dyn_table> which is of type any and can have any fields...
    I want to delete all those records which have a value of '10' in a field named field1
    I have written my delete statement in the following manner..
    DELETE <fs_dyn_table> WHERE field1 = '10'.....but it is not working...it gives me an error...stating that the line type of table must be statically defined.

    Hi,
    Loop on the internal table into a field-symbol of line type same as the internal table.
    Use assign component statement and then delete the corresponding record.
    Regards,
    Ankur Parab

  • Delete records in an internal table

    I uploaded the data incorrectly into a ztable .how can i delete all entries in a that table now. I am afraid the table gets deleted.

    Hi,
      you can delete the entries in the table by using DELETE command.
    1. DELETE FROM dbtab WHERE cond.
    DELETE FROM (dbtabname) WHERE cond.
    2. DELETE dbtab.
    DELETE *dbtab.
    DELETE (dbtabname) ...
    3. DELETE dbtab FROM TABLE itab.
    DELETE (dbtabname) FROM TABLE itab.
    4. DELETE dbtab VERSION vers.
    DELETE *dbtab VERSION vers.
    Effect
    Deletes lines from a database table(see Relational Databases ). You can specify thename of the database table either in the program itself with DELETEFROM dbtab ... or at runtime as the contents of the fielddbtabname with DELETE FROM (dbtabname) .... In bothcases, the database table must be known to the ABAP Dictionary.Only data from the current client is usually deleted. You can deletedata using a view only if the view refers to a singletable and was created in the ABAP Dictionary with themaintenance status "No restriction".
    DELETE belongs to the Open SQLcommand set.
    Notes
    The DELETE statement does not performauthorization checks. You must programthese yourself.
    The final (irrevocable) deletion of lines with the DELETEstatement is not performed until after a database commit (seeLogical Unit of Work (LUW)). Prior to this,you can reverse any database update with a database rollback (seeProgramming Transactions).
    You cannot rely exclusively on the locking mechanism of the database system to synchronize several users trying toaccess the same dataset at the same time. You should therefore use theSAP locking mechanism.
    <b>Variant 1</b>
    DELETE FROM dbtab WHERE cond.
    DELETE FROM (dbtabname) WHERE cond.
    Addition:
    ... CLIENT SPECIFIED
    Effect
    Deletes lines in a database table that satisfy the WHERE clause cond. With thisvariant, specification of a WHERE condition is obligatory .
    When the statement has been executed, the system field SY-DBCNTcontains the number of deleted lines.
    The return code is set as follows:
    SY-SUBRC = 0:
    At least one line was deleted.
    SY-SUBRC = 4:
    No lines were deleted, since no line was selected.
    Example
    Delete all bookings for the Lufthansa flight 0400 on02.28.1995 (in the current client):
    TABLES SBOOK.
    DELETE FROM SBOOK WHERE CARRID = 'LH'       AND
                            CONNID = '0400'     AND
                            FLDATE = '19950228'.
    Note
    To delete all the lines in a table, you must specify aWHERE condition that is true for all lines. You can achieve thiswith
    ... WHERE f IN itab
    If the internal table itab is empty, such a condition wouldselect all lines.
    Addition
    ... CLIENT SPECIFIED
    Effect
    Switches off automatic client handling. This allows youto delete data across all clients in the case of client-specifictables. The client field is then treated like a normal table field, forwhich you can formulate suitable conditions in the WHERE clause.
    You must specify the addition CLIENT SPECIFIED immediately afterthe name of the database table.
    <b>Variant 2</b>
    DELETE dbtab.
    DELETE *dbtab.
    DELETE (dbtabname) ...
    Additions:
    1. ... FROM wa
    2. ... CLIENT SPECIFIED
    See Short forms not allowed and* work areas not allowed.
    Effect
    These are SAP-specific short forms used to deleteone line of a database table. If the name of the database tableis specified in the program, the primary key ofthe line to be deleted is taken from the specified work area -dbtab or *dbtab. If the name of the database table is notdetermined until runtime ( DELETE (dbtabname) ...), the addition... FROM wa is obligatory .
    When the statement has been executed, the system field SY-DBCNTcontains the number of deleted lines (0 or 1).
    The return code is set as follows:
    SY-SUBRC = 0:
    The line was deleted.
    SY-SUBRC = 4:
    No lines could be deleted, since no line exists withthe primary key specified.
    Example
    Delete the booking with the booking number 3 for theLufthansa flight 0400 on 28.02.1995 (in the current client):
    TABLES SBOOK.
    SBOOK-CARRID = 'LH'.
    SBOOK-CONNID = '0400'.
    SBOOK-FLDATE = '19950228'.
    SBOOK-BOOKID = '00000003'.
    DELETE  SBOOK.
    Addition 1
    ... FROM wa
    Effect
    Takes the primary key for the line to be deleted notfrom the table work area dbtab, but from the explicitlyspecified work area wa. Here, the key values from left to rightare taken from wa according to the structure of the primarykey in the table work area dbtab (see TABLES). The structure of wa is not taken intoaccount. Therefore, the work area wa must be at least as wide(see DATA) as the primary key in thetable work area dbtab and the alignment ofthe work area wa must correspond to the alignment of the primarykey in the table work area. Otherwise, you get a runtime error.
    Note
    If a work area is not explicitly specified, the values forthe line to be deleted are taken from the table work area dbtab,even if the statement appears in a subroutine (see FORM) or function module (see FUNCTION) where the table work area is stored in a formalparameter or a local variable of the same name.
    Addition 2
    ... CLIENT SPECIFIED
    Effect
    As with variant 1.
    <b>Variant 3</b>
    DELETE dbtab FROM TABLE itab.
    DELETE (dbtabname) FROM TABLE itab.
    Addition:
    ... CLIENT SPECIFIED
    Effect
    Mass deletion: Deletes all database table lines forwhich the internal table itab contains values for theprimary key fields. The lines of the internaltable itab must satisfy the same condition as the work areawa in addition 1 to variant 2.
    The system field SY-DBCNT contains the number of deleted lines,i.e. the number of lines of the internal table itab for whosekey values there were lines in the database table dbtab.
    The return code is set as follows:
    SY-SUBRC = 0:
    All lines from itab could be used to deletelines from dbtab.
    SY-SUBRC = 4:
    For at least one line of the internal table in thedatabase table, there was no line with the same primary key. All foundlines are deleted.
    Note
    If the internal table itab is empty, SY-SUBRC and SY-DBCNT are set to 0.
    Addition
    ... CLIENT SPECIFIED
    <b>
    Effect</b>
    As with variant 1.
    <b>Variant 4</b>
    DELETE dbtab VERSION vers.
    DELETE *dbtab VERSION vers.
    This variant is not allowed in an ABAP Objectscontext. See VERSION addition not allowed.
    <b>Note</b>
    This variant is now obsolete, since variants 1 - 3 allowyou to specify the database table name dynamically.
    <b>Effect</b>
    Deletes a line in a database table, the name of which istaken from the field vers at runtime. The database table must beknown to the ABAP Dictionary and its name must conform to thefollowing naming convention: It must begin with 'T' and canconsist of four additional characters. The field vers mustcontain the table name without a leading 'T'. Only lines in thecurrent client are deleted. The line to be deleted is taken from thestatically specified table work area dbtab or *dbtab.
    The return code is set as follows: SY-SUBRC = 0:
    The line was deleted.
    SY-SUBRC = 4:
    No lines could be deleted because no line existedwith the specified primary key.
    Regards,
    Vara

  • Select query for picking data in a dynamic internal table

    Dear All,
    Please help.
    <u>The code is :</u>
    p_table1 = itab_final-tabname1.
            p_field1 = itab_final-fieldname1.         
            SELECT (p_field1) FROM (p_table1) INTO CORRESPONDING FIELDS OF TABLE <dyntable1>.      
    It is working fine when the domain is of CHAR
    The piece of code is not working where domain is DATS, CURR, DEC, etc.
    What shall I do so that it works for other domains also. Please its urgent......
    <u>ERROR that came:</u>
    An exception occurred. This exception will be dealt with in more detail
    below. The exception, assigned to the class 'CX_SY_OPEN_SQL_DB', was not
    caught, which                                                         
    led to a runtime error. The reason for this exception is:             
    The data read during a SELECT access could not be inserted into the    
    target field.                                                          
    Either conversion is not supported for the target field's type or the  
    target field is too short to accept the value or the data are not in a 
    form that the target field can accept

    Check below code
    REPORT zpwtest .
    *** Tables
    DATA: lt_data TYPE REF TO data.
    DATA: lt_fieldcatalog TYPE lvc_t_fcat.
    data : p_field type string ,
           p_table type string .
    *** Structure
    DATA: ls_fieldcatalog TYPE lvc_s_fcat.
    *** Data References
    DATA: new_line TYPE REF TO data.
    *** Field Symbols
    FIELD-SYMBOLS: <fs_data> TYPE REF TO data,
                   <fs_1> TYPE ANY TABLE,
                   <fs_2>,
                   <fs_3>.
    ls_fieldcatalog-fieldname = 'MANDT'.
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'CARRID'. "Fieldname
    ls_fieldcatalog-inttype = 'C'. "Internal Type C-> Character
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'CONNID'.
    ls_fieldcatalog-inttype = 'N'.
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'FLDATE'.
    ls_fieldcatalog-inttype = 'D'.
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'PRICE'.
    ls_fieldcatalog-inttype = 'P'.
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'CURRENCY'.
    ls_fieldcatalog-inttype = 'C'.
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ASSIGN lt_data TO <fs_data>.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
         EXPORTING
           it_fieldcatalog = lt_fieldcatalog
         IMPORTING
           ep_table = <fs_data>
         EXCEPTIONS
           generate_subpool_dir_full = 1
           OTHERS = 2
    IF sy-subrc <> 0.
    ENDIF.
    *** So <FS_1> now points to our dynamic internal table.
    ASSIGN <fs_data>->* TO <fs_1>.
    *** Next step is to create a work area for our dynamic internal table.
    CREATE DATA new_line LIKE LINE OF <fs_1>.
    *** A field-symbol to access that work area
    ASSIGN new_line->*  TO <fs_2>.
    <b>
    p_field = 'mandt carrid connid fldate price currency' .
    p_table = 'sflight' .
    *** And to put the data in the internal table
    SELECT (p_field)
      FROM (p_table)
      INTO CORRESPONDING FIELDS OF TABLE <fs_1>.
    </b>
    *** Access contents of internal table
    LOOP AT <fs_1> ASSIGNING <fs_2>.
      ASSIGN COMPONENT 5 OF STRUCTURE <fs_2> TO <fs_3>.
      WRITE: / <fs_3>.
    ENDLOOP.

  • Dynamic internal table from SELECT - statement ?

    Hi, is it possible to define an internal table just after a select statement is executed so that this internal table holds all the data that come back from the statement ?
    thanks in advance,

    Check the link -
    Re: Create Dynamic internal table
    Regards,
    Amit

  • Usage of 'Select for all entries' for dynamic internal tables..

    Hi all,
    I have a situation where I need to use select for all entries for a dynamic internal table.
    select * from /BIC/AZHSD_O1500 into i_table for all entries in <b>Dynamic_table</b> where doc_number = <dynamic_table????????>
    here iam not knowing how to match the <dynamic_table????????> doc_number ?
    the dynamic_table contains the doc_number as one field.
    here dynaimc_table is the internal table which is dynamic.
    I have tried various options but couldnot find the solution.
    Please resolve.
    Sidhartha.

    data : i_dyn_where type char72 occurs 0.
    field-symbols : <fs> type table.
    assign itab[] to <fs>.
    i_dyn_where = 'docno = <fs>-docno'.
    append i_dyn_where.
    select *
    from   vbak
    into   table t_vbak
    for    all entries in <fs>
    where  (I_dyn_where).   "Populate this where condition dynamically too
    Hope this will solve ur prob.

  • Create Table Control using Dynamic Internal Table.

    Hi,
       I have requirement in which I will create a Dynamic Internal Table and then I need to create a Table Control Using that Internal Table. Now this can't be done using Screen Editor as it requires a pre-defined internal table or a DDIC Object.
      Please Help.

    This should be correct answer(I am not author of code below):
    REPORT ztablemaintace NO STANDARD PAGE HEADING.
    TYPE-POOLS: rsds.
    DATA: is_x030l TYPE x030l,
    it_dfies TYPE TABLE OF dfies,
    is_dfies TYPE dfies,
    it_fdiff TYPE TABLE OF field_dif,
    is_fdiff TYPE field_dif.
    DATA: w_selid TYPE rsdynsel-selid,
    it_tables TYPE TABLE OF rsdstabs,
    is_tables TYPE rsdstabs,
    it_fields TYPE TABLE OF rsdsfields,
    it_expr TYPE rsds_texpr,
    it_ranges TYPE rsds_trange,
    it_where TYPE rsds_twhere,
    is_where TYPE rsds_where,
    w_active TYPE i.
    DATA: it_content TYPE REF TO data,
    it_modif TYPE REF TO data,
    it_fcat TYPE lvc_t_fcat.
    DATA: w_okcode TYPE sy-ucomm.
    FIELD-SYMBOLS: <itab> TYPE STANDARD TABLE,
    <ntab> TYPE STANDARD TABLE.
    * Macros
    DEFINE table_error.
      message e398(00) with 'Table' p_table &1.
    END-OF-DEFINITION.
    DEFINE fixed_val.
      is_fdiff-fieldname = is_dfies-fieldname.
      is_fdiff-fixed_val = &1.
      is_fdiff-no_input = 'X'.
      append is_fdiff to it_fdiff.
    END-OF-DEFINITION.
    * Selection screen
    SELECTION-SCREEN: BEGIN OF BLOCK b01 WITH FRAME.
    PARAMETERS: p_table TYPE tabname OBLIGATORY "table
    MEMORY ID dtb
    MATCHCODE OBJECT dd_dbtb_16.
    SELECTION-SCREEN: BEGIN OF LINE,
    PUSHBUTTON 33(20) selopt USER-COMMAND sel,
    COMMENT 55(15) selcnt,
    END OF LINE.
    SELECTION-SCREEN: SKIP.
    PARAMETERS: p_rows TYPE i. "rows
    SELECTION-SCREEN: END OF BLOCK b01,
    SKIP,
    BEGIN OF BLOCK b02 WITH FRAME.
    PARAMETERS: p_displ TYPE c AS CHECKBOX. "display
    SELECTION-SCREEN: END OF BLOCK b02.
    * Initialization
    INITIALIZATION.
      MOVE '@4G@ Filter records' TO selopt.
    * PBO
    AT SELECTION-SCREEN OUTPUT.
      IF w_active IS INITIAL.
        CLEAR: selcnt.
      ELSE.
        WRITE w_active TO selcnt LEFT-JUSTIFIED.
      ENDIF.
    * PAI
    AT SELECTION-SCREEN.
      IF p_table NE is_x030l-tabname.
        CALL FUNCTION 'DDIF_NAMETAB_GET'
          EXPORTING
            tabname   = p_table
          IMPORTING
            x030l_wa  = is_x030l
          TABLES
            dfies_tab = it_dfies
          EXCEPTIONS
            OTHERS    = 1.
        IF is_x030l IS INITIAL.
          table_error 'does not exist or is not active'.
        ELSEIF is_x030l-tabtype NE 'T'.
          table_error 'is not selectable'.
    *    ELSEIF is_x030l-align NE 0.
    *      table_error 'has alignment - cannot continue'.
        ENDIF.
    * Default values for system fields
        REFRESH: it_fdiff.
        is_fdiff-tabname = p_table.
        LOOP AT it_dfies INTO is_dfies.
          IF is_dfies-datatype = 'CLNT'.
            fixed_val sy-mandt.
          ELSEIF is_dfies-rollname = 'ERDAT'
          OR is_dfies-rollname = 'ERSDA'
          OR is_dfies-rollname = 'AEDAT'
          OR is_dfies-rollname = 'LAEDA'.
            fixed_val sy-datum.
          ELSEIF is_dfies-rollname = 'ERTIM'
          OR is_dfies-rollname = 'AETIM'.
            fixed_val sy-uzeit.
          ELSEIF is_dfies-rollname = 'ERNAM'
          OR is_dfies-rollname = 'AENAM'.
            fixed_val sy-uname.
          ENDIF.
          CALL FUNCTION '/SAPDMC/DATAELEMENT_GET_TEXTS'
            EXPORTING
              name        = is_dfies-rollname
            IMPORTING
              text_middle = is_dfies-reptext
            EXCEPTIONS
              not_found   = 1
              OTHERS      = 2.
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
          MODIFY it_dfies FROM is_dfies.
      ENDLOOP.
    * Prepare free selection on table
      REFRESH it_tables.
      is_tables-prim_tab = p_table.
      APPEND is_tables TO it_tables.
      CLEAR: w_selid.
    ENDIF.
    IF sy-ucomm = 'SEL'.
      IF w_selid IS INITIAL.
    * Init free selection dialog
        CALL FUNCTION 'FREE_SELECTIONS_INIT'
          EXPORTING
            expressions  = it_expr
          IMPORTING
            selection_id = w_selid
            expressions  = it_expr
          TABLES
            tables_tab   = it_tables
          EXCEPTIONS
            OTHERS       = 1.
      ENDIF.
    * Display free selection dialog
      CALL FUNCTION 'FREE_SELECTIONS_DIALOG'
        EXPORTING
          selection_id            = w_selid
          title                   = 'Selection'
          status                  = 1
          as_window               = 'X'
        IMPORTING
          expressions             = it_expr
          field_ranges            = it_ranges
          number_of_active_fields = w_active
        TABLES
          fields_tab              = it_fields
        EXCEPTIONS
          OTHERS                  = 1.
    ENDIF.
    * Start of processing
    START-OF-SELECTION.
      PERFORM f_create_table USING p_table.
      PERFORM f_select_table.
      PERFORM f_display_table.
    * FORM f_create_table *
    FORM f_create_table USING in_tabname.
      FIELD-SYMBOLS: <fcat> TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = in_tabname
        CHANGING
          ct_fieldcat      = it_fcat
        EXCEPTIONS
          OTHERS           = 1.
      IF sy-subrc = 0.
    *   Complete field catalog
        LOOP AT it_fcat ASSIGNING <fcat>.
          <fcat>-tabname = in_tabname.
        ENDLOOP.
        CALL FUNCTION 'LVC_FIELDCAT_COMPLETE'
          CHANGING
            ct_fieldcat = it_fcat
          EXCEPTIONS
            OTHERS      = 1.
      ELSE.
        WRITE: 'Error building field catalog'.
        STOP.
      ENDIF.
    * Create dynamic table for data
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = it_fcat
        IMPORTING
          ep_table        = it_content.
      IF sy-subrc = 0.
        ASSIGN it_content->* TO <itab>.
      ELSE.
        WRITE: 'Error creating internal table'.
        STOP.
      ENDIF.
    * Create dynamic table for modif
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = it_fcat
        IMPORTING
          ep_table        = it_modif.
      IF sy-subrc = 0.
        ASSIGN it_modif->* TO <ntab>.
      ELSE.
        WRITE: 'Error creating internal table'.
        STOP.
      ENDIF.
    ENDFORM.                    "f_create_table
    * FORM f_select_table *
    FORM f_select_table.
      IF w_active = 0.
        SELECT * FROM (p_table)
        INTO CORRESPONDING FIELDS OF TABLE <itab>
        UP TO p_rows ROWS.
      ELSE.
    * Selection with parameters
        CALL FUNCTION 'FREE_SELECTIONS_RANGE_2_WHERE'
          EXPORTING
            field_ranges  = it_ranges
          IMPORTING
            where_clauses = it_where.
        READ TABLE it_where INTO is_where WITH KEY tablename = p_table.
        SELECT * FROM (p_table)
        INTO CORRESPONDING FIELDS OF TABLE <itab>
        UP TO p_rows ROWS
        WHERE (is_where-where_tab).
      ENDIF.
      IF sy-dbcnt = 0.
        WRITE: 'No record selected'.
        STOP.
      ENDIF.
    ENDFORM.                    "f_select_table
    * FORM f_display_table *
    FORM f_display_table.
      DATA: l_answer TYPE c,
      l_eflag TYPE c.
      CLEAR: w_okcode.
      REFRESH: <ntab>.
    * Display table contents
      CALL FUNCTION 'STC1_FULLSCREEN_TABLE_CONTROL'
        EXPORTING
          header       = p_table
          tabname      = p_table
          display_only = p_displ
          endless      = 'X'
          no_button    = space
        IMPORTING
          okcode       = w_okcode
        TABLES
    *      nametab      = it_dfies
          table        = <itab>
    *      fielddif     = it_fdiff
          modif_table  = <ntab>
        EXCEPTIONS
          OTHERS       = 1.
      IF sy-subrc = 0.
        IF p_displ IS INITIAL AND w_okcode = 'SAVE'.
    * Confirm update
          CALL FUNCTION 'POPUP_TO_CONFIRM'
            EXPORTING
              titlebar              = p_table
              text_question         = 'Do you want to update table ?'
              default_button        = '2'
              display_cancel_button = ' '
            IMPORTING
              answer                = l_answer
            EXCEPTIONS
              OTHERS                = 1.
          IF l_answer = '1'.
    * Apply modifications
            IF NOT <ntab>[] IS INITIAL.
              PERFORM f_add_system USING space.
              MODIFY (p_table) FROM TABLE <ntab>.
              IF sy-subrc NE 0.
                l_eflag = 'X'.
              ENDIF.
            ENDIF.
    * Apply deletions
            IF l_eflag IS INITIAL.
              REFRESH: <ntab>.
              CALL FUNCTION 'STC1_GET_DATA'
                TABLES
                  deleted_data = <ntab>
                EXCEPTIONS
                  OTHERS       = 1.
              IF NOT <ntab>[] IS INITIAL.
                DELETE (p_table) FROM TABLE <ntab>.
                IF sy-subrc NE 0.
                  ROLLBACK WORK.
                  l_eflag = 'X'.
                ENDIF.
              ENDIF.
            ENDIF.
    * Apply creations
            IF l_eflag IS INITIAL.
              REFRESH: <ntab>.
              CALL FUNCTION 'STC1_GET_DATA'
                TABLES
                  new_data = <ntab>
                EXCEPTIONS
                  OTHERS   = 1.
              IF NOT <ntab>[] IS INITIAL.
                PERFORM f_add_system USING 'X'.
                INSERT (p_table) FROM TABLE <ntab>.
                IF sy-subrc NE 0.
                  ROLLBACK WORK.
                  l_eflag = 'X'.
                ENDIF.
              ENDIF.
            ENDIF.
            IF l_eflag IS INITIAL.
              COMMIT WORK.
              MESSAGE s261(53).
            ELSE.
              MESSAGE s075(3i).
              PERFORM f_select_table.
            ENDIF.
          ENDIF.
    * Display table again
          PERFORM f_display_table.
        ENDIF.
      ENDIF.
    ENDFORM.                    "f_display_table
    * FORM f_add_system *
    FORM f_add_system USING new TYPE c.
      FIELD-SYMBOLS: <irec> TYPE ANY,
      <upd> TYPE ANY.
      LOOP AT it_fdiff INTO is_fdiff.
        READ TABLE it_dfies INTO is_dfies
        WITH KEY fieldname = is_fdiff-fieldname.
        LOOP AT <ntab> ASSIGNING <irec>.
          ASSIGN COMPONENT is_fdiff-fieldname OF STRUCTURE <irec> TO <upd>.
          IF is_dfies-datatype = 'CLNT'.
            <upd> = sy-mandt.
          ELSE.
            CASE is_dfies-rollname.
              WHEN 'AENAM'.
                <upd> = sy-uname.
              WHEN 'AEDAT' OR 'LAEDA'.
                <upd> = sy-datum.
              WHEN 'AETIM'.
                <upd> = sy-uzeit.
              WHEN OTHERS.
            ENDCASE.
          ENDIF.
        ENDLOOP.
      ENDLOOP.
    ENDFORM.                    "f_add_system

Maybe you are looking for

  • Clustered listener gets nothing back from APEX after upgrade to 4.1.1

    Hi, I'm not sure if that subject is entirely accurate, but that appears to be the effect we are experiencing. We have had an SR open for this since April and seem to have the engineers stumped. Maybe someone on here has some insight that may help...

  • How to make a page break in numbers

    The only way I found to make a new page in Numbers was to make new rows down to where the page would break, but it's only letting me add a few new rows to the new page.  I'd like to know how to make a page break without just adding rows.

  • Firmware update on PC, then back to Mac??

    Hi I have an old iMac G5 & suddenly the new Firmware wont update my iPhone (The new iTunes wont run on my old machine as its not running Snow Leopard) I was thinking I could hard reset the phone & wipe everything off. Then I would update my iPhone's

  • IPhoto Sharing of Albums

    I have a Macbook Pro Computer and an iMac. I created an Album on my MacBook Pro computer and want to share/move this to my iMac through sharing. I've set up sharing between my two computers and see the photos on each computer, but can't find a way to

  • Conversion failed when converting the nvarchar value 'MX_PERSON' to data type int

    Hi, I am trying to check user status by running this query: my query take as input the userid= 'USER1234' as parameter select count (distinct mskey) from idmv_vallink_basic_active where mcAttrName='MSKEYVALUE' and mcSearchValue='USER1234'   and mskey