At new field symbol -field in ECC6

Hi experts,
We are upgrading to ECC6 from 4.7.  The command ' at new <wa_base>-vakey.' works in 4.7 but gives error ' "<WA_BASE>-VAKEY" is not defined as a field symbol ' in ECC6.  I can't find any SAP Notes or answers in the Network Forum or F1 Help.  Does anybody know how my code should be changed? 
Thanks, Brigitte

I believe that it is upgrade relevant: when I do program check in 4.7 I get no errors and when I check the same program in our ECC6 development client, I get the error.  Anyway, here's the relevant code - as you can see its nothing too difficult:
data: begin of it_base1 occurs 0,
       vakey type vakey,
       table type setyp,
       base type ty_base,
      end of it_base1.
form setup_conditions_base  using    cond_tab like it_base1[]
  field-symbols: <wa_base> like line of it_base1,
    loop at cond_tab assigning <wa_base>.
      ...  (do some stuff) ...
      at new <wa_base>-vakey.
      ... (do more stuff) ...
      end at
      ... etc ...

Similar Messages

  • Field Symbols /Field Groups

    Hi,
    What is the use of Field Symbols and Field Groups?
    pls explain me.
    My email addr [email protected]

    Hi Siva,
    Check the below links
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/content.htm
    FIELD-SYMBOLS
    Basic form
    FIELD-SYMBOLS <fs>.
    Additions
    1. ... STRUCTURE s DEFAULT wa
    2. ... TYPE t
    3. ... TYPE LINE OF t
    4. ... LIKE s
    5. ... LIKE LINE OF s
    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>.
    TABLES SFLIGHT.
    ASSIGN SFLIGHT-PLANETYPE TO <PT>.
    WRITE <PT>.
    Addition 1
    ... STRUCTURE s DEFAULT wa
    Effect
    Assigns any (internal) field string or structure to the field symbol from the ABAP/4 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.
    Addition 2
    ... TYPE t
    Addition 3
    ... TYPE LINE OF t
    Addition 4
    ... LIKE s
    Addition 5
    ... LIKE LINE OF s
    Effect
    You can use additions 2 to 5 to type field symbols in the same way as FORM parameters (see also Type assignment of subroutine parameters). ASSIGN performs the same type checks as with USING parameters of FORM s.
    <b>Field Groups</b>
    http://help.sap.com/saphelp_46c/helpdata/EN/d2/cb43e6455611d189710000e8322d00/content.htm

  • Field Symbols, Field String, and Field Group.

    Hi,
    Can you differentiate between filed symbols, field strings and field groups,
    With regards,
    Bharath Mohan B

    Hi,
    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.
    Related
    ASSIGN, DATA
    Additional help
    Declaring Field Symbols
    FIELD GROUPS
    are used to hold/handle large amount of data when the internal table are not useful
    we use EXTRACT statement, HEADER structure in them
    see the example
    REPORT demo_extract.
    NODES: spfli, sflight.
    FIELD-GROUPS: header, flight_info, flight_date.
    START-OF-SELECTION.
      INSERT: spfli-carrid spfli-connid sflight-fldate
                INTO header,
              spfli-cityfrom spfli-cityto
                INTO flight_info.
    GET spfli.
      EXTRACT flight_info.
    GET sflight.
      EXTRACT flight_date.
    END-OF-SELECTION.
      SORT STABLE.
      LOOP.
        AT FIRST.
          WRITE / 'Flight list'.
          ULINE.
        ENDAT.
        AT flight_info WITH flight_date.
          WRITE: / spfli-carrid , spfli-connid, sflight-fldate,
                   spfli-cityfrom, spfli-cityto.
        ENDAT.
        AT flight_date.
          WRITE: / spfli-carrid , spfli-connid, sflight-fldate.
        ENDAT.
        AT LAST.
          ULINE.
          WRITE: cnt(spfli-carrid), 'Airlines'.
          ULINE.
        ENDAT.
      ENDLOOP.
    FIELD STRING is nothing but a string with  one row of records.
    Reward points if useful
    regards
    Anji

  • Legnth of field symbol field

    Hi all,
    I iterate over a work area assigning each field to a field symbol which is then concatenated to a string that is written to a dataset. When I encounter a quantity field the progam dumps...the quantity field is not compatible with the string. I then decided to write the field symbol to a char variable before the concatenate...problem here is I have to define the length of the char first...what I want to do is set the length of the char variable dynamically...depending on the lenght of the field symbol just read in....can i do that?
    regards,
    Mat

    I finally realized that I was using WRITE when I should have been saying MOVE!!!
    My solution entailed the following...suggestions on how I might improve are welcome:
    *======================================================================
    Loop over the record set and populate the data set
    *======================================================================
      READ TABLE gt_supply_demand INDEX 1 INTO wa_supply_demand.
      ASSIGN wa_supply_demand TO <F1>.
      DESCRIBE FIELD <F1> TYPE l_type COMPONENTS l_col_count.
      LOOP AT gt_supply_demand INTO wa_supply_demand.
          l_index = 1.
          DO l_col_count TIMES.
            ASSIGN COMPONENT l_index OF STRUCTURE <F1> TO <F2>.
            MOVE <F2> TO l_temp_field.
            CONCATENATE l_row l_temp_field INTO l_row SEPARATED BY CON_TAB.
            l_index = l_index + 1.
          ENDDO.
        TRANSFER l_row TO ds_file.
        CLEAR wa_supply_demand.
        CLEAR l_row.
      ENDLOOP.

  • Can I use field symbol in AT events? How?

    Hi all,
    I want to use field symbol in <b>AT END OF</b> event
    Can I use field symbol in such event as it takes table fields only.
    Kinldy look in to pseudo:
    Loop itab.
             AT END OF <FS1>.
             ENDAT.
    Endloop.
    I tried in my program but it's giving me a short dump.
    If it is possible to use field symbol in AT events, kindly tell me how..??
    Thanks in Advance.
    Sagar

    Hi,
    i don't know your reqirement but it is possible:
    DATA: t1(4), t2 TYPE i.
    FIELD-GROUPS: header.
    INSERT t2 t1 INTO header.
    t1 ='AABB'. t2 = 1. EXTRACT header.
    t1 ='BBCC'. t2 = 2. EXTRACT header.
    t1 ='AAAA'. t2 = 2. EXTRACT header.
    t1 ='AABB'. t2 = 1. EXTRACT header.
    t1 ='BBBB'. t2 = 2. EXTRACT header.
    t1 ='BBCC'. t2 = 2. EXTRACT header.
    t1 ='AAAA'. t2 = 1. EXTRACT header.
    t1 ='BBBB'. t2 = 1. EXTRACT header.
    t1 ='AAAA'. t2 = 3. EXTRACT header.
    t1 ='AABB'. t2 = 1. EXTRACT header.
    SORT BY t1 t2.
    *Here begins the definition of the field symbols
    FIELD-SYMBOLS:
    <t1> TYPE ANY,
    <t2> TYPE ANY.
    ASSIGN t1 TO <t1>.
    ASSIGN t2 TO <t2>.</b>
    LOOP.
      AT FIRST.
        WRITE 'Start of LOOP'.
        ULINE.
      ENDAT.
      AT NEW <t1>.
        WRITE / '   New T1:'.
      ENDAT.
      AT NEW <t2>.
        WRITE / '   New T2:'.
      ENDAT.
      WRITE: /14 t1, t2.
      AT END OF <t2>.
        WRITE / 'End of T2'.
      ENDAT.
      AT END OF <t1>.
        WRITE / 'End of T1'.
      ENDAT.
      AT LAST.
        ULINE.
      ENDAT.
    ENDLOOP.
    Regards,
    Gianpietro

  • Field Symbol Issue

    Hello Experts,
    I'm very new to field-symbols and having challenge when using them. Basically I'm only trying to use specific column value from one type of field symbol to another but keep having short dump. I tried to re-wirte my code using work area and it works though.
    Can somebody have a look at my code and tell me what is causing the problem and how to resolve it.
    DATA:
         lit_variables    TYPE STANDARD TABLE OF zut_variables INITIAL SIZE 0,
    FIELD-SYMBOLS:
          <fs_variables>     type  zut_variables,
          <fs_rang_var>     type  zus_variables.
        loop at lit_variables ASSIGNING <fs_variables>.
            if <fs_variables> is assigned.
               <fs_range_var>-high   = <fs_variables>-high.
               <fs_range_var>-low    = <fs_variables>-low.
               <fs_range_var>-sign   = <fs_variables>-sign.
               <fs_range_var>-option = <fs_variables>-zoption.
            endif.
        endloop.
    Many thanks in advance.

    Hi,
    As you are using same structure for field symbols , no need of using field symbols.
    You can use work area.
    If you doesnt no the structure , you can assign field symbol.
    field-symbols <fs> type any.                            
    Regards,
    Ravi

  • Moving field-symbol data to an internal table

    Hi
    I have defined a field-symbol
      field-symbols: <fs_table> type standard table.
      Dynamically, I have populated some records in this <fs_table> & now I would like to copy this data into another internal table. I would like to know the best method to declare/create this internal table & to copy the records from <fs_table> to this internal table.
      Thanks,
      Sanjay

    if you know the structure of the reuslt in the first place, instead of dynamic itab you would have created a normal itab.
    do you want the new itab to be same as <l_table> ?
    then that also needs to be dynamically created.
    the best thing possible in you case is.
    field-symbols: <newtab> type any table.
    if <l_table> is assinged.
    assign <l_table> to <newtab>.
    endif .
    if you tell us why you want to move the <l_table> records to another similar itab, may be could come up with suggestion which dosesnt require you to move the data at all
    Raja

  • Assigning a value to a field-symbol (workarea of type any)

    Dear forumers,
    I'm having a bit of difficulty in assigning a value to a field-symbol (it should be treated as a workarea of type any), but I'm given a syntax error instead:-
    The data object "<LFS_WORKAREA>" has no structure and therefore no component called "LFMON".
    What could have gone wrong and how may I resolve this (I must have missed something out)? I will still need <LFS_WORKAREA> to be defined as TYPE ANY.
    Please help. I'd appreciate any inputs at all. Thanks.
    *&      Form  FORMAT_POST_PERIOD
    *       Subroutine to format the posting period data
    *      --> PI_MBEW     Material valuation data (internal table)
    FORM format_post_period  CHANGING    pi_mbew TYPE ANY TABLE.
    " Create local field symbols
      FIELD-SYMBOLS:
      <lfs_workarea> TYPE ANY,
      <lfs_lfmon>    TYPE ckmlcr-poper.
    " Create local variables
      DATA: lv_index TYPE sy-tabix.
      DATA: lv_lfmon TYPE ckmlcr-poper.
    " Format posting periods
      LOOP AT pi_mbew ASSIGNING <lfs_workarea>.
        lv_index = sy-tabix.
        ASSIGN COMPONENT 'LFMON' OF STRUCTURE <lfs_workarea> TO <lfs_lfmon>.
        PERFORM convert_lfmon USING    <lfs_lfmon>
                              CHANGING lv_lfmon.
        MOVE lv_lfmon TO <lfs_workarea>-lfmon.   " the syntax error occurs here  :(
        MODIFY pi_mbew FROM <lfs_workarea>
          INDEX lv_index
          TRANSPORTING lfmon.
        CLEAR: <lfs_workarea>,
               <lfs_lfmon>
               lv_lfmon,
               lv_index.
      ENDLOOP.
    ENDFORM.                    " FORMAT_POST_PERIOD

    Most of us aren't in it for the points in any case...
    For your solution you've redundant code:
    *&      Form  FORMAT_POST_PERIOD
    *       Subroutine to format the posting period data
    *      --> PI_MBEW     Material valuation data (internal table)
    FORM format_post_period  CHANGING    pi_mbew TYPE ANY TABLE.
      FIELD-SYMBOLS:
      <lfs_workarea> TYPE ANY,
      <lfs_lfmon>    TYPE ckmlcr-poper.
      DATA: lv_lfmon TYPE ckmlcr-poper.
    *  DATA: lo_workarea TYPE REF TO data.   "<--Not needed, because the LOOP AT ASSIGNING below does the work
    *  CREATE DATA lo_workarea LIKE LINE OF pi_mbew.
    *  ASSIGN lo_workarea->* TO <lfs_workarea>.
      LOOP AT pi_mbew ASSIGNING <lfs_workarea>.
        ASSIGN COMPONENT 'LFMON' OF STRUCTURE <lfs_workarea> TO <lfs_lfmon>.
        PERFORM convert_lfmon USING    <lfs_lfmon>
                              CHANGING lv_lfmon.
        <lfs_lfmon> = lv_lfmon.
        CLEAR lv_lfmon.
      ENDLOOP.
    ENDFORM.                    " FORMAT_POST_PERIOD
    Here's a couple of more efficient solutions, using LOOP AT INTO.
    FORM format_post_period  CHANGING    pi_mbew TYPE INDEX TABLE. " <-- Table type a little more specific
                                                                   "<--now you can use index operations
      FIELD-SYMBOLS:
      <lfs_workarea> TYPE ANY,
      <lfs_lfmon>    TYPE ckmlcr-poper.
      DATA: lv_lfmon TYPE ckmlcr-poper,
            lv_index TYPE sytabix.
      DATA: lo_workarea TYPE REF TO data.
      CREATE DATA lo_workarea LIKE LINE OF pi_mbew.
      ASSIGN lo_workarea->* TO <lfs_workarea>.
    ASSIGN COMPONENT 'LFMON' OF STRUCTURE <lfs_workarea> TO <lfs_lfmon>.
      LOOP AT pi_mbew INTO <lfs_workarea>.
        lv_index = sy-tabix.    
        PERFORM convert_lfmon USING    <lfs_lfmon>
                              CHANGING lv_lfmon.
        <lfs_lfmon> = lv_lfmon.
        MODIFY pi_mbew FROM <lfs_workarea>
           INDEX lv_index. " <--INDEX TABLE, so this is permitted.
        CLEAR lv_lfmon.
      ENDLOOP.
    ENDFORM.                    " FORMAT_POST_PERIOD

  • How to get the current type of a generic Field Symbol

    Hi Experts,
    I have a Field Symbol:
    FIELD-SYMBOLS: <lf_any> TYPE ANY.
    I loop around an internal table with a generic structure and assign their fields to my fieldsymbol:
    LOOP AT it_data ASSIGNING <lf_any>.
    After executing this statement I am able to see the current Absolute Type of the field Symbol in debugger.
    For example this could be TYPE ZX_1 in first loop, TYPE ZX_2 in second loop and so on...
    Question: How can I get this current type within my Loop?
    The Reason is I have to CREATE DATA xxx TYPE "current type of the field symbol".
    Thanks,
    Daniel

    Hello Daniel
    Do you have the RTTI classes available on your system? If so then try the following:
    *& Report  ZUS_SDN_RTTI_GET_TYPE
    REPORT  zus_sdn_rtti_get_type.
    DATA: gt_knb1   TYPE STANDARD TABLE OF knb1,
          gd_type   TYPE string.
    DATA: go_typedescr    TYPE REF TO cl_abap_typedescr,
          go_strucdescr   TYPE REF TO cl_abap_structdescr.
    FIELD-SYMBOLS: <gs_struc> TYPE ANY.
    START-OF-SELECTION.
      APPEND INITIAL LINE TO gt_knb1.
      LOOP AT gt_knb1 ASSIGNING <gs_struc>.
        go_typedescr = cl_abap_typedescr=>describe_by_data( <gs_struc> ).
        go_strucdescr ?= go_typedescr.
        gd_type = go_typedescr->get_relative_name( ).
        WRITE: / 'Type=', gd_type.
        gd_type = go_strucdescr->get_relative_name( ).
        WRITE: / 'Type=', gd_type.
      ENDLOOP.
    END-OF-SELECTION.
    Regards
      Uwe

  • How to add columns in field-symbol

    Dear All,
                  Have made a report for HR - ZHR_CTC by using logical database and field-symbol. Report is working fine, but now have to add columns e.g business area text, positions text etc.
    Have added columns in field-symbol.But not able to fetch data into that.
    Data has to be fetched from different trasparent table comparing <field-symbol>-field.
    Plz suggest the proper way to do it.
    <<text removed>>
    Regards,
    Gulrez Alam
    Edited by: Gulrez Alam on Dec 16, 2008 11:02 AM
    Edited by: Matt on Dec 16, 2008 11:36 AM

    Hi Rimpa,
                   Thanks a lot for you reply, have tried ur suggestion but it's not working. I am not able to understand how to insert data into field-symbol. Plz give some more clarifications about the same.
    Regards,
    Gulrez Alam

  • How to populate values of field symbols?

    HI,
    I need to pass values into a field-symbol (defined as a dynamic Work Area) and append the values later on into another field-symbol (defined as a dynamic Table) by inserting the work area to the table. The insert statement in the screen shot below is syntetically correct but when I uncomment
    *      <gw_itab>-tplnr = 'TPLNR'.
    *      <gw_itab>-pmsog = 'PMSOG'.
    *      <gw_itab>-k_pro = 'K_PRO'.
    I get a syntax error. During debugging if I pass the values of the work area, they are properly appended into the table.
    Could somebody show me the code on how to atain this programatically?
    Thanks for your help
    Carl

    From the short dump:
    "<GT_ITAB> has line type "v" and the length 24, but the work area has line type "g" and the length 8".
    The code you included in your first screenshot is not the code that it dumped on... Looking at the shortdump here's what you have.
    lv_fieldname = '<GW_ITAB>-TPLNR'.
    assign (lv_fieldname) to <gw_itab>.
    <gw_itab> = 'TPLNR'.
    insert <gw_itab> into table <gt_itab>.
    This code doesn't make any sense...
    What you're saying is:
    <gw_itab> points to <gw_itab>-tplnr. So now it points to just a field of the structure, not the whole structure.... Then you say that field is set to 'TPLNR'. So you set the field of the original structure called TPLNR to be the string "TPLNR"...
    If that's really what you're trying to do then try changing it to:
    field-symbols: <field> type any.
    lv_fieldname = '<GW_ITAB>-TPLNR'.
    assign (lv_fieldname) to <field>.
    <field> = 'TPLNR'.
    insert <gw_itab> into table <gt_itab>.

  • Run Time: type conflicts in field symbol

    In this statement i am getting run time error : assign component.
    type conflicts in field symbol
    FIELD-SYMBOLS:
        <fs_tab> TYPE ANY table,
         <wa_tab> TYPE ANY,
         <fs_field> type crmd_orderadm_h.
    DATA:      w_data    TYPE REF TO data.
    CREATE DATA w_data TYPE STANDARD TABLE OF (c_tabname) WITH NON-                     UNIQUE DEFAULT KEY.
        ASSIGN w_data->* TO <fs_tab>.
    SELECT * FROM (c_tabname)
              INTO CORRESPONDING FIELDS OF TABLE <fs_tab>
      LOOP AT <fs_tab> ASSIGNING <wa_tab>.
          DO.
            ASSIGN COMPONENT sy-index OF STRUCTURE <wa_tab> TO <fs_field>.
    *Writeing: fs_field here*
    Enddo.

    FIELD-SYMBOLS: <fs_field> type crmd_orderadm_h.
    <fs_field> type any.
    i cannot pass "
      lv_header_guid =    <fs_field>-guid.
    complete code as follows.
      LOOP AT <fs_tab> ASSIGNING <wa_tab>.
          DO.
            ASSIGN COMPONENT sy-index OF STRUCTURE <wa_tab> TO <fs_field>.
    *i am assining fs_field-guid here. Thats why i am taking this field symbol as type "crmd_orderadm_h"*
    *bold* * <fs_field>-guid.*bold**
            lv_header_guid =    <fs_field>-guid.
            iv_header_guid = lv_header_guid.
            REFRESH: lt_header_guid.
            INSERT iv_header_guid INTO TABLE lt_header_guid.
            REFRESH: im_orderadm_h,im_text.
            CALL FUNCTION 'CRM_ORDER_READ'
              EXPORTING
                it_header_guid       = lt_header_guid
              IMPORTING
                et_orderadm_h        = im_orderadm_h
                et_text              = im_text
              EXCEPTIONS
                document_not_found   = 1
                error_occurred       = 2
                document_locked      = 3
                no_change_authority  = 4
                no_display_authority = 5
                no_change_allowed    = 6
                OTHERS               = 7.
            IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
            ENDIF.
          ENDDO.

  • Can I verify a field-symbol using its component name?

    Hello experts,
    I am looping at my field-symbol and I need to know what are its component name.
    I need to create an IF or CASE statement checking whether the field-symbol's
    component name is equal to that of the value that I declared. I want to do
    something like this:
    LOOP AT <fs_dyntable> ASSIGNING <wa_dyntable>.
    ASSIGN COMPONENT sy-index OF STRUCTURE <wa_dyntable>
            TO <component>.
            IF sy-subrc <> 0.
              EXIT.
            ENDIF.
    if component name = '2000'.
        condition...
      elseif component name = '1999'.
        condition...
      elseif component name = '1998'.
        condition...
      endif.
    endloop.
    Again, thank you guys and take care!

    Hi,
    I am not clear on your doubt , but you can use field-symbol fields like below:
    * if <component>-fld1 = '2000'.
    condition...
    elseif <component>-fld1 = '1999'.
    condition...
    elseif <component>-fld1 = '1998'.
    condition...
    endif.
    endloop.
    LOOP AT x_table ASSIGNING <wa_table>.
    IF <wa_table>-fld1 EQ 100.
    -----your code
    ENDIF.
    ENDLOOP.
    Regards
    Appana

  • How to use field symbols

    can anyone tell me how to use field symbols. What effect it has on performance of a program?
    what r its avantages?
    iam working on a report where iam facing a lot of problems in performance issue. can anyone tell how field symbols are useful in this regard?
    thanx to all

    Check the below links
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/content.htm
    FIELD-SYMBOLS
    Basic form
    FIELD-SYMBOLS <fs>.
    Additions
    1. ... STRUCTURE s DEFAULT wa
    2. ... TYPE t
    3. ... TYPE LINE OF t
    4. ... LIKE s
    5. ... LIKE LINE OF s
    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>.
    TABLES SFLIGHT.
    ASSIGN SFLIGHT-PLANETYPE TO <PT>.
    WRITE <PT>.
    Addition 1
    ... STRUCTURE s DEFAULT wa
    Effect
    Assigns any (internal) field string or structure to the field symbol from the ABAP/4 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.
    Addition 2
    ... TYPE t
    Addition 3
    ... TYPE LINE OF t
    Addition 4
    ... LIKE s
    Addition 5
    ... LIKE LINE OF s
    Effect
    You can use additions 2 to 5 to type field symbols in the same way as FORM parameters (see also Type assignment of subroutine parameters). ASSIGN performs the same type checks as with USING parameters of FORM s.

  • How to use field symbol in select

    Hi,
        CONCATENATE 'WTG0' LV_MON INTO LV_FNAME.
        ASSIGN (LV_FNAME) TO <FS>.
        SELECT SINGLE <FS>  FROM COSP INTO LV_SAPRST
             WHERE OBJNR = LV_OBJ AND GJAHR = LV_YEAR AND WRTTP = '4' AND KSTAR = GT_INOUT-SAKNR
       Error message :    Unknown column name "<FS>" . field list. . field list. field list. 
       actually ,  if i use  if command,  i can do,  but i want to use simple code by fieldsymbol.
       is it possible in select command?
    Thanks in advance
    Benjamin

    Hi
    Hope it will help you.
    reward if help.
    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.
    Related
    ASSIGN, DATA
    Additional help
    Declaring Field Symbols

Maybe you are looking for