Field-symbols as class attribute

Hi Fellas,
Is there a way we can define a field-symbols as a class attribute ? My requirement is that i am dynamically constructing a structure at runtime in my model class and binding the component of this structure to my view fields. I am able to create the structure which is basically ref to cl_abap_structdescr and the problem is when i am binding to the model attribute, i need this to be a structure so that i can address the components as "//model/structure.component".
Please let me know how we can define a field-symbol as a class attribute.
Cheers,
Ram.

Hi Ram,
Field-Symbol as class attribute is not possible. Your way to do this by REF TO DATA is the correct way for that.
By default data binding is only possible like this:
Simple field attribute
value=”//<model>/<field name>”
Structure attribute
value=”//<model>/<structure name>.<field name>”
Table attribute
value=”//<model>/<table name>[<line index].<field name>”
If you want to bind to your data reference you have to implement your own getter and setter methods. Read this <a href="http://help.sap.com/saphelp_nw70/helpdata/en/fb/fbb84c20df274aa52a0b0833769057/frameset.htm">http://help.sap.com/saphelp_nw70/helpdata/en/fb/fbb84c20df274aa52a0b0833769057/frameset.htm</a> for further information. In addition to that, you have to implement your own GET_M_S_xxx to return metadata of your structure. By doing all this it is possible to implement a completely dynamic data binding. In the view it looks like the regular Structure attribute: value=”//<model>/<data-ref name>.<field name>”
Regards,
Thilo

