Populate data from dynamic internal table

Hi
I have dynamic internal table <lt_paxxxx>. Iam fillling <lt_paxxxx> in the following way.
select * into table <lt_paxxxx> from (infty-dbname).
I have to pass data of <lt_paxxxx> to another internal table lt_final.
'lt_final' should contain fields like <lt_paxxxx>, infty name, DB name.
Could you please help me out how to pass <lt_paxxxx> data to 'LT_FINAL'.

loop at <it_table>
       into <is_table>.
    loop at it_fieldcatalog
         into is_fieldcatalog.
      assign component is_fieldcatalog-fieldname
             of structure <is_table>
             to <field1>.
      concatenate 'IT_TABLE-'
                          is_fieldcatalog-fieldname
                         into w_field.
     assign (w_field) to <field2>.
     check sy-subrc eq space.
      move <field1> to <field2>.
    endloop.
   append it_table
  endloop.
regards

Similar Messages

  • Populate data in dynamic internal table

    Hi ppl,
    I have a requirement where I need to display certain fields in the report output.
    The output contains 8 fixed fields (common for all rows in output) and some dynamic fields (number of column varies with rows) which will be determined at runtime.
    I am able to create the dunamic internal table....and at runtime I see the fields created in the internal table correctly.
    Now my requirement is to fill this table with the data from 2 internal tables.
    The values for the 8 common fields comes from the internal table t_output and the values for dynamic fields come from t_dynamic.
    Please let me know the logic to merge these 2 internal tables into the dynamic internal table <dyn_table>.
    Regards.

    Hello David,
    This has been discussed many times before in this forum. Since the table structure is dynamic the fields are determined at runtime.
    To assign data to this table you have to use [ASSIGN COMPONENT ... |http://help.sap.com/abapdocu_70/en/ABAPASSIGN_MEM_AREA_DYNAMIC_DOBJ.htm#!ABAP_ALTERNATIVE_4@4@] variant.
    Please refer to the example provided in the documentation for details.
    BR,
    Suhas

  • How to populate data into Dynamic Internal Table.

    Hi Experts,
    I had created one Dynamic Internal table and one static internal table.I want to move data from Static Internal table to Dynamic interal table.And aslo the number of coloum of these two tables are not same.
    So please help me for solving this issue.
    Thanks,
    <u><i><b>Seema.</b></i></u>

    Hi,
    Check out this sample program for dynamictable report.
    REPORT  YMS_DYNAMICDEMO
                 NO STANDARD PAGE HEADING
                 MESSAGE-ID zcs_c2c_001.
    type-pools : abap.
    field-symbols: <dyn_table> type standard table,
                   <dyn_wa>,
                   <dyn_field>.
    data: dy_table type ref to data,
          dy_line  type ref to data,
          xfc type lvc_s_fcat,
          ifc type lvc_t_fcat.
    selection-screen begin of block b1 with frame.
    parameters: p_table(30) type c default 'T001'.
    selection-screen end of block b1.
    start-of-selection.
      perform get_structure.
      perform create_dynamic_itab.
      perform get_data.
      perform write_out.
    form get_structure.
    data : idetails type abap_compdescr_tab,
           xdetails type abap_compdescr.
    data : ref_table_des type ref to cl_abap_structdescr.
    Get the structure of the table.
      ref_table_des ?=
          cl_abap_typedescr=>describe_by_name( p_table ).
      idetails[] = ref_table_des->components[].
      loop at idetails into xdetails.
        clear xfc.
        xfc-fieldname = xdetails-name .
        xfc-datatype = xdetails-type_kind.
        xfc-intlen = xdetails-length.
        xfc-decimals = xdetails-decimals.
        append xfc to ifc.
      endloop.
    endform.
    form create_dynamic_itab.
    Create dynamic internal table and assign to FS
      call method cl_alv_table_create=>create_dynamic_table
                   exporting
                      it_fieldcatalog = ifc
                   importing
                      ep_table        = dy_table.
      assign dy_table->* to <dyn_table>.
    Create dynamic work area and assign to FS
      create data dy_line like line of <dyn_table>.
      assign dy_line->* to <dyn_wa>.
    endform.
    form get_data.
    Select Data from table.
      select * into table <dyn_table>
                 from (p_table).
    endform.
    form write_out.
    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.
    endform.
    Thanks,
    Shankar

  • How to populate data in dynamic internal table

    Hi Expert,
    fyi. My dynamic internal table field is created base on data selected. Eg. select table qpcd has 5 records.  These 5 recods will become fieldname to my dynamic internal table. My dynamic internal table will be
    ...itab
          01
          02
          03
          04
          05
    The 5 records from qpcd is populated in another table call viqmel.  I need to find the occurance of each code in viqmel and populate the number of occurance in itab in each of column.  The final dynamic itab will be like this
    table itab
    01       02     03    04     05   -
    > field name
    2         0        1     0       1    -
    > data
    my source code like below
    Report ZPLYGRND2.
    TABLES: mara, makt.
    TYPE-POOLS: slis, sydes.
    DATA:it_fcat TYPE slis_t_fieldcat_alv,
         is_fcat LIKE LINE OF it_fcat,
         ls_layout TYPE slis_layout_alv.
    DATA: it_fieldcat TYPE lvc_t_fcat,
          is_fieldcat LIKE LINE OF it_fieldcat.
    DATA: new_table TYPE REF TO data,
          new_line TYPE REF TO data,
          ob_cont_alv TYPE REF TO cl_gui_custom_container,
          ob_alv TYPE REF TO cl_gui_alv_grid,
          vg_campos(255) TYPE c,
          i_campos LIKE TABLE OF vg_campos,
          vg_campo(30) TYPE c,
          vg_tables(60) TYPE c.
    types : begin of t_qpcd,
             codegruppe like qpcd-codegruppe,
             code like qpcd-code,
            end of t_qpcd.
    data:wa_qpcd type t_qpcd,
         i_qpcd type standard table of t_qpcd initial size 0.
    FIELD-SYMBOLS: <l_table> TYPE table,
                   <l_line> TYPE ANY,
                   <l_field> TYPE ANY.
    select * into corresponding fields of wa_qpcd from qpcd
    where katalogart = 'D'
    and   codegruppe = 'OOT01'.
    append wa_qpcd to i_qpcd.
    endselect.
    loop at i_qpcd into wa_qpcd.
      is_fcat-fieldname = wa_qpcd-code.
      APPEND is_fcat TO it_fcat.
    endloop.
    LOOP AT it_fcat INTO is_fcat.
        is_fieldcat-fieldname = is_fcat-fieldname.
        is_fieldcat-ref_field = is_fcat-ref_fieldname.
        is_fieldcat-ref_table = is_fcat-ref_tabname.
        APPEND is_fieldcat TO it_fieldcat.
    ENDLOOP.
    *... Create the dynamic internal table
    CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
            it_fieldcatalog = it_fieldcat
        IMPORTING
            ep_table = new_table.
    if sy-subrc = 0.
    endif.
    *... Create a new line
    ASSIGN new_table->* TO <l_table>.
    CREATE DATA new_line LIKE LINE OF <l_table>.
    ASSIGN new_line->* TO <l_line>.
    LOOP AT <l_table> INTO <l_line>.
    ENDLOOP.

    hello dear i m giving u a code in this a dynamic table is made on the basis of table in database , and u can download this data correct it , see it, or even change it....and upload in tht table help full if u dont know the table name...in advance.
    also the code to populate data in dynamic table is in this code like:
    SELECT * FROM (MTABLE_N)
    INTO CORRESPONDING FIELDS OF TABLE <FS_ITAB> .
    look at the whole program .hope this solve ur problem thanks.
    REPORT ZTESTA  MESSAGE-ID ZIMM    .
    TYPES : DATA_OBJECT TYPE REF TO DATA.
    DATA : MITAB TYPE REF TO DATA .
    TYPE-POOLS : SLIS .
    DATA : IT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV
    WITH HEADER LINE .
    DATA : IT_FIELDCATALOG TYPE LVC_T_FCAT .
    DATA : WA_FIELDCATALOG TYPE LVC_S_FCAT .
    DATA : I_STRUCTURE_NAME LIKE DD02L-TABNAME .
    DATA : I_CALLBACK_PROGRAM LIKE SY-REPID .
    DATA : DYN_LINE TYPE DATA_OBJECT .
    FIELD-SYMBOLS : <FS_ITAB> TYPE STANDARD TABLE .
    DATA : TABLE_NAME_IS_VALID TYPE C .
    DATA : DYNAMIC_IT_INSTANTIATED TYPE C .
    CONSTANTS BUTTONSELECTED TYPE C VALUE 'X' .
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) T_TABL.
    PARAMETERS : MTABLE_N LIKE RSRD1-TBMA_VAL
    MATCHCODE OBJECT DD_DBTB_16 OBLIGATORY .
    DATA CHECKTABLED.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) T_FILE.
    PARAMETERS : MFILENAM LIKE RLGRAP-FILENAME .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) T_DOWN.
    PARAMETERS : P_DOWNLD RADIOBUTTON GROUP GRP1
    USER-COMMAND M_UCOMM .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) T_CHKF.
    PARAMETERS : P_CHKFIL RADIOBUTTON GROUP GRP1 .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) T_UPLD.
    PARAMETERS : P_UPLOAD RADIOBUTTON GROUP GRP1 .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) T_SHOW.
    PARAMETERS : P_SHOW_T RADIOBUTTON GROUP GRP1 .
    SELECTION-SCREEN END OF LINE.
    AT SELECTION-SCREEN OUTPUT .
      PERFORM CHECK_FILENAME .
    AT SELECTION-SCREEN.
      IF SY-UCOMM = 'ONLI'.
        CHECKTABLED = MTABLE_N+0(1).
        IF CHECKTABLED NE 'Z'.
          MESSAGE I017.
          LEAVE TO SCREEN 1000.
        ENDIF.
        IF SY-UNAME NE 'KAMESH.K'.
          MESSAGE I023 WITH SY-UNAME.
          LEAVE TO SCREEN 1000.
        ENDIF.
      ENDIF.
      IF SY-UCOMM = 'PRIN'.
        CHECKTABLED = MTABLE_N+0(1).
        IF CHECKTABLED NE 'Z'.
          MESSAGE I017.
          LEAVE TO SCREEN 1000.
        ENDIF.
        IF SY-UNAME NE 'KAMESH.K'.
          MESSAGE I023 WITH SY-UNAME.
          LEAVE TO SCREEN 1000.
        ENDIF.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR MFILENAM .
      PERFORM F4_FOR_FILENAME .
    INITIALIZATION .
      T_TABL = 'Table Name' .
      T_FILE = 'File Name' .
      T_DOWN = 'Download Table' .
      T_CHKF = 'Check File to Upload' .
      T_UPLD = 'Upload File' .
      T_SHOW = 'Show Table Contents' .
    START-OF-SELECTION .
      PERFORM CHECK_TABLE_NAME_IS_VALID .
    END-OF-SELECTION .
      IF TABLE_NAME_IS_VALID EQ ' ' .
        MESSAGE I398(00) WITH 'INVALID TABLE NAME' .
      ELSE .
        PERFORM INSTANTIATE_DYNAMIC_INTERNAL_T .
        CHECK DYNAMIC_IT_INSTANTIATED = 'X' .
        CASE BUTTONSELECTED .
          WHEN P_DOWNLD .
            PERFORM SELECT_AND_DOWNLOAD .
          WHEN P_CHKFIL .
            PERFORM CHECK_FILE_TO_UPLOAD .
          WHEN P_UPLOAD .
            PERFORM UPLOAD_FROM_FILE .
          WHEN P_SHOW_T .
            PERFORM SHOW_CONTENTS .
        ENDCASE .
      ENDIF .
    FORM CHECK_TABLE_NAME_IS_VALID.
      DATA MCOUNT TYPE I .
      TABLES DD02L .
      CLEAR TABLE_NAME_IS_VALID .
      SELECT COUNT(*) INTO MCOUNT FROM TADIR
      WHERE PGMID = 'R3TR'
      AND OBJECT = 'TABL'
      AND OBJ_NAME = MTABLE_N .
      IF MCOUNT EQ 1 .
        CLEAR DD02L .
        SELECT SINGLE * FROM DD02L WHERE TABNAME = MTABLE_N .
        IF SY-SUBRC EQ 0.
          IF DD02L-TABCLASS = 'TRANSP' .
            TABLE_NAME_IS_VALID = 'X' .
          ENDIF .
        ENDIF.
      ENDIF .
    ENDFORM. " CHECK_TABLE_NAME_IS_VALID
    FORM SELECT_AND_DOWNLOAD.
      CLEAR : <FS_ITAB> .
      SELECT * FROM (MTABLE_N)
      INTO CORRESPONDING FIELDS OF TABLE <FS_ITAB> .
      PERFORM CHECK_FILENAME.
      CALL FUNCTION 'WS_DOWNLOAD'
           EXPORTING
                FILENAME                = MFILENAM
                FILETYPE                = 'DAT'
           TABLES
                DATA_TAB                = <FS_ITAB>
           EXCEPTIONS
                FILE_OPEN_ERROR         = 1
                FILE_WRITE_ERROR        = 2
                INVALID_FILESIZE        = 3
                INVALID_TYPE            = 4
                NO_BATCH                = 5
                UNKNOWN_ERROR           = 6
                INVALID_TABLE_WIDTH     = 7
                GUI_REFUSE_FILETRANSFER = 8
                CUSTOMER_ERROR          = 9
                OTHERS                  = 10.
      IF SY-SUBRC EQ 0.
        MESSAGE I398(00) WITH 'Table' MTABLE_N
        'successfully downloaded to '
        MFILENAM .
      ENDIF.
    ENDFORM. " SELECT_AND_DOWNLOAD
    FORM UPLOAD_FROM_FILE.
      DATA : ANS TYPE C .
      DATA : LINES_OF_ITAB TYPE I .
      DATA : MSY_SUBRC TYPE I .
      CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
           EXPORTING
                TEXTLINE1 = 'Are you sure you wish to upload'
                TEXTLINE2 = 'data from ASCII File to DB table '
                TITEL     = 'Confirmation of Data Upload'
           IMPORTING
                ANSWER    = ANS.
      IF ANS = 'J' .
        PERFORM CHECK_FILENAME.
        CLEAR MSY_SUBRC .
        CALL FUNCTION 'WS_UPLOAD'
             EXPORTING
                  FILENAME                = MFILENAM
                  FILETYPE                = 'DAT'
             TABLES
                  DATA_TAB                = <FS_ITAB>
             EXCEPTIONS
                  CONVERSION_ERROR        = 1
                  FILE_OPEN_ERROR         = 2
                  FILE_READ_ERROR         = 3
                  INVALID_TYPE            = 4
                  NO_BATCH                = 5
                  UNKNOWN_ERROR           = 6
                  INVALID_TABLE_WIDTH     = 7
                  GUI_REFUSE_FILETRANSFER = 8
                  CUSTOMER_ERROR          = 9
                  OTHERS                  = 10.
        MSY_SUBRC = MSY_SUBRC + SY-SUBRC .
        IF SY-SUBRC EQ 0.
          DESCRIBE TABLE <FS_ITAB> LINES LINES_OF_ITAB .
          IF LINES_OF_ITAB GT 0 .
            MODIFY (MTABLE_N) FROM TABLE <FS_ITAB> .
            MSY_SUBRC = MSY_SUBRC + SY-SUBRC .
          ENDIF .
        ENDIF.
        IF MSY_SUBRC EQ 0 .
          MESSAGE I398(00) WITH LINES_OF_ITAB
          'Record(s) inserted in table'
          MTABLE_N .
        ELSE .
          MESSAGE I398(00) WITH
          'Errors occurred No Records inserted in table'
          MTABLE_N .
        ENDIF .
      ENDIF .
    ENDFORM. " UPLOAD_FROM_FILE
    FORM F4_FOR_FILENAME.
      CALL FUNCTION 'WS_FILENAME_GET'
           EXPORTING
                DEF_PATH         = 'C:\'
                MASK             = ',.,..'
                MODE             = '0'
           IMPORTING
                FILENAME         = MFILENAM
           EXCEPTIONS
                INV_WINSYS       = 1
                NO_BATCH         = 2
                SELECTION_CANCEL = 3
                SELECTION_ERROR  = 4
                OTHERS           = 5.
    ENDFORM. " F4_FOR_FILENAME
    FORM CHECK_FILENAME.
      IF MFILENAM IS INITIAL
      AND NOT ( MTABLE_N IS INITIAL )
      AND P_SHOW_T NE BUTTONSELECTED.
        CONCATENATE 'C:\'
        MTABLE_N '.TXT' INTO MFILENAM.
      ENDIF .
    ENDFORM. " CHECK_FILENAME
    FORM INSTANTIATE_DYNAMIC_INTERNAL_T.
      CLEAR DYNAMIC_IT_INSTANTIATED .
      I_STRUCTURE_NAME = MTABLE_N .
      CLEAR IT_FIELDCAT[] .
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_STRUCTURE_NAME       = I_STRUCTURE_NAME
           CHANGING
                CT_FIELDCAT            = IT_FIELDCAT[]
           EXCEPTIONS
                INCONSISTENT_INTERFACE = 1
                PROGRAM_ERROR          = 2
                OTHERS                 = 3.
      IF SY-SUBRC EQ 0.
        LOOP AT IT_FIELDCAT .
          CLEAR WA_FIELDCATALOG .
          MOVE-CORRESPONDING IT_FIELDCAT TO WA_FIELDCATALOG .
          WA_FIELDCATALOG-REF_FIELD = IT_FIELDCAT-FIELDNAME .
          WA_FIELDCATALOG-REF_TABLE = MTABLE_N .
          APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG .
        ENDLOOP .
        CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
        IT_FIELDCATALOG = IT_FIELDCATALOG
        IMPORTING
        EP_TABLE = MITAB .
        ASSIGN MITAB->* TO <FS_ITAB> .
        DYNAMIC_IT_INSTANTIATED = 'X' .
      ENDIF.
    ENDFORM. " INSTANTIATE_DYNAMIC_INTERNAL_T
    FORM SHOW_CONTENTS.
      CLEAR : <FS_ITAB> .
      SELECT * FROM (MTABLE_N)
      INTO CORRESPONDING FIELDS OF TABLE <FS_ITAB> .
      I_CALLBACK_PROGRAM = SY-REPID .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM = I_CALLBACK_PROGRAM
                IT_FIELDCAT        = IT_FIELDCAT[]
           TABLES
                T_OUTTAB           = <FS_ITAB>
           EXCEPTIONS
                PROGRAM_ERROR      = 1
                OTHERS             = 2.
    ENDFORM. " SHOW_CONTENTS
    FORM CHECK_FILE_TO_UPLOAD.
      PERFORM CHECK_FILENAME.
      CALL FUNCTION 'WS_UPLOAD'
           EXPORTING
                FILENAME                = MFILENAM
                FILETYPE                = 'DAT'
           TABLES
                DATA_TAB                = <FS_ITAB>
           EXCEPTIONS
                CONVERSION_ERROR        = 1
                FILE_OPEN_ERROR         = 2
                FILE_READ_ERROR         = 3
                INVALID_TYPE            = 4
                NO_BATCH                = 5
                UNKNOWN_ERROR           = 6
                INVALID_TABLE_WIDTH     = 7
                GUI_REFUSE_FILETRANSFER = 8
                CUSTOMER_ERROR          = 9
                OTHERS                  = 10.
      IF SY-SUBRC EQ 0.
        I_CALLBACK_PROGRAM = SY-REPID .
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
             EXPORTING
                  I_CALLBACK_PROGRAM = I_CALLBACK_PROGRAM
                  IT_FIELDCAT        = IT_FIELDCAT[]
             TABLES
                  T_OUTTAB           = <FS_ITAB>
             EXCEPTIONS
                  PROGRAM_ERROR      = 1
                  OTHERS             = 2.
      ENDIF .
    ENDFORM. " CHECK_FILE_TO_UPLOAD
    Message was edited by:
            SAURABH SINGH
            SENIOR EXECUTIVE
            SAMSUNG INDIA ELECTRONICS LTD.,NOIDA

  • 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.

  • How to pass data from dynamic internal table to standard internal table

    hi experts,
    below is the piece of code which i have used in my requirement but the data is not moved.
    LOOP AT <tab> ASSIGNING <tab1>.
      MOVE-CORRESPONDING <tab1> TO wa.
      append wa TO  gt_outtab.
    ENDLOOP.
    here
    <tab> - dynamic internal table.
    <tab1>-dynamic internal table work area.
    gt_outtab - standard internal table.
    wa- standard internal table work area.
    i am not getting what additional thing i have to write.
    pls help me in this regard.
    thankx in advance.
    soham.p.

    Hello soham p ,
    I am also using the same logic but in my program it is working fine so you declare the fieldsymols like this and try and also check the dynamic internal contain the data or not.
    FIELD-SYMBOLS : <y_i_table>  TYPE STANDARD TABLE,
                                 <y_wa_table> TYPE ANY.
      LOOP AT <y_i_table> ASSIGNING <y_wa_table>.
        MOVE-CORRESPONDING <y_wa_table> TO y_wa_vfscaid.
        APPEND y_wa_vfscaid TO y_i_vfscaid.
        CLEAR y_wa_vfscaid.
      ENDLOOP.

  • Data from dynamic internal table to be downloaded to App server

    Dear Friends,
    I have a a dynamically generated internal table  and it contains huge data.And my requirement is to download the same data with a deliminator into a text file in application server.
    Can you pls help me with the code....
    Thanks,
    jeevan.

    Hello Jeevan,
    PFB a code snippet for your requirement:
    DATA: v_dataset TYPE fileextern VALUE './test335.txt',
          v_dref TYPE REF TO data,
          v_data TYPE string.
    FIELD-SYMBOLS: <itab> TYPE STANDARD TABLE,
                   <wa> TYPE ANY,
                   <val> TYPE ANY.
    CREATE DATA v_dref TYPE STANDARD TABLE OF ('T001').
    ASSIGN v_dref->* TO <itab>.
    SELECT * FROM ('T001') INTO TABLE <itab> UP TO 20 ROWS.
    OPEN DATASET v_dataset FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    CHECK sy-subrc = 0.
    LOOP AT <itab> ASSIGNING <wa>.
      DO.
        ASSIGN COMPONENT sy-index OF STRUCTURE <wa> TO <val>.
        IF sy-subrc = 0.
          CONCATENATE v_data <val> INTO v_data SEPARATED BY ';'.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
      TRANSFER v_data TO v_dataset.
      CLEAR v_data.
    ENDLOOP.
    CLOSE DATASET v_dataset.
    @Others: The OP wants to add a delimiter to the fields of a dynamic table.
    >
    jeevan kumar wrote:
    > I have a a dynamically generated internal table  and it contains huge data.And my requirement is to download the same data with a deliminator into a text file in application server.

  • 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

  • Filling dynamic internal table with data from other internal table

    Hi Friends,
    My problem is that i have already built a dynamic internal table
    (class int_table->create) but now i want to fill it with data from other internal table.
    The dynamic table column name and the field value of the data filled internal table are same, but how to access that column name, since i cant hard code it anyway.
    Like if my werks field value is '8001'. I want to place it under the column 8001 of dynamic table, Can anybody help me in this regard?
    Awarding points is not a problem for even giving a slight hint.
    Best Regards

    Hi
    See this
    Dynamic internal table is internal table that we create on the fly with flexible column numbers.
    For sample code, please look at this code tutorial. Hopefully it can help you
    Check this link:
    http://www.****************/Tutorials/ABAP/DynamicInternaltable/DynamicInternalTable.htm
    Sample code:
    DATA: l_cnt(2) TYPE n,
    l_cnt1(3) TYPE n,
    l_nam(12),
    l_con(18) TYPE c,
    l_con1(18) TYPE c,
    lf_mat TYPE matnr.
    SORT it_bom_expl BY bom_comp bom_mat level.
    CLEAR: l_cnt1, <fs_dyn_wa>.
    Looping the component internal table
    LOOP AT it_bom_expl INTO gf_it_bom_expl.
    CLEAR: l_cnt1.
    AT NEW bom_comp.
    CLEAR: l_cnt, <fs_dyn_wa>, lf_mat.
    For every new bom component the material data is moved to
    temp material table which will be used for assigning the levels
    checking the count
    it_mat_temp[] = it_mat[].
    Component data is been assigned to the field symbol which is checked
    against the field of dynamic internal table and the value of the
    component number is been passed to the dynamic internal table field
    value.
    ASSIGN COMPONENT c_comp_list OF STRUCTURE <fs_dyn_wa> TO
    <fs_check>.
    <fs_check> = gf_it_bom_expl-bom_comp.
    ENDAT.
    AT NEW bom_mat.
    CLEAR l_con.
    ENDAT.
    lf_mat = gf_it_bom_expl-bom_mat.
    Looping the temp internal table and looping the dynamic internal table
    *by reading line by line into workarea, the materialxxn is been assigned
    to field symbol which will be checked and used.
    LOOP AT it_mat_temp.
    l_nam = c_mat.
    l_cnt1 = l_cnt1 + 1.
    CONCATENATE l_nam l_cnt1 INTO l_nam.
    LOOP AT <fs_dyn_table2> ASSIGNING <fs_dyn_wa2>.
    ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa2> TO <fs_xy>.
    ENDLOOP.
    IF <fs_xy> = lf_mat.
    CLEAR lf_mat.
    l_con1 = l_con.
    ENDIF.
    Checking whether the material exists for a component and if so it is
    been assigned to the field symbol which is checked against the field
    of dynamic internal table and the level of the component number
    against material is been passed to the dynamic internal table field
    value.
    IF <fs_xy> = gf_it_bom_expl-bom_mat.
    ASSIGN COMPONENT l_nam OF STRUCTURE <fs_dyn_wa> TO <fs_check>.
    CLEAR l_con.
    MOVE gf_it_bom_expl-level TO l_con.
    CONCATENATE c_val_l l_con INTO l_con.
    CONDENSE l_con NO-GAPS.
    IF l_con1 NE space.
    CONCATENATE l_con1 l_con INTO l_con SEPARATED BY c_comma.
    CLEAR l_con1.
    l_cnt = l_cnt - 1.
    ENDIF.
    <fs_check> = l_con.
    l_cnt = l_cnt + 1.
    ENDIF.
    ENDLOOP.
    AT END OF bom_comp.
    At end of every new bom component the count is moved to the field
    symbol which is checked against the field of dynamic internal table
    and the count is been passed to the dynamic internal table field
    value.
    ASSIGN COMPONENT c_count OF STRUCTURE <fs_dyn_wa> TO <fs_check>.
    <fs_check> = l_cnt.
    INSERT <fs_dyn_wa> INTO TABLE <fs_dyn_table>.
    ENDAT.
    ENDLOOP.
    Reward if useful
    Anji

  • Fetching data from one internal table and populating into other table

    hi
    i am working on a report program.
    here,i have my data in a internal table(having only one field) i.e. only one column in the table.
    now i want to populate this data into other internal internal table that has 13fields i.e. 13 columns.
    so could anyone let me know how can i work on this.
    i am looping the internal table with one field into a work area from there i am not able to proceed ahead.
    thanks in advance

    hi
    i would like to clear one point here i.e. my internal table into which i want to populate data is a dynamic internal table....so i cant give the fieldnames here..
    here i am pasting the code..so that u may get some idea...
    "generating dynamic internal table :
    ref_descr ?= cl_abap_typedescr=>describe_by_data( it_itab ).
    it_details[] = ref_descr->components[].
    loop at it_details into wa_comp.
    cnt = cnt + 1.
    wa_fcat-col_pos = cnt.
    wa_fcat-fieldname = wa_comp-name.
    append wa_fcat to t_fcat.
    endloop.
    CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
      EXPORTING
        I_STYLE_TABLE             =
        IT_FIELDCATALOG           = t_fcat
        I_LENGTH_IN_BYTE          =
      IMPORTING
       EP_TABLE                  = lo_table
        E_STYLE_FNAME             =
      EXCEPTIONS
        GENERATE_SUBPOOL_DIR_FULL = 1
        others                    = 2
    so lo_table is my dynamic internal table.
    ASSIGN lo_table->* TO <f_tab>.
    using the GUI_UPLOAD i have uploaded the data file(separated by semicolon)  from presentation server and its in the table itab.
    with the following logic i am capturing the data in between the semicolon's.
    LOOP AT itab INTO wa_itab.
    find all occurrences of c_semicolon in wsg_string results result_tab.
    loop at result_tab into wa_reslt.
    if sy-tabix = 1.
    str1 = wsg_string+0(wa_reslt-offset).
    wa_prev_offset  = wa_reslt-offset.
    wa_prev_offset = wa_prev_offset + 1.
    clear str1.
      else.
       count = wa_reslt-offset - wa_prev_offset.
       count = count.
    str2 = wsg_string+wa_prev_offset(count).
    clear str2.
    wa_prev_offset  = wa_reslt-offset.
    wa_prev_offset = wa_prev_offset + 1.
    enddo.
    endif.
    endloop.
    data is there in the fields str1 and str2.now i want to populate this data into dynamic internal table row-wise.
    could anyone suggest me how can i do this

  • How to populate data from dynamic drop down list to the text field

    Hi,
    I tried to populate data from dynamic drop down list to city field. I would like to concat data from drop down list.When selecting add button to add the item and select item from drop down list, data should be displayed in the text field. However, Please help. I spent alot of time to make it works I am not successful.
    Please see the link below.
    https://acrobat.com/#d=SCPS0eVi6yz13ENV0cnUdw
    Thanks for your help
    Cindy

    Hi Rosalin,
    Loop the hidden table, get the values and populate drop down in each iteration.
    DropDownList1.addItem("Text","Value");
    You can use one more solution for this scenario. If it is a matter of 2,3 dropdowns, put three dropDowns in the form layout and give seperate static data binding to them. At run time make the dropDowns hide/visible as per the requirement.
    Hope this helps.
    Thanks & Regards,
    Sanoosh

  • Can we get the data from two internal tables in ALV.

    hi friends i would like to display the data using two internal tables using alv grid.please guide me.

    Hi,
    ALV would be having a specific layout say :
    MATNR
    MAKTX
    QTY
    Now, if you have two internal tables, then do they have a different structure. If they have different structures, then what kind of ALV layout you expect. The ALV output should be as per the structure of 1st or 2nd internal table.
    If both internal table have same layout, then populate the data from 2nd internal table into 1st internal table and pass the 1st internal table ( it will have data of both internal tables) to ALV.
    Best regards,
    Prashant

  • How to get data  from an internal table in some other program

    I would like to get data from the internal table in the other program. When I using FM "LIST_FROM_MEMORY" to get the data, it doesn't work and the exception is not fount.
    If any special code need in the other program, like write data to memory .
    Many thx .
    From Ross Wang

    Hi
    <li>You need to have interaction if you want to use EXPORT/IMPORT statments.
    <li>The internal tables in both programs must be same
    <li>Program one ..Calling program
    REPORT ZTEST_NOTEPAD.
    DATA: BEGIN OF it_t001 OCCURS 0,
            bukrs TYPE t001-bukrs,
            butxt TYPE t001-butxt,
          END OF it_t001.
    START-OF-SELECTION.
      SUBMIT ztest_notepad1 AND RETURN.
      IMPORT it_t001 FROM MEMORY ID 'ZTEST_T100'.
      LOOP AT it_t001.
        WRITE:/ it_t001.
      ENDLOOP.
    <li>Program two ...Called program
    REPORT ztest_notepad1.
    DATA: BEGIN OF it_t001 OCCURS 0,
            bukrs TYPE t001-bukrs,
            butxt TYPE t001-butxt,
          END OF it_t001.
    START-OF-SELECTION.
      SELECT * FROM t001 INTO CORRESPONDING FIELDS OF TABLE it_t001 UP TO 10 ROWS.
      IF sy-dbcnt > 1.
        EXPORT it_t001 TO MEMORY ID 'ZTEST_T100'.
      ENDIF.
    I hope that it gets you some idea.
    Thanks
    Venkat.O

  • How to insert  data from different internal  table  into a data base table

    hi all,
             I want to insert a particular field in an internal table to a field in a data base table.Note that the fields in the internal table and database table are not of the same name since i need to insert data from different internal tables.can some one tell me how to do this?
    in short i want to do something like the foll:
    INSERT  INTO ZMIS_CODES-CODE VALUE '1'.
    *INSERT INTO ZMIS_CODES-COL1 VALUE DATA_MTD-AUFNR .(zmis_codes is the db table and data_mtd is the int.table)

    REPORT  ZINSERT.
    tables kna1.
    data: itab LIKE KNA1.
    data lv_kUNAG LIKE KNA1-KUNNR.
    lv_kuNAG =  '0000010223'.
    ITAB-kuNNR = lv_kuNAG.
    ITAB-name1 = 'XYZ'.
    INSERT INTO KNA1 VALUES ITAB.
    IF SY-SUBRC = 0.
    WRITE:/ 'SUCCESS'.
    ELSE.
    WRITE:/ 'FAILED'.
    ENDIF.
    Here lv_kunag is ref to kna1 kunnr passed in different name
    In internal table .
    Try and let me know if this logic dint work.

  • How to download data from an internal table to a text

    Hi All,
    I want to download data  from an internal table to a text file.
    The fields should be pipe(|) separated. I have tried GUI_DOWNLOAD but it is not taking the field separator.
    The sample of the desired data that i require should be this way:-
    13456TR|M|COUP|MATERIAL|KGS
    Thanks in advance.
    Regards
    Satish.

    Hi,
    Try this..
    REPORT  zc1download message-id zc1dwnmsg.
    *& Declaration Section for the Tables *
    TABLES: makt.
    *& Declaration Section for the Internal Tables
    DATA: intab TYPE TABLE OF makt,
          wa_intab LIKE LINE OF intab,
          no_of_rec TYPE i,
          count TYPE i.
    DATA: BEGIN OF f_intab,
            str(255) TYPE c,
          END OF f_intab.
    DATA: t_intab LIKE TABLE OF f_intab,
          w_intab LIKE LINE OF t_intab,
          temp(255) TYPE c.
    FIELD-SYMBOLS: <f> TYPE ANY.
    *& Selection ScreenSection for the file download
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS: file TYPE rlgrap-filename MEMORY ID file,
                tab RADIOBUTTON GROUP rad1 DEFAULT 'X',
                others RADIOBUTTON GROUP rad1,
                delimit TYPE c.
    SELECTION-SCREEN END OF BLOCK b1.
    START-OF-SELECTION.
      IF file IS INITIAL. " check to ensure file.
        MESSAGE i001.
        EXIT.
      ENDIF.
      IF others = 'X'.    " check to ensure delimiter.
        IF delimit = ' '.
          MESSAGE i002.
          EXIT.
        ENDIF.
      ENDIF.
      SELECT * FROM makt INTO TABLE intab.
      IF tab = 'X'.       " default delimiter tab is used
          CALL FUNCTION 'WS_DOWNLOAD'
          EXPORTING
            filename                = file
            filetype                = 'DAT'
            mode                    = 'A'
          TABLES
            data_tab                = intab
          EXCEPTIONS
            file_open_error         = 1
            file_write_error        = 2
            invalid_filesize        = 3
            invalid_type            = 4
            no_batch                = 5
            unknown_error           = 6
            invalid_table_width     = 7
            gui_refuse_filetransfer = 8
            customer_error          = 9
            no_authority            = 10
            OTHERS                  = 11.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ELSE.             " If user defind delimiter is to be used
                  Counts the number of fields                *
        DO.
          ASSIGN COMPONENT sy-index OF STRUCTURE wa_intab TO <f>.
          IF sy-subrc <> 0.
            EXIT.
          ELSE.
            count = count + 1.
          ENDIF.
        ENDDO.
        LOOP AT intab INTO wa_intab.
          DO count TIMES. " Adding the delimiter in required places
            ASSIGN COMPONENT sy-index OF STRUCTURE wa_intab TO <f>.
            CONCATENATE temp delimit <f> INTO temp.
          ENDDO.
          SHIFT temp.
          APPEND temp TO t_intab.
          CLEAR temp.
        ENDLOOP.
        CALL FUNCTION 'WS_DOWNLOAD'
          EXPORTING
            filename                = file
            filetype                = 'ASC'
            mode                    = 'A'
          TABLES
            data_tab                = t_intab
          EXCEPTIONS
            file_open_error         = 1
            file_write_error        = 2
            invalid_filesize        = 3
            invalid_type            = 4
            no_batch                = 5
            unknown_error           = 6
            invalid_table_width     = 7
            gui_refuse_filetransfer = 8
            customer_error          = 9
            no_authority            = 10
            OTHERS                  = 11.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ENDIF.
      WRITE:/ 'The Data has been tranfered to :', file.
    Cheers
    Kathir!~

Maybe you are looking for