Can Internal Table be declared dynamically

Hi All ,
     iam facing a problem in delearing an internal table ,i let u know the query and the problem iam facing in that .
Nothing but the include is used for the Replacment of a interface .
1.iam trying to use an include which is called by nearly 100 programs .
2.since i dont know the number of fields each program is using .
   since in the include i have to create a internal table that has to fullfill the needs of each and every program that uses this include .
DATA:   objbin TYPE STANDARD TABLE OF solisti1 INITIAL
        SIZE 0 WITH HEADER LINE.
internal table has to be created using the above table.
example .
program 1 may be having 4 fields ,and program 2 may be having 5 fields .
can some one help me on this.
Thanks,
vinay .

use
REPORT ZUTIL_SEARCH_STRUCTURE MESSAGE-ID 031 .
INCLUDE yDATA_TOP.
INCLUDE ySEL_SCREEN.
INCLUDE yFORMS.
INITIALIZATION.
  P4 = 2.
  P5 = 1.
AT SELECTION-SCREEN.
  IF P4 <= 0 OR P5 <= 0.
    MESSAGE E031 WITH 'Search Criteria Cannot be Zero!'.
  ENDIF.
START-OF-SELECTION.
  PERFORM DYNAMIC_CODE.
*&  Include           YDATA_TOP                                        *
DATA : ITAB(72) OCCURS 0.
  DATA WA(200).
  DATA REC_CNT(3).
*&  Include           YSEL_SCREEN                                      *
SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-001.
  PARAMETERS:P1 RADIOBUTTON GROUP COMP.
  PARAMETERS:P2 RADIOBUTTON GROUP COMP.
  PARAMETERS:P3 RADIOBUTTON GROUP COMP.
  SELECTION-SCREEN END OF BLOCK BLK.
  SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-002.
  PARAMETERS : P4(3) OBLIGATORY.
  PARAMETERS : P5(5) OBLIGATORY .
  PARAMETERS : P6 AS CHECKBOX.
  SELECTION-SCREEN END OF BLOCK BLK1.
*&  Include           YFORMS                                           *
***INCLUDE ZFORMS .
*&      Form  DYNAMIC_CODE
      text
