How to create internal table dynamically?

hi all
I have a particular internal table in memory area( thru EXPORT TO MEMORY ID ....)
how can i create an internal table of this type in another program at runtime  ?
this internal table need not be a data dictionary type.
i.e., i need to create an internal table of type which
is stored in a particular memory-id.
Regards,
Naveen........
null

Hi,
Check this code :
TYPE-POOLS: slis.
FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE, 
                <fs_dyntable>,                    
                <fs_fldval> type any.             
PARAMETERS: p_cols(5) TYPE c.   
DATA:        t_newtable TYPE REF TO data,
             t_newline  TYPE REF TO data,
             t_fldcat   TYPE slis_t_fldcat_alv,
             t_fldcat   TYPE lvc_t_fcat,
             wa_it_fldcat TYPE lvc_s_fcat,
             wa_colno(2) TYPE n,
             wa_flname(5) TYPE c. 
* Create fields .
  DO p_cols TIMES.
    CLEAR wa_it_fldcat.
    move sy-index to wa_colno.
    concatenate 'COL'
                wa_colno
           into wa_flname.
    wa_it_fldcat-fieldname = wa_flname.
    wa_it_fldcat-datatype = 'CHAR'.
    wa_it_fldcat-intlen = 10.
    APPEND wa_it_fldcat TO t_fldcat.
  ENDDO. 
* Create dynamic internal table and assign to FS
  CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
      it_fieldcatalog = t_fldcat
    IMPORTING
      ep_table        = t_newtable. 
  ASSIGN t_newtable->* TO <t_dyntable>. 
* Create dynamic work area and assign to FS
  CREATE DATA t_newline LIKE LINE OF <t_dyntable>.
  ASSIGN t_newline->* TO <fs_dyntable>.
DATA it_fieldcatalog TYPE lvc_t_fcat.
DATA lr_table TYPE REF TO data.
FIELD-SYMBOLS <lt_table> TYPE table.
*-- Import the fieldcatalog
IMPORT it_fieldcatalog TO it_fieldcatalog
       FROM MEMORY ID 'CREATE_DYNAMIC_TABLE'.
IF sy-subrc <> 0.
  EXIT.
ENDIF.
*-- Create the dynamic table with the field catalog as structure
CALL METHOD cl_alv_table_create=>create_dynamic_table
  EXPORTING
    it_fieldcatalog           = it_fieldcatalog
  IMPORTING
    ep_table                  = lr_table
  EXCEPTIONS
    generate_subpool_dir_full = 1
    OTHERS                    = 2.
IF sy-subrc <> 0.
  EXIT.
ENDIF.
*-- Convert the reference into a table
ASSIGN lr_table->* TO <lt_table>.
IF sy-subrc <> 0.
  EXIT.
ENDIF.
*-- Export the created table so that the function module can import it
EXPORT lt_table FROM <lt_table>
       TO MEMORY ID 'CREATE_DYNAMIC_TABLE'.
Regards
L Appana

