How to declare variable for Table type in the ABAP Editor

Hi!
I have Table Type 'FIELDNAME_TAB' (Table of fieldnames). I want to pass the list of fieldnames to this Table Type in the ABAP Editor.
Can anyone help me in this?

You would declare the internal table like so.
data: itab type FIELDNAME_TAB.
data: wa like line of itab.
wa = 'This_value'.
append wa to itab.
Regards.
Rich Heilman
Message was edited by:
        Rich Heilman

Similar Messages

  • How to declare variable in table valued function

    hello.
    i have the following code to define a inline table valued function
    but the use of cmn.ReshteId('Lf_WL') as a function in where clause is not good performance.
    Alter function lf.fn_WholeLifeBn_GetForm(@ViewKind tinyint, @CurrentLocation int) returns table
    as
    return
    select B.*
    from lf.fn_LifeBN_GetForm(@ViewKind, @CurrentLocation) B
    where Reshte = cmn.ReshteId('Lf_WL')
    for better performance following code is good:
    declare @Reshte smallint
    set @Reshte = cmn.ReshteId('Lf_TS')
    select B.*
    from lf.fn_LifeBN_GetForm(@ViewKind, @CurrentLocation) B
    where Reshte = @Reshte
    but can not use it as the first code block in inline function.
    please help for define a good function.

    What do you think about Multi-Statement Table-Valued UDFs?
    create function Func(@Var int)
    returns @T table(ColName int)
    as
    begin
      insert into @T(ColName) values (@Var)
      return
    end
    select * from Func(10)
    select * from Func(20)
    ---or
    alter function Func()
    returns @T table(ColName int)
    as
    begin
      declare @Var int
      set @Var = 10
      insert into @T(ColName) values (@Var)
      return
    end
    select * from Func()
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How to insert variable for table name in Select statement ?

    I am creating a stored procedure which will take two table names as IN parameters. Within the procedures I would like to use the parameters in the following manner;
         SELECT count(*)
         INTO v_target_cnt
         FROM TargetTable;
    TargetTable is one of the parameters passed in. When I do this however it does not recognize the parameter. I have tried assigning the parameter to a local variable and using the variable, with not luck.
    Any help....thanks

    Null,
    What you are describing is called a LEXICAL parameter, which is allowed (preceded by an ampersand) in sql but not in pl/sql because it would not be possible to compile it. That is why you need to use Andrew's suggestion to make the sql dynamic. In older versions you would need to use DBMS_SQL which is horrible and now thankfully redundant.

  • How to declare variable in the scipt

    data is coming from standard program .
    rf140-stida key entry date.
    bsik-bldat posting date
    i want to display difference between  rf140-stida and bsik-bldat in scipt form it will give number of days.
    how can i declare variables for this.
    how to write code in my form.

    Hi
    U need to create a routine to calculate the difference:
    /: DEFINE &DELTA& = SPACE
    /: PERFORM <FORM NAME> IN PROGRAM <PROGRAN NAME>
    /: USING &RF140-STIDA&
    /: USING &BSIK-BLDAT&
    /: CHANGING &DELTA&
    &DELTA&
    The routine has to be defined in your Z-PROGRAM and to have these interface:
    FORM <FORM NAME>  TABLES IN_TAB_EM     STRUCTURE ITCSY
                                                       OUT_TAB_EM STRUCTURE ITCSY.
      DATA: DELTA TYPE I.
      DATA: DATE1 LIKE SY-DATUM,
                 DATE2 LIKE SY-DATUM.
    * ---> Rembember the date has the ouput format, so it has to be converted in the
    * input format
      READ TABLE  IN_TAB_EM WITH KEY NAME = 'RF140-STIDA'.
      IF SY-SUBRC = 0.
         DATE1(4)     = IN_TAB_EM-VALUE+6(4).
         DATE1+4(2) = IN_TAB_EM-VALUE+3(2).
         DATE1+6(2) = IN_TAB_EM-VALUE(2). 
      ENDIF.
      READ TABLE  IN_TAB_EM WITH KEY NAME = 'BSIK-BLDAT'.
      IF SY-SUBRC = 0.
         DATE2(4)     = IN_TAB_EM-VALUE+6(4).
         DATE2+4(2) = IN_TAB_EM-VALUE+3(2).
         DATE2+6(2) = IN_TAB_EM-VALUE(2). 
      ENDIF.
      DELTA = DATE1 - DATE2.
      READ TABLE  OUT_TAB_EM WITH KEY NAME = 'DELTA'.
      IF SY-SUBRC = 0.
         WRITE DELTA TO OUT_TAB_EM-VALUE.
         MODIFY OUT_TAB_EM INDEX SY-TABIX.
      ENDIF.
    ENDFORM.
    Max

  • How to create Variables for the Key Figures

    Hi All,
    How to create Variables for the Key Figures
    Thanks
    Bhaskar

    Hi,
    It is not possible to create the variables on Key figures directly. But we can create a formula variable with processing type 'User Entry' ,SO that the user entered value can be used in the calculations of the query.
    With rgds,
    Anil Kumar Sharma .P

  • How to organize variables for file saving and scalability?

    Hello,
    I have created several CVI applications that store production data for numerous machines.  To organize the data for file saving I have implemented structures.  This has worked well with one limitation, the inability to scale the structure at a later date without invalidating existing files.  I would like to consider alternative approaches that would allow scalability.
    Here's an example of my current method...
    // Definition of structure per machine.
    struct machine_1
       int  int_param_1, int_param_2, int_param_3;
       double  dbl_param_1, dbl_param2, dbl_param3;
    struct machine_2
       int int_param_1, int_param_2, int_param_3;
       double dbl_param_1, dbl_param2, dbl_param3;
    // Definition of inclusive structure. (Member name and structure tag name are the same.)
    struct
       struct machine_1   machine_1;
       struct machine_2   machine_2;
    } machine_parameters;
    To assign a value to a structure variable:
    // Assign value.
    machine_parameters.machine_1. dbl_param_2 = 77.47;
    Then when it comes time to save the populated structures:
    // Save structure.
    error = fwrite (&machine_parameters, sizeof(machine_parameters), 1, dest);
    The problem comes later when multiple files already exist and one of the machine structures needs an additional variable added.  For example, if I need to add int_param_4 to the machine_1 structure.  Adding this variable will invalidate the previously saved files because they were saved with a different structure and will not be able to be opened with a new structure containing one additional variable due to the structure definition mismatch.
    I have added spare variables per data type to the structures for each machine, but it's a losing game.  If I add 10 spare variables, I end up needing to store 11 more pieces of data.
    Is there a better approach?
    Thanks,
    Aaron T.

    One simple way is to output the data as ASCII comma separated values, with a newline character at the end of each row of data.
    I.E., the only structure to your file data is a "row" of CSV's, with the file containing some number of rows.
    Then, you load the data into Excel, and it will parse the CSV's for you and when it sees the newline, put the next set of CSV's on the next row of the worksheet.
    If you ever need to expand the number of items in a row, you just add them as you generate data, pushing the newline to the right, the extra data  extending the row.
    So you get an Excel worksheet filled with rows of (possibly varying length) data.   So long as you add data at the end of the row when you redefine what you're saving, anything reading the file should see the same stuff that was always there.
    You can write a macro to reformat or parse the CSV's once they're in the spreadsheet.  With Excel 2007 supporting very large worksheets, you can put a lot of data into one.  I think they expose a C interface for writing fast data manipulation of cell data now too - sort of a fast macro from the Excel viewpoint.  I think the number of columns is 16384 and 1 million rows in a "Big Grid". The Excel 2007 engine is multi-threaded and you can tell it how many cores to use on a multicore machine.
    So the only problem I see is the loss of local structure (your C structs get serialized and get concatenated to one another) but you could re-introduce the structure with a macro.
    Or, if you were to write out serialized binary values and then view the file data using a hex editor like Neo, you can tell Neo what your C structs were and it will pick up binary file data and put it back into the C structs for viewing.
    Or use MatLab to read the CSV's and reformat it.
    Or use the CVI SQL interface and write it out as database records.  I think the SQL toolkit costs extra, maybe it comes with the FDS. 
    Menchar

  • How to create variant for table/view ?

    Hi,
    When I go through SM30, I find a radio button called variant. I don't know the effect.
    Can anyone tell me how to create variant for table / view ?
    I want to know when we need to create variant for table/view.
    Best regards,
    Chris Gu

    hi ,
    Whenever you start a program in which selection screens are defined, the system displays a set of input fields for database-specific and program-specific selections. To select a certain set of data, you enter an appropriate range of values.
    For further information about selection screens, refer to Selection Screens in the ABAP User's Guide.
    If you often run the same program with the same set of selections (for example, to create a monthly statistical report), you can save the values in a selection set called a variant
    Procedure
    To create a new variant:
           1.      On the ABAP Editor initial screen, enter the name of the program for which you want to create a variant, select Variants, and choose Change.
           2.      On the variant maintenance initial screen, enter the name of the variant to be created.
    Note the naming convention for variants (see below).
           3.      Choose Create.
    If the program has more than one selection screen, a dialog box for screen assignment appears. The dialog box does not appear if the program only has one selection screen. The selection screen appears in this case.
           4.      If there is more than one selection screen, select the screens for which you want to create the variant
    5.      Choose Continue.
    The (first) selection screen for the report appears.
    If your program has more than one selection screen, use the scroll buttons in the left-hand corner of the application toolbar to navigate between them and to fill the fields with values. If you keep scrolling forwards, the Continue button appears on the last selection screen.
           6.      Enter the desired selection values, including multiple selection and dynamic selection.
           7.      Choose Continue.

  • How to declare variables in standard text  - so10 t.code

    Hello Friends,
             How to declare variables in standard text  - so10 t.code? Your response will be appreciated much.
    Thanks
    Sri

    For Script & Smartform  Text - &VAR&

  • How to define variable for value range in Bex Query?

    Hi
    How to define variable for Keyfig. value range on runtime like characteristic in Bex Query?
    Example: On runtime user select one of the following condition:
    1)User want to those records where amount is greater than $1000
    2)User want to those records where amount is greater than $1000 and less than $5000
    3)User want to those records where amount is greater than and equal to $1000

    Hi ,
    Need to Use exceptions & conditions for this scenario's  & need to create variable for exceptions based on condtions.
    Below document provides steps how to make selections at run time for a kfg.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60b33a28-dca2-2d10-f3b2-d2096b460b1e?QuickLink=index&overridelayout=true&48842368468641
    Regards,
    Seshu.P

  • How to set optional for table structure in functiona module

    hi experts,
    as i have small doubt regarding
    while publishing web service by using rfc where i am unable to set optional for table structure i am able to put optional for import parameters may i know how to set optional for table structure ....
    reagrds prabhanjan

    Ignoring the TABLES/CHANGING/EXPORTING argument...
    while publishing web service by using rfc where i am unable to set optional for table structure i am able to put optional for import parameters may i know how to set optional for table structure
    Why not?  There's no issue with marking a TABLES interface parameter with 'Optional' and publishing the function module or function group as a web service...

  • How to create and add table type to a DDIC Structure in sap 3.1H

    How to create and add table type to a DDIC Structure in sap 3.1H

    How to create and add table type to a DDIC Structure in sap 3.1H

  • How do you search for a song in the latest version of ITunes??

    How do you search for a song in the latest version of ITunes??
    Yes this might be the stupidest question ever, but leave it to Apple to make the simplest thing hard.
    In EVERY version of Itunes, up until 11, you used to be able to type an artists name, song name, or album into the search field and it would narrow it down so that you can see what you are looking for (in the list below).  Now, Itunes tells you that you have music by said artist, yet doesn't list them whatsoever. Furthermore, when you click on the results it doesn't list them for you either.
    I'm sure it is some weird setting, but cannot for the life of me find.  I cannot name one application that doesn't show a list when you type in the search field.  Augh!
    Please help.
    G

    You can choose what it searches and where

  • Associated table type of the Table parameters in function module

    Hi,
    If I want to select all the associated table types of the Table parameters used in a given function module in a report, how can that be done ?
    Thanks.
    Regards,
    Rajesh

    Try this.
    report zrich_0001 .
    data: import type table of rsimp with header line,
          change type table of rscha with header line,
          export type table of rsexp with header line,
          tables type table of rstbl with header line,
          except type table of rsexc with header line,
          docume type table of rsfdo with header line,
          source type table of rssource with header line.
    parameters: p_func type rs38l-name.
    call function 'RPY_FUNCTIONMODULE_READ'
      exporting
        functionname             = p_func
      tables
        import_parameter         = import
        changing_parameter       = change
        export_parameter         = export
        tables_parameter         = tables
        exception_list           = except
        documentation            = docume
        source                   = source
    exceptions
       error_message            = 1
       function_not_found       = 2
       invalid_name             = 3
       others                   = 4.
    loop at tables.
      write:/ tables-parameter,
              tables-dbstruct,
              tables-types,
              tables-optional,
              tables-typ,
              tables-class,
              tables-ref_class,
              tables-line_of,
              tables-table_of.
    endloop.
    Regards,
    Rich Heilman

  • Whats the important of "  table-type  " in sap abap?

    hi,
    i am ahmed. abap fresher.
    i want to what use and importance of table-type in sap abap which comes in      
                         datadictionary
                                V               
                        data types
    V----
    V                         V                                 V
    data element       structure                   table type
    i want to know about table type. plz give a brief idea.
    bye.

    hi,
    Transparent Tables
    A transparent table in the dictionary has a one-to-one relationship with a table in the database. Its structure in R/3 Data Dictionary corresponds to a single database table. For each transparent table definition in the dictionary, there is one associated table in the database. The database table has the same name, the same number of fields, and the fields have the same names as the R/3 table definition. When looking at the definition of an R/3 transparent table, it might seem like you are looking at the database table itself.
    Transparent tables are much more common than pooled or cluster tables. They are used to hold application data. Application data is the master data or transaction data used by an application. An example of master data is the table of vendors (called vendor master data), or the table of customers (called customer master data). An example of transaction data is the orders placed by the customers, or the orders sent to the vendors.
    Transparent tables are probably the only type of table you will ever create. Pooled and cluster tables are not usually used to hold application data but instead hold system data, such as system configuration information, or historical and statistical data.
    Both pooled and cluster tables have many-to-one relationships with database tables. Both can appear as many tables in R/3, but they are stored as a single table in the database. The database table has a different name, different number of fields, and different field names than the R/3 table. The difference between the two types lies in the characteristics of the data they hold, and will be explained in the following sections.
    Table Pools and Pooled Tables
    A pooled table in R/3 has a many-to-one relationship with a table in the database (see Figures 3.1 and 3.2). For one table in the database, there are many tables in the R/3 Data Dictionary. The table in the database has a different name than the tables in the DDIC, it has a different number of fields, and the fields have different names as well. Pooled tables are an SAP proprietary construct.
    When you look at a pooled table in R/3, you see a description of a table. However, in the database, it is stored along with other pooled tables in a single table called a table pool. A table pool is a database table with a special structure that enables the data of many R/3 tables to be stored within it. It can only hold pooled tables.
    R/3 uses table pools to hold a large number (tens to thousands) of very small tables (about 10 to 100 rows each). Table pools reduce the amount of database resources needed when many small tables have to be open at the same time. SAP uses them for system data. You might create a table pool if you need to create hundreds of small tables that each hold only a few rows of data. To implement these small tables as pooled tables, you first create the definition of a table pool in R/3 to hold them all. When activated, an associated single table (the table pool) will be created in the database. You can then define pooled tables within R/3 and assign them all to your table pool (see Figure 3.2).
    Pooled tables are primarily used by SAP to hold customizing data.
    When a corporation installs any large system, the system is usually customized in some way to meet the unique needs of the corporation. In R/3, such customization is done via customizing tables. Customizing tables contain codes, field validations, number ranges, and parameters that change the way the R/3 applications behave.
    Some examples of data contained in customizing tables are country codes, region (state or province) codes, reconciliation account numbers, exchange rates, depreciation methods, and pricing conditions. Even screen flows, field validations, and individual field attributes are sometimes table-driven via settings in customizing tables.
    During the initial implementation of the system the data in the customizing tables is set up by a functional analyst. He or she will usually have experience relating to the business area being implemented and extensive training in the configuration of an R/3 system.
    Table Clusters and Cluster Tables
    A cluster table is similar to a pooled table. It has a many-to-one relationship with a table in the database. Many cluster tables are stored in a single table in the database called a table cluster.
    A table cluster is similar to a table pool. It holds many tables within it. The tables it holds are all cluster tables.
    Like pooled tables, cluster tables are another proprietary SAP construct. They are used to hold data from a few (approximately 2 to 10) very large tables. They would be used when these tables have a part of their primary keys in common, and if the data in these tables are all accessed simultaneously. The data is stored logically as shown in Figure 3.3.
    Figure 3.3 : Table clusters store data from several tables based on the primary key fields that they have in common.
    Table clusters contain fewer tables than table pools and, unlike table pools, the primary key of each table within the table cluster begins with the same field or fields. Rows from the cluster tables are combined into a single row in the table cluster. The rows are combined based on the part of the primary key they have in common. Thus, when a row is read from any one of the tables in the cluster, all related rows in all cluster tables are also retrieved, but only a single I/O is needed.
    A cluster is advantageous in the case where data is accessed from multiple tables simultaneously and those tables have at least one of their primary key fields in common. Cluster tables reduce the number of database reads and thereby improve performance.
    For example, as shown in Figure 3.4, the first four primary key fields in cdhdr and cdpos are identical. They become the primary key for the table cluster with the addition of a standard system field pageno to ensure that each row is unique.
    Reward if helpful
    Jagadish

  • How to access the java stack table "xi_af_msg" from the ABAP engine.

    Hello Guys,
    How to access the java stack table "xi_af_msg" from the ABAP engine.
    I need to access this table.

    These 3 are the tables that are for XI Adapter in ABAP Stack.
    SWFRXICNT
    SWFRXIHDR
    SWFRXIPRC
    You can also try the following tables.
    SXMSAEADPMOD                   XI: Adapter and Module Information
    SXMSAEADPMODCHN                XI: Adapter Module Chains
    SXMSAEAGG                      XI: Adapter Runtime Data (Aggregated)
    SXMSAERAW                      XI: Adapter Runtime Data (Raw Data)
    Cheers,
    Sarath.
    Award if helpful.

Maybe you are looking for

  • Flat file load issue-Urgent

    Hello I'm trying to load a master data infoobject with a flat file and getting errors. The infoobject ZCOLLECT_DATE has two fields - ZQUARTER and ZCOLLECTDATE ZCOLLECT_DATE is of Data type NUMC, Length 5, conversion routine PERI5 and Output length 6

  • Java 1.4.2_03 display bug -- anyone else seen this?

    Hi All, I've noticed that my application, which worked fine under 1.3.1 and 1.4.1 no longer works under the latest and greatest (?) J2SE, 1.4.2. In short, the application consists of a bunch of JApplets stored as cards in a CardLayout, which is then

  • Itunes cannot connect to my ipod touch

    I have uninsalled and reistalled itunes, but to no avail.  I have followed all of the links on the support pages too, but nothing seems to owrk. I keep getting the following message when I log into ITunes "itunes could not connect to this ipod as an

  • Scale for co-ordinate axes

    I want to draw cordinate axes(X and Y) along the edges of my drawing area. I want that the cordinate axes are scaled. I mean number should appear at regular interval( user defined). Is there any predefined method to do that. Or I have to draw axes as

  • How do i import sms from android

    is there a how-to, how to import my sms from my old android phone? i didnt found any.