Defining internal table dynamcially...

Hello Gurus,
Currently I am defining internal table as follows. The custom table name is ZCUST.
data: itab LIKE ZCUST OCCURS 1 WITH HEADER LINE.
But I have a situation where I have to define a internal table dynamcially based on the
table name defined in configuration table.
How can I define itab dynamically where custom table name will be selected at runtime ?
Regards,
Rajesh.

This question has been asked and answered many times before. Please search the forum before asking.
Rob

Similar Messages

  • How to define internal table in smartform(urgent)

    Hi all,
    How can i define a internal table <b>with header line </b> in global data ???
    i defined like
    In Types,
    TYPES : BEGIN OF T_XVBPLP2 ,
             VENUM(10),
             VEPOS(10),
             POSNR(6),
             VEMNG LIKE LIPS-LFIMG,
             MATNR LIKE LIPS-MATNR,
             CHARG LIKE LIPS-CHARG,
             ARKTX LIKE LIPS-ARKTX,
             END OF T_XVBPLP2.
    TYPES: T_XVBPLP TYPE TABLE OF T_XVBPLP2.
    In Global Data,
    T_XVBPLP TYPE T_XVBPLP.
    Still, i am getting error message that, Internal table is not with header line.
    can u plz give me some examples , to  define internal table with header line in smartform ???
    any correct answers will be rewarded??
    Regards
    pabitra

    Hi
    define WA_ITAB  in Global variables
    variable name          type assin      associated type
    t_text                      like                     zstc_text
    you cannot define a internal table with header line in SMART Forms. Declare a internal table and a work area separately both referring to the same structure.
    Then you can use the work area. So, in this case WA_ITAB is declared as a global variable of TYPE ZSTC_TEXT.
    Regards
    Pavan

  • How to Define Internal Table in Smartform

    Hello,
    I have some problem on define Internal Table in Smartform
    I define a Temp_IT_Gen Type LBBIL_IT_GEN in Global Definiations
    but i find that it is not available for me to append data into it,
    the error message is Temp_IT_Gen is not a Internal Table - the Occurs n Specification is missing
    so how can i solve it?
    i want to use the internal table in the hold program.
    Thanks a lot in advance.

    Hi,
    First U define the Table type in 'TYPES' tab of Global Definitions and then assing that table type to Internal table in 'Global Data' tab.
    Eg:
    define the Table Type like below in TYPES tab.
    TYPES:BEGIN OF ty_TEMP.
            INCLUDE STRUCTURE XXXXXXX.
    TYPES:END OF ty_TEMP.
    TYPES: g_t_temp TYPE STANDARD TABLE OF ty_TEMP .
    Now, define the Internal table in Global Data tab like below:
    Variable Name    Type assignment    Associated Type
    G_T_ITEM_1       TYPE                    G_T_TEMP
    NOTE: whatever U define in Global Definitions can be used only in SMARTFORM, if u want to use it in Program U must define in Form Interface.
    Hope it helps!!
    Rgds,
    Pavan

  • Passing a program defined internal table to an abap object

    Hi. I have an internal table that was previously defined and created by SAP that I need to process in a user exit. The table is defined exactly as shown below.
    Is it possible to pass a table that was defined in this manner (not in the ABAP dictionary) as an argument to a method of an ABAP object?
    If so, what would the data type of the itab parameter have to be when defining the object's method parameter list? Is it necessary to somehow "cast it" to the KNA1 table type once I receive the table into the method? If so, what is the data type of the object's receiving variable/attribute?
    data: begin of lkna1 occurs 0001.
            include structure kna1 .
    data:
          end of lkna1 .
    Just as one additional piece of information, I am using version 4.5B and I am trying to do this through se24.
    Thanks so much!

    Hi again,
    <b>This kind of simple approach,
    we can pass ANY KIND OF TABLE
    WITHOUT HAVING TO DEFINE
    LINE TYPE IN SE11.</b>
    1. doing this simply u will achieve what u want.
      ( i just tried the same)
    2. in se24,
      give like this
    ITAB     Importing     Type     <b>STANDARD TABLE</b>
    3. in the calling program,
      call like this,
    report abc.
    data: begin of lkna1 occurs 0001.
    include structure kna1.
    data: end of lkna1.
    data: testobj type ref to zsdtest.
    select * from kna1
    into table lkna1.
    lkna1-kunnr  = '000234'.
    create object testobj.
    <b>call method testobj->testreceive
    exporting itab = lkna1[].</b>
    4.
    then in the class, source code,
    just use like this
    (so that u can accesss the fields of the itab,
    using myitab)
    <b>method TESTRECEIVE .
    data : myitab type table of kna1.
    myitab[] = itab[].
    break-point.
    endmethod.</b>
    5. thats all !
    regards,
    amit m.

  • Define internal table depending on parameter

    Hello,
    does anybody know how internal tables can be defined when tablename is passed as parameter ?
    I have p_table and want to define an internal table depending on its value (e.g. KNA1, MARA, LFA1 ) dynamically, so for example if p_table= MARA
    DATA:
    l_tab_table TYPE STANDARD TABLE OF MARA.
    l_str_table TYPE MARA.
    Has anybody done this before ?
    Thank you!

    Hi
    U have to use field-symbols:
    PARAMETERS: P_TABLE(30).
    DATA: DYN_TAB TYPE REF TO DATA.
    FIELD-SYMBOLS: <TAB> TYPE TABLE.
    CREATE DATA DYN_TAB TYPE TABLE OF (P_TABLE).
    ASSIGN DYN_TAB->* TO <TAB>.
    I believe the option CREATE DATA ... TYPE TABLE is available from release 4.7.
    If you use a lower release you have to use the method
    CREATE_DYNAMIC_TABLE of class CL_ALV_TABLE_CREATE:
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
      EXPORTING
         I_STRUCTURE_NAME = P_TABLE
      CHANGING
         CT_FIELDCAT      = GT_FIELDCAT.
    call method cl_alv_table_create=>create_dynamic_table
        exporting it_fieldcatalog = gt_fieldcat
        importing ep_table        = DYN_TAB.
    ASSIGN DYN_TAB->* TO <TAB>.
    Max

  • Define Internal table

    Hi,
    My requirement is like that i declare one internal table like:
    TYPES: BEGIN OF wa_mathead,
            matkl TYPE matkl,     "Material Group
            mvgr1 TYPE mvgr1,     "Material Class
            matnr TYPE matnr,     "Material
    end of wa_mathead.
    now i want to declare another internal table say itab with some new fields and including wa_mathead structure.
    how can i do that.
    Amit.

    INCLUDE STRUCTURE is not valid in all contexts and should be avoided.
    Simply use the type you've defined in the definition of your table:
    TYPES: BEGIN OF wa_mathead,
            matkl TYPE matkl, "Material Group
            mvgr1 TYPE mvgr1, "Material Class
            matnr TYPE matnr, "Material
          end of wa_mathead.
    TYPES: BEGIN OF itab_rec_type,
             hdr TYPE wa_mathead,
             f1  TYPE blah,
    You'll have to acess the header data of a record of your itab as wa-hdr-matkl.
    matt

  • Defining internal tables

    Hi,
    I'm somewhat lost in my code. I have to use all fields of a table in my development. I tried doing it as follows but I receive an error like my internal table is not defined.
    data: begin of t_type.
            include structure tablename.
    data: end of t_type.
    data: i_internaltable type standard table of t_type initial size 0.
    Then I did the following which worked fine:
    data: i_internaltable type standard table of tablename initial size 0.
    But the problem now is that I have to use one field from another table. Normally it should be like
    data: begin of t_type.
            include structure tablename.
    data field like table-field.
    data: end of t_type.
    I'm lost.... Plz help
    Thx

    Hi,
    Declare as below:
    structure Declaration.
    types:  begin of t_type.
    include structure tablename.
    types: field like table-field.
    types: end of t_type.
    Table Decalartion.
    data: i_internaltable type standard table of t_type initial size 0.
    *Work area.
    data: w_type type t_type
    Now this will work.
    Revert back if any issues.
    Reward with points if helpful.
    Regards,
    Naveen

  • Can't we pass custom defined internal table in SMARTFORM Interface

    Hi,
         I have a scenario, that my internal table from the program is is not dictionary type, but combination of some fields. Can't I directly pass this table to my smartform.
    Thank U 4 Ur time.
    Cheers,
    Sam

    hi,
    We can not pass the Internal tables to a Smartforms, you need to create the Structure and give the Structure in the Smartform, and declare the the internal table of that structure type and pass it
    Regards
    Sudheer

  • Importing internal table in Adobe Interactive Forms

    Hi all,
    at the moment I do my first steps in AIF.
    I have created a report and select dd02l, dd03l and dd04l.
    dd02l is a structure. dd03l and dd04l are internal tables.
    How can I import internal tables into my function module with getting a runtime error? Fields and structures are no problem?
    I have defined both internal tables as importing parameter in my form interface because I cannot define internal tables ;o(
    Thx 4 help & regards
    Michael

    hi,
    find attached document it will helpful for u go to link
    1.https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c2567f2b-0b01-0010-b7b5-977cbf80665d
    2.https://www.sdn.sap.com/irj/sdn/abap-elearning
    thanks reward if helpful

  • How to use internal table in Exporting Parameter of method.

    Hi Friends,
    I am new to abap oops and using the following code to read a select-option and pass the data in an internal table but on defining
    internal table of a standard  type it is giving me following error :
    ITAB is not an internal table - the OCCURS n specification is missing.
    code
    ====
      class lcl_get_details DEFINITION.
        PUBLIC SECTION.
          types : r_carrid type RANGE OF sflight-carrid.
          data  : itab type STANDARD TABLE OF sflight.
          METHODS : get_data IMPORTING s_carrid type R_carrid
                             EXPORTING itab type sflight.
      ENDCLASS.   
    class lcl_get_details IMPLEMENTATION.
      METHOD get_data.
        select *
        from sflight
        into table itab
        where carrid in s_carrid.
        if sy-subrc eq 0.
          sort itab by carrid.
        endif.
      endmethod.   
    ERROR : ITAB is not an internal table - the OCCURS n specification is missing.
    Kindly help.

    Hi,
    I think your problem is, because you use 2 variables named ITAB in method get_data.
    Instance-variable ITAB is defined as STANDARD TABLE OF sflight.
    Exporting-parameter ITAB is defined as sflight.
    It seems like in implementation of get_data exporting-parameter ITAB is used.
    Try this implementation:
    METHOD get_data.
      select * from sflight into table me->itab
       where carrid in s_carrid.
      if sy-subrc eq 0.
      sort me->itab by carrid.
      endif.
    ENDMETHOD.
    This should solve your compiler error.
    Nether the less, get_data will yield an empty structure as result.
    Regards, Hubert
    Edited by: Hubert Heitzer on Feb 24, 2010 10:22 AM

  • 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

  • Issue with internal table in object oriented ABAP.

    Hello Gurus,
    I am having trouble defining internal table in Object oriented ABAP. for following:
    DATA: BEGIN OF IT_TAB OCCURS 0.
            INCLUDE STRUCTURE ZCUSTOM.
    DATA    tot_sum   TYPE char40.
    DATA END OF IT_TAB.
    Can someone help ?
    Regards,
    Jainam.
    Edited by: Jainam Shah on Feb 5, 2010 8:33 PM
    Edited by: Jainam Shah on Feb 5, 2010 8:33 PM
    Moderator message - Please post in the correct forum. You can easily find out for yourself by looking at SAP help for internal tables using OOP - thread locked
    Edited by: Rob Burbank on Feb 5, 2010 2:49 PM

    No, you can not declare internal table with header line in OO context. You have to declare the work are/header line separately
    Example:
    TYPES: BEGIN OF ty_it_tab.
            INCLUDE STRUCTURE mara.
    TYPES:  tot_sum TYPE char40.
    TYPES: END OF ty_it_tab.
    DATA: it_tab TYPE STANDARD TABLE  OF ty_it_tab.
    DATA: wk_tab TYPE ty_it_tab.
    LOOP AT it_tab INTO wk_tab.
    ENDLOOP.
    Edited by: Dean Q on Feb 5, 2010 8:50 PM

  • Bdc upload file data into internal table problem with gui_upload fm

    Hello experts,
    my coding is like this ..
    data : begin of itab occurs 0 .
    field1 like mara-matnr,
    field2......
    etc,
    end of itab.
    data: file1 type string.
    parameter :file like rlgrap-filename.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    EXPORTING
    static = 'X'
    mask = space
    field_name = 'FILE'
    CHANGING
    file_name = file.
    START-OF-SELECTION.
    FILE1 = FILE . "HERE I AM PASSING INTO STRING
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = FILE1
    FILETYPE = 'ASC'
    has_field_separator = 'X'
    TABLES
    data_tab = itab. " here the data is not populating from the file , it is giving the error like speified table not found.
    HERE i am getting the message like "specified table name not recgonised" . the data is not populating into the itab from the file.
    file structure is same as the internal table.
    I stored the file as .txt( ie in notepad).
    my file is like this..
    10000 200 323 sunndarrr.......
    i had a problem with this bdc , i am getting like "specified table name not recgonised" in the fm gui_upload while debugging.
    when i am using the ws_upload it is working fine.
    please guide me where i have done the mistake.
    thank you so much for all the replies.

    Hi,
    Have a look on the following code.
    TABLES: kna1.
    DATA: BEGIN OF itab1 OCCURS 0,
          str(255),
          END OF itab1.
    DATA: itab2 TYPE kna1 OCCURS 0 WITH HEADER LINE.
    CALL FUNCTION 'WS_UPLOAD'
      EXPORTING
        filename                = 'D:\ABAP EVE\ffile1.txt'
        filetype                = 'ASC'
      TABLES
        data_tab                = itab1
      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
        no_authority            = 10
        OTHERS                  = 11.
    IF sy-subrc <> 0.
      WRITE:/ 'sorry'.
    ELSE.
      LOOP AT itab1.
        SPLIT itab1-str AT ',' INTO itab2-kunnr itab2-name1.
        APPEND itab2.
      ENDLOOP.
      IF sy-subrc = 0.
        LOOP AT itab2.
          WRITE:/ itab2-kunnr,itab2-name1.
          INSERT INTO kna1 VALUES itab2.
        ENDLOOP.
        IF sy-subrc = 0.
          WRITE:/ 'inserted'.
        ELSE.
          WRITE:/ 'not inserted'.
        ENDIF.
      ELSE.
        WRITE:/ 'fail'.
      ENDIF.
    ENDIF.
    Flat file:
    10001,Sadney
    10003,Yogesh
    20005,Madan
    1.U need to define internal table with one field of max size
    2.upload the flat file data into that internal table
    3.split that internal table data into another internal table(having fields)
    <REMOVED BY MODERATOR>
    thanks,
    Chandu
    Edited by: Alvaro Tejada Galindo on Apr 30, 2008 12:17 PM

  • Internal table on Start Routine

    Hello
    I have 5 key figures. They have an standard routine with a select statement. Basically they have to read an external DSO and get some fields values.
    As all of them have the same SELECT statement I think it would be better to replace this with a select in the Start Routine, in order to improve performance. But unfortunatelly I'm not an abap programmer.
    How could this be replaced in the Start routine ?
    select single EXRATEXACC DOC_CURRCY NETVAL_INV
          into (h_rate, h_dcurr, h_inv)
          from /bic/azsdbiio100
           where BILL_NUM eq SOURCE_FIELDS-/BIC/ZREFDOC
           and BILL_ITEM eq SOURCE_FIELDS-/BIC/ZREFDOCLN
           and COMP_CODE eq SOURCE_FIELDS-COMP_CODE.
      if sy-subrc ne 0. " Not found
            select single EXRATEXACC DOC_CURRCY NETVAL_INV
            into (h_rate, h_dcurr, h_inv)
            from /bic/azsdbiio100
             where DOC_NUMBER eq SOURCE_FIELDS-DOC_NUMBER
             and S_ORD_ITEM eq SOURCE_FIELDS-S_ORD_ITEM
             and COMP_CODE eq SOURCE_FIELDS-COMP_CODE.
         if sy-subrc eq 0.
              h_flag = 'X'.  " Document found
         endif.
      else.
         h_flag = 'X'.  "Document found.
      endif.
    if h_flag = 'X'.
            if h_dcurr ne SOURCE_FIELDS-CURRENCY.
              if h_rate lt 0.
                h_rate = h_rate * ( -1 ).
                clear h_amount.
                if h_inv ne 0.
                  h_amount = h_inv.
                else.
                  h_amount = SOURCE_FIELDS-/BIC/ZG_AVV104 * h_rate.
                endif.
              elseif h_rate gt 0.
                if h_inv ne 0.
                  h_amount = h_inv.
                else.
                  h_amount = SOURCE_FIELDS-/BIC/ZG_AVV104 / h_rate.
                endif.
              else.
                h_amount = SOURCE_FIELDS-/BIC/ZG_AVV104.
              endif.
            else.
              h_amount = SOURCE_FIELDS-/BIC/ZG_AVV104.
            endif.
            RESULT = h_amount.
            CURRENCY = h_dcurr.
          endif.
        endif.

    Hi,
    what you need to do first is to define internal tables in the start routine for each individual routine with the key fields. So look at the different SELECT SINGLE statements and build up the internal table(s). So for the first one you need to define an internal table with fields BILL_NUM, BILL_ITEM, COMP_CODE  (your key) and EXRATEXACC, DOC_CURRCY and NETVAL_INV. I don't know if you can combine the two select single statements, that will depend on if BILL_NUM is the same type of field as DOC_NUMBER.
    After declaration of the internal tables you can fill the bales by doing a SELECT instead of select single INTO the internal table.
    In the individual update rules you can do a READ TABLE (internal table) WITH KEY yyyyyy
    In this way you only have to access the DB once per data package and read from the internal memory for each record, which will definitely improve performance.
    Hope this helps!

  • How to create an internal table

    Hi friends,
                     In  what are the ways can we construct the internal table ?  Can you tell me the advantages and disadvantages ?

    Hi,
    You can define internal tables either with (WITH HEADER LINE addition) or without header lines. 
    An internal table with header line consists of a work area (header line) and the actual table body. You address both objects 
    using the same name. The way in which the system interprets the name depends on the context. For example, the MOVE statement applies to the header line, but the SEARCH statement applies to the body of the table.
    To avoid confusion, you are recommended to use internal tables without header lines. This is particularly important when you use nested tables. However, internal tables with header line do offer a shorter syntax in several statements 
    ( APPEND, INSERT, MODIFY, COLLECT, DELETE, READ, LOOP ). 
    Within ABAP Objects, you can only use internal tables without a header line. You can always address the body of an internal table <itab> explicitly by using the following syntax: <itab>[].  This syntax is always valid, whether the internal table has a header line or not.  
    Example
    DATA itab1 TYPE TABLE OF i WITH HEADER LINE.
    DATA itab2 TYPE TABLE OF i WITH HEADER LINE.
    itab1 = itab2.  " Only header lines will be copied 
    itab1[] = itab2[].  " Copies table body 
    Regards,
    Bhaskar

Maybe you are looking for

  • 12 month plan full advance payment for 10 month.

    Hello! Is anybody could help me with information regarding whether or not it is possible to pay full amount for 10 months in advance while the first two months of the 12 month plan were paid normally (i.e. once in a month). In short: is it possible t

  • Exporting File Dimensions to File

    Hi, I have approximately 65,000 images for which I need to catalogue filenames and pixel dimensions into an Excel spreadsheet. I am using Bridge CS5, and I can see a field containing pixel dimensions, but I can't seem to find a script that will expor

  • Where is the Hue, Saturation, Lightness effect that has colorize option in CS3 Premiere?

    Hi, Please could you say where is the Hue, Saturation, Lightness effect that has colorize option in CS3 Premiere? I look under Color Correction in Effects and there is a "Color Balance (HLS)" but there is no colorize option. Thanks for your help.

  • My external drive is never recognized.

    i verified it via disc utility. it never shows up when i want to import from it or save files to it. what else can i do? it's a Lacie drive

  • Problems with parport and writing to data adresse 0x037a

    Hi, Iam currently trying to control a DC-motor, I need to change the strobe which is at the data control. At adresss 0x037a i cant write to it. Running userport on winxp and i can access and turn data ports at 0x0378 on and off. I get this error mess