Similar Messages

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

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

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

  • Can we create internal table dynamically ? how?

    hi to all experts,
                           can we create internal table dynamically ? how?plz explain me with an example.Anybody with good example  will be rewarded.it was asked in an interview what the answer for it

    HI
    Yes you can create
    see this
    /people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap
    JUST USE THIS CODE AND DO THE ESSENTIAL CHANGES ACCORDING TO YOU
    STEP: 1 - get backend field catalog (currently displayed alv)
    CLEAR: tl_fieldcatalog. REFRESH: tl_fieldcatalog.
    CALL METHOD w_grid->get_backend_fieldcatalog
    IMPORTING
    et_fieldcatalog = tl_fieldcatalog.
    STEP: 2 - create a new fieldcatalog for dynamic internal table
    CLEAR: sl_fieldcatalog.
    CLEAR: t_outtab_fieldname. REFRESH: t_outtab_fieldname.
    CLEAR: tl_fieldcatalog_new. REFRESH: tl_fieldcatalog_new.
    CLEAR: t_download_fieldname. REFRESH: t_download_fieldname.
    CLEAR: t_download_fieldheading. REFRESH: t_download_fieldheading.
    LOOP AT tl_fieldcatalog INTO sl_fieldcatalog.
    STEP: 2.1 - populate data in T_OUTTAB_FIELDNAME
    APPEND sl_fieldcatalog-fieldname TO t_outtab_fieldname.
    STEP: 2.2 - populate TL_FIELDCATALOG_NEW & T_DOWNLOAD_FIELDNAME
    IF sl_fieldcatalog-no_out EQ ''.
    IF sl_fieldcatalog-fieldname NE 'STATUS'
    OR sl_fieldcatalog-fieldname NE 'MESG_STATUS'
    OR sl_fieldcatalog-fieldname NE 'ZLOCK'
    OR sl_fieldcatalog-fieldname NE 'T_PLANT'
    OR sl_fieldcatalog-fieldname NE 'T_CSR'.
    If field is COMM_PLANT, change its length
    IF sl_fieldcatalog-fieldname EQ 'COMM_PLANT'.
    sl_fieldcatalog-outputlen = 1800.
    sl_fieldcatalog-intlen = 1800.
    sl_fieldcatalog-dd_outlen = 1800.
    ENDIF. "comm_plant
    sl_fieldcatalog_new = sl_fieldcatalog.
    APPEND sl_fieldcatalog_new TO tl_fieldcatalog_new.
    APPEND sl_fieldcatalog-fieldname TO t_download_fieldname.
    APPEND sl_fieldcatalog-scrtext_l TO t_download_fieldheading.
    CLEAR: sl_fieldcatalog, sl_fieldcatalog_new.
    ENDIF.
    ENDIF.
    ENDLOOP.
    STEP: 3 - create dynamic internal table
    FREE: ref_download.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    I_STYLE_TABLE =
    it_fieldcatalog = tl_fieldcatalog_new
    IMPORTING
    ep_table = ref_download
    E_STYLE_FNAME =
    EXCEPTIONS
    generate_subpool_dir_full = 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.
    ASSIGN ref_download->* TO <ft_download>.
    CREATE DATA ref_wa LIKE LINE OF <ft_download>.
    ASSIGN ref_wa->* TO <fs_download>.
    STEP: 4 - populate data in dynamic internal table
    LOOP AT t_outtab INTO wa_outtab.
    LOOP AT t_download_fieldname.
    ASSIGN COMPONENT t_download_fieldname OF STRUCTURE
    <fs_download> TO <fs_download_field>.
    IF t_download_fieldname-field EQ 'COMM_PLANT'.
    STEP: 4.1 - get long text from database table
    CLEAR: wal_table.
    SELECT SINGLE * FROM zshaven_plnt_txt
    INTO wal_table
    WHERE vbeln = wa_outtab-vbeln
    AND posnr = wa_outtab-posnr
    AND del_no = wa_outtab-del_no
    AND del_itm = wa_outtab-del_itm.
    IF sy-subrc EQ 0.
    STEP: 4.2 - break long-text into separate lines
    CLEAR: tl_text. REFRESH: tl_text.
    SPLIT wal_table-plant_comm
    AT '~'
    INTO TABLE tl_text.
    STEP: 4.3 - Combine these separate lines with space in
    between two lines
    CLEAR: wal_text, final_text.
    LOOP AT tl_text INTO wal_text.
    IF final_text IS INITIAL.
    final_text = wal_text.
    ELSE.
    CONCATENATE final_text '-' wal_text
    INTO final_text.
    REPLACE '-' WITH ' ' INTO final_text.
    ENDIF.
    ENDLOOP.
    STEP: 4.4 - move long text to work-area
    <fs_download_field> = final_text.
    ENDIF. "subrc
    ELSE. "t_download_fieldname
    READ TABLE t_outtab_fieldname
    WITH KEY field = t_download_fieldname-field.
    ASSIGN COMPONENT t_outtab_fieldname-field OF STRUCTURE
    wa_outtab TO <fs_outtab_field>.
    <fs_download_field> = <fs_outtab_field>.
    ENDIF.
    ENDLOOP.
    STEP: 4.5 - Move data from work-area to dynamic internal table
    APPEND <fs_download> TO <ft_download>.
    CLEAR: <fs_download>.
    ENDLOOP.
    STEP: 5 - download
    CALL FUNCTION 'DOWNLOAD'
    EXPORTING
    filename = 'C:\zshaven.xls'
    filetype = 'DAT'
    filetype_no_show = 'X'
    filetype_no_change = 'X'
    TABLES
    data_tab = <ft_download>
    fieldnames = t_download_fieldheading
    EXCEPTIONS
    invalid_filesize = 1
    invalid_table_width = 2
    invalid_type = 3
    no_batch = 4
    unknown_error = 5
    gui_refuse_filetransfer = 6
    customer_error = 7
    OTHERS = 8.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

  • How to fill internal table dynamically

    Hi All,
       how to fill internal table dynamically.
    for example:
    begin of itab occurs 0,
    empid like pa0000-pernr,
    empname like pa0001-ename,
    grade(5),
    end of itab.
    now i want to append dynamically field itab-grade along with rest fields.
    is this possible?? if yes kindly let me know how to do that.
    Regards,
    Kiran I

    Hi kiran,
    To fill and create and internal table dynamically you can use this code.
    TYPE-POOLS: slis.
    DATA: it_fcat TYPE slis_t_fieldcat_alv,
          is_fcat LIKE LINE OF it_fcat.
    DATA: it_fieldcat TYPE lvc_t_fcat,
          is_fieldcat LIKE LINE OF it_fieldcat.
    DATA: new_table TYPE REF TO data.
    DATA: new_line  TYPE REF TO data.
    FIELD-SYMBOLS: <l_table> TYPE ANY TABLE,
                   <l_line>  TYPE ANY,
                   <l_field> TYPE ANY.
    is_fieldcat-fieldname = 'FIELD1'.
    is_fieldcat-ref_field = 'MATNR'.
    is_fieldcat-ref_table = 'MARA'.
    APPEND is_fieldcat TO it_fieldcat.
    is_fieldcat-fieldname = 'FIELD2'.
    is_fieldcat-ref_field = 'SPRPS'.
    is_fieldcat-ref_table = 'PA0001'.
    APPEND is_fieldcat TO it_fieldcat.
    is_fieldcat-fieldname = 'FIELD3'.
    is_fieldcat-ref_field = 'BEGDA'.
    is_fieldcat-ref_table = 'PA0002'.
    APPEND is_fieldcat TO it_fieldcat.
    Create a new Table
    CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
        it_fieldcatalog = it_fieldcat
      IMPORTING
        ep_table        = new_table.
    Create a new Line with the same structure of the table.
    ASSIGN new_table->* TO <l_table>.
    CREATE DATA new_line LIKE LINE OF <l_table>.
    ASSIGN new_line->* TO <l_line>.
    Test it...
    DO 40 times.
      ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <l_line> TO <l_field>.
      <l_field> = '12345'.
      ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <l_line> TO <l_field>.
      <l_field> = 'X'.
      ASSIGN COMPONENT 'FIELD3' OF STRUCTURE <l_line> TO <l_field>.
      <l_field> = '20030101'.
      INSERT <l_line> INTO TABLE <l_table>.
    ENDDO.
    LOOP AT <l_table> ASSIGNING <l_line>.
    ASSIGN COMPONENT 'field1' OF STRUCTURE <l_line> TO <l_field>.
      WRITE  / <l_line>.
    ENDLOOP.
    regards,
    Aashish Garg

  • How to create internal table for a structure in BSP

    hi ,
    I have created a Structure in BSP.I want to create an internal table for that Structure. But in my coding ie.
    <% data: begin of itab_1 .
                     include type zuvendstr.
                     data:end of itab_1.
                     data wa_str like line of itab_1.
                     loop at itab_1 into wa_str. %>
                    <tr>
                     <td><%=wa_str-name%> </td>
                           <%endloop.%>
    In this zuvendstr is Structure ,wa_str is workarea and itab_1 is an Internal table.But it is showinng an error that itab_1 is unknown.But we cannot define internal tables for an Structure in Page Attributes.So,please resolve how to create internal table for Structure in BSPS

    Hi,
    You can define itab_1 like this (assuming zuvendstr is a structure type):
    DATA: itab_1 TYPE TABLE OF zuvendstr.
    Regards,
    Tanguy

  • How to create internal table storing instances of ABAP class

    Hi experts, any one knows how to create internal table storing instances of ABAP class or alternative to implement such function?

    Hi
    Please see below example from ABAPDOCU, this might help you.
    Internal Table cnt_tab is used to store class objects.
    Regards,
    Vishal
    REPORT demo_objects_references.
    CLASS counter DEFINITION.
      PUBLIC SECTION.
        METHODS: set IMPORTING value(set_value) TYPE i,
                 increment,
                 get EXPORTING value(get_value) TYPE i.
      PRIVATE SECTION.
        DATA count TYPE i.
    ENDCLASS.
    CLASS counter IMPLEMENTATION.
      METHOD set.
        count = set_value.
      ENDMETHOD.
      METHOD increment.
        ADD 1 TO count.
      ENDMETHOD.
      METHOD get.
        get_value = count.
      ENDMETHOD.
    ENDCLASS.
    DATA: cnt_1 TYPE REF TO counter,
          cnt_2 TYPE REF TO counter,
          cnt_3 TYPE REF TO counter,
          cnt_tab TYPE TABLE OF REF TO counter.
    DATA number TYPE i.
    START-OF-SELECTION.
      CREATE OBJECT: cnt_1,
                     cnt_2.
      MOVE cnt_2 TO cnt_3.
      CLEAR cnt_2.
      cnt_3 = cnt_1.
      CLEAR cnt_3.
      APPEND cnt_1 TO cnt_tab.
      CREATE OBJECT: cnt_2,
                     cnt_3.
      APPEND: cnt_2 TO cnt_tab,
              cnt_3 TO cnt_tab.
      CALL METHOD cnt_1->set EXPORTING set_value = 1.
      CALL METHOD cnt_2->set EXPORTING set_value = 10.
      CALL METHOD cnt_3->set EXPORTING set_value = 100.
      DO 3 TIMES.
        CALL METHOD: cnt_1->increment,
                     cnt_2->increment,
                     cnt_3->increment.
      ENDDO.
      LOOP AT cnt_tab INTO cnt_1.
        CALL METHOD cnt_1->get IMPORTING get_value = number.
        WRITE / number.
      ENDLOOP.

  • How to create alv table dynamically by performing action on the button.

    Hi all,
    my requirement is to create alv table dynamically.
    that is i will create two buttons
    1) show alv table
    2) close alv table
    if user selects show alv table then the alv table should be displayed.
    and if user selects clsoe alv table then the alv table should be closed.
    to create alv table dynamically  i have followed this procedure.
    under view properties i have added salv_wd_table component. then under the action of showalvbutton i went to code wizard and i have selected instantiate used component component use salv_wd_table. the following code will be generated
    with this code i am unable to display alv table dynamically correct me where i went wrong kindly send me the necessary steps how to create alv table dynamically
    data lo_cmp_usage type ref to if_wd_component_usage.
    lo_cmp_usage =   wd_this->wd_cpuse_salv_wd_table( ).
    if lo_cmp_usage->has_active_component( ) is initial.
      lo_cmp_usage->create_component( ).
      endif.
    to close table i have used the following code. with this code i am able to achieve the functionality to delete the alv table
    data lo_cmp_usage type ref to if_wd_component_usage.
    lo_cmp_usage =   wd_this->wd_cpuse_salv_wd_table( ).
    if lo_cmp_usage->has_active_component( ) is initial.
      else.
      lo_cmp_usage->Delete_component( ).
    endif.
    Thanks & Regards,
    Naveen
    Edited by: naveen.webhelp on Feb 10, 2011 5:52 AM

    Hi
    ALV table will be shown in the viewcontainerUI element.
    it is shown there empty if you dont fill the node bound to the data node of the interface controller of the comp usage
    SALV_WD_TABLE.
    and if you are not getting the table filled in the first place.
    then check have you mapped the DATA node to some node in the comp controller
    wht basically is your requirment is that you want to show ALV gird on click of one button and delete it on click of other button.
    there are many ways to do so.
    best way is control the visiblity of the viewcontainer UI element which containes the TABLE view of SALV_WD_table comp.
    create an attribute of type WDUI_VISIBILITY name say VIS.
    now go to the layout and bound hte visible property of the viewcontainer to this attribute VIS.
    then in the showalv grid button's eventhandler write
    wd_context->set_attribute(
    name = 'VIS'
    value = '02'
    and in the wddoinit and delete alv grid button's event handler write
    wd_context->set_attribute(
    name = 'VIS'
    value = '01'
    thanks
    sarbjeet singh

  • Create internal table dynamically for IDoc fields

    Hi,
    I need to create an internal table dynamically based on the segment field names that are returned in the table pt_fields when calling function 'IDOCTYPE_READ_COMPLETE'.  I see many posts suggesting classes such as 'cl_wrf_dynamic_table=>create_dynamic_table', but it does not work for me.  The problem I have with the classes is that it doesn't allow you to have the same column name more than once.  But in the scenario I am testing, I have some column names that are duplicated, and I cannot remove the duplicates.  Are there any functions or classes that I can use to create a dynamic internal table that will not check if a column name is used twice?
    Thanks,
    Carrie

    Hello Carrie
    My first thought was that RTTI might be able to do this but it does not (see the dump below). And it is obvious that RTTI behave likes this.
    Error analysis
        An exception occurred which is explained in detail below.
        The exception, which is assigned to class 'CX_SY_STRUCT_COMP_NAME', was not
         caught and
        therefore caused a runtime error.
        The reason for the exception is:
        Multiple Specification of the Name 'CUSTOMER' as a Component Name (Component 7)
    Just think about any way  to define statically an itab or structure containing duplicated field names. You will always get a syntax error irrespective of whether you use a DDIC structure, a TYPE or a DATA variable.
    If there is no way to define such a structure statically why should it be different when defining dynamically?
    Regards
      Uwe

  • How to create a table dynamically

    Hello All,
    I want to create a table dynamically in DDIC. I know that there is function module exist DB_CREATE_TABLE but i am getting some errors while using it.
    Could any please post some code for it.
    Regards,
    Lisa

    Here is the code i have writen my self.
    PARAMETERS: tabname TYPE dd02l-tabname,
                fldname TYPE dd03p-fieldname,
                rollname TYPE dd03p-rollname.
    DATA: gt_cl_bc_dyn TYPE REF TO zcl_bc_dyn,
          status TYPE sy-subrc.
    data: lct_table type ZTT_ZTSITAB.
    INITIALIZATION.
      tabname = 'ZTEST1'.
      CREATE OBJECT gt_cl_bc_dyn.
    START-OF-SELECTION.
      CALL METHOD gt_cl_bc_dyn->create_table
        EXPORTING
          tabname   = tabname
          fieldname = fldname
          rollname  = rollname
          itab      = lct_table
        IMPORTING
          status    = status    .
      IF status = 0.
        WRITE: 'Table creation is successful'.
      ELSE.
        WRITE: 'Table creation is unsuccessful'.
      ENDIF.
    Code in the method
    METHOD create_table.
      DATA: ls_dd02v_wa TYPE dd02v,
            ls_dd09l_wa TYPE dd09l,
            ls_dd03p TYPE dd03p,
            lt_dd03p TYPE TABLE OF dd03p,
            rc TYPE sy-subrc.
      ls_dd02v_wa-tabname = tabname.
      ls_dd02v_wa-tabclass = 'TRANSP'.
      ls_dd02v_wa-contflag = 'A'.
      ls_dd09l_wa-tabname = tabname.
      ls_dd09l_wa-tabkat = '0'.
      ls_dd09l_wa-tabart = 'APPL0'.
      ls_dd03p-tabname = tabname.
      ls_dd03p-fieldname = fieldname.
      ls_dd03p-position = '0001'.
      ls_dd03p-keyflag = 'X'.
      ls_dd03p-rollname = rollname.
      APPEND ls_dd03p TO lt_dd03p.
      CALL FUNCTION 'DDIF_TABL_PUT'
        EXPORTING
          name                    = tabname
         dd02v_wa                = ls_dd02v_wa
         dd09l_wa                = ls_dd09l_wa
       TABLES
         dd03p_tab               = lt_dd03p
       EXCEPTIONS
         tabl_not_found          = 1
         name_inconsistent       = 2
         tabl_inconsistent       = 3
         put_failure             = 4
         put_refused             = 5
         OTHERS                  = 6
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      CALL FUNCTION 'DDIF_TABL_ACTIVATE'
        EXPORTING
          name              = tabname
       IMPORTING
         rc                = rc
       EXCEPTIONS
         not_found         = 1
         put_failure       = 2
         OTHERS            = 3
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      status = rc.
    ENDMETHOD.

  • How to create internal fields dynamically

    Hi,
    I am getting the data from MARA table to an internal table. Now I have to show the data according to month wise, like if same material is created in may and just, i have to show that material in may and june like below.
    material | may | june |
    m1        |    10 |     5 |
    m2        |    20 |   15 |
    I have to show this report in ALV.
    so how can i get the month columns dynamically for each month?
    i.e., when month is changed it has to create a new month.
    Plz suggest me.
    Regards,
    Dhanunjay

    REPORT ztest.
    *** Tables
    DATA: LT_DATA type ref to DATA.
    DATA: LT_FIELDCATALOG type LVC_T_FCAT.
    *** 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>.
    *** And to put the data in the internal table
    select MANDT CARRID CONNID FLDATE PRICE CURRENCY
      from SFLIGHT
      into corresponding fields of table <FS_1>.
    *** Access contents of internal table
    loop at <FS_1> assigning <FS_2>.
    assign component 1 of structure <FS_2> to <FS_3>.
    write: / <FS_3>.
    endloop.

  • How to create internal table in Adobe form - SFP transaction?

    How shd i create an internal table under Global data ???
    Regards,
    Gurmukh singh

    you can create the inernal table using the table types.
    assume you want to create the Inernal table of type SFLIGHT, then you can create in this way...under the global Defintions.
    VARiABLE NAME       Type Assignment      Type name
    IT_SFLIGHT                TYPE                       SFLIGHT_TAB1
    IT_VBAP                    TYPE                       VBAP_TT
    you can populate these tables using the Initialization->Code Initialization.
    for more details Check here..
    https://www.sdn.sap.com/irj/sdn/adobe

  • How to create a table dynamically in webdynpro

    hai everybody
    in webdynpro we know how to create at design time
    but i want to create it at runtime that is dynmamically i want to set the rows and coloums of the table at run time
    Thanks & Regards
    sravan

    I guess this should work,
    Suppose you want to dynamically create a Table (say Category) having a column called Category Code, then in the wdDoModifyView() hook method, just add the following code snippet,
    if (firstTime) {
    //Create the Table UI Element
    IWDTable table = (IWDTable) view.createElement(IWDTable.class, null);
    //Set the Table Header
    IWDCaption tableCaption = (IWDCaption) view.createElement(IWDCaption.class, null);
    tableCaption.setText("Category Table Contents");
    table.setHeader(tableCaption);
    //Create and add a Column UI element for the above table     
    IWDTableColumn column = (IWDTableColumn) view.createElement(IWDTableColumn.class, null);
    table.addColumn(column);
    //Set the required column header using the caption (Category Code here)                         
    IWDCaption caption = (IWDCaption) view.createElement(IWDCaption.class, null);
    caption.setText("Category Code");
    column.setHeader(caption);
    //Create a TableCellEditor and bind it to an attribute of the Category Node in the context     
    IWDTextView editor = (IWDTextView) view.createElement(IWDTextView.class, null);
    editor.bindText("tb_Category.cat_code");
    column.setTableCellEditor(editor);
    //Finally add the Table UI element to the view          
    IWDUIElementContainer root = (IWDUIElementContainer) view.getRootElement();
    root.addChild(table);
    You need to follow the same procedure for adding multiple columns to the table.
    Hope this answers your question!
    Regards
    Kishan

  • How to pass internal tables dynamically in the subroutine

    Hi Folks,
    I need to take 3 input files from presentation server. instead of writing the gui_upload for 3 times i want to have it in a subroutine. but i need to specify the tables structure in the subroutine which is not possible to specify in the form ...endform since 3 itabs are fully different.
    is there a way i can handle this dynamically...!
    Please send the code if u have the same kind of stuff.
    Thanks for ur valuable time.

    Hi Hasmath,
    Try this
    data: begin of itab1 occurs 0,
            field1(2),
          end of itab1.
    data: begin of itab2 occurs 0,
            field1(10),
          end of itab2.
    data: filename type string.
    start-of-selection.
    perform file_upload tables itab1.
    perform file_upload tables itab2.
    *&      Form  file_upload
          text
         -->P_ITAB1  text
    form file_upload  tables   p_itab1." type any
    call function 'GUI_UPLOAD'
      exporting
        filename                      = filename
       FILETYPE                      = 'ASC'
      HAS_FIELD_SEPARATOR           = ' '
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      tables
        data_tab                      = p_itab1
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_READ_ERROR               = 2
       NO_BATCH                      = 3
       GUI_REFUSE_FILETRANSFER       = 4
       INVALID_TYPE                  = 5
       NO_AUTHORITY                  = 6
       UNKNOWN_ERROR                 = 7
       BAD_DATA_FORMAT               = 8
       HEADER_NOT_ALLOWED            = 9
       SEPARATOR_NOT_ALLOWED         = 10
       HEADER_TOO_LONG               = 11
       UNKNOWN_DP_ERROR              = 12
       ACCESS_DENIED                 = 13
       DP_OUT_OF_MEMORY              = 14
       DISK_FULL                     = 15
       DP_TIMEOUT                    = 16
       OTHERS                        = 17
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    endform.                    " file_upload
    REgards,
    Ravi Kanth Talagana

  • How to delete a field from a Dynamically created internal table

    Hi friends,
    I have got a requirement in which, I will be entering the table name and Excel file from seletion-screen.
    based on the Table I have entered in the selection-screen I need to create a dynamic internal table so that I can fill that Execel data into that internal table and later i using BDC i can I can fill the database table using SM30 transaction.
    here. my problem is that, When I am creating internal table dynamically, MANDT filed is also getting created in the internal table.
    please, help in deleteing the filed MANDT from the internal able.
    following is the code which creates the dynamic internal table.
    CREATE DATA dy_table TYPE TABLE OF (p_tabname).
    assign dy_table->* to <dyn_table>.
    please provide, if any sample code is available.
    Regards,
    Xavier.P

    Hi,
    You can use this logic,
    While creating the Dynamic filed catalog try to avoid MANDT field.
    Ex:
    *Dynamic creation of a structure
      CREATE DATA LP_STRUCT TYPE (V_TABLE).
      ASSIGN LP_STRUCT->* TO <FS>.
    *Fields Structure
      OF_SDESCR ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_DATA( <FS> ).
    LOOP AT OF_SDESCR->COMPONENTS ASSIGNING <COMPONENTS>.
    *Field MANDT not displayed
        IF SY-TABIX = 1 AND <COMPONENTS>-NAME = 'MANDT'.
          CONTINUE. " Next loop
        ENDIF.
    *Build Fieldcatalog
        LS_LVC_CAT-FIELDNAME = <COMPONENTS>-NAME.
        LS_LVC_CAT-REF_TABLE = V_TABLE.
        APPEND LS_LVC_CAT TO LT_LVC_CAT.
        CLEAR LS_LVC_CAT.
      ENDLOOP.

  • Passing internal tables dynamically to a subroutine

    Hi All,
    How to pass internal tables dynamically to a subroutine?
    In subroutine logic i'm fetching data from MARA table for all entries in the internal table passed to the subroutine. Based on some condition the internal table varies. I'm placing the code below
    Both GT_AUFM & GT_AUFM1 are of 2 different structures having MATNR.
    IF WA_AUFM1-BWART EQ '261'.
        PERFORM GET_IF_SEMIFINISHED USING GT_AUFM1.
    ELSE IF WA_AUFM1-BWART EQ '262'.
        PERFORM GET_IF_SEMIFINISHED TABLES GT_AUFM.
    ENDIF.
    FORM GET_IF_SEMIFINISHED  USING P_TABLE TYPE ANY TABLE.
      REFRESH GT_MARA.
      SELECT MATNR FROM MARA INTO TABLE GT_MARA
                     FOR ALL ENTRIES IN P_TABLE
                     WHERE MATNR EQ P_TABLE-MATNR
                       AND MTART IN R_MTART.
      ENDFORM.
    With this logic i'm getting an error that the specified type has no structure and therefore no component called MATNR.
    Thanks,
    Anil.

    refer this link
    dynamic internal table

Maybe you are looking for

  • Credit charges based on the number of credit days offered to the customer

    AOA, I have a scenario. We have credit charges based on the number of credit days offered to the customer. This scenario will be executed on credit sales only. Example of pricing, a product mobile is offered to customer A on 20 Days credit Mobile   $

  • Problem in Shipment purchase order number

    Hello Experts, At time of shipment count number(VI02), purchase order and service entry is created automatically. But whenever created new shipment count same purchase order number is updated ie sequentially not taking, but service entry has not prob

  • Can't Trash Files Outside of Home Directory

    Hello I have a problem I can't seem to trash files/directories outside of my home directory even if I have rwx!... not sure when it started.  Here's an example of my issue. [jamie@simula vhosts]$ groups wheel video audio optical storage camera jamie

  • Swingbench2.4: Can not start schema creation wizards

    Hi Community, When trying swingbench2.4 I got "java.lang.NoClassDefFoundError: while resolving class: com.dom.benchmarking.swingbench.wizards.Wizard" error. I've included $SWINGHOME/lib/swingbench.jar, where the wizard class file can be found, in my

  • How to set up an iPhone as PAN for MacBook Air

    I would like to know how to set up a Personal Area Network for my MacBookAir by using my iPhone. I successfully used Bluetooth to pair the two, according to the MacAir, but the iPhone never believed it and insisted that it had found no device to pair