Field symbol to dynamic variable field naming

Hello all,
I am not used to field-symbols and I don't know if it's possible to do.
I need to create a node for a ALV Tree and the hierarchy changes 9 times. So, instead of create 9 loops I want to create a Perform and use the field as parameter.
case 'X'.
     when s1.
       perform tree_nodes_s1 using 'BEZEI' 'NAME1' 'VTEXT'.
     when s2.
       perform tree_nodes_s2 using 'BEZEI' 'VTEXT' ''.
In the Form
loop at it_data into wa_data.
     if l_field1 is not initial.
       on change of field.
         perform add_carrid_line using wa_data   ''
                                 changing l_carrid_key.
       endon.
     endif.
So, the field need to be wa_data-bezei or wa_data-name1 or wa_data-vtext etc.
I guess that I saw it on SAP code but I really don't know how to reproduce it.
Thanks,
Andréa

Hi Roland Spindler
I did that before and I thought that it was wrong because I got this same error message:
The field "<L_FIELD1>" specified under LIKE either has no type or a  generic type. type.
Code
   field-symbols: <l_field1> type any.
   assign component param1 of structure wa_data to <l_field1>.
   check sy-subrc = 0.
     loop at it_data into wa_data.
     if <l_field1> is not initial.
       on change of <l_field1>.
         perform add_carrid_line using wa_data   ''
                                 changing l_carrid_key.
       endon.
     endif.
Not sure if I can use it on 'on change of'.
do you know the right type to declare?
Thanks,
Andrea

