In webdynpro ,Passing field symbols as values to class methods

Hi
Please tell me the ways of accessing database in webdynpro abap(not directly). I am calling Class method for accessing database. As currently I am directly accessing database in my webdynpro application. I have created a class and method for the same.
In my method I want to use select statement which will return table with values to webdynpro application. So for select statement(Calling Method) I need to use my field symbol values as where in clause .
Could anyone please help with example code?
Thanks,
Ujjwal

data: in_line type ref to data.
CREATE DATA in_line LIKE LINE OF <dyn_tab>.
  ASSIGN in_line->* TO <dyn_wa>.
You can create a data reference and assign it to a field symbol and change the values. direclty passing field symbols is not possible.
Abhi

Similar Messages

  • How to pass field symbol as parameter to a method

    Hi,
    I have a field symbol of type table,also i have a method with parameter (say vbeln), i need to pass the range value in <fs> as the parametrs to the method.,
    How can I acheive this,
    A code snippet eill help me a lot.,
    Thank you.
    Arjun.G

    Hi,
    Example code :
    field-symbols : <fs> type table.
    CALL METHOD cl_gui_frontend_services=>gui_upload
      CHANGING
        data_tab                = <fs>
    *  EXCEPTIONS
    *    file_open_error         = 1
    *    file_read_error         = 2
    *    no_batch                = 3
    *    gui_refuse_filetransfer = 4
    *    invalid_type            = 5
    *    no_authority            = 6
    *    unknown_error           = 7
    *    bad_data_format         = 8
    *    header_not_allowed      = 9
    *    separator_not_allowed   = 10
    *    header_too_long         = 11
    *    unknown_dp_error        = 12
    *    access_denied           = 13
    *    dp_out_of_memory        = 14
    *    disk_full               = 15
    *    dp_timeout              = 16
    *    not_supported_by_gui    = 17
    *    error_no_gui            = 18
    *    others                  = 19
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Remember : parameter should be of type standard table.
    Regards,
    Mohaiyuddin

  • Is it possible to pass a field symbol as parameter from any method of view?

    Hi
    Is it possible to pass a field symbol as an importing parameter to teh globally declared attribute??

    While it is true that you can pass field symbols, they must be fully typed at the time you pass them  and they will be passed by value, not by reference. If you want to pass generically typed variables use a data reference (TYPE REF TO) instead.

  • Passing Field Symbols in FM

    Hi Friends,
                            In my FM, i want to pass field symbol back to my main program for further use. How can i achieve the same.
                            In my source code section of FM,
    FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE,
                   <fs_dyntable>,
                   <fs_fldval> TYPE ANY,
                   <fs_col1>,<fs_col2>.
      DATA : t_newtable TYPE REF TO data,t_newline  TYPE REF TO data,t_fldcat TYPE lvc_t_fcat.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog           = t_fldcat
        IMPORTING
          ep_table                  = t_newtable
        EXCEPTIONS
          generate_subpool_dir_full = 1
          OTHERS                    = 2.
      ASSIGN t_newtable->* TO <t_dyntable>.
      CREATE DATA t_newline LIKE LINE OF <t_dyntable>.
    i want to pass <t_dyntable> back to my prg but i am not getting how to pass it and where to write it.
    Please guide me.
    Thanks and Regards,
    Gaurav

    Hi Naimesh,
                            Thanks for the reply.
                             Finally i understood what you guys wanted me to do.I did exactly the same but the problem remains the same.
                             when my control get back to subroutine it works fine, i mean upto
    ASSIGN r_dyntab->* TO <t_dyntable>
    ,it works fine.But when the control gets over from FM and process the next statement 
    clear <t_dyntable>.
    then the  <t_dyntable> says it is not yet assigned. I want to access  <t_dyntable> as main dynamic table for further process.
    i have added code for your reference.
    Thanks and Regards,
    Gaurav
    Report Zcallingprg. 
    DATA : t_newtable TYPE REF TO data,t_newline  TYPE REF TO data,t_fldcat TYPE lvc_t_fcat.
      DATA : wa_it_fldcat TYPE lvc_s_fcat,wa_colno(2) TYPE n,wa_flname(5) TYPE c,G_DISCONT.
      data : num2(2).
      DATA: rest TYPE i.
      DATA: task(8) TYPE c value '1'.
      FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE,
                   <fs_dyntable>,
                   <fs_fldval> TYPE ANY,
                   <fs_col1>,<fs_col2>.
    DO 100 TIMES.
      rest = sy-index MOD 36.
      IF rest = 0.
        task = task + 1.
      ENDIF.
    CALL FUNCTION 'ZTEST_NEW_TASK' STARTING NEW TASK task
      EXPORTING
        num2          = 2.
    ENDDO.
      clear <t_dyntable>.
    FORM get_dyn_tab CHANGING r_dyntab TYPE REF TO data.
    ASSIGN r_dyntab->* TO <t_dyntable>.
    ENDFORM.
    code of FM
    CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog           = t_fldcat
        IMPORTING
          ep_table                  = r_newtab
        EXCEPTIONS
          generate_subpool_dir_full = 1
          OTHERS                    = 2.
    *ASSIGN r_newtab->* TO <t_dyntable>.
    PERFORM get_dyn_tab(ztemp5) USING r_newtab.

  • Passing Field Symbols in subroutines

    Hi all,
    Can any body tell me how to pass field symbols in a suboutine and will that effect orignal value of that symbl if i change it in subroutine.
    Any Help will be awarded.
    <b>Sachin</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.
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Passing field symbol value to a variable

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

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

  • How to pass field symbol or table from one view to another view in abap web dynpro?

    I am creating an Inbound Outbound ALV report in ABAP Web Dynpro. However at selection-screen I have select options and fetching is done at view2. Problem is we can pass parameter using inbound outbound parameters but how to pass internal table or field-symbols from one view to another view? I made use of Assistance Class too but its not very clear to me. Please give me some example or code to sort this problem out.

    I am creating an Inbound Outbound ALV report in ABAP Web Dynpro. However at selection-screen I have select options and fetching is done at view2. Problem is we can pass parameter using inbound outbound parameters but how to pass internal table or field-symbols from one view to another view? I made use of Assistance Class too but its not very clear to me. Please give me some example or code to sort this problem out.

  • Passing field-symbols to a function module

    Hey experts.
    In this scenario I am in the need to pass two buffer fieldsymbols (one contains a string, the other one a table) from my main programm to a function module.
    The main programm handles the user input and double-loops the function call with changing parameters. I cannot initialize the field-symbols within a loop since I'd loose the data. So I need to declare them BEFORE the function call proceeds, get them transfered over to the function module AND I need them saved from one call to the next one.
    Any suggestions ?
    How can I set global parameters available in my main programm and my function module?

    Hi Paul,
    Field symbols never contain data but refer to some existing data objects, so what you need is to copy the latter (string and internal table in your case), and you can define to which data objects the field symbols refer to, at any time. To duplicate a data object, it will depend if they are defined statically or dynamically?
    How can I set global parameters available in my main programm and my function module?
    It's difficult to give you one answer, it may depend on your scenario, you have lots of possibilities, interface work area, global data that is written and read using dedicated procedures, export/import to memory...
    A little excerpt of your code would help.
    BR
    Sandra

  • Field-symbols as parameters to the method of a class

    Hi All,
    I am having an doubt regarding the field-symbols.Can we pass the field-symbols as a parameter to the method of a class.If yes can anyone tell me how to do this. Before posting I have searched regarding it in google but I did not find any better solution.Though I have seen some examples regarding the passing of field symbols as a parameter those scenarios does not match with my report as my report varies dynamically based on selection criteria.
    Below is the snippet of my code regarding the passing of field-symbols as a parameter.
    methods:  final_data importing <fs_h_line>TYPE any
                                                 <fs_h> TYPE STANDARD TABLE
                                   exporting <fs_f_line> TYPE any
                                                 <fs_f> TYPE STANDARD TABLE, 
    CALL METHOD l_obj->final_data exporting <fs_h_line> = <fs_header_line>
                                                                  <fs_h>      = <fs_header>
                                                   importing <fs_f_line> = <fs_final_line>
                                                                 <fs_f>      = <fs_final>.
    With the above code I am getting an error.Check whether it is correct or not.If not suggest the solution to resolve the issue.
    Regards,
    Chakradhar.

    Hi
    Maybe if you change this code below to field-symbol, it can work:
    DATA: tl_header_csv TYPE STANDARD TABLE OF yol_header_arquivo,
          tl_csv_aux    TYPE textline_t                          .
    DATA: wl_header_csv LIKE LINE OF tl_header_csv.
    converter_csv_al11_itab( EXPORTING im_t_csv = tl_csv_aux
                             IMPORTING ex_w_sap = wl_header_csv
                             CHANGING  ex_t_sap = tl_header_csv ).
    METHOD converter_csv_al11_itab.
      IM_T_CSV  Importing  Type  TEXTLINE_T
      EX_W_SAP  Exporting  Type  ANY
      EX_T_SAP  Changing   Type  STANDARD TABLE

  • Passing select-options table to a class method

    Hi,
    I have to pass a table which contains a select-options to a class method as a param...
    How I do this??
    DATA s_mail TYPE  z_mail_rng.
    o_mail->add_receiver( ? ).
    (add_receiver's formal param is TYPE ANY)
    Plese give me help.
    Thanks.

    Hi,
    I send coding for  how to use select-options in class.
    May it is useful for u
    tables:marc.
    selection-screen begin of block b1 with frame title text-001.
    select-options: s_matnr for marc-matnr.
    selection-screen end of block b1.
    class c3 definition.
    public section.
    types: begin of ty_marc,
    matnr type marc-matnr,
    werks type marc-werks,
    end of ty_marc.
    data: wa_itab type ty_marc.
    data: itab type table of ty_marc .
    data: wa_matnr type r_matnr.
    methods: add.
    private section.
    *methods: sub.
    endclass.
    class c3 implementation.
    method add .
    select matnr
    werks
    from marc into table itab where matnr IN s_matnr.
    write:/ 'material no', 20 'plant'.
    loop at itab into wa_itab.
    write:/ wa_itab-matnr,
    wa_itab-werks.
    endloop.
    endmethod .
    endclass.
    start-of-selection.
    data b1 type ref to c3.
    create object b1 .
    call method b1->add.

  • Field symbols values passing as parameter to Methods

    Hi ,
    Can we pass fields symbols as parameter to methods ? I want to use field symbols values in my where in clause in methods, thereafter I want to pass my internal table to calling method.
    Thanks,
    Ujjwal

    Hi,
    I have create an class in which have I have create a method to written a select query to extract value from a table. The table name is passed by user. the select used is:
    select * from (tab) into CORRESPONDING FIELDS OF TABLE data.
    this method has 2 parameter:
    tab of type sting (importing).
    data of type ANY TABLE (exporting).
    and i am using the following code to get the data:
    data:  itab TYPE TABLE OF t578w.
    field-SYMBOLS <ab> TYPE any.
    ASSIGN 'T578W' to <ab>.
    CALL METHOD Z_GET_TABLE_DATA=>GET_TABLE " Z_GET_TABLE_DATA is the class name & GET_TABLE  is method name
        EXPORTING
          tab  = <ab>
        IMPORTING
          data = itab.
    You can code in similar way.
    I hope it helps.
    Regards
    Arjun
    Edited by: Arjun Thakur on Apr 23, 2009 3:16 PM

  • Declaring Field Symbols in Public Section of class

    Dear All,
    I am working with class and hav declared some field symbols in one of the method.
    Now I want to move these declaration in Public section of the class so that this field symbol declaration can be used by other methods of the class but I am not able to do the same.
    Can anyone help me in finding as what I am doing wrong here.
    Regards,
    Lalit Kabra

    What you are trying to do is define an attribute. I doubt you can use field symbol as a class attribute. Consider using a data object instead.
    Data : dref type ref to data.
    This can later be deferenced in the individual methods.
    Hope this helps.
    Here's an example for the same:
    REPORT  z_class_001                             .
    *       CLASS lcl_class1 DEFINITION
    CLASS lcl_class1 DEFINITION.
      PUBLIC SECTION.
        DATA dref TYPE REF TO data.
        METHODS : constructor IMPORTING i_type TYPE char20,
                  meth1 IMPORTING value TYPE i.
    ENDCLASS.                    "lcl_class1 DEFINITION
    *       CLASS lcl_class1 IMPLEMENTATION
    CLASS lcl_class1 IMPLEMENTATION.
      METHOD constructor.
        CREATE DATA dref TYPE (i_type).
      ENDMETHOD.                    "constructor
      METHOD meth1.
        FIELD-SYMBOLS <fs> TYPE ANY.
        ASSIGN dref->* TO <fs>.
        WRITE: 'Value is ' ,value.
        ASSIGN value TO <fs>.
        WRITE: 'Field symbol is ', <fs>.
      ENDMETHOD.                                                "meth1
    ENDCLASS.                    "lcl_class1 IMPLEMENTATION
    START-OF-SELECTION.
      DATA ref_class TYPE REF TO lcl_class1.
      CREATE OBJECT ref_class EXPORTING i_type = 'I'.
      CALL METHOD ref_class->meth1
        EXPORTING
          value = 3.
    BR,
    Advait
    Edited by: Advait Gode on Sep 16, 2009 9:44 AM

  • 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

  • Field symbols in ...........in SE24....have ur points..pleas

    Hi all,
    I want to declare a field symbol <fs> in a class, & to use it in different methods of the same class.
    But in attributes of the class, how i declare field symbol in a class.
    I m not able to do this...
    <b>Pleas assist me..& have ur points.</b>
    Regards,
    pradeep phogat

    Pradeep,
    See this thread. It gives details about field symbol used in a standard class. This should give you some idea.
    Re: Field Symbol
    ashish

  • 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