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

Similar Messages

  • 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

  • How to use FIELD-SYMBOLS with TYPE ANY?

    Hi!
    I need to write a function which gets an import string parameter containing a field name like MATNR. In this function I have to "map" this string to a real variable so that I can access the field which is represented by the string. I tried it like this but it does not work:
    FUNCTION ZTEST1.
    ""Lokale Schnittstelle:
    *"  IMPORTING
    *"     REFERENCE(I_MARA) TYPE  MARA
      DATA: FIELD_NAME(30) VALUE 'I_MARA'.
      FIELD-SYMBOLS : <FS_ANY> TYPE ANY.
      Assign (FIELD_NAME) to <FS_ANY>.
    Does not work (I guess because of 'type any')
      WRITE: <FS_ANY>-MATNR.
    ENDFUNCTION.
    How can I solve this problem?
    Thanks,
    Konrad

    This code is far from perfection...But at least it could help you to find the right track -;)
    REPORT ydummy_atg.
    DATA: w_mara TYPE STANDARD TABLE OF mara.
    START-OF-SELECTION.
      SELECT *
      INTO TABLE w_mara
      FROM mara.
      PERFORM test TABLES w_mara.
    *&      Form  test
    FORM test TABLES t_mara.
      DATA: field_name(30) VALUE 'T_MARA',
            new_line TYPE REF TO data,
            flag TYPE c,
            w_tabix TYPE sy-tabix.
      FIELD-SYMBOLS : <fs_any> TYPE ANY,
                      <l_line> TYPE ANY,
                      <l_field> TYPE ANY.
      ASSIGN (field_name) TO <fs_any>.
      CREATE DATA new_line LIKE LINE OF t_mara.
      ASSIGN new_line->* TO <l_line>.
      LOOP AT t_mara.
        MOVE t_mara TO <l_line>.
        ASSIGN COMPONENT 2 OF STRUCTURE <l_line> TO <l_field>.
        <l_field> = <l_line>.
        WRITE:/ <l_field>.
      ENDLOOP.
    ENDFORM.                    " test
    Greetings,
    Blag.

  • How to use field symbols in program

    how to use field symbols can any one explain with example please..
    Regards,
    venki...

    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.
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • 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-SYMBOLS to declare a table

    How to use FIELD-SYMBOLS to declare a table?

    hi yong,
    this will be very general:
    FIELD-SYMBOLS : <gf_table> TYPE ANY TABLE.
    or
    to do like a specific table from your program
    FIELD-SYMBOLS : <gf_table> TYPE itab.
    itab is of course your internal table from your program.
    ec

  • 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

  • How to save a variant with dynamic selections parameters

    Anybody knows how to save a variant for an ABAP that uses a Logical database with Dynamic Selections?
    Have a look for example to the following:
    SE38 - DEMO_PROGRAM_GET - Execute - Shift F4 - Connection Number.
    How to save 0820 as Connection Number?
    Function Group SVAR seems good but FREE SELECTIONs are not easy to manage...

    Hello,
      I tried to save the variant of DEMO_PROGRAM_GET with dynamic selection field (Connection Number) filled. It gets saved without any problem. Just click 'SAVE' and enter the variant name and description.
    Thanks,
    Venu

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

  • How to create a Type Object with Dynamic select query columns in a Function

    Hi Every One,
    I'm trying to figure out how to write a piplined function that executes a dynamic select query and construct a Type Object in order to assigned it to the pipe row.
    I have tried by
    SELECT a.DB_QUERY INTO actual_query FROM mytable a WHERE a.country_code = 'US';
    c :=DBMS_SQL.OPEN_CURSOR;
    DBMS_SQL.PARSE(c,actual_query,DBMS_SQL.NATIVE);
    l_status := DBMS_SQL.EXECUTE(c);
    DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
    FOR j in 1..col_cnt LOOP
    DBMS_SQL.DEFINE_COLUMN(c,j,v_val,2000);
    END LOOP;
    FOR j in 1..col_cnt LOOP
    DBMS_SQL.COLUMN_VALUE(c,j,v_val);
    END LOOP;
    But got stuck, how to iterate the values and assign to a Type Object from the cursor. Can any one guide me how to do the process.
    Thanks,
    mallikj2

    Hi Justin,
    First of thanks for your reply, and coming to my requirement, I need to report the list of items which are there in the dynamic select statement what am getting from the DB. The select statement number of columns may vary in my example for different countries the select item columns count is different. For US its '15', for UK it may be 10 ...like so, and some of the column value might be a combination or calculation part of other table columns (The select query contains more than one table in the from clause).
    In order to execute the dynamic select statement and return the result i choose to write a function which will parse the cursor for dynamic query and then iterate the values and construct a Type Object and append it to the pipe row.
    Am relatively very new for these sort of things, welcome in case of any suggestions to make it simple (Instead of the function what i thought to work with) also a sample narrating the new procedure will be appreciated.
    Thanks in Advance,
    mallikj2.

  • How to use field-symbols in MODIFY ... TRANSPORTING and SORT

    Hi,
    I need to increase the performance of an abap report using the field-symbols. More exactly  the code is the following.
    TYPES:
      BEGIN OF itab_structure.
         INCLUDE STRUCTURE nameofstructure.
      TYPES:
         RECNO   LIKE sy-tabix,
      END OF itab_structure.
    DATA:
      itab TYPE STANDARD TABLE OF  itab_structure
           WITH HEADER LINE
           WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.
    SORT itab ASCENDING BY f1.
    LOOP AT itab WHERE f1 = '10'.
        itab-fn= value-n.
    MODIFY itab
                 TRANSPORTING  fx fy fz ft     
                        WHERE  f1   = c1_filed AND
                                      f2   = c2_field.
    ENDLOOP.
    I need your suggestions in this kind of conversion or solution.
    SORT itab ASCENDING BY f1 (<-- I don't know if in this case the better performances should be obtained using field symbols and in which way)
    FIELD-SYMBOLS: <fs_itab_line> TYPE LINE OF itab.
    LOOP AT itab ASSIGNING <fs_itab_line> WHERE
    <fs_itab_line>-f1 = '10'.
    MODIFY itab 
                 TRANSPORTING  fx fy fz ft     
                        WHERE  f1   = c1_filed AND
                                      f2   = c2_field.
    (I don't know if in this case the better performances should be obtained using field symbols and in which way)
    ENDLOOP.
    I wish to implement the field symbols or the better performance in terms of execution time in all my abap code, where it is possible.
    Any suggestion will be well appreciated.
    Thanks in advance for your kind support.
    Regards,
           Giovanni

    Dear All,
    I have appeciated your suggestions and I can conclude these points in my case:
    1) The "sort" statement is not optimized in a different way using filed-symbols
    2) The loop with "where" condition on a standard table is performed using filed-symbols
    But ... my last point to investigate is about the statement MODIFY table TRANSPORTING f1, f2 WHERE conditions.
    More exactly, in my code the execution logic of the abap code expects a global modification of the same table at the end of every (primary) loop, using the MODYFY statement.
    In other words in my code I can locate two loops on the same table in the following logic:
    LOOP AT table1 WHERE f1 = '10'. (#1)
          updates to table1
          set c1_filed, c2_filed
          LOOP AT table1.   (#2)            
             IF f1 = c1_filed AND
                f2 = c2_filed.
               table1-fx = 'x'.
               table1-fy = 'y'.
               table1-fz = 'z'.
               table1-ft = 't'.   
             ENDIF.                 
             MODIFY table1.            
          ENDLOOP.   (#2)              
    ENDLOOP.   (#1)
    In better way (maybe more fast in terms of execution time) to modify a set of lines (MODIFY...TRANSPORTING...WHERE):
    LOOP AT table1 WHERE f1 = '10'.
       table1-fx= 'x'.
       table1-fy= 'y'.
       table1-fz= 'z'.
       table1-ft= 't'.
       MODIFY itab
          TRANSPORTING fx fy fz ft
       WHERE f1 = c1_filed AND
             f2 = c2_field.
    ENDLOOP.
    My aim is to use field-symbols everywhere possible for speeding up the execution of my code,by maintaining this logic.
    My proposal should be the following but I need your kind opinion.
    FIELD-SYMBOLS: <fs_#1_line> TYPE LINE OF table1.
    FIELD-SYMBOLS: <fs_#2_line> TYPE LINE OF table1.
    LOOP AT table1 WHERE f1 = '10' ASSIGNING <fs_#1_line>. (#1)
          updates to table1
          set c1_filed, c2_filed
          LOOP AT table1 ASSIGNING <fs_#2_line>.  (#2)            
             IF <fs_#2_line>-f1 = c1_filed AND
                <fs_#2_line>-f2 = c2_filed.
               <fs_#2_line>-fx = 'x'.
               <fs_#2_line>-fy = 'y'.
               <fs_#2_line>-fz = 'z'.
               <fs_#2_line>-ft = 't'.   
             ENDIF.                 
          ENDLOOP.   (#2)              
    ENDLOOP.   (#1)
    Your kind support is very important for me.
    Thanks in advance.
    Regards,
         Giovanni

  • How to use a queue with dynamic data

    When using a collector I have found that it significantly slows down my loop times. I am using LabView7.1 on a Dell PC with Windows XP.  If I use a queue with dynamic data do you think that will require less of my processor and allow for faster loop speeds?
    I have created a queue using dynamic data in one loop and I want to retrieve all available samples each iteration in a slower loop. If I use the flush queue I get a 1d array of dynamic data. What is the best way to convert the 1d array of dynamic data so that the array of dynamic data is consolidated back into a single dynamic data type? Any help would be much appreciated.

    Hi Dennis,
    You could for instance wire the array to an auto-indexed for loop. I attach an example. I assume you wish to concatenate the arrays a singel waveform.
    Hope it helps,
    Pelle S
    District Sales Manager
    National Instruments Sweden
    Attachments:
    Dynamic queue.vi ‏245 KB

  • Problem With Insert statement using field symbols with unicode enabled

    I was writng a function module for dyanamic operations on the table. We are using the field symbols, function module is unicode enabled.
    Assign statements are working fine, with which we created work are <fs_wa_header> and internal table <fs_tb_item> dynamically based on the table name (IM_TB_HENAME) which we get as import parameter.
    we have query which is giving us dump.
    INSERT  (IM_TB_HENAME)  FROM <FS_WA_HEADER>.

    Hi
    INSERT (IM_TB_HENAME) FROM <FS_WA_HEADER> is good for inserting a line in the database, so IM_TB_HENAME has to have the name of dictionary table.
    U should write:
    INSERT  <FS_WA_HEADER> INTO (IM_TB_HENAME).
    But I believe you can't use the variable IM_TB_HENAME, you should use another field-symbols:
    ASSIGN (IM_TB_HNAME) TO <FS_TB_ITEM>.
    INSERT  <FS_WA_HEADER> INTO <FS_TB_ITEM>.
    Max

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

  • How to use field symbols  while creating a new RFC Bapi

    Hi all,
    I have written a RFC Bapi in the traditional way.
    I need to replace all with field symbols (import. export. tables and source code).
    What is the syntax ?
    Any sample codng will be more helpful.
    Regards
    Senthil

    Please search for available information on "field symbols" before posting
    Thread locked
    Thomas

Maybe you are looking for

  • My MacBook has question marks on all folders and won't run ANY program. Help!

    A week ago I was editing some photographs in Photoshop CS 5 extended. My computer has been running slow for a while so I thought that I would finish these files and then clear it of some photos since I know I've recently uploaded several gbs onto it.

  • What is JREMetrics reg subkey used for?

    I noticed with release 20 and now 21 that a subkey is created upon installation: hklm\software\JREMetrics and contains values: JREVersion updateCount MachineCount I always disable the AutoUpdates in any manner possible so, is this another update mech

  • Safari 4.1 Will Not Start Up (Quits Unexpectedly)

    After doing a software update to Safari 4.1, the program will not launch (the menu bar appears for a second or two, then the message box appears stating that Safari "quit unexpectedly"). Can anyone tell me what is causing this and how to fix it? My e

  • Trying to optimize a home network with ABS, AE and a router!  New advice!

    I currently have this setup: Cable modem going into a linksys router. 1 line goes to an imac 1 line goes to an emac 1 line goes to a silly windows pc 1 line goes to an AIRPORT BASE STATION (usb -older one) From the ABS - I power 2 laptops (ibooks) -

  • Phone goes right to voice mail without ringing

    I have noticed recently that my phone goes right to voice mail when i call my home number from my cell phone. I noticed also when i am home and get a call it won't let me answer it Any ideas? Thanks in advance