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.

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

  • 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

  • Is it possible to pass TABLE as the output parameter in stored procedure

    Hey Experts,
      Is it possible to pass TABLE as the output parameter in stored procedure.
    eg
    create procedure spGetData
    @tableName as TABLE(intValue INT NOT NUL)
    as 

    You can use OPENQUERY or OPENROWSET, as mentioned above, to make stored procedure results table like. There are
    some limitations with these methods:
    http://technet.microsoft.com/en-us/library/ms188427.aspx
    In OPENQUERY this-sql-server-instance can be used instead of a linked server name. It requires setting data accces server option:
    exec sp_serveroption @server = 'PRODSVR\SQL2012'
    ,@optname = 'DATA ACCESS'
    ,@optvalue = 'TRUE'
    LINK: http://www.sqlusa.com/bestpractices/select-into/
    Kalman Toth Database & OLAP Architect
    SELECT Video Tutorials 4 Hours
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Passing an Internal Table as parameter to a method

    Hi,
       Can we pass an internal table as a parameter to a method.if so how can we do that?i am new to abap objects..

    Hi Matt,
            Here is the code that i am trying to execute.I am extracting the data in the method "Extract" and passing it to the method "Display" to produce a report output.When i execute this it is giving me an error saying that t_mara is not an internal table since i just refered it with x_mara in the class definition.So how can i modify this code to pass t_mara as an internal table from the method "Extract".Please help me.
    *& Report  ZOBJ_PRAC                                      *
    REPORT  zobj_prac                                                   .
          CLASS example DEFINITION
    CLASS example DEFINITION.
      PUBLIC SECTION.
            TYPES : BEGIN OF x_mara,
                  matnr TYPE matnr,
                  ersda TYPE ersda,
               END OF x_mara.
        METHODS : extract EXPORTING t_mara TYPE x_mara,
                          display IMPORTING it_mara TYPE x_mara.
    ENDCLASS.                    "example DEFINITION
    "example IMPLEMENTATION
          CLASS example IMPLEMENTATION
    CLASS example IMPLEMENTATION.
      METHOD extract.
        DATA :lt_mara TYPE STANDARD TABLE OF x_mara INITIAL SIZE 0,
                  lw_mara TYPE x_mara.
        SELECT matnr ersda FROM mara INTO TABLE lt_mara UP TO 10 ROWS.
        t_mara[]  =  lt_mara[].
      ENDMETHOD.                    "extract
      METHOD display.
        DATA :lt_mara TYPE STANDARD TABLE OF x_mara INITIAL SIZE 0,
              lw_mara TYPE x_mara.
        lt_mara[]  =  it_mara[].
        LOOP AT lt_mara INTO lw_mara.
          WRITE:/ lw_mara-matnr,
                20 lw_mara-ersda.
        ENDLOOP.
      ENDCLASS.                    "example IMPLEMENTATION
    START-OF-SELECTION.
      DATA :  b1 TYPE REF TO example.
    CREATE OBJECT b1 TYPE example.
      TYPES : BEGIN OF x_mara,
                  matnr TYPE matnr,
                  ersda TYPE ersda,
               END OF x_mara.
    data : t_mara type standard table of x_mara initial size 0,
           it_mara type standard table of  x_mara initial size 0.
      call method b1->extract
        importing
         t_mara = t_mara.
         it_mara[]  =  t_mara[].
      call method b1->display
        exporting
         it_mara = it_mara.
    Edited by: Sai Chaitanya on Dec 2, 2008 5:30 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

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

  • 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

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

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

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

  • FIELD SYMBOL  : - Get Data from Another program

    Hi Gurus,
    I have a Z program - ZPROG1.
    I need to get the value of a variable V_VAR1 from program RV63A712 which is a routine.
    How can i get the value of V_VAR1 from RV63A712 into my program ZPROG1. using field symbol .
    The main program of RV63A712 is SAPLV61A.
    For example .
    The program RV63A712 is as below.
    *&      Form  FRM_KOND_BASIS_712
          Copper Price Participation
          John May  09/01/2009
    FORM frm_kond_basis_712.
    V_VAR1 = B_KBETR + G_KWERT .
    ENDFORM.
    Avi

    hello ,
    try this sample code...
    data: c_progvar(30) type c value '(RV63A712)V_VAL1'.
    data: v_val1 type wrbtr.
    field-sybmol: <fs> type any.
    assign (c_progvar) to <fs>.
    if <fs> is assigned.
      v_val1 =  <fs>.
    endif.
    regards
    Prabhu

  • Passing Currency field to external subroutine from script

    Hi,
                I am passing one currency field to external subroutine from script. In subroutine we can get that currency in character format. I want to convert that into currency format. how can i do that?
    thnk u

    easy conversion:
    number = character_parameter

  • Dynamically Pass a list as input parameter to a Graphical Clac View

    Hi All,
    Can anyone please let me know if it is possible to pass a list of comma separated values as an input parameter to a graphical calculation view and how this list can be parsed inside the view?
    The requirement is to invoke the graphical view using sql script.
    Thanks,
    Goutham

    Hi Goutham,
    Have a look on these documents:
    Using Multiple Values in Input parameter for filtering in Graphical Calculation View
    SAP HANA: Handling Dynamic Select Column List and Multiple values in input parameter
    Regards,
    Krishna Tangudu

  • How to pass entire class as a parameter in a method of other class- OpenScr

    Hi Folks,
    Whenever we create a script in OpenScript, it can contain only one class. However I want to declare several variables in a class/script and pass this entire class B as a parameter in a methodA of classA.
    What I mean by mean that is , I create ClassB something like below
    public class MyParams.....
    variable1;
    variable2;
    variable3;
    variable4;
    variable5;
    public class Original.....
    public void methodA(MyParams params)
    params = new MyParams();
    field1 = params.variable1;
    field2 = params.variable2;
    field3 = params.variable3;
    field5= params.variable5;
    Edited by: OATS Explorer on Mar 8, 2012 1:53 AM

    Hi
    I have a stand alone program (can be used by all other users) which will accept request_id and To_Email as parameters. I am developing a new request set in which I want to incldue this stand alone program and want to pass Prog#1 request Id to the 2nd stand alone program as a parameter so that I can send the output of the Prog#1 to the users through E-mail.
    Do we have any options to pass Prog#1 requeset id in to Prog#2 as a parameter in the request set without modifying the stand alone concurrent program code.
    Please note that i dont want to change stand alone program code becuase this code/program was developed to work in general for all the users and I dont want to change this code for new requirement/purpose...
    Hope you understood my requirement...
    Thanks!!

  • String containing apostrophe sign passed to text field via binded parameter from XDP displayed wrong

    Hello,
    I have a text field that is bound to a String field in XDP, sometimes when the field contains apostrophe sign (') generated PDF displays &#39; instead, for example if the value is he's it shows he&#39;s
    The field format is plain text only.
    The problem only appears occasionaly and rarealy and I can't find the reason and can't even reproduce it anymore.
    Maby someone has encountered such problem and know the reason why it happens or conditions for it to happen and the means to fix it?

    I don't want to be one of those that gives meaningless advise but I'm keen to 'give back' to this forum so here goes ... maybe completely up the wrong tree ...
    I'll assume you're generating the XDP on a server and then passing that to the browser as a content type "application/vnd.adobe.xdp+xml"
    Have you also tried setting the character set to UTF-8 ?  I use ASP and have "response.CharSet = "utf-8" " in my header.

Maybe you are looking for

  • IMac CD/DVD

    Hello: I am a NEW user of any Apple product. I just purchased the new iMac 2.4 and received it today. I put in a CD filled with just pictures. Since (of course) these pictures were saved (probably) as .jpg's or .gif's and burned on a cd, I think this

  • Developing Forum in Servlets

    How can I start developing a forum in java servlets?? can anybody guide me the steps and source code thanks & regards

  • What exactly is a Security Update?

    I keep applying Security Updates from the Software Update panel when available, but what do these actually do. I am assuming they have something to do with "security"? What range of things can these include?

  • IPod Touch 4th Generation; every time I try to back up and update, I get error -43. Help?

    My iPod Touch is a 4th generation running on iOS 4.3.3, and I want to update to the more recent iOS 6.1.2; however, when I connect to iTunes to back up/update, about 3/4 of the way through the backing up, I get error message -43, telling me that cont

  • Simple (but annoying problem

    Hi all. I've installed JMF with the windows performance pack onto my windows XP machine, ran the installation verifier, and all seems to be OK. The registry tool successfully lists all the devices on my system, with all the information associated. Ho