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

Similar Messages

  • Using field symbol on export parameter

    HI All,
    I am using this logic In few methods of mine and I wonder if there is option the create one method
    and every time that I need it just call it.
    The issue is that <lt_output> is not assign yet (this need to happen in the method itself )so And I need to export it
    and if I am creating method with exporting field type any I put the field symbol there I am getting dump.
    Any idea ?
    ASSIGN COMPONENT lv_table_out
                OF STRUCTURE is_response TO <lt_output>.
      IF sy-subrc <> 0.
        READ TABLE it_map INTO ls_map INDEX 1.
        lv_out = ls_map-left.
        ASSIGN COMPONENT lv_out
        OF STRUCTURE is_response TO <lt_output>.
      ENDIF.
    Best regards
    Joy

    Hi,
    Ok, then you will have to use a data object to reference your field symbol and use a returning parameter I guess:
    DATA: lo_data TYPE REF TO data.
    FIELD-SYMBOLS: <lt_output> TYPE ANY.
    CLASS lcl_main DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS: get RETURNING value(r_val) TYPE REF TO data.
    ENDCLASS.                   
    CLASS lcl_main IMPLEMENTATION.
      METHOD get.
        FIELD-SYMBOLS <fs> TYPE ANY.
        ASSIGN COMPONENT 1 OF STRUCTURE is_response TO <fs>.
        GET REFERENCE OF <fs> INTO r_val.
      ENDMETHOD.                    "get
    ENDCLASS.                  
    START-OF-SELECTION.
      lo_data = lcl_main=>get( ).      
      ASSIGN lo_data->* TO <lt_output>. 
    Kr,
    m.
    Edited by: Manu D'Haeyer on Oct 5, 2011 2:42 PM

  • Missing Parameter in class method

    Hi,
    This is with regard to the Survey transaction. For survey, I did some modifications and I did the modifications based on a parameter in class method CL_UWS_PUBLISHING=>PUBLISH. It was working fine in our development server. But when I ported it to the Quality system, an erro appears telling that the parameter ID_SURVEY_ID is not available in the system.
    As part of the implementation, our team has applied several notes to the application. Is it that, this parameter came as part of some note? If so, how can I find the relevant note. I searched for notes regarding survey but didn't find this one.
    Please do help me in this regard.
    Regards,
    Jubish

    Hi All,
    Please do help in this regard.
    Regards,
    Jubish

  • 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

  • Problem with retrieving a value from the import parameter of a method

    Hi Friends,
    I have a problem accessing the field.
    I have a import paramter in the method of my Z class. The import paramter is of type ANY.
    In my method I get the value of this import paramter as
    . In this I have a field Catalog Id which is a z field.
    How should I retrieve the value of this catalog Id from this importing parameter?
    Regards,
    Raju

    Hi Friends
    Can anyone tell me whether this is a structure or a Class refernce, so that I can access the field in that.
    Regards,
    Raju

  • Type for SENDER parameter in Class Method

    Hi all,
    I have an import parameter declared in a Class method .
    in SE38 program i want to retrieve through export parameter .
    But i am not able to figure how to defind the type of SENDER parameter . Please suggest if my perception is wrong or the point that i am missing here .
    Regards,
    Ry.

    Hi Vijay,
    Thank you for your reply . the problem i am having is the functionlaity of this report is it displays three grids and when ever i double click on a grid it should identify the particluar grid . i have highlighted in bold where i am encountering the problem. i am enclosing the class details and the report source code. Please suggest after going through it . thanks in advance.
    Class details that i have created :
    the class has a method handle_double_event with event handler double_click of CL_GUI_ALV_GRID . i have defined this in the method section.
    in public section section :
    public section.
      types GO_GRID1 type ref to CL_GUI_ALV_GRID .
      class-methods HANDLE_DOUBLE_CLICK
        for event DOUBLE_CLICK of CL_GUI_ALV_GRID
        importing
          ES_ROW_NO
          E_COLUMN
          E_ROW
          SENDER .
    in handle_double_event code :
    DATA:
      go_grid1         TYPE REF TO cl_gui_alv_grid,
      go_grid2         TYPE REF TO cl_gui_alv_grid,
      go_grid3         TYPE REF TO cl_gui_alv_grid.
    DATA:
      gt_knb1          TYPE STANDARD TABLE OF knb1,
      gt_vbak          TYPE STANDARD TABLE OF vbak,
      gt_vbap          TYPE STANDARD TABLE OF vbap.
      define local data
        DATA:
          ls_knb1      TYPE knb1,
          ls_vbak      TYPE vbak,
          ls_vbap      TYPE vbap.
       DATA: es_row_no type lvc_s_roid,
             e_column  type lvc_s_col,
             e_row     type lvc_s_row.
        *CASE sender. - here when i double click on the first grid go_grid1 it should go inside the go_grid1 . but it is not entering .*
          WHEN go_grid1.
            READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
            CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
            CALL METHOD go_grid1->set_current_cell_via_id
              EXPORTING
                 IS_ROW_ID    =
                 IS_COLUMN_ID =
                is_row_no    = es_row_no.
            Triggers PAI of the dynpro with the specified ok-code
            CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDERS' ).
          WHEN go_grid2.
            READ TABLE gt_vbak INTO ls_vbak INDEX e_row-index.
            CHECK ( ls_vbak-vbeln IS NOT INITIAL ).
            CALL METHOD go_grid1->set_current_cell_via_id
              EXPORTING
                 IS_ROW_ID    =
                 IS_COLUMN_ID =
                is_row_no    = es_row_no.
            Triggers PAI of the dynpro with the specified ok-code
            CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDER_DET' ).
          WHEN go_grid3.
            READ TABLE gt_vbap INTO ls_vbap INDEX e_row-index.
            CHECK ( ls_vbap-matnr IS NOT INITIAL ).
            SET PARAMETER ID 'MAT' FIELD ls_vbap-matnr.
            CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
          WHEN OTHERS.
            RETURN.
        ENDCASE.
    endmethod.
    Code for the Report that is accessing the class.
    DATA:
      gd_okcode        TYPE ui_func,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_splitter      TYPE REF TO cl_gui_splitter_container,
      go_splitter_2    TYPE REF TO cl_gui_splitter_container,
      go_cell_top      TYPE REF TO cl_gui_container,
      go_cell_bottom   TYPE REF TO cl_gui_container,
      go_cell_left     TYPE REF TO cl_gui_container,
      go_cell_right    TYPE REF TO cl_gui_container,
      go_grid1         TYPE REF TO cl_gui_alv_grid,
      go_grid2         TYPE REF TO cl_gui_alv_grid,
      go_grid3         TYPE REF TO cl_gui_alv_grid,
      list             type ref to zcl_eventhandler,
      es_row_no        type lvc_s_roid,
      e_column         type lvc_s_col,
      e_row            type lvc_s_row,
      sender(8)        type c.
    DATA:
      gt_knb1          TYPE STANDARD TABLE OF knb1,
      gt_vbak          TYPE STANDARD TABLE OF vbak,
      gt_vbap          TYPE STANDARD TABLE OF vbap.
    PARAMETERS  :  p_bukrs TYPE ekko-bukrs default '1000'.
    START-OF-SELECTION.
      create object list.
      SELECT        * FROM  knb1 INTO TABLE gt_knb1
             WHERE  bukrs  = p_bukrs.
    Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent                      = cl_gui_container=>screen0
          ratio                       = 50
        EXCEPTIONS
          OTHERS                      = 6.
      IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Create splitter container
      CREATE OBJECT go_splitter
        EXPORTING
          parent            = go_docking
          rows              = 1
          columns           = 1
         NO_AUTODEF_PROGID_DYNNR =
         NAME              =
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 2
          OTHERS            = 3.
      IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Get cell container
      CALL METHOD go_splitter->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
         container = go_cell_left.
          container = go_cell_top.
      CALL METHOD go_splitter->get_container
        EXPORTING
          row       = 1
          column    = 2
        RECEIVING
          container = go_cell_right.
    Create 2nd splitter container
      CREATE OBJECT go_splitter_2
        EXPORTING
         parent            = go_cell_left
          parent            = go_cell_top
          rows              = 2
          columns           = 1
         NO_AUTODEF_PROGID_DYNNR =
         NAME              =
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 2
          OTHERS            = 3.
      IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Get cell container
      CALL METHOD go_splitter_2->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
          container = go_cell_top.
      CALL METHOD go_splitter_2->get_container
        EXPORTING
          row       = 2
          column    = 1
        RECEIVING
          container = go_cell_bottom.
    Create ALV grids
      CREATE OBJECT go_grid1
        EXPORTING
          i_parent          = go_cell_top
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CREATE OBJECT go_grid2
        EXPORTING
          i_parent          = go_cell_bottom
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CREATE OBJECT go_grid3
        EXPORTING
          i_parent          = go_cell_right
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
          CALL METHOD ZCL_EVENTHANDLER=>HANDLE_DOUBLE_CLICK
            EXPORTING
              ES_ROW_NO = ES_ROW_NO
              E_COLUMN  = E_COLUMN
              E_ROW     = E_ROW
              SENDER.
    Set event handler
      SET HANDLER: list->handle_double_click FOR go_grid1.
      SET HANDLER: list->handle_double_click FOR go_grid2.
      SET HANDLER: list->handle_double_click FOR go_grid3.
    Display data
      CALL METHOD go_grid1->set_table_for_first_display
        EXPORTING
          i_structure_name = 'KNB1'
        CHANGING
          it_outtab        = gt_knb1
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      REFRESH: gt_vbak.
      CALL METHOD go_grid2->set_table_for_first_display
        EXPORTING
          i_structure_name = 'VBAK'
        CHANGING
          it_outtab        = gt_vbak
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      REFRESH: gt_vbap.
      CALL METHOD go_grid3->set_table_for_first_display
        EXPORTING
          i_structure_name = 'VBAP'
        CHANGING
          it_outtab        = gt_vbap
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc <> 0.
       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Link the docking container to the target dynpro
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0100'
         CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc <> 0.
       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    NOTE: dynpro does not contain any elements
      CALL SCREEN '0100'.
    Flow logic of dynpro:
    *PROCESS BEFORE OUTPUT.
    MODULE STATUS_0100.
    *PROCESS AFTER INPUT.
    MODULE USER_COMMAND_0100.
    END-OF-SELECTION.
    *&      Form  CUSTOMER_SHOW_ORDERS
          text
    -->  p1        text
    <--  p2        text
    FORM customer_show_orders .
    define local data
      DATA:
        ld_row      TYPE i,
        ls_knb1     TYPE knb1.
      CALL METHOD go_grid1->get_current_cell
        IMPORTING
          e_row = ld_row.
      READ TABLE gt_knb1 INTO ls_knb1 INDEX ld_row.
      CHECK ( syst-subrc = 0 ).
      SELECT        * FROM  vbak INTO TABLE gt_vbak
             WHERE  kunnr  = ls_knb1-kunnr.
      REFRESH: gt_vbap.
    ENDFORM.                    " CUSTOMER_SHOW_ORDERS
    *&      Form  ORDER_SHOW_DETAILS
          text
    -->  p1        text
    <--  p2        text
    FORM order_show_details .
    define local data
      DATA:
        ld_row      TYPE i,
        ls_vbak     TYPE vbak.
      CALL METHOD go_grid1->get_current_cell
        IMPORTING
          e_row = ld_row.
      READ TABLE gt_vbak INTO ls_vbak INDEX ld_row.
      CHECK ( syst-subrc = 0 ).
      SELECT        * FROM  vbap INTO TABLE gt_vbap
             WHERE  vbeln  = ls_vbak-vbeln.
    ENDFORM.                    " ORDER_SHOW_DETAILS
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
    SET PF-STATUS 'STATUS_0100'.  " contains push button "ORDERS"
    SET TITLEBAR 'xxx'.
    Refresh display of detail ALV list
      CALL METHOD go_grid2->refresh_table_display
       EXPORTING
         IS_STABLE      =
         I_SOFT_REFRESH =
        EXCEPTIONS
          OTHERS         = 2.
      IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Refresh display of detail ALV list
      CALL METHOD go_grid3->refresh_table_display
       EXPORTING
         IS_STABLE      =
         I_SOFT_REFRESH =
        EXCEPTIONS
          OTHERS         = 2.
      IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
    move sy-ucomm to gd_okcode.
    CASE gd_okcode.
        WHEN 'BACK' OR
             'END'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
      User has pushed button "Display Orders"
        WHEN 'ORDERS'.
          PERFORM customer_show_orders.
        WHEN 'ORDERS_DET'.
          PERFORM order_show_details.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    endmodule.
    Regards,
    Ry

  • Error while passing  parameter fot class method

    Hi abapers,
    i am trying to do alv grdi dispaly using class cl_gui_alv_grid. i am getting error "ITAB1" is not type-compatible with formal parameter 'IT_OUTTAB'.
    i attached code here.
    Internal Tables
    types: begin of itab,
          matnr type mara-matnr,
          maktx type makt-maktx,
          end of itab.
    data: itab1 like itab.
    DATA: alvgrid type ref to cl_gui_alv_grid.
    CALL METHOD ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
       I_BUFFER_ACTIVE               =
       I_BYPASSING_BUFFER            =
       I_CONSISTENCY_CHECK           =
        I_STRUCTURE_NAME              = 'ITAB'
       IS_VARIANT                    =
       I_SAVE                        =
       I_DEFAULT                     = 'X'
       IS_LAYOUT                     =
       IS_PRINT                      =
       IT_SPECIAL_GROUPS             =
       IT_TOOLBAR_EXCLUDING          =
       IT_HYPERLINK                  =
       IT_ALV_GRAPHICS               =
       IT_EXCEPT_QINFO               =
      CHANGING
        IT_OUTTAB                     = itab1.
       IT_FIELDCATALOG               =
       IT_SORT                       =
       IT_FILTER                     =
    EXCEPTIONS
       INVALID_PARAMETER_COMBINATION = 1
       PROGRAM_ERROR                 = 2
       TOO_MANY_LINES                = 3
       others                        = 4
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    please help me.

    Try this -
    CALL METHOD ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
    I_BUFFER_ACTIVE =
    I_BYPASSING_BUFFER =
    I_CONSISTENCY_CHECK =
    I_STRUCTURE_NAME = 'ITAB'
    IS_VARIANT =
    I_SAVE =
    I_DEFAULT = 'X'
    IS_LAYOUT =
    IS_PRINT =
    IT_SPECIAL_GROUPS =
    IT_TOOLBAR_EXCLUDING =
    IT_HYPERLINK =
    IT_ALV_GRAPHICS =
    IT_EXCEPT_QINFO =
    CHANGING
    IT_OUTTAB = <b>itab1[].</b>
    IT_FIELDCATALOG =
    IT_SORT =
    IT_FILTER =
    EXCEPTIONS
    INVALID_PARAMETER_COMBINATION = 1
    PROGRAM_ERROR = 2
    TOO_MANY_LINES = 3
    others = 4
    Cheers

  • 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

  • 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

  • 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

  • HOW TO PASS SELECT-OPTIONS AS IMPORT PARAMETER TO A CLASS

    Hi experts,how to pass select options value as a export parameters to a zclass.
    can  give me some idea.
    Thanks
    sai

    As Sachin already said, selection options are stored in an internal table. You can reconstruct the table type without the corresponding input fields using the type addition RANGE OF.
    So - assuming you have the following in your program:
    DATA: wa TYPE sflight.
            SELECT-OPTIONS so_car FOR sflight-carrid.
    you can create a publically-visible type in your class using direct type entry and the code
    TYPES: my_selectoption TYPE RANGE OF sflight-carrid.
    and use this to define the importing parameter of the method.
    The only other thing you have to remember is that select-options generates an internal table with header line. Thereore, to pass the table to the method, you would use (in the above example) so_car[], and not just the name of the select-option.
    Hope this helps.
    Regards
    Jon.

  • How to give a value range in export parameter (global class)

    hi all,
    I have created a class-method called get_po_date. In this i had export parameter as qmfe-qmnum. If i give qmfe-qmnum in import parameter in class, i am able to give only one value at one time, but i need a range of values at a time. Instead of qmfe-qmnum in associated type, i have given 'LXHME_RANGE_C12' ( a range table for char 12 ). the thing is i wanted to select this range in select-options. but still iam getting <b>not type compatible syntax error</b>. can any body solve my problem,
    feel free to ask if any confusion with my question.
    Best Regards,
    abhilash.

    Hello Abhilash
    Instead of using a specific range (where field LOW and HIGH are of type QMNUM) you can use a <b>generic </b>select option (of type <b>RSDSSELOPT</b>). Have a look at the following sample report <b>ZUS_SDN_SELOPTIONS</b>.
    *& Report  ZUS_SDN_SELOPTIONS
    REPORT  zus_sdn_seloptions.
    TABLES: qmfe.
    DATA:
      gt_data          TYPE STANDARD TABLE OF qmfe,
      gt_data_x        TYPE STANDARD TABLE OF qmfe,
      gt_selopt        TYPE rseloption,  " generic table type for selopts
      gs_selopt        TYPE rsdsselopt.
    START-OF-SELECTION.
      SELECT        * FROM  qmfe INTO TABLE gt_data
             WHERE ( qmnum BETWEEN '000000000001' AND '000000000500' ).
      gs_selopt-sign   = 'I'.
      gs_selopt-option = 'BT'.
      gs_selopt-low    = '000000000001'.
      gs_selopt-high   = '000000000500'.
      APPEND gs_selopt TO gt_selopt.
      SELECT * FROM qmfe INTO TABLE gt_data_x
        WHERE ( qmnum IN gt_selopt ).
      IF ( gt_data = gt_data_x ).
        WRITE: 'Selected data are equal.'.
      ELSE.
        WRITE: 'Selected data are NOT equal.'.
      ENDIF.
    END-OF-SELECTION.
    Since RSDSSELOPT and RSELOPTION are global DDIC objects they can be used in <i>public </i>methods.
    Regards
      Uwe

  • 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 change column name heading thru Class method in ALV report

    When I Select LayOut on Selection screen then Display ALV Output columnname display Quantity but I want change this name to Carats.
    I set Short, Medium and Long text is Carats.

    DATA: lt_fcat    type lvc_t_fcat,
              lv_fname type fieldname value '<Your FName>'.
    FIELD-SYMBOLS: <fcat> type lvc_s_fcat.
    CALL METHOD alv_grid->get_frontend_fieldcatalog
       IMPORTING
           et_fieldcatalog = lt_fcat.
    read table lt_fcat assigning <fcat> with key fieldname = lv_fname.
    if sy-subrc is initial.
       <fcat>-COLTEXT = <fcat>-SCRTEXT_L = <fcat>-SCRTEXT_M = <fcat>-SCRTEXT_S = <fcat>-SELTEXT = '<Your new Description>'.
    endif.
    CALL METHOD alv_grid->set_frontend_fieldcatalog
       EXPORTING
           it_fieldcatalog = lt_fcat.
    call method alv_grid->REFRESH_TABLE_DISPLAY.

  • Problem with import parameter

    Our GetDetail function has an import parameter that we need to use to filter the returned dataset.  The parameter, MTRANTY, shows up correctly in the "Import" section of our GetDetail in the Mapping Screen of merep_sbuilder.  What I am not seeing is any reference to MTRANTY in the generated meRepMeta.xml file.  In the "Import" section of the mapping screen is does show "Link to Key Field of TOP: MTRANTY" in the Mapping Description.
    When I bring up the filtering criteria of our syncbo it shows another field, CUSTOMER, as "Filter Field 1", but I can't seem to be able to change it to MTRANTY as I think it should be.
    So, my question is, do the filter field and the import parameter have any connection?  Is there something else I need to do to make MTRANTY available in the meRepMeta.xml definition?  Or do I just set the key field of TOP (SYNC_KEY from the xml file) to my desired value and perform the synchronization?
    On a related note, in the xml file on the "SyncBO id" line, the parameter "reqDirectSync" is set to false.  Will this prevent me from initiating a synchronization using SyncManager.synchronizeWithBackend()?
    Thanks,
    Adam

    Hi Adam,
    The main thing here are ,
    <u>1)Metadata definition (XML file: Client view of SyncBO)</u>
    (meRepMeta.xml )
    The data structure used for the data exchange between  the mobile clients and the MI Server Component can be specified by defining the metadata for the SyncBO.
    This XML document will be used by the MI JAVA APIs to access and manipulate the local SyncBO data downloaded from Smart Synchronization.
    <b>A client application developer typically looks into the generated XML document for implementing the data access layer of a client application.</b>
    <u>2)Default value setting</u>
    It might not be necessary to expose some fields to the clients; how ever, the fields can be mandatory fields when the BAPI wrappers are called (mainly in create and change functions). In such cases, the field can be set as “default“ and its default value can be assigned. <b>The default values also need to be assigned for the selection criteria parameter(s) of the GetList BAPI
    wrapper function, which is used to pre-filter data being stored in the replica database.</b>
    <u>3)Filter setting</u>
    <b>To reduce the number of records on client devices, for example, to avoid downloading unnecessary data, the data filtering function can be used to filter the <b>data downloaded from the replica database</b></b>.
    Filtering is possible on these levels:
    a)At SyncBO level
    b)At Mobile ID level
    c) Mobile group Level.
        During synchronization,
    associated with each sync bo ...
    Getlist populate the Header Instances.
    --  for each Header instance getdetail is executed.
      so in the importing mapping part ,
    the mapped fields are only necessary for the  server at runtime.(here u can create value ids corresponding to each importing parameter and set values .)
    if u want to filter the header instances by means of user who is syncing .. then u ca directly give the default value of Value ID as ME-SYNC_USER against ur importing parameter.
    [In the client  we need only the header details and item details only].
       The relation bw  filtering of ITEM (Getdetail) is maintained  through the key fields in the ImportParam of Getdetail.(which are internally linked through the Header populated in Getlist ..)
    (Key fields of Getlist  is a subset of fields in the Header Structure).
    <<So, my question is, do the filter field and the import parameter have any connection? >>
    As i mentioned above  ,  Getlist is executed using the import params , and the replica BD is populated with the output from  getList. <b>Filters filter data from Replica DB to the Client  Device...</b>
                                   Regards
                                   Kishor Gopinathan

