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

Similar Messages

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

  • 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

  • HOW CAN I SEND FIELD SYMBOL TO SUBROUTINE

    HAI,
             HOW CAN I SEND FIELD SYMBOL TO SUBROUTINE
             HOW CAN I COME BACK FROM 5TH INTERACTIVE REROT TO 2ND
    INTERACTIVE REPORT.
    THANK YOU.
    ASHOK

    Hi
    Write some code in the program to come to 2nd list from 5th list
    if sy-lsind = 5.
       sy-lsind = 2.
    endif.
    for field symbols see the doc
    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
    Reward points if useful
    Regards
    Anji

  • Field Symbol as Subroutines name?

    Dear all,
    I am writing a program which includes different routines; it will be the best for me to separate different routines into different sub-routines for calling. However, it depends different parameters that I passed in, can I use a field symbol as the subroutine name for calling?
    In the following sample:
    DATA: program_name(20) TYPE C.
    FIELD-SYMBOLS: <BDC_NAME> TYPE ANY.
    CONCATENATE 'ZBDC_' i_program_name INTO program_name.
    ASSIGN program_name TO <BDC_NAME>.
    PERFORM   <BDC_NAME> .
    The error of the above code is <The FORM "<BDC_NAME>" does not exist> I think the problem may be the type of field-symbol, since I am assigning a parameter with type = C. SAP may not be able to recognize and convert it into a subroutine name. Is there any possible solution in doing this?
    Regards,
    Mandy Au

    Thanks all for your fast response.
    However, when I changed my code into the new one, error still occurs.
    i_program_name = 'ZTEST'.
    data: program_name(20) type c.
    "FIELD-SYMBOLS: <BDC_NAME> type any.
    concatenate 'ZBDC_' i_program_name into program_name.
    "assign program_name to <BDC_NAME>.
        perform (program_name) using i_output_date  i_region .
    ERROR: Routine name not specified
    The i_program_name is a parameter passed in the upper level of the subroutine, which will be passed during runtime, therefore there is no actual name passed in. That is why I think of using the <Field-symbols>.
    Regards,
    Mandy Au

  • 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

  • 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

  • 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

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

  • Problem in accessing field symbols passed as parameters to subroutine

    Hi,
    I have different internal tables/structures,i am populating those tables dynamically using field symbols. If i put that logic in perform, i am getting error while accessing the field symbol insdie the form.
    For ex: My code looks like below.
    tab1 is my int table, fs1 is my work area,
    declared <fs1> as
    data:  <fs1>  type fs1.  <fs1> is my structure type.
    perform populate tables tab1
                              using <fs1>
                                       fs1.
    form populate tables p_tab
                         using p_fs
                                  p_wa.
    assign  p_wa to p_fs.
    endform.
    i am getting the error in the assign stmt
    logic without form...endform is
    assign fs1 to <fs1>
    logic was working fine wihtout perform.
    Regards,
    sowjanya

    Hi Sowjanya,
    Try this one, Hope it will solve your issue
    REPORT  ztest_fs_create.
    DATA: gt_final TYPE STANDARD TABLE OF pernr_d,
          wa_final TYPE pernr_d.
    NODES pernr.
    TABLES pa0001.
    FIELD-SYMBOLS: <tab> TYPE pernr-pernr.
    GET pernr.
      ASSIGN pernr-pernr TO <tab>.
      PERFORM get_pernr USING <tab>.
    END-OF-SELECTION.
      LOOP AT gt_final INTO wa_final.
        WRITE:/1 wa_final.
      ENDLOOP.
    *&      Form  gt_pernr
          text
         -->P_TAB      text
    FORM get_pernr USING p_tab TYPE any.
      APPEND p_tab TO gt_final.
    ENDFORM.                    "gt_pernr
    Cheers
    Pavan

  • Passing unassigned field symbols to a method

    Hello Gurus,
    I work with a field symbol in a method and after the work is finished i have to use it i my program that i call the method from.
    The problem is that the field symbol gets assigned only in the method so i can`t get the field symbol as a changing parameter in my method because it is not assigned yet.
    I thought that i can return the field symbol from the method after it has been assigned, but i don`t know how. The <fs> is a dynamic itab that i created within the method.
    Can anyone help please ??

    Although already answered this code snippet might make it clearer
    my_line is your data structure  typically  an itab structure.
    For example
    TYPES:  BEGIN OF s_elements,
       tabname  type DD02L-tabname,
       tabclass type dd02l-tabclass,
       as4user  type dd02L-as4user,
       as4date  type dd02l-as4date,
       as4time  type DD02l-as4time,
       viewed(1) type c.
    TYPES: END OF    s_elements.
    Data: my_line            TYPE s_elements.
    1) get the structure of your itab automatically so you can build an FCAT simply for any structure without the horrendous usual coding to manipulate and create FCATS.
    CALL METHOD me->return_structure
           EXPORTING
                my_line = my_line.
    You need to make a table ZOGT data available in the class definition either as an attribute if you are using the class builder SE24 or as DATA in the relevant class section.
    data:
        zog         LIKE LINE OF lr_rtti_struc->components .
    data:
      zogt                    LIKE TABLE OF zog .
    method RETURN_STRUCTURE.
    lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data( my_line ).
        zogt[]  = lr_rtti_struc->components.
    endmethod.
    Your structure details are now in table zogt.
    Use this to build an FCAT.
    CALL METHOD me->create_dynamic_fcat
          IMPORTING
                it_fldcat = it_fldcat.
    method CREATE_DYNAMIC_FCAT.
    LOOP AT zogt INTO zog.
          CLEAR wa_it_fldcat.
          wa_it_fldcat-fieldname = zog-name .
          wa_it_fldcat-datatype = zog-type_kind.
          wa_it_fldcat-inttype = zog-type_kind.
          wa_it_fldcat-intlen = zog-length.
          wa_it_fldcat-decimals = zog-decimals.
          wa_it_fldcat-coltext = zog-name.
          wa_it_fldcat-lowercase = 'X'.
          APPEND wa_it_fldcat TO it_fldcat .
        ENDLOOP.
    endmethod.
    Now having got your FCAT you can build your dynamic table.
        CALL METHOD me->create_dynamic_table
          EXPORTING
                it_fldcat = it_fldcat
          IMPORTING
                dy_table        = dy_table.
    (dy_table is defined as ref to data)
    method CREATE_DYNAMIC_TABLE.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
           EXPORTING
                it_fieldcatalog = it_fldcat
           IMPORTING
                ep_table = dy_table.
    endmethod.
    Now populate your dynamic table as per sample code here
    field_symbols:
    <dyn_table>    TYPE  STANDARD TABLE.
    <dyn_wa>.
    data: dy_line            TYPE REF TO data.
    FORM populate_dynamic_itab.
      ASSIGN dy_table->* TO <dyn_table>.
       CREATE DATA dy_line LIKE LINE OF <dyn_table>.
      ASSIGN dy_line->* TO <dyn_wa>.
      SELECT *
            FROM DD02L
            INTO  CORRESPONDING FIELDS OF TABLE <dyn_table>
            WHERE TABNAME LIKE  'ZHR%'.
    ENDFORM.
    Now you can display your grid and process your data.
    CALL METHOD z_object->display_grid
           EXPORTING
             g_outtab = <dyn_table>
             g_fldcat = it_fldcat
             i_gridtitle = i_gridtitle
             i_edit  = i_edit
             i_zebra = i_zebra
           CHANGING
             it_fldcat = it_fldcat
             gt_outtab = <dyn_table>.
    In the Method
    method DISPLAY_GRID.
    GET REFERENCE OF g_outtab INTO g_outtab1.
        GET REFERENCE OF g_fldcat INTO g_fldcat1.
        struct_grid_lset-edit = i_edit.  "To enable editing
        struct_grid_LSET-zebra = i_zebra.
        struct_grid_lset-grid_title = i_gridtitle.
        struct_grid_lset-ctab_fname = 'T_CELLCOLORS'.
        struct_grid_lset-stylefname = 'CELLTAB'.
         CALL METHOD grid1->set_ready_for_input
            EXPORTING
                 i_ready_for_input = '1'.
        CALL METHOD grid1->set_table_for_first_display
           EXPORTING
                 is_layout       = struct_grid_lset
            CHANGING
                 it_outtab       = gt_outtab
                 it_fieldcatalog = it_fldcat.
      ENDMETHOD.
    You can even easily code your own  column names if you so wish in the application program.
    Before calling the method that displays the grid encode the following macro.
    DEFINE col_name.
      read table it_fldcat into  wa_it_fldcat index &1.
      wa_it_fldcat-coltext = &2.
      wa_it_fldcat-outputlen = &3.
      modify it_fldcat from wa_it_fldcat index &1.
    END-OF-DEFINITION.
    Then have a subroutine in your application code something like this
    Form name_columns.
    Here before displaying you can change the field catalog to
    adjust your own column names.
    *col_name  col-nr 'your name' output length.
        col_name 1 'Table name' 30.
        col_name 2 'Table class' 12.
        col_name 3  'Changed By' 12.
        col_name 4  '    On'   12.
        col_name 5  '    At'   8.
        col_name 6  'Act' 3.
      i_gridtitle = 'HR ESS / ITS  ZHR Tables - Double click to display'.
      i_zebra = 'X'.
      i_edit = ' '.
    endform.
    Hope this clears it up a bit.
    Once you get this stuff working you can re-use 99% of the code for almost any structure making the whole process of OO ALV grid applications really simple.
    Yoy only need as well a standard dynpro with a custom container on it (se51).
    Cheers
    jimbo

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

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

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

  • FIELD-SYMBOLS as parameter subroutine that point to table

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

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

Maybe you are looking for

  • Logical Operator list to end users

    Hi, Is there any way that we can provide Logical operator also in the filter/prompt, for the end user in WebI on top of a SAP BW universe? Ex: User has to select a logical operator(like <,<=,>,>=,= etc) and value for a 'Net Due Date' filter Tried sea

  • AIR Runtime version comparison / updating

    Question #1: Is there any built in function, that could compare AIR runtime versions. I know the current runtimeversion that the user has, and I know the version that I developed for. Now I would like to make sure that the user has the same or newer

  • Is it still snowing in minnesota

    has cougar escaped its bondage does birch tree have spring leaves is pig snorting happily away we may never know tttastcb

  • My iPod shuffle erases songs when I plugg it back into my computer after I erase the songs I just put in it?

    My iPod shuffle erases songs when I plugg it back into my computer after I erase the songs I just put in it?

  • Illustrator CS6 crashing on save

    Hello, Illustrator CS6 has been crashing for one of my users on save recently. She has been sending me multiple crash reports and I have not been able to figure out what's going on.  Here's a little history She is running and intel 2.66 with 8 GB of