Similar Messages

  • Field symbols as Class Attributes

    Hello Gurus,
    Is anybody able to say to me if it is possible to declare field symbols as class attributes? As I can understand until now, this is not possible and we need to use some attribute with the "TYPE REF TO Data" to get the information we need. Correct?
    Thanks,
    Daniel.

    Ok, let me see if someone can give me some idea on how to improve my method:
    Method: PREPARE_PTOOL_DATA
    Parameters specification:
    Parameter        Type     Typing     Reference Type
    PF_ANALYSIS        Importing     Type     /SYM/SC_PT_ID_ANALYSIS_D
    PF_ANAL_DESC        Importing     Type     /SYM/SC_NM_DESC_ANALYSIS
    PF_LOGIC        Importing     Type     CHAR01
    PF_MATERIAL        Importing     Type     MATNR
    PF_MAKTX        Importing     Type     MAKTX
    PT_DATA_COMPA        Exporting     Type     /SYM/SC_TAB_PT_RESULT_CP
    PT_CALC_ANALY        Exporting     Type     /SYM/SC_TAB_PT_RESULT_CA
    PT_DATA_MATERIAL1 Changing     Type     /SYM/SC_TAB_PROC_ALLERG_RESULT
    PT_DATA_MATERIAL2     Changing     Type     /SYM/SC_TAB_PROC_ALLERG_RESULT
    Source code:
    From the /SYM/SC_CL_PROCESS_ALLERG_GEN class
    Old version (but it is working)
    METHOD prepare_ptool_data.
      DATA: ls_data_material1   TYPE /sym/sc_s_proc_allerg_result,
            ls_data_material2   TYPE /sym/sc_s_proc_allerg_result,
            lf_index_material1  TYPE sy-tabix,
            lf_index_material2  TYPE sy-tabix,
            ls_result_cp        TYPE /sym/sc_pt_result_cp,
            ls_result_ca        TYPE /sym/sc_pt_result_ca.
    Prepare data for Data Comparison step
      IF pt_data_compa IS REQUESTED.
        LOOP AT pt_data_material1 INTO ls_data_material1.
          lf_index_material1 = sy-tabix.
          CLEAR ls_result_cp.
          MOVE pf_analysis   TO ls_result_cp-analysis.
          MOVE pf_anal_desc  TO ls_result_cp-desc_analysis.
          MOVE ls_data_material1-algbe TO ls_result_cp-desc_property.
    If Logic 'A', move the text from ls_data_material1 to original
    material status
          IF pf_logic EQ c_logic_a.
            MOVE ls_data_material1-agsbe TO ls_result_cp-val_orig_matnr.
    If Logic 'B', move the text from ls_data_material1 to "toy"
    material status
          ELSEIF pf_logic EQ c_logic_b.
            MOVE ls_data_material1-agsbe TO ls_result_cp-val_toy_matnr.
          ENDIF.  " IF pf_logic EQ c_logic_a.
    Read the lt_data_toy by the Allergen ID (ALGEN)
          CLEAR ls_data_material2.
          READ TABLE pt_data_material2 INTO ls_data_material2
                WITH KEY algen = ls_data_material1-algen BINARY SEARCH.
          IF sy-subrc EQ 0.
            lf_index_material2 = sy-tabix.
    If Logic 'A', move the text from ls_data_material2 to "toy°
    material status
            IF pf_logic EQ c_logic_a.
              MOVE ls_data_material2-agsbe TO ls_result_cp-val_toy_matnr.
    If Logic 'B', move the text from ls_data_material2 to original
    material status
            ELSEIF pf_logic EQ c_logic_b.
              MOVE ls_data_material2-agsbe TO ls_result_cp-val_orig_matnr.
            ENDIF.  " IF pf_logic EQ c_a.
    Delete record from lt_data_toy, index lf_index_toy
            DELETE pt_data_material2 INDEX lf_index_material2.
          ENDIF.  " IF sy-subrc EQ 0.
          APPEND ls_result_cp TO pt_data_compa.
    Delete record from lt_data_orig, index lf_index_orig
          DELETE pt_data_material1 INDEX lf_index_material1.
        ENDLOOP.  " LOOP AT lt_data_material1 INTO ls_data_material1.
      ENDIF.  " IF pt_data_compa IS REQUESTED.
    Prepare data for Calculation Analysis step
      IF pt_calc_analy IS REQUESTED.
        LOOP AT pt_data_material1 INTO ls_data_material1.
          lf_index_material1 = sy-tabix.
          CLEAR ls_result_ca.
          MOVE pf_material   TO ls_result_ca-matnr.
          MOVE pf_maktx      TO ls_result_ca-maktx.
          MOVE pf_analysis   TO ls_result_ca-analysis.
          MOVE pf_anal_desc  TO ls_result_ca-desc_analysis.
          MOVE ls_data_material1-algbe TO ls_result_ca-desc_property.
    If Logic 'A', move the text from ls_data_material1 to original
    material status
          IF pf_logic EQ c_logic_a.
            MOVE ls_data_material1-agsbe TO ls_result_ca-val_curr_stat.
    If Logic 'B', move the text from ls_data_material1 to "toy"
    material status
          ELSEIF pf_logic EQ c_logic_b.
            MOVE ls_data_material1-agsbe TO ls_result_ca-val_simul_stat.
          ENDIF.  " IF pf_logic EQ c_logic_a.
    Read the lt_data_toy by the Allergen ID (ALGEN)
          CLEAR ls_data_material2.
          READ TABLE pt_data_material2 INTO ls_data_material2
                WITH KEY algen = ls_data_material1-algen BINARY SEARCH.
          IF sy-subrc EQ 0.
            lf_index_material2 = sy-tabix.
    If Logic 'A', move the text from ls_data_material2 to "toy°
    material status
            IF pf_logic EQ c_logic_a.
              MOVE ls_data_material2-agsbe TO ls_result_ca-val_simul_stat.
    If Logic 'B', move the text from ls_data_material2 to original
    material status
            ELSEIF pf_logic EQ c_logic_b.
              MOVE ls_data_material2-agsbe TO ls_result_ca-val_curr_stat.
            ENDIF.  " IF pf_logic EQ c_a.
    Delete record from lt_data_toy, index lf_index_toy
            DELETE pt_data_material2 INDEX lf_index_material2.
          ENDIF.  " IF sy-subrc EQ 0.
          APPEND ls_result_ca TO pt_calc_analy.
    Delete record from lt_data_orig, index lf_index_orig
          DELETE pt_data_material1 INDEX lf_index_material1.
        ENDLOOP.  " LOOP AT lt_data_material1 INTO ls_data_material1.
      ENDIF.  " IF pt_calc_analy IS REQUESTED.
    ENDMETHOD.
    As you can see, I am repeating almost the same code, just changing some items. I am not sure if I can use new parameters (ANY or ANY TABLE) but, my first idea to improve it was to use the field-symbols (and it works ok). The issue is that I have to repeat the assignment lines every same named method of the classes I am changing (I would like to do the assignment into a new method of the superclass). Do you think it is possible or should I give up and proceed with the assignments locally, for each same named method of each class?
    Thanks,
    Daniel.

  • Very Urgent: how to define field symbols in class using se24 Points assured

    hi all
    I am new to abap oo programming. I am using se24 to build a class
    where some methods have code which involves working with field sybmols but i am not able to figure out way for how to define field symbols in the attributes section.
    I tried defining like : fld_sym type ref to  dbtab-fld
    but in the method implementation if i try to use it like assign fld to <fld_sym> there it says fld_sym is not defined as a field symbol.
    So can anyone please guide me how to define field symbols in se24.
    Also what should be the general steps while creating a class using se24.
    Points assured
    thanks

    Hi
    Global classes are like Global fun modules in which the Methods and code is already written and is mainly used for Reusability purpose.
    Goto SE24 tcode and see the std global classes like
    CL_ABAP_CHAR_UTILITIES
    see the links
    chk out the links below:
    General Tutorial for OOPS
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
    Have a look at these links for OO ABAP.
    http://www.sapgenie.com/abap/OO/
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    SDN Series:
    https://www.sdn.sap.com/irj/sdn/developerareas/abap?rid=/webcontent/uuid/35eaef9c-0b01-0010-dd8b-e3b0f9ed7ccb [original link is broken]
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf
    Basic concepts of OOPS
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b6cae890-0201-0010-ef8b-f970a9c41d47
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1591ec90-0201-0010-3ba8-cdcd500b17cf
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
    http://www.henrikfrank.dk/abapuk.html
    http://www.erpgenie.com/abap/OO/
    Reward oints if useful,
    Aleem.

  • Field symbols inside class

    Is it possible to declare field symbols inside classes?
    Thanks in advance.
    Hema
    Moderator message: please search for information and try yourself before asking.
    Edited by: Thomas Zloch on Dec 23, 2010 10:55 AM

    Hi Hemalatha,
    We can use Field Symbols in classes.
    local field_symbols within methods are allowed.
    you can only use field-symbols within method (locally), not as direct class attribute (globally).
    U can check with this sample code.
    Sample code is given below:
    CLASS c1 DEFINITION.
    PUBLIC SECTION.
    METHODS m1 IMPORTING oref TYPE REF TO object attr TYPE string.
    ENDCLASS.
    CLASS c1 IMPLEMENTATION.
    METHOD m1.
    FIELD-SYMBOLS <attr> TYPE ANY.
    ASSIGN oref->(attr) TO <attr>.
    WRITE <attr> ...
    ENDMETHOD.
    ENDCLASS.
    I hope u got this .....

  • Field-symbols in classes

    Hello,
    Is it possible to use field-symbols in classes?
    When I try to declare field-symbol in class like other variable, appears an error.
    Or may be it is possible to use something instead of field-symbols?
    Great thanx in advance!

    Hi
    You can use field symbols in classes.
    Sample code is given below:
    CLASS c1 DEFINITION.
      PUBLIC SECTION.
        METHODS m1 IMPORTING oref TYPE REF TO object
                             attr TYPE string.
    ENDCLASS.
    CLASS c1 IMPLEMENTATION.
      METHOD m1.
        FIELD-SYMBOLS <attr> TYPE ANY.
        ASSIGN oref->(attr) TO <attr>.
        WRITE <attr> ...
      ENDMETHOD.
    ENDCLASS.
    Thanks
    Khushboo

  • Model Binding and Calculated Field Syntax for "class" Attribute

    Hi,
    I tried to use the calculated field syntax from SAP UI5 to change the CSS class attribute of an element based on some model property, i.e., I wanted to change the class in the corresponding formatter function based on the currently bound value. However, my formatter function is not called. When I use the same syntax on a text attribute, it works.
    I also tried to use normal property binding, but it did not work on the class attribute either (it just put class="{property}" in the rendered HTML).
    Is there anything I missed or is it just not possible to use property binding and calculated field syntax for class attributes? Did anybody try something like this before?
    I think it is a standard use case to change the CSS class based on some model property. So, if anybody knows how to do that, could you give a short example?
    Best regards
    Svenja

    They have a class property. At least, I can do the following in an XML view:
    <Button
                  icon="sap-icon://add"
                  press="onButtonPress"
                  class="my-button-class" />
    I would expect the following to work as well, but for me it did not:
    <Button
                  icon="sap-icon://add"
                  press="onButtonPress"
                  class="{/customClass}" />
    This renders the following HTML (cropped to the important parts):
    <button type="button" class="sapMBtn {/customClass}">
    </button>
    It seems like the class attribute is something special although I don't see a reason why. Other HTML templating engines, for example, support things like that.

  • Field-symbols as pgae attributes?

    Hi all,
    i have the problem of including a page fragment two times in the same page. In this fragment i declare a field symbol. And when i try to compile the code it crashes.
    I need to declare it somewhere, so that just one declaration have to take place. I suppose as a page attribute is the correct step. But i don't know how to  do that. Could anyone help me or give me an other possible solution to my problem.

    Hi,
    In the assumption that you have defined a table called itab.
    In your page:
    <%FIELD-SYMBOLS <fs> TYPE ANY TABLE.%>
    <%@ include file = "pagefrag.htm" %>
    <%@ include file = "pagefrag.htm" %>
    in your page frag:
    <%ASSIGN itab TO <fs>.%>
    That's it, it works fine.
    Eddy
    PS.
    Put yourself on the SDN world map (http://sdn.idizaai.be/sdn_world/sdn_world.html) and earn 25 points.
    Spread the wor(l)d!

  • Field Symbol as Global Data

    Hi, can a field symbol be global in a static class?

    Hello Kenneth
    Please refer to the answer of Klaus Ziegler in the following thread
    Re: Field symbols as Class Attributes
    Regards
      Uwe

  • Field Symbol Assignment

    Hi,
    I have a doubt regarding the field symbol assignment.
    In my program, I have logic as below.
    <b>  W_1STCNTFLD = 'E_INV_AGING_STRU-PDISCCNTP1'.
      W_2NDCNTFLD = 'E_INV_AGING_STRU-PDISCCNTP2'.
      ASSIGN (W_1STCNTFLD) TO <FS1>.
      ASSIGN (W_2NDCNTFLD) TO <FS2>.</b>
    While debugging, when I see the values of the Field Symbols <b><FS1></b> and <b><FS2></b> after assignment, they are <b>0, 0</b>. Why is it like that..?
    In general, what does a Field Symbol hold..? the value of the variable being assigned or the Memory location of that variable..?
    When I remove the paranthesis while assigning like below,
      <b>ASSIGN W_1STCNTFLD TO <FS1>.</b>
    it is storing the value of the variable(<b>E_INV_AGING_STRU-PDISCCNTP1</b>) to <b><FS1></b> instead of '0'.
    And what is the difference between   <b>ASSIGN (W_1STCNTFLD) TO <FS1></b> and   <b>ASSIGN W_1STCNTFLD TO <FS1></b>..? I mean, when we put paranthesis to the variable and when we remove the paranthesis.
    Please clarify my doubts. Thanks in advance.
    Thanks & Regards,
    Paddu.

    when you use the paranthesis,(W_1STCNTFLD) actually equals to ('E_INV_AGING_STRU-PDISCCNTP1'),and the 'E_INV_AGING_STRU-PDISCCNTP1' must be the label of a data object,it can't be a string!
    please refer to the following document(coming from sap abap keywords document):
    Alternative 2
    ... [TABLE FIELD] (name)
    Alternative 3
    ... oref->(attr_name)
    Alternative 4
    ... {class|(class_name)}=>{attr|(attr_name)}
    Effect
    There are three dynamic variants for mem_area, where the storage area is not specified directly, but as the content of character/type data objects enclosed within parentheses.
    In the first variant (name), the label in name is built exacltly like the direct specification. When the statement is executed, the content of name must be the label of a data object that can contain offset/length specifications, strucuture component selectors, and component selectors for the assignment of attributes in classes or objects (since Release 6.10). The content of name must be specified in uppercase letters.
    The optional addition TABLE FIELD before (name) is only possible outside of classes. This addition limits the search area - where the data object specified in (name) is searched for (see below) - to the interface work areas for the current program group declared using TABLES. If TABLE FIELD is specified, casting_spec and range_spec cannot be specified explicitly.
    If the label in name is a field symbol or a form parameter with an unstructured type, components can be addressed, as of Release 6.10, through structure component selectors. The components must exist when the statement is executed.
    The second variant oref->(attr_name) is a special case of the first variant for the assignment of an instance attribute to a field symbol - where the object reference variable oref is specified statically. The label of the attribute is specified dynamically in the character-type field attr_name and must not be specified in uppercase letters.
    The third variant {class|(class_name)}=>{name|(attr_name)} is a special case of the first variant for the assignment of a static attribute to a field symbol where the class name class and the name of the attribute name can be specified both directly and dynamically in character-type fields class_name or attr_name. The contents of attr_name and class_name do not have to be in uppercase letters. If the class name is specified dynamically and the attribute is specified directly, no offset/length specifications can be made for the attribute.
    If a data object is specified dynamically, this is searched for in accordance with the following hierarchy.
    Within the local data objects of the current procedure
    Within the attributes, visible in a method, of the actual class, where , in instance methods, the self reference me-> is set explicitly before the label
    Within the global data of the current program
    Within the interface work areas of the main program of the current program group declared with TABLES
    Within the attributes of the object to which oref refers, if the label has the expression oref-> (as of Release 6.10)
    Note
    Only for internal use can the label in name also have the form (PROG)DOBJ, whereby PROG is the name of an ABAP program and DOBJ is the name of a global data object of this program. If the program PROG is loaded during execution of the statement ASSIGN in the same internal mode as the current program is loaded, the data object (PROG)DOBJ in this program is searched for and the field symbol points to this data object after successful assignment.
    Example
    Dynamic access to an attribute of an object (Dynamic Access) through a field symbol.
    CLASS c1 DEFINITION.
      PUBLIC SECTION.
        METHODS m1 IMPORTING oref TYPE REF TO object
                             attr TYPE string.
    ENDCLASS.
    CLASS c1 IMPLEMENTATION.
      METHOD m1.
        FIELD-SYMBOLS <attr> TYPE ANY.
        ASSIGN oref->(attr) TO <attr>.
        WRITE <attr> ...
      ENDMETHOD.
    ENDCLASS.

  • Field symbols or ?

    Hi,
    its possible form internal table like this:
    tabname | row | columnName | columnValue
    t005 | 1 | land1 | AD
    t005 | 1 | landk | AND
    t005 | 1 | lnplz | 00
    t005 | 2 | land1 | AS
    t005 | 2 | landk | ND
    t005 | 2 | lnplz | 01
    to create internal table "t005" in this structure:
    row|  land1 | landk | lnplz | ...
    1 | AD | AND | 00
    2 | AS | ND | 01
    (use field-symbols, or dynamic attribute declarations...)
    thanks, m

    Try this...
    Get the T005 data into internal table as first table...
    tabname | row | columnName | columnValue
    t005 | 1 | land1 | AD
    t005 | 1 | landk | AND
    t005 | 1 | lnplz | 00
    t005 | 2 | land1 | AS
    t005 | 2 | landk | ND
    t005 | 2 | lnplz | 01
    Now declare another internal table in the form...
    row| land1 | landk | lnplz | ...
    sort itab_t005 by tablename row.
    now loop at itab_t005.
    at new row.
    clear itab_new.
    endat.
    if itab_t005-columename eq 'land1.
    itab_new-land1 = itab_t005-columevalue.
    endif.
    the same for other two....
    at end of row.
    append itab_new.
    endat.
    endloop.
    Hope this will solve ur porblem...

  • Accessing the attributes of a class using field symbols?

    An option to pulll a variable into a user exit that otherwise would be out of reach is detailed [here|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/208811b0-00b2-2910-c5ac-dd2c7c50c8e8]
    Can a similar approach involving field symbols or otherwise, be used to pull in the attributes of a class into the exit? For now, I'm trying to access the A_FRONTEND_INDEX attribute of the class CL_HRXSS_REM.
    any ideas?
    ~Suresh

    Hi,
    Have you already tried (PROGRAM)(OBJECT)->A_FRONTEND_INDEX in your code? I prepared small testing scenario with two programs and it works.
    REPORT  zmv_test1.
    FORM test.
      FIELD-SYMBOLS: <fs> TYPE ANY.
      ASSIGN '(ZMV_TEST2)zip->crc32_map' TO <fs>.
      IF sy-subrc EQ 0.
        <fs> = 'Test'.
      ENDIF.
    ENDFORM.                    "test
    REPORT  zmv_test2.
    DATA: zip TYPE REF TO cl_abap_zip.
    START-OF-SELECTION.
      CREATE OBJECT zip.
      PERFORM test IN PROGRAM zmv_test1.
    Cheers,

  • 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

  • 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

  • Field symbol as import parameter in class method ???

    Hi everyone,
    is it possible to pass a field symbol as an import parameter to a method in a class? If yes, how do I define the data type of the import parameter? I'm trying to work with field symbols as the program doesn't know what kind of structure the program parameter p_srcdso has. Coding example would be something like this:
    PARAMETERS: p_srcdso TYPE rsdodsobject DEFAULT '/BIC/AKVI0001'.
    DATA: lr_srcpkg TYPE REF TO data.
    FIELD-SYMBOLS: <fs_table> TYPE ANY TABLE.
    CREATE DATA lr_srcpkg TYPE TABLE OF (p_srcdso).
    ASSIGN lr_srcpkg->* TO <fs_table>.
    SELECT *
    FROM (p_srcdso)
    INTO TABLE <fs_table>.
    CALL METHOD cl_ref->create_somethign
    EXPORTING
        i_source_package = <fs_table>.
    Thanks,
    Alex

    Halo Alexander,
    You can use TYPE REF TO DATA( say the parameter name is i_data) as the importing parameter of the method create_somethign and inside the method you need to dereference it using data reference variable again.
    data: dref type ref to data.
    field-symbols: <fs_table> type table.
    create data dref like i_data.
    assign dref->* to <fs_table>.
    Regards
    Arshad

  • 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

Maybe you are looking for

  • How can I prevent Firefox from automatically updating?

    Hello, I am trying to prevent Firefox 28 from automatically updating to Firefox 29 (on OSX 10.7.5). I have the option "Never check for updates" checked under 'Update' in the 'Advanced' Preferences. I have "Automatically update Search Engines" uncheck

  • ITunes 10.4 Update: Bonjour Problems

    (Just as an aside, I have never experienced problems of this manner, and installation of new updates was always simple & easy) Whenever I attempt to update iTunes+Quicktime, I seem to encounter the same baffling problem: I am not able to provide a ro

  • Search field in iPad's iTunes is missing

    Hi, Something odd, but after updating the iPad to latest version of 5.1.1 now for some odd reason I cannot seem to find the search field in the iTunes music and video store, though I do have other buttons etc. (I'm a US resident). Any 1 else also hav

  • IPad3 - Storage management

    1- Is there an SD card reader that can be connected to the iPAD3? 2- What are the tranfere speeds limits? 3- Can the iPAD3 read from a wi-fi SD card using wi-fi mode directly? Or does it has to be via an existing wi-fi office network. 4- Can we conne

  • Specifying Colors with a different ColorModel than sRGB

    Hi everyone, for a reason which I still don't understand, for sometimes I'm as foolish as hell, I want to specify a color with the HSV color model. In order to do this I went through the API specification and I came up with this solution, which I tho