Maybe you are looking for

  • No video on mac with hardware accelaration enabled

    hi there, i just posted this thread yesterday in the flash player category, but i think it might be more correct if its posted here. we are creating a live stream  with a digital rapids encoder, and getting no video on macs if the  hardware accelarat

  • Non Domain Computer users how to AD RMS service ?? I completed registry setting.

    hi all I'm having problems with AD RMS.  Domain members computer is operating normally.  But  WORKGROUP computer is not able to connect to the AD RMS server.  AD RMS Cluster to ping is successful.  client registry settings are now complete.  [HKEY_LO

  • Which is the better app for devloping a freelance design website?

    Hey Forum I'm putting together a website for my freelance design business. I've rough out the site, but now I'm stuck between using Dreamweaver or Flash. The site is relatively simple with the common home, about, philosophy portfolio and contact page

  • Keyboard options with Apple TV?

    Is there a way to either A) Pair a wireless keyboard with Apple TV or B) Add a keyboard controller to the remote app? I throughly enjoy the remote app and gestures but having to slide along to select letters and numbers sets me back a bit. Apologies

  • Inline (non full-screen) video in stageWebView for iPhone (iOS)???

    According to this post (below), all we need in order to allow native inline video for the iPhone is a simple Obj-C property webview.allowsInlineMediaPlayback = YES; in conjunction with adding "allowsInlineMediaPlayback" to the html5 video tag. http:/