-->  p1        text
<--  p2        text
FORM DYNAMIC_CODE.
  APPEND 'REPORT ZSEARCH NO STANDARD PAGE HEADING.' TO ITAB.
  APPEND 'TABLES : DD03L,DD02L.' TO ITAB.
  DATA TAB LIKE TEXTPOOL OCCURS 0 WITH HEADER LINE.
  APPEND 'SELECTION-SCREEN BEGIN OF BLOCK BLK' TO ITAB.
  APPEND 'WITH FRAME TITLE TEXT-001.' TO ITAB.
  DO P4 TIMES.
    REC_CNT = SY-INDEX.
    CONDENSE REC_CNT NO-GAPS.
    IF P1 = 'X'.
      CONCATENATE 'PARAMETERS:F' REC_CNT
      ' LIKE DD03L-FIELDNAME OBLIGATORY.'
      INTO WA.
      APPEND WA TO ITAB.
      TAB-ID = 'S'.
      CONCATENATE 'F'   REC_CNT  INTO WA.
      TAB-KEY = WA.
      CONCATENATE'$$$$$$$$' 'Field Name' REC_CNT  INTO WA.
      TAB-ENTRY = WA.
    ENDIF.
    IF P2 = 'X'.
      CONCATENATE 'PARAMETERS:D' REC_CNT
      ' LIKE DD03L-ROLLNAME OBLIGATORY.'
      INTO WA.
      APPEND WA TO ITAB.
      TAB-ID = 'S'.
      CONCATENATE 'D'   REC_CNT  INTO WA.
      TAB-KEY = WA.
      CONCATENATE'$$$$$$$$' 'Data Element' REC_CNT  INTO WA.
      TAB-ENTRY = WA.
    ENDIF.
    IF P3 = 'X'.
      APPEND 'SELECTION-SCREEN BEGIN OF LINE.' TO ITAB.
      CONCATENATE 'SELECTION-SCREEN COMMENT (15) FOR FIELD DT'
      REC_CNT '.' INTO WA.
      APPEND WA TO ITAB.
      CONCATENATE 'PARAMETERS:DT' REC_CNT
      ' LIKE DD03L-DATATYPE OBLIGATORY.'
      INTO WA.
      APPEND WA TO ITAB.
      CONCATENATE 'SELECTION-SCREEN COMMENT (16) FOR FIELD SIZE'
      REC_CNT '.' INTO WA.
      APPEND WA TO ITAB.
      CONCATENATE 'PARAMETERS:SIZE' REC_CNT
      ' LIKE DD03L-LENG OBLIGATORY.' INTO WA.
      APPEND WA TO ITAB.
      APPEND 'SELECTION-SCREEN END OF LINE.' TO ITAB.
      TAB-ID = 'S'.
      CONCATENATE 'DT'   REC_CNT  INTO WA.
      TAB-KEY = WA.
      CONCATENATE'$$$$$$$$' 'Data Type' REC_CNT  INTO WA.
      TAB-ENTRY = WA.
      APPEND TAB.
      TAB-ID = 'S'.
      CONCATENATE 'SIZE'   REC_CNT  INTO WA.
      TAB-KEY = WA.
      CONCATENATE'$$$$$$$$' 'Len. of Field' REC_CNT  INTO WA.
      TAB-ENTRY = WA.
    ENDIF.
    APPEND TAB.
  ENDDO.
  APPEND 'SELECTION-SCREEN END OF BLOCK BLK.' TO ITAB.
  APPEND 'DATA: BEGIN OF IT_FLD OCCURS 0,' TO ITAB.
  APPEND 'FIELDNAME TYPE DD03L-FIELDNAME,' TO ITAB.
  APPEND 'LENG TYPE DD03L-LENG,' TO ITAB.
  APPEND 'ROLLNAME LIKE DD03L-ROLLNAME,' TO ITAB.
  APPEND 'DATATYPE LIKE DD03L-DATATYPE,' TO ITAB.
  APPEND 'END OF IT_FLD.' TO ITAB.
  APPEND  'DATA : BEGIN OF IT_STRUCNAME OCCURS 0,' TO ITAB.
  APPEND 'TABNAME LIKE DD02L-TABNAME,' TO ITAB.
  APPEND  'END OF IT_STRUCNAME.' TO ITAB.
  APPEND 'DATA : BEGIN OF IT_MATCH OCCURS 0,' TO ITAB.
  APPEND 'TABNAME LIKE DD02L-TABNAME,' TO ITAB.
  APPEND 'END OF IT_MATCH.' TO ITAB.
  APPEND 'DATA COUNT(3) TYPE I.' TO ITAB.
  APPEND 'START-OF-SELECTION.' TO ITAB.
  DO P4 TIMES.
    REC_CNT = SY-INDEX.
    CONDENSE REC_CNT NO-GAPS.
    IF P1 = 'X'.
      CONCATENATE 'IT_FLD-FIELDNAME = ' '$' 'F' REC_CNT '.' INTO WA.
    ENDIF.
    IF P2 = 'X'.
      CONCATENATE 'IT_FLD-ROLLNAME = ' '$' 'D'
      REC_CNT '.' INTO WA.
    ENDIF.
    IF P3 = 'X'.
      CONCATENATE 'IT_FLD-DATATYPE = ' '$' 'DT'
      REC_CNT '.' INTO WA.
      REPLACE '$' WITH SPACE INTO WA.
      APPEND WA TO ITAB.
      CONCATENATE 'IT_FLD-LENG = ' '$' 'SIZE'
      REC_CNT '.' INTO WA.
    ENDIF.
    REPLACE '$' WITH SPACE INTO WA.
    APPEND WA TO ITAB.
    APPEND 'APPEND IT_FLD.' TO ITAB.
  ENDDO.
  CONCATENATE 'SELECT DISTINCT TABNAME FROM DD03L'
  'INTO TABLE IT_STRUCNAME'
  INTO WA
  SEPARATED BY SPACE.
  APPEND WA TO ITAB.
  APPEND 'FOR ALL ENTRIES IN IT_FLD' TO ITAB.
  IF P1 = 'X'.
    CONCATENATE  'WHERE FIELDNAME = IT_FLD-FIELDNAME AND'
    'AS4LOCAL = ''A'' .' INTO WA
    SEPARATED BY SPACE.
  ENDIF.
  IF P2 = 'X'.
    CONCATENATE  'WHERE ROLLNAME = IT_FLD-ROLLNAME AND'
    'AS4LOCAL = ''A'' .' INTO WA
    SEPARATED BY SPACE.
  ENDIF.
  IF P3  = 'X'.
    CONCATENATE  'WHERE DATATYPE = IT_FLD-DATATYPE AND'
                 'LENG = IT_FLD-LENG AND'
                  INTO WA
     SEPARATED BY SPACE.
    APPEND WA TO ITAB.
    WA =  'AS4LOCAL = ''A'' .' .
  ENDIF.
  APPEND WA TO ITAB.
  APPEND 'LOOP AT IT_STRUCNAME.' TO ITAB.
  IF P6 = 'X'.
    APPEND 'CLEAR DD02L-ACTFLAG.' TO ITAB.
    APPEND 'SELECT SINGLE ACTFLAG FROM DD02L' TO ITAB.
    APPEND 'INTO DD02L-ACTFLAG WHERE TABNAME = ' TO ITAB.
    APPEND 'IT_STRUCNAME-TABNAME' TO ITAB.
    APPEND 'AND AS4LOCAL = ''A''' TO ITAB.
    CONCATENATE
    'AND TABCLASS IN ( '
    '''VIEW'''
    '''APPEND'''
    '''INTTAB'''
    INTO WA.
    APPEND WA TO ITAB.
    APPEND 'IF SY-SUBRC EQ 0.' TO ITAB.
  ENDIF.
  APPEND 'DESCRIBE TABLE IT_MATCH.' TO ITAB.
  CONCATENATE 'IF SY-TFILL =' P5 '.' INTO WA SEPARATED BY SPACE.
  APPEND WA TO ITAB.
  APPEND 'EXIT.' TO ITAB.
  APPEND 'ENDIF.' TO ITAB.
  APPEND 'CLEAR COUNT.' TO ITAB.
  DO P4 TIMES.
    REC_CNT = SY-INDEX.
    APPEND 'CLEAR DD03L-AS4LOCAL.' TO ITAB.
    CONDENSE REC_CNT NO-GAPS.
    IF P1 = 'X'.
      APPEND
        'SELECT SINGLE AS4LOCAL  FROM DD03L INTO' TO
          ITAB.
      APPEND 'DD03L-AS4LOCAL' TO ITAB.
      CONCATENATE 'WHERE TABNAME = '
       'IT_STRUCNAME-TABNAME'
       INTO WA SEPARATED BY SPACE.
      APPEND WA TO ITAB.
      CONCATENATE 'AND FIELDNAME ='
      '$'
      'F' REC_CNT '$'  INTO WA.
      REPLACE '$' WITH SPACE INTO WA.
      REPLACE '$' WITH SPACE INTO WA.
    ENDIF.
    IF P2 = 'X'.
      APPEND
     'SELECT SINGLE AS4LOCAL  FROM DD03L INTO' TO
      ITAB.
      APPEND 'DD03L-AS4LOCAL' TO ITAB.
      CONCATENATE 'WHERE TABNAME = '
      'IT_STRUCNAME-TABNAME'
      INTO WA SEPARATED BY SPACE.
      APPEND WA TO ITAB.
      CONCATENATE 'AND ROLLNAME ='
      '$'
      'D' REC_CNT '$'  INTO WA.
      REPLACE '$' WITH SPACE INTO WA.
      REPLACE '$' WITH SPACE INTO WA.
    ENDIF.
    IF P3 = 'X'.
      APPEND
       'SELECT SINGLE AS4LOCAL  FROM DD03L INTO'
        TO  ITAB.
      APPEND 'DD03L-AS4LOCAL' TO ITAB.
      CONCATENATE 'WHERE TABNAME = '
     'IT_STRUCNAME-TABNAME'
      INTO WA SEPARATED BY SPACE.
      APPEND WA TO ITAB.
      CONCATENATE 'AND DATATYPE ='
      '$'
      'DT' REC_CNT INTO WA.
      REPLACE '$' WITH SPACE INTO WA.
      APPEND WA TO ITAB.
      CONCATENATE 'AND LENG =' '$' 'SIZE'
      REC_CNT INTO WA.
      REPLACE '$' WITH SPACE INTO WA.
    ENDIF.
    APPEND WA TO ITAB.
    IF P6 = 'X'.
      CONCATENATE 'AND POSITION = ' REC_CNT INTO WA
      SEPARATED BY SPACE.
      APPEND WA TO ITAB.
    ENDIF.
    APPEND  'AND AS4LOCAL = ''A'' .' TO ITAB.
    APPEND 'IF SY-SUBRC EQ 0.' TO ITAB.
    APPEND 'COUNT = COUNT + 1.' TO ITAB.
    APPEND 'ELSE.' TO ITAB.
    APPEND 'CONTINUE.' TO ITAB.
    APPEND 'ENDIF.' TO ITAB.
  ENDDO.
  CONCATENATE 'IF COUNT =' '$' P4  '.' INTO WA SEPARATED  BY SPACE.
  REPLACE '$' WITH SPACE INTO WA.
  APPEND WA TO ITAB.
  APPEND 'CLEAR IT_MATCH.' TO ITAB.
  APPEND 'IT_MATCH-TABNAME = IT_STRUCNAME-TABNAME.' TO ITAB.
  APPEND 'APPEND IT_MATCH.' TO ITAB.
  APPEND 'ENDIF.' TO ITAB.
  IF P6 = 'X'.
    APPEND 'ENDIF.' TO ITAB.
  ENDIF.
  APPEND 'ENDLOOP.' TO ITAB.
  APPEND 'SORT IT_MATCH BY TABNAME.' TO ITAB.
  APPEND 'WRITE :/25'  TO ITAB.
  APPEND  '''List of Structure(s) Matching the Criteria:''' TO ITAB.
  APPEND  'COLOR 4 ON.' TO ITAB.
  APPEND 'WRITE:/.' TO ITAB.
  APPEND 'WRITE:/33(33) SY-ULINE .' TO ITAB.
  APPEND'WRITE:/33 SY-VLINE,' TO ITAB.
  APPEND '34 ''Structure Name'' COLOR 2 ON,65 SY-VLINE.'
  TO ITAB.
  APPEND 'WRITE:/33(33) SY-ULINE .' TO ITAB.
  APPEND 'LOOP AT IT_MATCH.'
                             TO ITAB.
  APPEND
  'WRITE:/33 SY-VLINE,34'
  TO ITAB.
  APPEND
  'IT_MATCH-TABNAME'
  TO ITAB.
  APPEND
  ',65 SY-VLINE. '
  TO ITAB.
  APPEND 'ENDLOOP.' TO ITAB.
  APPEND 'WRITE:/33(33) SY-ULINE .' TO ITAB.
  INSERT REPORT 'ZSEARCH' FROM ITAB.
  IF P1 = 'X'.
    TAB-ID = 'I'.
    TAB-KEY = '001'.
    TAB-ENTRY = 'Enter the Field Names to be Seached:'.
    APPEND TAB.
  ENDIF.
  IF P2 = 'X'.
    TAB-ID = 'I'.
    TAB-KEY = '001'.
    TAB-ENTRY = 'Enter the Data Elements to be Seached:'.
    APPEND TAB.
  ENDIF.
  IF P3 = 'X'.
    TAB-ID = 'I'.
    TAB-KEY = '001'.
    TAB-ENTRY = 'Enter the Data Types and  Lengths to be Seached:'.
    APPEND TAB.
  ENDIF.
  TAB-ID = 'R'.
  TAB-KEY = SPACE.
  TAB-ENTRY = 'Searches Structures/Tables'.
  APPEND TAB.
  INSERT TEXTPOOL 'ZSEARCH'  FROM TAB LANGUAGE SY-LANGU.
  SUBMIT ZSEARCH VIA SELECTION-SCREEN AND RETURN.
  DELETE REPORT 'ZSEARCH'.
