Field-symbol definition for a variable representing transparent tables

Hi Gurus
I'm trying to create a very simple report to display table descriptions and their DB number of records:
Ex:
MARA 50000
MARD 123000
I can't compile this piece of code:
field-symbols: <table>.
assign (DD02T-TABNAME) to <table>.
    clear n.
    *SELECT COUNT( * )*
       INTO n
       FROM <table>.
The problem here is that <table> is not defined in the ABAP dictionary as a a table , projection view or databse view.
1. Is there a way of defining <table> with a field-symbol data statement to make it work?
2. Alternatively, how can you produce a list of all table DB entry counts for a dynamic list of transparent tables?
Thanks
Nuno

With the code you have field symbol will "point" to a table contained in DD02T-TABNAME , not its name.
What you need is to get the table name , not table itself
field-symbols: <table_name>.
assign DD02T-TABNAME to <table>.  "get table name, not its content
clear n.
SELECT COUNT( * )
INTO n
FROM (<table>).
or simply without field symbol
SELECT COUNT( * )
INTO n
FROM (DD02T-TABNAME).
Regards
Marcin

Similar Messages

  • Passing field symbol value to a variable

    Hi All,
    I have a value in Field Symbol declared as   <FS-STATUS> TYPE STANDARD TABLE.
    I want to use the value  <fs-status> -low  in  a case statement.
    For this i think i have to pass the <fs-status> -low  into a variable and then use in case statement.
    Can anyone explain how to pass values in field symbol to variable? Or if this is not possible is there any other solution.
    Thanks in advance.

    Hi ,
    I have give some code sample ; just check ..
    DATA: BEGIN OF line,
             col1(1) TYPE c,
             col2(1) TYPE c VALUE 'X',
           END OF line.
    FIELD-SYMBOLS <fs> LIKE line.
    ASSIGN line TO <fs>.
    MOVE <fs>-col2 TO <fs>-col1.
    WRITE: <fs>-col1, <fs>-col2.
    Or u can check this link :
         http://www.erpgenie.com/abaptips/content/view/401/62/

  • ABAP field symbols and PERL reference variables to unnamed arrays.

    Rob -
    Please do NOT delete this post even though it contains this link:
    ABAP field symbols and PERL reference variables to unnamed arrays.
    to a question I posted in the Scripting Languages forum.
    It's a question that should be of interest to ABAP programmers, and they may miss if they don't frequent the SL forum ...
    Thanks for your forbearance here (in advance, of course) ...
    Best
    djh
    Edited by: Rob Burbank on Jul 11, 2011 1:26 PM

    If interested, please reply in the original thread. We don't want multiple conversations at cross purposes do we?
    Rob

  • Reg Field-Symbol value trasfer into variable

    Hi,
    I'm using one FIELD-SYMBOL in one of my program. I used this to catch Hotspot Fields in List Report. It catches that required field of BELNR.
    I read the Click event through that FIELD-SYMBOL. Now I used
    DATA: HOTSPOT(18) , "VALUE 'Document No',
          F(18), OFF TYPE I, LIN TYPE I, VAL(40), LEN TYPE I.
    FIELD-SYMBOLS <FS>.
    ASSIGN HOTSPOT TO <FS>.
    WRITE <FS> HOTSPOT COLOR 3 INVERSE ON.
    AT LINE-SELECTION.
    *WINDOW STARTING AT 5 6 ENDING AT 45 20.
    GET CURSOR FIELD F OFFSET OFF
    LINE LIN
    VALUE VAL
    LENGTH LEN.
    data: click_item type bsid-belnr.
    move val to click_item.
    It moves the value into CLICK_ITEM variable. But when I try to run SELECT query with condition BELNR = CLICK_ITEM, query gives no result.
    Can you please point out my fault?
    Thanks.
    Kumar saurav.

    Try using Conversion Routine before the Select Query.
    DATA : T_BELNR TYPE BSID_BELNR.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        input         = CLICK_ITEM
    IMPORTING
        OUTPUT        = T_BELNR
    and pass T_BELNR to the where condition.
    Hope this helps.

  • Issue while moving from string to field symbol -- waiting for help

    Hi Abap Experts,
    At present I got stucked here at client place. Please help me . Thanks in advance.
    I have a structure in field symbol. I also have data in the string (rec ty )
    I need to move it to corresponding fields in the field symbol. While moving, it is giving a dump.
    data:linetype type string,
    struc type ref to DATA.
    field-symbols: <fs> type any.
    linetype = i_strucname.
    " Get internal table and attach the field-symbol
    CREATE DATA struc type standard table OF (linetype).
    ASSIGN struc->* TO <fs>.
    <fs> = string. (dump is occuring here)

    Hi,
    My code:
    data:linetype type string,
    struc type ref to DATA.
    field-symbols: <fs> type any ,
    <f1> type any .
    linetype = i_strucname (Z structure)
    " Get internal table and attach the field-symbol
    CREATE DATA struc type standard table OF (linetype).
    ASSIGN struc->* TO <fs>.
    I need to populate the Z structure at runtime with the appropriate field values from the string.
    for example:
    input: abc \ \xyz
    structure: first ffield length 10,   " MY Z STRUCTURE
                   second field length 5
                    third field length 10.
    output: abc        xyz         
    I get the structures dynamically.

  • Using field-symbols with FOR ALL ENTRIES IN ...

    Hi all of you,
    Is it possible to use field symbol by the FOR ALL THE ENTRIES IN itab.
    Normally, isn't possible.
    So my problem is that I'm having duplicate code.
    I've something like this.
          IF ap_objcl EQ omaterial.
            SELECT objectid
            INTO TABLE i_cdpos
            FROM cdpos
            FOR ALL ENTRIES IN otf_materials
            WHERE objectclas = ap_objcl AND
                  tabname = otf_materials-tablename AND
                  fname = otf_materials-fieldname.
         ELSEIF ap_objcl EQ otf_documents...
    And I'm looking to use otf_materials and otf_documents
    So, instead to duplicate the code, I'm looking for a way to restrain the code by using maybe field symbols.
    Ideal :
    FIELD-SYMBOLS : <otf_mats_docs> LIKE OTF_TABLE.
    IF ap_objcl EQ omaterial
    ASSIGN local copy of otf_materials TO <otf_mats_docs> CASTING.
    ELSEIF ap_objcl EQ odocuments
    ASSIGN local copy of otf_documents TO <otf_mats_docs> CASTING.
    ENDIF.
            SELECT objectid
            INTO TABLE i_cdpos
            FROM cdpos
            FOR ALL ENTRIES IN <otf_mats_docs>
            WHERE objectclas = ap_objcl AND
                  tabname = <otf_mats_docs>-tablename AND
                  fname = <otf_mats_docs>-fieldname.
    IF ap_objcl EQ omaterials.
    *Do nothing
    ELSEIF ap_objcl EQ odocuments.
    *Do something with the date in otf_documents.
    ENDIF.
    Regards,
    Kais

    Hi,
    Ok, using forms is great things to deal with it.
    But, may be it'll slow down the program and I need a really rapid program.
    I tried using form.
    The problem by pushing the FOR ALL ENTRIES IN <structure>
    didn't works.
    It tells me that the structure that I pushed via "using" is not an internal table.
    The same structure work find in the global program.
    What should I do ?.
    The structure is given by as a parameters in Function Module.
    FORM data_search
      USING
        object_cl TYPE j_objnr
        table_data LIKE ****structure****
      CHANGING
        global_lst TYPE ANY TABLE.
          DATA : BEGIN OF otf_list OCCURS 0,
               objectid TYPE cdpos-objectid,
             END OF otf_list.
      DATA : ii_cdpos LIKE TABLE OF otf_list WITH HEADER LINE.
         IF table_data IS NOT INITIAL.
            SELECT objectid
            INTO TABLE ii_cdpos
            FROM cdpos
            FOR ALL ENTRIES IN table_data
            WHERE objectclas = object_cl AND
                  tabname = table_data-tablename AND
                  fname = table_data-fieldname.
          ELSE.
            SELECT objectid
            INTO TABLE i_cdpos
            FROM cdpos
            WHERE objectclas = ap_objcl.
          ENDIF.
          SELECT DISTINCT objectid
          INTO TABLE global_lst
          FROM cdhdr
          FOR ALL ENTRIES IN ii_cdpos
          WHERE ( ( udate GT from_date AND udate LT to_date ) OR
                  ( udate EQ from_date AND udate NE to_date AND utime GE from_time ) OR
    *              ( udate NE from_date AND udate EQ to_date AND utime LE to_time ) OR
    *              ( udate EQ from_date AND udate EQ to_date AND utime GE from_time AND utime LE to_time )
                  ( udate EQ to_date AND (
                                           udate NE from_date OR
                                           utime GE from_time
                                     AND utime LE to_time )
                ) AND
                objectclas = ap_objcl AND
                objectid = ii_cdpos-objectid.
    ENDFORM.

  • Read dynamic field symbol Work Area before append to dynamic table

    Hi experts:
    I have a dynamic work area but before doing an append to the dynamic table, I need to do some validation on some fields of the work area in order to decide to append it or not, but I don't know how...
    More or less this is the example
    loop at so_kschl.
        field = so_kschl-low.
        if <t_dyntable>-field = 0. "if the value of this field in dinamic table is 0.
    don't append
        else.
           APPEND <fs_dyntable> TO <t_dyntable>.  
        endif.
    endloop.
    Thank you very much for your help.
    Miriam

    Check this example, you read the component of the dynamic work area and assign it to a field-symbols. In this case, I validate that the entry is always 'a'.
    DATA: i_lvc TYPE lvc_t_fcat WITH HEADER LINE,
          i_table TYPE REF TO data,
          l_style TYPE lvc_fname,
          l_warea TYPE REF TO data,
          l_name(7) VALUE 'VARCHAR'..
    FIELD-SYMBOLS: <fs> TYPE table,
                  <fs2> TYPE ANY,
                  <fs3> TYPE ANY.
    PARAMETERS p_char TYPE c LOWER CASE.
    START-OF-SELECTION.
      i_lvc-fieldname = 'Varchar'.
      i_lvc-inttype = 'C'.
      i_lvc-intlen = 1.
      APPEND i_lvc.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
      it_fieldcatalog = i_lvc[]
      IMPORTING
      ep_table = i_table
      e_style_fname = l_style.
      ASSIGN i_table->* TO <fs>.
      CREATE DATA l_warea LIKE LINE OF <fs>.
      ASSIGN l_warea->* TO <fs2>.
      <fs2> = p_char.
      ASSIGN COMPONENT l_name OF STRUCTURE <fs2> TO <fs3>.
      IF <fs3> = 'a'.
        WRITE: 'Component VARCHAR is a'.
    *  APPEND <fs2> TO <fs>.
      ELSE.
        WRITE: 'Component VARCHAR is not a'.
      ENDIF.

  • FIELD-SYMBOLS as parameter subroutine that point to table

    Hi everyone,i have question. We often send table through subroutine using keyword TABLE.
    FORM f_xxx TABLES pt_xxx
    Now my question is possible send this internal table through field symbols? If so, how to do this?
    1. FORM f_xxx USING <fs_xxx> STRUCTURE ty_xxx or
    2. FORM f_xxx CHANGING <fs_xxx> STRUCTURE .... or
    3. FORM f_yyy TABLES <fs_yyy>
    Thank you.
    Regards,
    Satria

    Hi everyone,i have question. We often send table through subroutine using keyword TABLE.
    FORM f_xxx TABLES pt_xxx
    Now my question is possible send this internal table through field symbols? If so, how to do this?
    1. FORM f_xxx USING <fs_xxx> STRUCTURE ty_xxx or
    2. FORM f_xxx CHANGING <fs_xxx> STRUCTURE .... or
    3. FORM f_yyy TABLES <fs_yyy>
    Thank you.
    Regards,
    Satria

  • How check variable in field-symbol?

    Hi
    I have in my report following code:
    data: l_auth_pai type zps_auth_pai,
             name(20)   type c.
       field-symbols: <rep_var>  type any.
           CONCATENATE 'pai_' l_auth_pai-stru_name into name.
            assign (name) TO <rep_var>.
    Could You suggest me a way, in which I can check:
    1. if in report a variable with name "name' exist/is declared
    2.if variable with name "name" is an internal table or a line
    Thx in advance
    J.S.
    Edited by: John Smith on Oct 17, 2008 12:46 PM

    Hi,
    data: l_auth_pai type zps_auth_pai,
             name(20)   type c.
       field-symbols: <rep_var>  type any.
           CONCATENATE 'pai_' l_auth_pai-stru_name into name.
            assign (name) TO <rep_var>.
    assume that there is a variable pai_matnr and its value is 'TEST'
    in your case I assume that l_auth_pai-stru_name contains value 'MATNR'
    then statement
    assign (name) TO <rep_var>
    will cause field-symbol <rep_var> to reference variable pai_matnr
    it could be structure or internal table depends on how it is declared.
    Regards,
    Vishal

  • Sample program for field symbol

    hi,
             I am fresher. I want sample program(code) for field symbol.

    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/field_sy.htm
    TYPES: BEGIN OF line,
             col1 TYPE c,
             col2 TYPE c,
           END OF line.
    DATA: wa TYPE line,
          itab TYPE HASHED TABLE OF line WITH UNIQUE KEY col1,
          key(4) TYPE c VALUE 'COL1'.
    FIELD-SYMBOLS <fs> TYPE ANY TABLE.
    ASSIGN itab TO <fs>.
    READ TABLE <fs> WITH TABLE KEY (key) = 'X' INTO wa.
    The internal table ITAB is assigned to the generic field symbol <FS>, after which it is possible to address the table key of the field symbol dynamically. However, the static address
    READ TABLE <fs> WITH TABLE KEY col1 = 'X' INTO wa.
    is not possible syntactically, since the field symbol does not adopt the key of table ITAB until runtime. In the program, the type specification ANY TABLE only indicates that <FS> is a table. If the type had been ANY (or no type had been specified at all), even the specific internal table statement READ TABLE <FS> would not have been possible.
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb387a358411d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb387a358411d1829f0000e829fbfe/content.htm

  • How to access dynamic fields in a field symbol

    hi
    how do i access the dynamic fields created in side a field-symbol....
    wht i mean is i have a table, whose workarea i assign to field symbol. but this table is runtime, altough i have debugged and found the values in this table, I want to accees the field symbol in a generic way.
    say the table has 3 fields now fld1 fld2 and fld3 so i want to access the field symbol <fs> as <fs>-(name) where name can be anything fld1 or fld2 whichever i assign....
    thanks. Let me know if you have any further questions.

    Field symbols are placeholders or symbolic names for other fields. They do not physically reserve space for a field, but point to its contents. A field symbol cam point to any data object. The data object to which a field symbol points is assigned to it after it has been declared in the program.
    Whenever you address a field symbol in a program, you are addressing the field that is assigned to the field symbol. After successful assignment, there is no difference in ABAP whether you reference the field symbol or the field itself. You must assign a field to a field symbol before you can address it in a program.
    Field symbols are similar to de-referenced pointers in the C programming language (that is, pointers to which the content operator * is applied). In ABAP, data references represent a real equivalent to pointers in the sense of variables that contain a memory address and can be used without the contents operator.
    All operations programmed with field symbols are applied to the field assigned to it. A MOVE statement between two field symbols, for example, assigns the contents of the field assigned to another source field symbol to the field assigned to the target field symbol. The field symbols themselves point to the same fields after the MOVE statement as they did before the MOVEstatement.
    You can create field symbols either without or with type specifications. If you do not specify a type, the field symbol inherits all of the technical attributes of the field assigned to it. If you do specify a type, the system checks during the field assignment whether the assigned field matches the type of field symbol.
    Field symbols provide greater flexibility when you address data objects:
    ·        You can assign one field symbol to another, which allows you to address subfields.
    ·        Assignments to field symbols may extend beyond field boundaries. This allows you to address regular sequences of fields in memory efficiently.
    ·        You can also force a field symbol to take different technical properties than those of the field assigned to it (casting).
    The flexibility of field symbols provides elegant solutions to certain problems. On the other hand, it does mean that errors can easily occur. Since fields are not assigned to field symbols until runtime, the effectiveness of syntax and security checks is very limited for operations involving field symbols. This can lead to runtime errors or incorrect data assignments.
    While runtime errors indicate an obvious problem, incorrect data assignments are dangerous because they can be very difficult to detect. For this reason, you should only use field symbols if you cannot achieve the same result using other ABAP statements.
    For example, you may want to process part of a string where the offset and length depend on the contents of the field. You could use field symbols in this case. The MOVE statement (with your own auxiliary variables, if required) is much safer than using field symbols, since it cannot address memory beyond the boundary of a field. However, field symbols may improve performance in some cases.
    To declare a field symbol, use the statement
    FIELD-SYMBOLS  .
    For field symbols, the angle brackets are part of the syntax. They identify field symbols in the program code.
    If you do not specify any additions, the field symbol.
    in a static ASSIGN and:
    ASSIGN (dobj) TO  from the second loop pass onwards.

  • Field symbols not working in data transfer VOFM routine

    Hi,
    I have been trying to set a value using field symbols, however for some reasons its not working. I am using a field symbol in a data transfer routine and the value which I am trying to set is a standard field outside the VOFM routine code.
    I am trying to set a  field gla_subrc which is actually a changing parameter.
    The actual paramter is gn_subrc of type sy-subrc and within the form the name is gla_subrc. I need to set this changing parameter gla_subrc using the data transfer routine.
    Is there a specific rule that field symbols dont work for changing paramters within subroutine or is there a specific syntax.
    The syntax I am using is
    ASSIGN ('(SAPLV50S)gla_subrc')  to <fs>. 
    I also used the local program name instead of main program but still that does not work. Tried using the actual parameter as well.
    Can someone please help me in this.
    Thanks & Regards,
    Naresh.

    I need to stop outbound delivery creation against STO using vl10b transaction. The only way to stop creation is using data transfer delivery VOFM routine.
    If i give an error message MESSAGE E001, this will give a hard error which is not acceptable. To avoid this, i use a perform message statment with message id and certain parameters which can displayed in a log.
    However to make sure this message is displayed in log, I am clearing a work area having specific data needed for delivery creation.
    Because of this clear, my error message gets captured in log but along with this another fake message is displayed in log which caused by the clear message.
    The user gets confused as he now sees 2 messages, 1 which is correct and other 1 which is fake and that confuses him.
    Data transfer routine is not the best place to give messages in log but we have very few options. The only way the system can give 1 message is if i set gla_subrc to 1. This is a variable which will help the system understand that the delivery should not be created as there is something wrong because the value is 1. Hence it will stop the creation and instead display whatever message i had passed to the log.
    I need to somehow set this variable to 1 based on lot of analysis that has been done in the past.
    Please let me know if there is any way by which we can fix this.
    Thanks & Regards,
    Naresh.

  • In getting error in field symbols

    your attempted to assign a field to a type filed symbols but the field dose not have the required type.
    iam getting runtimes error like this what should i do for this.
    regards,
    sivakumar

    Hi,
    Do not assign any particular data type to your field symbol definition.
    field-symbols: <fs> type any.
    assign p_matnr to <fs>.
    assign sy-datum to <fs>.
    regards
    Subramanian

  • What is field symbols?

    Hi all,
    Can anyone explains what is Fiels symbol and significance of that with examples?
    Thanks
    Shiva

    HI Shiva
    Field symbols are placeholders or symbolic names for other fields. They do not physically reserve space for a field, but point to its contents. A field symbol cam point to any data object. The data object to which a field symbol points is assigned to it after it has been declared in the program.
    Whenever you address a field symbol in a program, you are addressing the field that is assigned to the field symbol. After successful assignment, there is no difference in ABAP whether you reference the field symbol or the field itself. You must assign a field to each field symbol before you can address the latter in programs.
    Field symbols are similar to dereferenced pointers in C (that is, pointers to which the content operator * is applied). However, the only real equivalent of pointers in ABAP, that is, variables that contain a memory address (reference) and that can be used without the contents operator, are reference variables in ABAP Objects. (For more information, see Data References).
    All operations programmed with field symbols are applied to the field assigned to it. For example, a MOVE statement between two field symbols moves the contents of the field assigned to the first field symbol to the field assigned to the second field symbol. The field symbols themselves point to the same fields after the MOVE statement as they did before.
    You can create field symbols either without or with type specifications. If you do not specify a type, the field symbol inherits all of the technical attributes of the field assigned to it. If you do specify a type, the system checks the compatibility of the field symbol and the field you are assigning to it during the ASSIGN statement.
    Field symbols provide greater flexibility when you address data objects:
    If you want to process sections of fields, you can specify the offset and length of the field dynamically.
    You can assign one field symbol to another, which allows you to address parts of fields.
    Assignments to field symbols may extend beyond field boundaries. This allows you to address regular sequences of fields in memory efficiently.
    You can also force a field symbol to take different technical attributes from those of the field assigned to it.
    The flexibility of field symbols provides elegant solutions to certain problems. On the other hand, it does mean that errors can easily occur. Since fields are not assigned to field symbols until runtime, the effectiveness of syntax and security checks is very limited for operations involving field symbols. This can lead to runtime errors or incorrect data assignments.
    While runtime errors indicate an obvious problem, incorrect data assignments are dangerous because they can be very difficult to detect. For this reason, you should only use field symbols if you cannot achieve the same result using other ABAP statements.
    For example, you may want to process part of a string where the offset and length depend on the contents of the field. You could use field symbols in this case. However, since the MOVE statement also supports variable offset and length specifications, you should use it instead. The MOVE statement (with your own auxiliary variables if required) is much safer than using field symbols, since it cannot address memory beyond the boundary of a field. However, field symbols may improve
    To declare a field symbol, use the statement
    FIELD-SYMBOLS <FS> [<type>|STRUCTURE <s> DEFAULT <wa>].
    For field symbols, the angle brackets are part of the syntax. They identify field symbols in the program code.
    If you do not specify any additions, the field symbol <FS> can have data objects of any type assigned to it. When you assign a data object, the field symbol inherits its technical attributes. The data type of the assigned data object becomes the actual data type of the field symbol.
    Note: it is possible to assign reference variables and structured data objects to untyped field symbols. However, the static field symbol is only a pointer to the field in memory, and does not have the complex type attributes of a reference or structured field until runtime. You can only use the field symbol to address the whole field (for example, in a MOVE statement). Specific statements such as CREATE OBJECT <FS> or LOOP AT <FS> are not possible.
    Typing Field Symbols
    The <type> addition allows you to specify the type of a field symbol. When you assign a data object to a field symbol, the system checks whether the type of the data object you are trying to assign is compatible with that of the field symbol. If the types are not compatible or convertible, the system reacts with a syntax or runtime error. If however, you want to assign the type of the field symbol to the data object by means of casting, you must do so explicitly using the ASSIGN statement. The system then treats the assigned data object as if it had the same type as the field symbol.
    You specify the type of a field symbol using the same semantics as for formal parameters in procedures. For <type> you can enter either TYPE <t> or LIKE <f>. You can specify the type either generically or in full. If you specify a generic type, the type of the field symbol is either partially specified or not specified at all. Any attributes that are not specified are inherited from the corresponding data object in the ASSIGN statement. If you specify the type fully, all of the technical attributes of the field symbol are determined when you define it. You can then only assign data objects to it that have exactly the same data type.
    You should always specify a type for each field symbol. If you cannot avoid defining a generic field symbol, make this clear by using an appropriate generic type declaration.
    Generic Type Specification
    The following types allow you more freedom when using actual parameters. The data object only needs to have the selection of attributes specified.
    Typing
    Check for data object
    No type specification
    TYPE ANY
    All types of data object are accepted. The field symbol adopts all of the attributes of the data object.
    TYPE C, N, P, or X
    Only data objects with type C, N, P, or X are accepted. The field symbol adopts the field length and DECIMALS specification (type P) of the data object.
    TYPE TABLE
    The system checks whether the data object is a standard internal table. This is a shortened form of TYPE STANDARD TABLE (see below).
    TYPE ANY TABLE
    The system checks whether the data object is an internal table. The field symbol inherits all of the attributes (line type, table type, key) from the data object.
    TYPE INDEX TABLE
    The system checks whether the data object is an index table (standard or sorted table). The field symbol inherits all of the attributes (line type, table type, key) from the data object.
    TYPE STANDARD TABLE
    The system checks whether the data object is a standard internal table. The field symbol inherits all of the remaining attributes (line type, key) from the data object.
    TYPE SORTED TABLE
    The system checks whether the actual parameter is a sorted internal table. The field symbol inherits all of the remaining attributes (line type, key) from the data object.
    TYPE HASHED TABLE
    The system checks whether the actual parameter is a hashed internal table. The field symbol inherits all of the remaining attributes (line type, key) from the data object.
    If you specify a type generically, remember that the attributes inherited by the field symbol from the program are not statically recognizable in the program. You can, at most, address them dynamically.
    TYPES: BEGIN OF line,
             col1 TYPE c,
             col2 TYPE c,
           END OF line.
    DATA: wa TYPE line,
          itab TYPE HASHED TABLE OF line WITH UNIQUE KEY col1,
          key(4) TYPE c VALUE 'COL1'.
    FIELD-SYMBOLS <fs> TYPE ANY TABLE.
    ASSIGN itab TO <fs>.
    READ TABLE <fs> WITH TABLE KEY (key) = 'X' INTO wa.
    The internal table ITAB is assigned to the generic field symbol <FS>, after which it is possible to address the table key of the field symbol dynamically. However, the static address
    READ TABLE <fs> WITH TABLE KEY col1 = 'X' INTO wa.
    is not possible syntactically, since the field symbol does not adopt the key of table ITAB until runtime. In the program, the type specification ANY TABLE only indicates that <FS> is a table. If the type had been ANY (or no type had been specified at all), even the specific internal table statement READ TABLE <FS> would not have been possible.
    If you adopt a structured type generically (a structure, or a table with structured line type), the individual components cannot be addressed in the program either statically or dynamically. In this case, you would have to work with further field symbols and the method of assigning structures component by component.
    Specifying the Type Fully
    When you use the following types, the technical attributes of the field symbols are fully specified. The technical attributes of the data objects must correspond to those of the field symbol.
    Typing
    Technical attributes of the field symbol
    TYPE D, F, I, or T
    The field symbol has the technical attributes of the predefined elementary type
    TYPE <type>
    The field symbol has the type <type>. This is a data type defined within the program using the TYPES statement, or a type from the ABAP Dictionary
    TYPE REF TO <cif>|DATA
    The field symbol is a reference variable for the class or interface <cif>, or for a data object.
    TYPE LINE OF <itab>
    The field symbol has the same type as a line of the internal table <itab> defined using a TYPES statement or defined in the ABAP Dictionary
    LIKE <f>
    The field symbol has the same type as an internal data object <f> or structure, or a database table from the ABAP Dictionary
    When you use a field symbol that is fully typed, you can address its attributes statically in the program, since they are recognized in the source code. If you fully specify the type of a field symbol as a reference or structured data object, you can address it as you would the data object itself, once you have assigned an object to it. So, for example, you could address the components of a structure, loop through an internal table, or create an object with reference to a field symbol.
    REPORT demo_field_symbols_type .
    DATA: BEGIN OF line,
             col1(1) TYPE c,
             col2(1) TYPE c VALUE 'X',
           END OF line.
    FIELD-SYMBOLS <fs> LIKE line.
    ASSIGN line TO <fs>.
    MOVE <fs>-col2 TO <fs>-col1.
    The field symbol <FS> is fully typed as a structure, and you can address its components in the program.
    Attaching a structure to a field symbol
    The STRUCTURE addition forces a structured view of the data objects that you assign to a field symbol.
    FIELD-SYMBOLS <FS> STRUCTURE <s> DEFAULT <f>.
    The structure <s> is either a structured local data object in the program, or a flat structure from the ABAP Dictionary. <f> is a data object that must be assigned to the field symbol as a starting field. However, this assignment can be changed later using the ASSIGN statement.
    When you assign a data object to the field symbol, the system only checks that it is at least as long as the structure. You can address the individual components of the field symbol. It has the same technical attributes as the structure <s>.
    If <s> contains components with type I or F, you should remember the possible effects of alignment. When you assign a data object to a field symbol with a structure, the data object must have the same alignment, otherwise a runtime error may result. In such cases, you are advised to assign such data objects only to structured field symbols, which retain the same structure as the field symbol at least over the length of the structure.
    The STRUCTURE is obsolete; you should no longer use it. Field symbols defined using the STRUCTURE addition are a mixture of typed field symbols and a utility for casting to either local or ABAP Dictionary data types. If you want to define the type of a field symbol, include the TYPE addition in a FIELD-SYMBOLS statement. If you want to use casting, include the CASTING addition in an ASSIGN statement.
    Example using the obsolete STRUCTURE addition:
    DATA: wa(10) VALUE '0123456789'.
    DATA: BEGIN OF line1,
             col1(3),
             col2(2),
             col3(5),
          END OF line1.
    DATA: BEGIN OF line2,
             col1(2),
             col2 LIKE sy-datum,
          END OF line2.
    FIELD-SYMBOLS: <f1> STRUCTURE line1 DEFAULT wa,
                   <f2> STRUCTURE line2 DEFAULT wa.
    WRITE: / <f1>-col1, <f1>-col2, <f1>-col3,
           / <f2>-col1, <f2>-col2.
    Example using the correct syntax (TYPE and CASTING):
    DATA: wa(10) VALUE '0123456789'.
    DATA: BEGIN OF line1,
             col1(3),
             col2(2),
             col3(5),
          END OF line1.
    DATA: BEGIN OF line2,
             COL1(2),
             COL2 LIKE sy-datum,
          END OF line2.
    FIELD-SYMBOLS: <f1> LIKE line1.
    ASSIGN wa TO <f1> CASTING.
    FIELD-SYMBOLS: <f2> LIKE line2.
    ASSIGN wa TO <f2> CASTING.
    WRITE: / <f1>-col1, <F1>-col2, <F1>-col3,
           / <f2>-col1, <F2>-col2.
    In both cases, the list appears as follows:
    012 34 56789
    01 2345/67/89
    This example declares two field symbols to which different structures are attached. The string WA is then assigned to each of them. The output shows that the field symbols assign the strings component by component according to the type of the components.
    Assigning Components of Structures to a Field Symbol
    For a structured data object <s>, you can use the statement
    ASSIGN COMPONENT <comp> OF STRUCTURE <s> TO <FS>.
    to assign one of its components <comp> to the field symbol <FS>. You can specify the component <comp> either as a literal or a variable. If <comp> is of type C or a structure that has no internal tables as components, it specifies the name of the component. If <comp> has any other elementary data type, it is converted to type I and specifies the number of the component. If the assignment is successful, SY-SUBRC is set to 0. Otherwise, it is set to 4.
    This statement is particularly important for addressing components of structured data objects dynamically. If you assign a data object to a field symbol either generically or using casting, or pass it generically (or using casting) to the parameter interface of a procedure, you cannot address its components either statically or dynamically. Instead, you must use the above statement. This allows indirect access either using the component name or its index number.
    DATA: BEGIN OF LINE,
            COL1 TYPE I VALUE '11',
            COL2 TYPE I VALUE '22',
            COL3 TYPE I VALUE '33',
          END OF LINE.
    DATA COMP(5) VALUE 'COL3'.
    FIELD-SYMBOLS: <F1>, <F2>, <F3>.
    ASSIGN LINE TO <F1>.
    ASSIGN COMP TO <F2>.
    DO 3 TIMES.
      ASSIGN COMPONENT SY-INDEX OF STRUCTURE <F1> TO <F3>.
      WRITE <F3>.
    ENDDO.
    ASSIGN COMPONENT <F2> OF STRUCTURE <F1> TO <F3>.
    WRITE / <F3>.
    The output is:
    11         22         33
    33
    The field symbol <F1> points to the structure LINE, <F2> points to the field COMP. In the DO loop, the components of LINE are specified by their numbers and assigned one by one to <F3>. After the loop, the component COL3 of LINE is specified by its name and assigned to <F3>. Note that ASSIGN COMPONENT is the only possible method of addressing the components of <F1>. Expressions such as <F1>-COL1 are syntactically incorrect.
    Regards,
    Laxmi.

  • Field symbols im samrt forms

    HI gurus in smart forms in global definitions there is a tab called field symbols wat for it is used and how to use it can any body explain me with an aexample

    hi rajesh,
    http://searchsap.techtarget.com/tip/0,289483,sid21_gci790038,00.html
    hope this will help u
    Regards,
    sindhu.

Maybe you are looking for

  • PowerMac G5 (quad) vs Intel Macs?

    Hello what would be better? The PowerMac G5 (quad powerpc 2.5ghz) or Intel Mac mini or Intel iMac. i don't have enough money for a Mac pro, so that's out of the question, but on ebay, the Powermac G5's (with quad processors) are about the same pice a

  • Groups - sort by display name

    Hi All, I've a question: do you know how to make Lync client to sort my groups by name (alphabetically - A->Z)?  I have more than 20 groups and I've noticed that after few weeks some groups changed the initial location on the list. And now I have the

  • How can i view images ?

    In some web sites (famous, big retail websites) the images are not loaded when i view a website, instead i see a square with a question mark for each picture that was supposed to be.... just to make sure, the "laod pictures" is checked on the prefere

  • DB from AIX to NT

    Can I use the full database backup (made under AIX)to restore it under Windows NT 4.0? Both databases are version 8.0.4, however the NT version is a workgroup version and the AIX version is an Enterprise Edition. Thanks in advance. null

  • MacBook Pro (Late 2011) calibration problem

    Hi, I have tried to calibrate the monitor of my MacBook Pro (Late 2011, Mountain Lion OS) with the Spyder4Express, but the monitor has a yellow cast after the calibration. I've verified the yellow cast by comparing my monitor with other calibrated mo