Similar Messages

  • Need Help in Field Symbol for Dynamically passing  table field value

    Hi All,
    In my internal table I am having data.
    I am dynamically forming table field name and substitute for the another table field name to pass DATA.
    but I am getting the Variable name insted of Value ie Data.
    I am using Field Symbol for this.
    data:
    Field-symbols <TS> type any.
    field1 type string.
    LOOP AT TABLEFIELDS INTO WA_TABLEFIELDS.
                READ TABLE  TEST  WITH KEY NAME = WA_TABLEFIELDS-FIELDNAME.
                IF SY-SUBRC = 0.
                  CONCATENATE 'WA_' WA_TABLEFIELDS-TABNAME '-' WA_TABLEFIELDS-FIELDNAME INTO  Field1.
                  Assign Field1 to <TS>.
                    ALL_VAL-VALUE = <TS>
    "After substituting the <TS>  into ALL_VAL-VALUE  field I need a DATA to be passed but the variable name is appending"*    
             APPEND ALL_VAL.
                ENDIF.
              ENDLOOP.
    kindly how to pass the value into the table.
    Thanks in advance.
    San

    Hi,
    pls assign a break point in
    CONCATENATE 'WA_' WA_TABLEFIELDS-TABNAME '-' WA_TABLEFIELDS-FIELDNAME INTO Field1.
    Assign Field1 to <TS>.
    ALL_VAL-VALUE = <TS>
       " Put a break point here and check for the value in <TS>.
    if <TS> contains value then create a work area for ALL_VAL AND PASS the Field-Symbol to that and then  append thw wa into the table...
    Hope this works out!!
    thanks

  • How to use Field-symbol with dynamic select query

    Can anybody tell me, how to use field-symbols in the dynamic select query.

    FIELD-SYMBOLS <fs> { typing | STRUCTURE struc DEFAULT dobj }.
    1. ... typing
    2. ... STRUCTURE struc DEFAULT dobj
    The FIELD-SYMBOLS statement declares a field symbol <fs>. The name conventions apply to the name fs. The angle brackets of the field symbols indicate the difference to data objects and are obligatory. You can declare field symbols in any procedure and in the global declaration section of an ABAP program, but not in the declaration section of a class or an interface. You can use a field symbol in any operand position in which it is visible and which match the typing defined using typing.
    After its declaration, a field symbol is initial - that is, it does not reference a memory area. You have to assign a memory area to it (normally using the ASSIGN statement) before you can use it as an operand. Otherwise an exception will be triggered.
    eg.
    FIELD-SYMBOLS <fs> TYPE ANY.
    DATA: BEGIN OF line,
            string1(10) VALUE '0123456789',
            string2(10) VALUE 'abcdefghij',
          END OF line.
    WRITE / line-string1+5.
    ASSIGN line-string1+5(*) TO <fs>.
    WRITE / <fs>.
    output:
    56789
    56789
    reward if helpful
    anju

  • Are field symbols and Dynamic internal tables consistant?

    Hi,
    Are field symbols and Dynamic internal tables
    always consistent?
    In my program I m creating a dynamic itab and assignig values to it using <FS>, sometimes the program fails to execute assign <Fs> statement...
    this happens once in 3 to 4 runs
    any solution...
    I have proper clear and refresh statements in program.
    Thanks,
    Hardik

    Anurag,
    Thanks for a quick reply. Here I am sending a small piece of my code.
    MOVE-CORRESPONDING OUTTAB TO DYNTAB.
          CLEAR IT_UDATE.
          CLEAR : T_KBETR .
          READ TABLE IT_UDATE WITH KEY UDATE = OUTTAB-UDATE.
          CONCATENATE 'DYNTAB-KBETR' IT_UDATE-CO_POS INTO T_KBETR.
          ASSIGN (T_KBETR) TO <FS> .
          SUBRC5 = SY-SUBRC .
          IF SUBRC5 = 0 .
              <FS> =  OUTTAB-KBETR .
          ENDIF .
    read statement will always return CO_POS .
    while debuging this code a few times
    <b>ASSIGN (T_KBETR) TO <FS> .</b>
    returns sy-subrc = 4
    and that was leading the program to short dump earlier.
    now, as I have a check DYNTAB-KBETR holds no value on display.
    this happens very few times. (most of the times report is displaying desired output)
    Thanks,
    Hardik

  • I am stuck in FIELD-SYMBOLS and dynamic tables.

    Hi guys,
                I am trying to create dynamic table. My requirement is as follows--
    I have to display grid layout report in depending on given input.
    In input i have fields for DC and STORE.
    In output i have to display columns depending on number of DC and STORE paased in input.
    For example if in input, i have 2 DCs DC01 and DC02 and in STs i have say 1 input - ST01
    then in outpt grid report there will be 3 columns.
    So my columns to be displayed depends on number of input values given while running it.
    I am trying to use dynamic table.
    My output report contains fields from different table...so i cant use
    FIELD-SYMBOLS: <DYN_TABLE> TYPE STANDARD TABLE
    instead i m trying to use
    FIELD-SYMBOLS: <DYN_TABLE> LIKE T_ARTMAS  "T_ARTMAS is declared as types : begin of....end of .... .
    but it is giviing an error in following form
    FORM CREATE_DYNAMIC_ITAB.
    Create dynamic internal table and assign to FS
      CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
          IT_FIELDCATALOG = IFC
        IMPORTING
          EP_TABLE        = DY_TABLE.
      ASSIGN DY_TABLE->* TO <DYN_TABLE>.
    Create dynamic work area and assign to FS
      CREATE DATA DY_LINE LIKE LINE OF <DYN_TABLE>........error on this line.
      ASSIGN DY_LINE->* TO <DYN_WA>.
    ENDFORM.                    "create_dynamic_itab
    saying "<DYN_TABLE>" is not an internal table - the "OCCURS n" specification is missing.          
    Kindly help me...
    thx in advance...

    Hi
    .FIELD-SYMBOLS: <DYN_TABLE> LIKE T_ARTMAS "T_ARTMAS is declared as types : begin of....end of .... .
    but it is giviing an error in following form.....
    Just as Sasha wrote, the problem could be you've defined a flat structure and u need a table, but now just a little a question: why do u want to use a dynamic table but your field-symbol is like a certain type?
    That means u know how the table is so u don't need to use a dynamic table, your issue seems not to make sense.
    Max

  • How to Copy data from field symbol to Dynamic Internal Table

    Hi,
    I want to copy the data between two dynamic Internal tables . Following is the code were I have data in the field symbol wanted to transfer it to the other Internal table :
    REPORT  ztest.
    DATA:
           gd_dref          TYPE REF TO data,
           gd_dref1          TYPE REF TO data.
    FIELD-SYMBOLS:  <fs1>   TYPE any,
                               <fs_wa> TYPE any,
                                <field>    TYPE any,                  
                                <fs_wa1> TYPE ANY TABLE.  * Contains data from p_src
    *Copy data from p_src to p_dest*
    PARAMETERS: p_src LIKE dd02l-tabname .    * Name of Dynamic Internal table *
                             p_dest LIKE dd02l-tabname .  * Name of Dynamic Internal table*
    *DATA : lt_csks LIKE p_dest WITH HEADER LINE.
    START-OF-SELECTION.
      CREATE DATA gd_dref TYPE (p_src).
      CREATE DATA gd_dref1 TYPE TABLE OF (p_src).
       ASSIGN gd_dref->* TO <fs_wa>.
       ASSIGN gd_dref1->* TO <fs_wa1>.
       SELECT * FROM (p_src) INTO TABLE <fs_wa1>.
    *Write out data from FIELD SYMBOLS TO Table.
       loop at <fs_wa1> into <fs_wa>.
         do.
           assign component  sy-index
              of structure <fs_wa> to <field>.
           if sy-subrc <> 0.
           exit.
           endif.
           if sy-index = 1.
             write:/ <field>.
           else.
           write: / <field>.
           endif.
         enddo.
       endloop.
    *Need Logic To Copy the Data to p_dest table from <fs_wa1>.
    *p_dest is a table having a similar structure to table p_src .
    *Need Logic To Copy the Data to p_dest table from <fs_wa1>.
    EXIT.
    Thanks in Advance.

    try this...
    I have extended your source code and just used vbak/vbap as an example as they have some common fields like vbeln/erdat etc which corresponds with your requirement of 'similar structure' i.e. shared/common fields in both.
    Cheers...
    report  ztest.
    data:
      gd_dref type ref to data,
      gd_dref1 type ref to data,
      gd_dref_str type ref to data,
      gd_dref_tab type ref to data.
    field-symbols:
      <fs1> type any,
      <fs_wa> type any,
      <fs1_dest_str> type any,
      <fs_dest_tab> type any table,
      <field> type any,
      <fs_wa1> type any table.
    * contains data from p_src
    *Copy data from p_src to p_dest*
    parameters: p_src like dd02l-tabname default 'vbak',
    * name of dynamic internal table *
                p_dest like dd02l-tabname default 'vbap'.
    * name of dynamic internal table*
    *data : lt_csks like p_dest with header line.
    start-of-selection.
      create data gd_dref type (p_src).
      create data gd_dref1 type table of (p_src).
      assign gd_dref->* to <fs_wa>.
      assign gd_dref1->* to <fs_wa1>.
      select * from (p_src) into corresponding fields of table <fs_wa1>
      up to 3 rows
      where vbeln ne space.
      create data gd_dref_str type (p_dest).
      create data gd_dref_tab type standard table of (p_dest).
      assign gd_dref_str->* to <fs1_dest_str>.
      assign gd_dref_tab->* to <fs_dest_tab>.
    *write out data from field symbols to table.
      loop at <fs_wa1> into <fs_wa>.
        " break-point here - can see vbeln/waers/create date/ etc move over to new structure
        " the 'common' fields of your structures - the same will happen. if they not the same name you will have to do an
        " explicit move i.e. if fieldname = xyz ....move fieldxyz to new field123....after the move-corre
        break-point.
        move-corresponding <fs_wa> to <fs1_dest_str>.
        insert <fs1_dest_str> into table <fs_dest_tab>.
    **    do.
    **      assign component  sy-index
    **         of structure <fs_wa> to <field>.
    **      if sy-subrc <> 0.
    **        exit.
    **      endif.
    **      if sy-index = 1.
    **        write:/ <field>.
    **      else.
    **        write: / <field>.
    **      endif.
    **    enddo.
      endloop.
      " write out some dest data from the dest table build from previous loop
      loop at <fs_dest_tab> assigning <fs1_dest_str>.
        do.
          assign component sy-index of structure <fs_wa> to <field>.
          if sy-subrc <> 0.
            exit.
          endif.
          if sy-index = 1.
            write:/ <field>.
          else.
            write: / <field>.
          endif.
        enddo.
      endloop.

  • How to use field symbols in dynamic select query

    I have a requirement to take the table name from selection screen and get data from that table 
      SELECT * FROM (P_TBLNM)
      INTO TABLE  <ITAB>
      WHERE <condition>.
    I have declared field symbol as type any table , but i am getting dump saying fieldsymbol is not getting assigned .
    Any pointers , please help.

    Hi laxmi,
    for your second question, try this one:
    DATA : ref_table_des TYPE REF TO cl_abap_structdescr,
    <itab> TYPE STANDARD TABLE,
    <wtab> TYPE ANY,
    dref TYPE REF TO DATA.
    DATA: <knumh>.
    ref_table_des ?= cl_abap_typedescr=>describe_by_name( P_TBLNM ).
    create data dref type handle ref_table_des.
    assign dref->* to <wtab>.
    create data dref like standard table of <wtab>.
    assign dref->* to <itab>.
    SELECT * FROM (P_TBLNM)
    INTO TABLE <itab>
    WHERE <condition>.
    LOOP AT <itab> ASSIGNING <wtab>.
    assign component 'KNUMH' of structure <wtab> to <knumh>.
    SELECT * FROM KONP
    APPENDING TABLE GI_KONP
    WHERE KNUMH = <knumh>.
    ENDLOOP.
    Regards,
    Richard
    Edited by: richard santos on Nov 17, 2009 8:16 AM

  • Field Symbols and Dynamic references

    Hello,
    I have Two internal tables Itab1 and Itab2 which are containing MATNR as field.
    Itab1-matnr contains the value as 123;456;789.
    I have two more Field-symbols Var1 and var2 which contains the values as <Var1> = itab1-matnr
                           <var2> = itab2-matnr.
    now i wanted to split contents of Itab1-matnr.
      split <var1> at ';' into <var2> <var1>.
    By this, my expected result is 123 into Itab2-matnr and 456;789 into itab1-matnr.
    How can i do this? now Var1 contains the value as itab1-matnr, but not the contents of itab1-matnr ( But not 123;456;789) .
    Pleasde help me in solving this.

    Hello Rajesekhar,
    U can try this...
    I have used fields instead of internal table.
    data: itab1 like mara-matnr value '123;456;789',
          itab2 like mara-matnr.
    data: begin of itab3 occurs 0.
    data:  fld(50).
    data end of itab3.
    field-symbols: <fs1> type any,
                   <fs2> type any.
    assign itab1 to <fs1>.
    assign itab2 to <fs2>.
    search <fs1> for ';'.
    sy-fdpos = sy-fdpos + 1.
    <fs2> = <fs1>(sy-fdpos).
    <fs1> = <fs1>+4.

  • Using field-symbols in dynamic structure

    Hi, experts.
    See if you can help me: in version 4.6C and 6.00 a structure has changed its name - from BAPIOIL2017_GM_ITM_CRTE_P to BAPIOIL2017_GM_ITM_CRTE_PARAM.
    Now I have to change a report that uses this structure and find <b>a way to make it work in both versions.</b> In this report, a work-area is assigned like the struture and receives a set of data in fields to be used in a FM.
    In report
    data: wa_bapi like BAPIOIL2017_GM_ITM_CRTE_P.
    Look what I did until now:
              field-symbols: <wa>.
    data:   pc_table_1      type ddobjname.
    if sy-saprl = '46C'.
      pc_table = 'BAPIOIL2017_GM_ITM_CRTE_P'.
    elseif sy-saprl = '700'.
      pc_table = 'BAPIOIL2017_GM_ITM_CRTE_PARAM'.
    endif.
    assign wc_line_1 to <wa> casting type (pc_table).
    Now, how to atribute values to the fields?
    Thanks!!

    field-symbols: <fs> type any. "for work area
    data: odat type ref to data.  "creating the data
    "Assume <lt_table> is the internal table
    create data odat like line of  <lt_table>.    
    asssign odat->* to <fs>.
    "now <fs> is the work area.
    Check this and let me know..

  • Field name retrieval from field symbols after assigning to field in a struc

    We have an internal table of about 100 columns. First 7 of them have key values and other fields are data fields. Out of remaining 93 fields, any 2 to 3 fields have data stored in it in each record. Using field symbols in a loop (93 fixed iterations), we are identifying which fields has a data in it. Once we identify the field, how do we retrieve the name of the field / column of the table. We are performing further processing based on name of the field.
    Any ideas how to get the name of the column assigned to field symbols?
    sample raw code piece is as below:
    clear n.
    Do 93 times.
      n = n + 1.
      assign component n of structure itab to <fs>.
      if not <fs> is initial.
       Get name of the field in cfname.
        perform process_record using cfname.
      endif.
    enddo.
    Thanks.
    Regards.

    Hi,
    Try this..use the function module GET_COMPONENT_LIST to get the fields of the internal table and store it in an internal table ITAB_COMP..
    Then use READ TABLE ITAB_COMP INDEX sy-index..
    You can get the field name from the work area..
    Thanks,
    Naren

  • Field Symbol that call input field

    I learnt that I will need to use field symbol to call the values that is in my input field call (IO_INPUT). How am I suppose to call the valuein my input field? Codes example is appreciated

    FIELD-SYMBOLS
    Declares field symbols.
    Syntax
    FIELD-SYMBOLS <FS> [<type>|STRUCTURE <s> DEFAULT <wa>].
    Field symbols are placeholders or symbolic names for other fields. Pointed brackets are part of the syntax for field symbol names. The <type> addition allows you to specify the type of a field symbol. The STRUCTURE addition forces a structured view of the data objects that you assign to the field symbol.
    PLZ REWARD IF USEFUL.
    PEGARDS,
    PRIYA.

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

  • Dynamic select with field symbols

    Hi guys,
    I have 2 tables.
    First table is the popup fields using fm popup_get_values:
    tab1-tabname
    tab1-fieldname
    tab1-value
    Second table is the input fields to be displayed in the popup box:
    tab2-transactno
    tab2-docno
    tab2-customer
    tab2-postdate
    etc... (it has many fields)
    Let's say currently i loop at tab2 and assign each value of the individual fields to a variable each:
    loop at tab2
    v_transactno = tab2-transactno
    v_docno = tab2-docno
    etc...
    endloop.
    My question is how do i assign each variable to the popup fields according to the fieldname so that it can get its corresponding value correctly?
    How can this be done dynamically?
    Can the loop above be done dynamically as well coz it has alot of fields to cater for?
    Please help me solve this problem. Futher similar examples would be much appreciated as well.
    Thank you very much!

    Hi
    see the concept of field sysmbols and do accordingly
    Field Symbols
    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.
    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 performance in some cases.
    check the below links u will get the answers for your questions
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/content.htm
    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/field_sy.htm
    http://searchsap.techtarget.com/tip/1,289483,sid21_gci920484,00.html
    Syntax Diagram
    FIELD-SYMBOLS
    Basic form
    FIELD-SYMBOLS <fs>.
    Extras:
    1. ... TYPE type
    2. ... TYPE REF TO cif
    3. ... TYPE REF TO DATA
    4. ... TYPE LINE OF type
    5. ... LIKE s
    6. ... LIKE LINE OF s
    7. ... TYPE tabkind
    8. ... STRUCTURE s DEFAULT wa
    The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Cannot Use Untyped Field Symbols ad Cannot Use Field Symbols as Components of Classes.
    Effect
    This statement declares a symbolic field called <fs>. At runtime, you can assign a concrete field to the field symbol using ASSIGN. All operations performed with the field symbol then directly affect the field assigned to it.
    You can only use one of the additions.
    Example
    Output aircraft type from the table SFLIGHT using a field symbol:
    FIELD-SYMBOLS <PT> TYPE ANY.
    DATA SFLIGHT_WA TYPE SFLIGHT.
    ASSIGN SFLIGHT_WA-PLANETYPE TO <PT>.
    WRITE <PT>.
    Addition 1
    ... TYPE type
    Addition 2
    ... TYPE REF TO cif
    Addition 3
    ... TYPE REF TO DATA
    Addition 4
    ... TYPE LINE OF type
    Addition 5
    ... LIKE s
    Addition 6
    ... LIKE LINE OF s
    Addition 7
    ... TYPE tabkind
    Effect
    You can define the type of the field symbol using additions 2 to 7 (just as you can for FORM parameters (compare Defining the Type of Subroutine Parameters). When you use the ASSIGN statement, the system carries out the same type checks as for USING parameters of FORMs.
    This addition is not allowed in an ABAP Objects context. See Cannot Use Obsolete Casting for FIELD SYMBOLS.
    In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. See Defining Types Using STRUCTURE.
    Effect
    Assigns any (internal) field string or structure to the field symbol from the ABAP Dictionary (s). All fields of the structure can be addressed by name: <fs>-fieldname. The structured field symbol points initially to the work area wa specified after DEFAULT.
    The work area wa must be at least as long as the structure s. If s contains fields of the type I or F, wa should have the structure s or at least begin in that way, since otherwise alignment problems may occur.
    Example
    Address components of the flight bookings table SBOOK using a field symbol:
    DATA SBOOK_WA LIKE SBOOK.
    FIELD-SYMBOLS <SB> STRUCTURE SBOOK
    DEFAULT SBOOK_WA.
    WRITE: <SB>-BOOKID, <SB>-FLDATE.
    Regards
    Anji

  • How to read dynamic field symbol

    hi all,
       ASSIGN (tabname) TO <fs_tab>.
       in above code i am passing dynamic table to fs_tab
      can anyone tell me how can i read this field symbol........
      in other words i want to read dynamic field symbols

    Hi,
    you could do without the field-symbols:
    select from variable table
    grtz,
    Koen

  • Dynamic field symbol

    Hello :i would like to ask one favor , how can i define a field symbol, that can recieve a dynamic variable
    segment of code:
    CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = it_fldcat
        IMPORTING
          ep_table        = it_dynamic.
      ASSIGN it_dynamic->* TO <dyn_table>.
    CREATE DATA wa_dynamic LIKE line of <dyn_table>.
      ASSIGN wa_dynamic->* TO <dyn_wa>. " this one 'wa_dynamic'  i need to sent to <dyn_wa>
    thanks a lot

    HI
    GOOD
    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.
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb387a358411d1829f0000e829fbfe/content.htm
    THANKS
    MRUTYUN

Maybe you are looking for

  • Itunes wont download properly, help?

    When i download itunes it downloads most of it but it stops near the end and comes up with something saying "service 'Apple Mobile Device' failed to start. Verify that you have sufficient privileges to start system services." When i click ignore, it

  • Different instance numbers in Oracle BPM Workspace 11g

    Hi!! I'm running the QuoteProcessLab, I launched the process and in the first activity 'Enter Quote Details' I just save the info, so I see the instance created with number 200043. If I login into te workspace with jstein I see the instance in the 'P

  • Reconciliation account update for parked document

    Hi, I have created a Customer parked document in FB70. Now If I go and check the FBL5N for customer account which is the part of the parked document, the transaction is appearing. But when I check the FBL3N for reconciliation account which is assigne

  • DTW oProductTrees not update in SAP

    Hello. I need colaboration  with this case. When import template for bill Of materials, the dtw Show message " Update Successfully ", but i review in SAP the BOM , the  Quantity its not updated.  The template was mported without the active test run f

  • How to voice text

    I have turned on the auto voice text, how do I use it, should a mircophone appear on keyboard or something?