ENDFORM.                    " DYNAMIC_CODE
Plz reward points and close the thread..
gunjan

Similar Messages

  • Creating Dynamic Internal table with a dynamic name

    Hi,
    I want to create dynamic internal tables with dynamic names.
    For example:
    Suppose I have a table with three fields.
    1. Structure name
    2.Fields
    3.file
    And the structure of the internal table is as follows:
    TYPES:BEGIN OF table_type,
          struct                  TYPE char70,
          fields                   TYPE tt_type OCCURS 0,
          File                      TYPE ttab_type OCCURS 0,
          END OF table_type.
    Suppose I have one record inside my internal table with struct as "STRUCTURE", fields have an internal table content of set of fields and File has some set of records.
    Now I want to create dynamic internal table whose name will be "STRUCTURE" , the fields of the dynamic internal table structure[] will be as in fields, and the records will be as in File.
    Like this if i have 100 records in my internal table then I have to create 100 dynamic internal table dynamically.
    Can anyone suggest how to do this?
    Edited by: Jjammy on Jul 22, 2009 7:52 AM

    Hi,
    Check the sample program and develop your program accordingly.
    <font color=blue><pre>
    REPORT  ztest_notepad.
    *& Declarations
    *Type-pools
    TYPE-POOLS:
          slis.
    *Types
    TYPES:
          ty_fcat      TYPE lvc_s_fcat,
          ty_fcatalog  TYPE slis_fieldcat_alv.
    *Work areas
    DATA:
          wa_fcat      TYPE ty_fcat,
          wa_fcatalog  TYPE ty_fcatalog.
    *Internal tables
    DATA:
          it_fcat      TYPE STANDARD TABLE OF ty_fcat,
          it_fcatalog  TYPE STANDARD TABLE OF ty_fcatalog.
    *Type reference
    DATA:
          it_dyn_tab   TYPE REF TO data,
          wa_newline   TYPE REF TO data.
    *Filed symbols
    FIELD-SYMBOLS:
          <gt_table>   TYPE STANDARD TABLE,
          <fs_dyntable>,
          <fs_fldval>  TYPE ANY,
          <l_field>    TYPE ANY.
    *Variables
    DATA:
          l_fieldname  TYPE lvc_s_fcat-fieldname,
          l_tabname    TYPE lvc_s_fcat-tabname,
          l_fieldtext  TYPE lvc_s_fcat-seltext,
          l_index      TYPE char2.
    "Selection-screen
    PARAMETERS:
             p_colms   TYPE i.
    *& start-of-selection.
    START-OF-SELECTION.
      PERFORM build_fieldcat.
      PERFORM create_dynamic_table.
      DO 20 TIMES.
        DO p_colms TIMES.
          l_index = sy-index.
          CONCATENATE 'FIELD' l_index INTO l_fieldname.
          ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
          <l_field> = sy-index.
        ENDDO.
        INSERT <fs_dyntable> INTO TABLE <gt_table>.
      ENDDO.
      LOOP AT it_fcat INTO wa_fcat.
        PERFORM fieldcatalog1 USING: wa_fcat-fieldname
                                      wa_fcat-tabname
                                      wa_fcat-seltext.
      ENDLOOP.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program = 'ZTEST_NOTEPAD'
          it_fieldcat        = it_fcatalog
        TABLES
          t_outtab           = <gt_table>.
    *&      Form  BUILD_FIELDCAT
    FORM build_fieldcat .
      CLEAR: l_fieldname,
             l_tabname,
             l_fieldtext,
             l_index.
      DO  p_colms TIMES.
        CLEAR l_index.
        l_index = sy-index.
        CONCATENATE 'FIELD' l_index INTO l_fieldname.
        CONCATENATE 'Field' l_index INTO l_fieldtext.
        l_tabname = '<GT_TABLE>'.
        PERFORM fieldcatalog USING: l_fieldname
                                    l_tabname
                                    l_fieldtext.
      ENDDO.
    ENDFORM.                    " BUILD_FIELDCAT
    *&      Form  CREATE_DYNAMIC_TABLE
    FORM create_dynamic_table .
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = it_fcat
        IMPORTING
          ep_table        = it_dyn_tab.
      ASSIGN it_dyn_tab->* TO <gt_table>.
    Create dynamic work area and assign to FS
      CREATE DATA wa_newline LIKE LINE OF <gt_table>.
      ASSIGN wa_newline->* TO <fs_dyntable>.
    ENDFORM.                    " CREATE_DYNAMIC_TABLE
    *&      Form  FIELDCATALOG
    FORM fieldcatalog USING field table f_txt.
      wa_fcat-fieldname = field.
      wa_fcat-tabname   = table.
      wa_fcat-seltext = f_txt.
      APPEND wa_fcat TO it_fcat.
      CLEAR  wa_fcat.
    ENDFORM.                    " FIELDCATALOG
    *&      Form  FIELDCATALOG1
    FORM fieldcatalog1 USING field table f_txt.
      wa_fcatalog-fieldname = field.
      wa_fcatalog-tabname   = table.
      wa_fcatalog-seltext_m = f_txt.
      APPEND wa_fcatalog TO it_fcatalog.
      CLEAR  wa_fcatalog.
    ENDFORM.                    " FIELDCATALOG1 </pre>
    </font>
    Thanks
    Venkat.O

  • How to check if internal table exists in dynamical called subroutine ?

    Hi,
    in a dynamically called subroutine i'm using a internal table, but in some calls this table is not exist.
    How can i check in the code whether the internal table exist or not ?
    regards,
    Hans

    In Horst Keller's blog /people/horst.keller/blog/2005/05/27/abap-geek-10--everything-functions-150-but-how my issue is talked about :
    All other parameters are handled in a way as they were declared as global data objects in the top include of the function group, that can be used only during the execution of the function module: They are visible throughout the function group but you can access them only while the function module is active. If you access such a parameter and the respective function module is not executed, you get the runtime error GETWA_NOT_ASSIGNED (Why? Well, technically thos guys are represented via field symbols which are valid only during the runtime of the function module).
    The code is in SD pricing. Sometimes the code is called from function module PRICING_BUILD_XKOMV or PRICING_SUBSCREEN_PBO where TKOMV is defined as globalized parameter.
    And sometimes it is called from function module PRCING_CHECK where TKOMV is NOT defined as parameter.
    In the call of last function the dump occures on the ASSIGN statement :
         data: ls_tkomv like line of tkomv,
                  lv_tablename(30) type c value 'TKOMV[]'.
        field-symbols: <lfs> type any table.
         assign (lv_tablename) to <lfs>.
         if <lfs> is assigned.
    Any suggestions to solve the issue ?
    regards,
    Hans

  • How much data can internal tables store?

    ABAPers,
    The function module that I am writing gets used by many of our customers. This module needs to store data temporily for further processing. Depending on individual customer's needs, the storage could be as little as 10000 records or it could run into millions of records.
    While doing my research, I cam across this quote:
    If you expect the size of your list to be greater than
    the amount of memory you want your program to use, then
    use field-groups (actually, if you use internal tables,
    and the number of records exceeds the number of records
    in your OCCURS statement, the system just writes those
    extra records to the paging space. So is there really any
    difference between just using an internal table with an
    OCCURS 0 statement-- which would write the entire table
    to paging space-- and using field-groups? According to
    Gareth M. de Bruyn and Robert Lyfareff in Introduction to
    ABAP/4 Programming for SAP, field-groups are stored more
    efficiently, and have better performance. They recommend
    field-groups for lists of 100,000 or more records).
    Questions:
    1. Is it true that internal tables can store any amount of records, irrespective of the amount of physical memory?
    2. For "OCCURS 0", are all the records ALWAYS stored in the paging space? Or, does the ABAP engine does virtual paging much like an operating system?
    Thank you in advance for your help.
    Pradeep

    Two good questions.......  here are two NOT so good answers.
    1)  The number of records that you are allow in your internal table(s) is limited to a cap for your session.  This is is a system setting.  When you reach the cap, program will end.
    2) You should not be using OCCURS extension anyway, always use TYPE TABLE OF.
    Regards,
    Rich Heilman

  • Modify the structure of internal table which created dynamically!!!

    HI All,
    I am creating internal table dynamically using the below syntax.  Now I need to remove few of the fields from the internal table structure. Could you please help me how to go ahead in these cases?
    * Create table dynamically for local data
      CREATE DATA gv_table_l TYPE TABLE OF (<fs_tabname>).
      CREATE DATA gv_wa_l    TYPE (<fs_tabname>).
      ASSIGN gv_table_l->*   TO <fs_local_tab>.
      ASSIGN gv_wa_l->*      TO <fs_local_wa
    >.
    Please let me know if you have any thoughts.
    Thanks,
    Raghu.

    Hi ,
    check this wiki
    [Internal Table|http://wiki.sdn.sap.com/wiki/display/Snippets/Howtocreateinternaltable+dynamically]
    in your case ...
    1.Get filed list based on the type ...make use of  "cl_abap_datadescr=>describe_by_type('MARA'), check for syntax or sample programs...
    2.Delete fields which you dont want to be in your internal table....
    3.Create internal table using method " CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE" ref attached link for sample code by Pinaki...
    regards
    Prabhu

  • Can display:table used for dynamically varring column

    Dear All,
    i am new in JSP,Struts development, can any help me regarding the issue as follows:
    i would like to show the record of table (from Database that i fetch in Array list in which according to table the column is varring )on the JSP
    so any one tell me that how can implement this
    or there is any other way that i should follow.
    since i could not show much more record on JSP at a time so pagination is requered so , i would like to use display tag.
    thanks in advance
    ajju

    please help me i am stuck on this issue

  • How to LOOP AT dynamic internal tables.

    I have an internal table name declared in field I_DYN_TAB with me and I want to loop at this I_DYN_TAB.
    ( 4 example:
    DATA: I_DYN_TAB(10) VALUE 'I_TAB'.
    where I_TAB is my internal table with data in it.)
    I already tried couple of things.
    A. READ TABLE (I_DYN_TAB) WITH KEY I_DYN_TAB-FIELD1
    but, it is not allowing me to read it dynamically this way.
    B. LOOP AT (I_DYN_TAB). Again this is also not working.
    Another option I tried is to create a field symbol for the internal table, which again is not useful or may be I am doing it wrong.
    So if anybody can help me in solving this problem, it would be great.
    Waiting for reply.
    Regards
    Arpit

    U can use
    ASSIGN COMPONENT...
    Eg:
    FIELD-SYMBOLS: <dyn_field>,
                     <dyn_field1>,
                     <dyn_field2>,
                     <dyn_field3> TYPE ANY .
    * Test when UOM, 'KMEIN' is '%'
    *        <b>ASSIGN COMPONENT 'KMEIN' OF STRUCTURE p_line1 TO <dyn_field1>.</b>
    *        ASSIGN COMPONENT 'KBETR' OF STRUCTURE p_line1 TO <dyn_field2>.
    *        ASSIGN COMPONENT 'KBETR' OF STRUCTURE p_line1 TO <dyn_field>.
    * Test when Curr, 'KONWA' is '%'
            ASSIGN COMPONENT 'KONWA' OF STRUCTURE p_line1 TO <dyn_field1>.
            ASSIGN COMPONENT 'KBETR' OF STRUCTURE p_line1 TO <dyn_field2>.
            ASSIGN COMPONENT 'KBETR' OF STRUCTURE p_line1 TO <dyn_field>.
            IF <dyn_field1> = '%'.
              <dyn_field> =  <dyn_field2> / 10.
            ENDIF.
            if <dyn_field2> LE -1.
              <dyn_field> = <dyn_field> * -1.
            endif.
              INSERT p_line1 INTO TABLE p_output1.
    Hope this helps.

  • 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

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

  • TSV_TNEW_PAGE_ALLOC_FAILED  with internal table declared with occurs 0

    HI guys,
    when the internal table is declared as occurs 0, the dump TSV_TNEW_PAGE_ALLOC_FAILED is encountered, when changing the declaration into standard table, th dump disappears. Why is this so?
    Thanks!

    There are three type of tables: Standard, sorted and hashed tables (see [here|http://help.sap.com/abapdocu_70/en/ABAPDATA_ITAB.htm]). When you define a table using the keyword OCCURS you're still defining a standard table.
    Your exception indicates that you're running out of memory. The difference in the declarations that you mention shouldn't cause that. Main difference between the two declaration versions is probably that your table defined via OCCURS has a header line, whereas your other table doesn't (unless you declared it explicitly as WITH HEADER LINE).
    I don't think though that with that little information anybody could explain the short dump. Actually it sounds rather odd that the change you mention should cause the dump (or make it go away). So I suspect you probably have to post further details. You might want to check the shortdump yourself and place a breakpoint at this place and run it for each version. Maybe you can see some difference...

  • 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

  • Splitting a string into respective fields of dynamic internal table

    Hi,
        I've a string concatenated with a separator. I've to split the string and assign it to the respective fields of an internal table, which is dynamic.
    Table name will be passed through selection screen. The data is coming from another system via RFC.
    Eg : String ITAB :
                                100;89001;EN;Material1;MATERIAL1
                                100;89002;EN;Material2;MATERIAL2
    The String ITAB may contain any master data. Let's say the above data is from MAKT table. So, I want to assign the above data to the respective fields of MAKT internal table(Dynamic).
    I heard, this requirement can be achieved using some standard CLASS.
    Please help me in doing this task.
    Regards,
    Sunny

    Hello,
    you can use dynamic programming for this issue, i.e.:
    DATA: gv_table_name   TYPE string,
          gr_type_desc    TYPE REF TO cl_abap_typedescr,
          gr_struct_desc  TYPE REF TO cl_abap_structdescr,
          gr_table_desc   TYPE REF TO cl_abap_tabledescr,
          gv_t            TYPE c,
          gv_comp         TYPE i,
          gr_table_ref    TYPE REF TO data,
          gr_struc_ref   TYPE REF TO data.
    DATA: gt_itab   TYPE TABLE OF string,
          gt_split  TYPE TABLE OF string,
          gv_str    TYPE string.
    FIELD-SYMBOLS: <table>    TYPE ANY TABLE,
                   <struct>   TYPE ANY,
                   <comp>     TYPE ANY.
    APPEND '100;89001;EN;Material1;MATERIAL1' TO gt_itab.
    APPEND '100;89002;EN;Material2;MATERIAL2' TO gt_itab.
    "go!
    gv_table_name = 'MAKT'.
    cl_abap_tabledescr=>describe_by_name(
          EXPORTING p_name = gv_table_name
          RECEIVING p_descr_ref = gr_type_desc
          EXCEPTIONS type_not_found = 4 ).
    gr_struct_desc ?= gr_type_desc.
    gr_table_desc = cl_abap_tabledescr=>create( gr_struct_desc ).
    CREATE DATA gr_table_ref TYPE HANDLE gr_table_desc.
    CREATE DATA gr_struc_ref TYPE HANDLE gr_struct_desc.
    ASSIGN gr_table_ref->* TO <table>.
    ASSIGN gr_struc_ref->* TO <struct>.
    DESCRIBE FIELD <struct> TYPE gv_t COMPONENTS gv_comp.
    LOOP AT gt_itab INTO gv_str.
      CLEAR: gt_split.
      SPLIT gv_str AT ';' INTO TABLE gt_split.
      DO gv_comp TIMES.
        READ TABLE gt_split INTO gv_str INDEX sy-index.
        ASSIGN COMPONENT sy-index OF STRUCTURE <struct> TO <comp>.
        <comp> = gv_str.
        CLEAR gv_str.
      ENDDO.
      INSERT <struct> INTO TABLE <table>.
    ENDLOOP.
    After this code you will have all data in <table> field symbol in proper type.
    Regards,
    Jacek

  • 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

  • Add column in the dynamic internal table

    Hi Experts,
    I have a dynamic internal table. I need add new column in the internal table and I don´t Know.
    My code:
    DATA:  it_generic TYPE REF TO Data,
    wa_generic TYPE REF TO data.
    FIELD-SYMBOLS: <table> TYPE ANY TABLE,
    <wa>    TYPE ANY,
    <field> TYPE ANY.
    CREATE DATA it_generic  TYPE STANDARD TABLE OF (wa_datoscarga-ZTBLCAR).
    CREATE DATA wa_generic  TYPE (wa_datoscarga-ZTBLCAR).
    ASSIGN it_generic->* TO <table>.
    CHECK <table> IS ASSIGNED.
    ASSIGN wa_generic->* TO <wa>.
    CHECK <wa> IS ASSIGNED.
    SELECT *
    INTO  CORRESPONDING FIELDS OF TABLE <table>
    FROM (wa_datoscarga-ZTBLCAR)
    WHERE  bukrs   EQ p_bukrs      AND
    z_petic EQ z_peticion   AND
    ZIDFASE eq 'E'.
    After this I need add one column selection at the first position of the columns.
    Thanks

    Hi,
    Please refer to the below link for the code snippet on how to create a dynamic internal table -
    [Create a dynamic internal table.|http://www.divulgesap.com/blog.php?p=MjE=]
    Cheers,
    Ravi

Maybe you are looking for

  • Idoc Not received on MII Message Listener

    Hi All, I am trying to post Idoc from R/3 to MII Server , but some how I am not getting it I have configured Destination, Parter, Partner Profile on the R/3 and Message Listener on MII. When I am trying to send Idoc from R/3 using BD10 transaction (I

  • Final Cut Pro 7 issues

    I have just recently upgraded to FCP 7 from 5.1 and I am having multiple problems with it. The main issue is that when I batch capture from My Panasonic DVX100 using 24p advanced pull-down the video on my computer after capture is out of sync by half

  • Using dynamic SQL (native) in triggers.

    Hi All: As a part of client requirement, I need to capture all column data from tables when rows get deleted. I am using a single table to capture deleted column data (not concatenated but one column data per row). I am using native dynamic SQL as I

  • Where to put feature requests?

    Hi! Just wanna ask if somebody knows where I can send my feature requests für iTunes. It is simply anoying when told that a file can't be found in the location where the library was told a file is saved. When I wanna see where it iTunes is looking fo

  • Outlook 2010 on Windows 7 stopped working (after many years) with Yahoo Mail since End Nov 2013

    Yahoo has made design changes to Yahoo month or so ago (Nov 2013). Yahoo now states the Outlook (amongst few other apps) does not work well with Yahoo and Outlook now needs another level of security set up on Yahoo account and a special password gene