Calling container using classes

hi friends,
i have a requirement .i need to record a transaction QM02 and once i enter the notification number in initial screen,in next screen  i have to select from
menu SYSTEM->SERVICES FOR OBJECT  and it will call a pop up box. but the problem is when we go through recording that option(services for  object)in system menu is disabled in recording .so i have to call the same box(container) using classes.
do any one know how to call this or solve this issue .
is there any other approach by which we can do this
thanks and regards
srinivas

Hai Srnivasulu,
If the required menu item is disabled when you r recording
just choose the transaction QM02 directly and go with debugging mode to capture the corresponding OKCODE .
Here I found the OKCODE For getting the pop up box is 'INIT'.
hOPE THIS WILL HELP YOU..
still if you have any clarifications Let me know your requirement clearly 
Regards,

Similar Messages

  • Error  while  calling badi using class cl_exithandler with getInstance

    hi experts...we are using SAP ECC 6.0  version
    I have created  BADI Def   and  Implementation using  se18   and se19 with some interface methods..
    Problem:
    I'm writing  a report to call  that using  class CL_EXITHANDLER but it shows an  Exception..
    " Exception condition "DATA_INCONS_IN_EXIT_MANAGEM" raised."
    Report example:
    DATA: CL_EXIT  TYPE REF TO CL_EXITHANDLER,
          IF_USER_INSTANCE TYPE REF TO ZIF_EX_USER_MAILID1.
    CALL METHOD cl_exithandler=>get_instance
      EXPORTING
       EXIT_NAME                       = 'ZBADI_USERMAIL_DEF'
    *    NULL_INSTANCE_ACCEPTED        = SEEX_FALSE
    *  IMPORTING
    *    ACT_IMP_EXISTING              =
      CHANGING
        instance                       = IF_USER_INSTANCE
    *  EXCEPTIONS
    *    NO_REFERENCE                  = 1
    *    NO_INTERFACE_REFERENCE        = 2
    *    NO_EXIT_INTERFACE             = 3
    *    CLASS_NOT_IMPLEMENT_INTERFACE = 4
    *    SINGLE_EXIT_MULTIPLY_ACTIVE   = 5
    *    CAST_ERROR                    = 6
    *    EXIT_NOT_EXISTING             = 7
    *    DATA_INCONS_IN_EXIT_MANAGEM   = 8
    *    others                        = 9
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    so i found that all  EXITs  are in the Table " SXS_ATTR" 
    but  what i have created BADI  has not exist  in that Table so that  it gets  an  Exception(while i'm debugging found this)
    so kindly tel me whats problem my BADI "ZBADI_USERMAIL_DEF"  not maintained that  Database table
    but  in Implentation class  its working fine..

    yes i have created  badi  in  Enhancement spot so  regarding what u told i'm using  GET BADI  and CALL BADI
    DATA:W_HANDLE TYPE REF TO ZBADI_USERMAIL_DEF.
    GET BADI W_HANDLE.
    CALL BADI w_handle->get_user_mailid
      EXPORTING
        uname  = UNAME
      changing
        mailid = W_EMAIL
    WRITE: / 'UNAME:',UNAME.
    WRITE: / 'EMAIL ID',W_EMAIL.
    CALL BADI w_handle->get_user_address_data
      EXPORTING
        uname    = UNAME
      changing
        addrdata = W_ADDRDATA
    IF W_ADDRDATA IS NOT INITIAL.
      WRITE: / W_ADDRDATA-BNAME,W_ADDRDATA-NAME1,W_ADDRDATA-NAME2,W_ADDRDATA-TELPR,W_ADDRDATA-TELNR,W_ADDRDATA-TEL01.
    ENDIF.
    but  here  BADI  are not  called 
    Interface implementation class methods  not  executed  so kindly tel me whats problem here.
    Thanks in Advance
    sivakumar

  • Use of swings- one class calling the gui class

    Hi,
    I have a class Manager and a class ManagerGUI.
    My ManagerGUI class looks somehting like this-
    public class ManagerGUI extends JFrame
    String name;
    JPanel namePanel;
    JTextField nameInput;
    JLabel nameLabel;
    Manager empAgent;
    ManagerGUI(Manager ea)
    super(ea.getLocalName());
    empAgent = ea;
    //make the name panel and add it to the topPanel.
    addListeners();
    getContentPane().add(topPanel, BorderLayout.CENTER);
    setResizable(false);
    }//end constructor.
    public void show()
    pack();
    super.setVisible(true);
    void addListeners()
    nameInput.addActionListener(new NameL());
    class NameL implements ActionListener
    public void actionPerformed(ActionEvent e)
    nameE = nameInput.getText();
    }//end class ManagerGUI.
    I have tried to seperate it out so that any changes can be easily implemented (although it perhaps is a long way of doing things).
    Now I have a class Manager that wants to call the GUI and then process the information got from the text field.
    I use the following lines to call the GUI class.
    manGui = new ManagerGUI(this);
    manGui.show();
    Is this the correct way of calling the GUI class?
    How do I get to use the variable nameE here, in the Manager?
    Thanks.

    Hi,
    I have no idea why you want to have an instance of Manager class in class ManagerGUI and an instance of ManagerGUI class in Manager class.
    I will create an instance of Manager in ManagerGUI and show the GUI there.
    In Manager you can create method that will accept the text from textfield in parameter.
    L.P.

  • How to print text on container using oop on alv list

    Hello Guru's,
             pl guide me how to print text on container using alv list-display which have interactive events  using     oop classes/methods ...
                    I want to print hard coded text on coantainer , on double clicking it will call another screen.
    Pl Help..
    Message was edited by:
            paresh sonavane

    Hi Paresh,
           1.      Go to the Layout and Create One custom container box and give name it.
            2. Custom Container is the one type of tool and its used for Displaying the Reports 
                with the use of ABAP Objects.
            3. Go to se38 and Write The Following Code.
    tables ZTEAM_GD.
    DATA : OBJ TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
           OBJ1 TYPE REF TO CL_GUI_ALV_GRID.
    DATA IT_TEAM LIKE TABLE OF ZPLAYER_BAT_DET       .
    SELECT * FROM ZPLAYER_BAT_DET INTO TABLE IT_TEAM.
    CREATE OBJECT OBJ
      EXPORTING
        CONTAINER_NAME              = 'ALV'.          -
    > Give ur Container Name
    CREATE OBJECT OBJ1
      EXPORTING
        I_PARENT          = OBJ.
    CALL METHOD OBJ1->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
        I_STRUCTURE_NAME              = 'ZPLAYER_BAT_DET'
      CHANGING
        IT_OUTTAB                     = IT_TEAM.
    *CALL METHOD OBJ1->SET_DROP_DOWN_TABLE
    EXPORTING
       I_STRUCTURE_NAME = 'ZTEAM_GD'
    CHANGING
       IT_OUTTAB        = IT_TEAM.
    CALL SCREEN 9000.
    *&      Module  USER_COMMAND_9000  INPUT
          text
    MODULE USER_COMMAND_9000 INPUT.
    CASE SY-UCOMM.
    WHEN 'EXT'.
      LEAVE PROGRAM.
    ENDCASE.
    ENDMODULE.                 " USER_COMMAND_9000  INPU     
    Thanks.
    Reward If Helpful.

  • Control problem in trees using class

    Hi all i am creating tree structure using class method in that when i am creating only one node it is working properly but when i try to crate multiple nodes it is giving me dump my program is as follow.
    I search these on sdn and try the things but it still giving me same error.
    *& Report  ZIRPT_HR_TEST_SPLITTER_01
    report  zirpt_hr_test_splitter_01.
    tables : pa0001,t582s.
    select-options : p_pernr for pa0001-pernr no intervals.
    *       CLASS screen_init DEFINITION
    class screen_init definition create private.
      public section.
        class-methods init_screen.
        methods constructor.
      private section.
        data: splitter_h type ref to cl_gui_splitter_container,
        splitter_v type ref to cl_gui_splitter_container,
        picture type ref to cl_gui_picture,
        tree type ref to cl_gui_simple_tree,
         it_pa0001 type table of pa0001,
         it_pa0000 type table of pa0000.
        methods: fill_tree,
        fill_picture.
    endclass.                    "screen_init DEFINITION
    *       CLASS screen_handler DEFINITION
    class screen_handler definition.
      public section.
        methods: constructor importing container
        type ref to cl_gui_container,
        handle_node_double_click
        for event node_double_click
        of cl_gui_simple_tree
        importing node_key.
      private section.
        data: html_viewer type ref to cl_gui_html_viewer,
               it_pa0001 type table of pa0001,
               it_pa0000 type table of pa0000,
        list_viewer type ref to cl_gui_alv_grid.
        methods:
        fill_list importing pernr type pa0001-pernr
                           infty type t582s-infty.
    endclass.                    "screen_handler DEFINITION
    *       CLASS screen_init IMPLEMENTATION
    class screen_init implementation.
      method init_screen.
        data screen type ref to screen_init.
        create object screen.
      endmethod.                    "init_screen
      method constructor.
        data: events type cntl_simple_events,
        event like line of events,
        event_handler type ref to screen_handler,
        container_left type ref to cl_gui_container,
        container_right type ref to cl_gui_container,
        container_top type ref to cl_gui_container,
        container_bottom type ref to cl_gui_container.
        create object splitter_h
        exporting
        parent = cl_gui_container=>screen0
        rows = 1
        columns = 2.
        call method splitter_h->set_border
          exporting
            border = cl_gui_cfw=>false.
        call method splitter_h->set_column_mode
          exporting
            mode = splitter_h->mode_absolute.
        call method splitter_h->set_column_width
          exporting
            id    = 1
            width = 110.
        container_left = splitter_h->get_container( row = 1 column = 1 ).
        container_right = splitter_h->get_container( row = 1 column = 2 ).
        create object splitter_v
        exporting
        parent = container_left
        rows = 2
        columns = 1.
        call method splitter_v->set_border
          exporting
            border = cl_gui_cfw=>false.
        call method splitter_v->set_row_mode
          exporting
            mode = splitter_v->mode_absolute.
        call method splitter_v->set_row_height
          exporting
            id     = 1
            height = 160.
        container_top = splitter_v->get_container( row = 1 column = 1 ).
        container_bottom = splitter_v->get_container( row = 2 column = 1 ).
        create object picture
        exporting parent = container_top.
        create object tree
        exporting parent = container_bottom
        node_selection_mode =
        cl_gui_simple_tree=>node_sel_mode_single.
        create object event_handler
        exporting container = container_right.
        event-eventid = cl_gui_simple_tree=>eventid_node_double_click.
        event-appl_event = ' '.
        append event to events.
        call method tree->set_registered_events
          exporting
            events = events.
        set handler event_handler->handle_node_double_click for tree.
        call method: me->fill_tree,
                     me->fill_picture.
         call method cl_gui_cfw=>flush.
      endmethod.                    "constructor
      method fill_picture.
        types pict_line(256) type c.
        data pict_tab type table of pict_line.
        data url(255) type c.
        data : file type rlgrap-filename value 'C:\Documents and Settings\sapgroup.NITCOWRL\My Documents\nitco.gif'.
        translate file to upper case.
    *CALL FUNCTION 'WS_UPLOAD'
    *EXPORTING
    *filename = file
    *filetype = 'BIN'
    *TABLES
    *data_tab = pict_tab.
        data query_table_wa type w3query.
        data query_table type table of w3query." OF like w3query occurs 1 with header line.
        data html_table type table of w3html."  like w3html occurs 1.
        data return_code type  w3param-ret_code.
        data content_type type  w3param-cont_type.
        data content_length type  w3param-cont_len.
        data pic_data type table of w3mime."  like w3mime occurs 0.
        data pic_size type i.
        refresh query_table.
        query_table_wa-name = '_OBJECT_ID'.
        query_table_wa-value = 'ENJOYSAP_LOGO'.
        append query_table_wa to query_table.
        call function 'WWW_GET_MIME_OBJECT'
          tables
            query_string        = query_table
            html                = html_table
            mime                = pic_data
          changing
            return_code         = return_code
            content_type        = content_type
            content_length      = content_length
          exceptions
            object_not_found    = 1
            parameter_not_found = 2
            others              = 3.
        if sy-subrc = 0.
          pic_size = content_length.
        endif.
        call function 'DP_CREATE_URL'
          exporting
            type     = 'image'
            subtype  = cndp_sap_tab_unknown
            size     = pic_size
            lifetime = cndp_lifetime_transaction
          tables
            data     = pic_data
          changing
            url      = url
          exceptions
            others   = 1.
    *IMPORT pict_tab = pict_tab FROM DATABASE abtree(pi) ID 'FLIGHTS'.
    *CALL FUNCTION 'DP_CREATE_URL'
    *EXPORTING
    *type = 'IMAGE'
    *subtype = 'GIF'
    *TABLES
    *data = pict_tab
    *CHANGING
    *url = url.
        call method picture->load_picture_from_url
          exporting
            url = url.
        call method picture->set_display_mode
          exporting
            display_mode = picture->display_mode_fit_center.
    *     CALL METHOD cl_gui_cfw=>flush.
      endmethod.                    "fill_picture
      method fill_tree.
        data: node_table type table of abdemonode,
        node type abdemonode.
    *data : it_pa0001 TYPE TABLE OF p0001,
        data :wa_pa0001 type pa0001,
              wa_pa0000 type pa0000,
              it_t582s type table of t582s,
              wa_t582s type t582s.
        types : begin of ttab,
                 itext type t582s-itext,
                 infty type t582s-infty,
                 pernr type p0001-pernr,
                 end of ttab.
        data : itab type table of ttab,
               wa_tab type ttab.
          field-symbols : <fs> like p_pernr.
          data : text1 type c.
        node-hidden = ' '.
        node-disabled = ' '.
        node-isfolder = 'X'.
        node-expander = ' '.
        select * from t582s
                 into corresponding fields of table it_t582s
                 where sprsl = sy-langu
                   and infty in ('0001','0000')."'0002','0006',
    *                         '0008','0015','0019').
        loop at it_t582s into wa_t582s .
          move-corresponding wa_t582s to wa_tab.
          node-node_key = wa_t582s-infty.
          clear node-relatkey.
          clear node-relatship.
          node-text = wa_t582s-itext.
          node-n_image = ' '.
          node-exp_image = ' '.
          append node to node_table.
          loop at p_pernr assigning <fs>.
            wa_tab-pernr = <fs>-low.
            append wa_tab to itab.
            clear p_pernr-low.
            node-node_key = <fs>-low.
            node-relatkey = wa_tab-infty.
            node-relatship = cl_gui_simple_tree=>relat_last_child.
            node-text = <fs>-low.
            node-n_image = '@AV@'.
            append node to node_table.
          endloop.
    *        SELECT SINGLE * FROM pa0001 INTO wa_pa0001 WHERE pernr in p_pernr.
    *     WHEN '0000'.
    *        SELECT SINGLE * FROM pa0000 INTO wa_pa0000 WHERE pernr = p_pernr.
    *    wa_tab-pernr = wa_pa0000-pernr.
    *    endcase.
          clear : wa_tab,wa_pa0001,wa_pa0000.
        endloop.
    *node-hidden = ' '.
    *node-disabled = ' '.
    *node-isfolder = 'X'.
    *node-expander = ' '.
    *LOOP AT itab INTO wa_tab.
    *AT NEW infty.
    *node-node_key = wa_tab-infty.
    *CLEAR node-relatkey.
    *CLEAR node-relatship.
    *node-text = wa_tab-itext.
    *node-n_image = ' '.
    *node-exp_image = ' '.
    *APPEND node TO node_table.
    *ENDAT.
    *AT NEW pernr.
    * node-node_key = wa_tab-pernr.
    *node-relatkey = wa_tab-infty.
    *node-relatship = cl_gui_simple_tree=>relat_last_child.
    *node-text = wa_tab-pernr.
    *node-n_image = '@AV@'.
    *node-exp_image = '@AV@'.
    *ENDAT.
    *APPEND node TO node_table.
    *ENDLOOP.
        call method tree->add_nodes
          exporting
            table_structure_name = 'ABDEMONODE'
            node_table           = node_table.
    *    CALL METHOD cl_gui_cfw=>flush.
      endmethod.                    "fill_tree
    endclass.                    "screen_init IMPLEMENTATION
    *       CLASS screen_handler IMPLEMENTATION
    class screen_handler implementation.
      method constructor.
        create object: html_viewer exporting parent = container,
        list_viewer exporting i_parent = container.
      endmethod.                    "constructor
      method handle_node_double_click.
        data: infty type t582s-infty,
              pernr type pa0001-pernr.
        infty = node_key(4).
        pernr = node_key+4(8).
    *IF pernr IS INITIAL.
    *CALL METHOD: fill_html EXPORTING infty = infty,
    *html_viewer->set_visible EXPORTING visible = 'X',
    *list_viewer->set_visible EXPORTING visible = ' '.
    *ELSE.
        call method: fill_list exporting infty = infty
                                         pernr = pernr,
        list_viewer->set_visible exporting visible = 'X',
        html_viewer->set_visible exporting visible = ' '.
    *ENDIF.
    *    CALL METHOD cl_gui_cfw=>flush.
      endmethod.                    "handle_node_double_click
    *METHOD fill_html.
    *DATA url TYPE scarr-url.
    *SELECT SINGLE url
    *FROM scarr
    *INTO url
    *WHERE infty = infty.
    *CALL METHOD html_viewer->show_url EXPORTING url = url.
    *ENDMETHOD.
      method fill_list.
        data: flight_tab type table of demofli,
        begin of flight_title,
        carrname type scarr-carrname,
        cityfrom type spfli-cityfrom,
        cityto type spfli-cityto,
        end of flight_title,
        list_layout type lvc_s_layo.
    *DATA : it_pa0001 TYPE TABLE OF p0001.
        if infty = '0001'.
          select * from pa0001 into table it_pa0001 where pernr = pernr.
        elseif infty = '0000'.
          select * from pa0001 into table it_pa0001 where pernr = pernr.
        endif.
    *SELECT SINGLE c~carrname p~cityfrom p~cityto
    *INTO CORRESPONDING FIELDS OF flight_title
    *FROM ( scarr AS c
    *INNER JOIN spfli AS p ON c~carrid = p~carrid )
    *WHERE p~carrid = carrid AND
    *p~connid = connid.
    *SELECT fldate seatsmax seatsocc
    *INTO CORRESPONDING FIELDS OF TABLE flight_tab
    *FROM sflight
    *WHERE carrid = carrid AND connid = connid
    *  ORDER BY fldate.
    *CONCATENATE flight_title-carrname
    *connid
    *flight_title-cityfrom
    *flight_title-cityto
        list_layout-grid_title = 'TEST'.
        list_layout-smalltitle = 'X'.
        list_layout-cwidth_opt = 'X'.
        list_layout-no_toolbar = 'X'.
    *if infty = '0001'.
        call method list_viewer->set_table_for_first_display
          exporting
            i_structure_name = 'PA0001'
            is_layout        = list_layout
          changing
            it_outtab        = it_pa0001.
    * CALL METHOD cl_gui_cfw=>flush.
    *ELSEIF infty = '0001'.
    *CALL METHOD list_viewer->set_table_for_first_display
    *EXPORTING i_structure_name = 'PA0000'
    *is_layout = list_layout
    *CHANGING it_outtab = it_pa0000.
    *endif.
      endmethod.                    "fill_list
    endclass.                    "screen_handler IMPLEMENTATION
    start-of-selection.
      data : it_pa0001 type table of p0001.
      call screen 100.
    *  MODULE status_0100 OUTPUT
    module status_0100 output.
      set pf-status 'SCREEN_100'.
      set titlebar 'TIT_100'.
      call method screen_init=>init_screen.
    *   CALL METHOD cl_gui_cfw=>flush.
    endmodule.                    "status_0100 OUTPUT
    *  MODULE cancel INPUT
    module cancel input.
      set screen 0.
      leave program.
    endmodule.                    "cancel INPUT
    Plz Suggest ,
    Regards ,
    Paresh G.

    METHOD fill_tree.
        DATA: node_table TYPE TABLE OF abdemonode,
        node TYPE abdemonode.
    *data : it_pa0001 TYPE TABLE OF p0001,
        DATA :wa_pa0001 TYPE pa0001,
              wa_pa0000 TYPE pa0000,
              it_t582s TYPE TABLE OF t582s,
              wa_t582s TYPE t582s.
        TYPES : BEGIN OF ttab,
                 itext TYPE t582s-itext,
                 infty TYPE t582s-infty,
                 pernr TYPE p0001-pernr,
                 END OF ttab.
        DATA : itab TYPE TABLE OF ttab,
               wa_tab TYPE ttab.
          FIELD-SYMBOLS : <fs> LIKE p_pernr.
          DATA : text1 TYPE c.
        node-hidden = ' '.
        node-disabled = ' '.
        node-isfolder = 'X'.
        node-expander = ' '.
        SELECT * FROM t582s
                 INTO CORRESPONDING FIELDS OF TABLE it_t582s
                 WHERE sprsl = sy-langu
                   AND infty IN ('0001','0000')."'0002','0006',
                            '0008','0015','0019').
        LOOP AT it_t582s INTO wa_t582s .
          MOVE-CORRESPONDING wa_t582s TO wa_tab.
          node-node_key = wa_t582s-infty.
          CLEAR node-relatkey.
          CLEAR node-relatship.
          node-text = wa_t582s-itext.
          node-n_image = ' '.
          node-exp_image = ' '.
          APPEND node TO node_table.
          LOOP AT p_pernr ASSIGNING <fs>.
            wa_tab-pernr = <fs>-low.
            APPEND wa_tab TO itab.
            CLEAR p_pernr-low.
            node-node_key = <fs>-low.
            node-relatkey = wa_tab-infty.
            node-relatship = cl_gui_simple_tree=>relat_last_child.
            node-text = <fs>-low.
            node-n_image = '@AV@'.
            APPEND node TO node_table.
          ENDLOOP.
    CLEAR : wa_tab,wa_pa0001,wa_pa0000.
        ENDLOOP.
    CALL METHOD tree->add_nodes
          EXPORTING
            table_structure_name = 'ABDEMONODE'
            node_table           = node_table.
       CALL METHOD cl_gui_cfw=>flush.
      ENDMETHOD.                    "fill_tree

  • Is it possbile to create ALV Grid using Class &  without using SE51

    Is it possible to create a alv grid using Class, with out using the screen painter(SE51).

    Hi Preethi,
    It is possible to creat ALV grid using class, provided u have to create a custom control in the screen dialog.
    Try with the foll code. This is an example for flight detail.
    DATA: container TYPE REF TO cl_gui_custom_container,
          alv_con TYPE REF TO cl_gui_alv_grid.
    data : it_sflight like table of wa with header line,
           g_fieldcat type lvc_t_fcat.
    /* Paste the code the PBO
        CREATE OBJECT container
          EXPORTING
            container_name              = 'C_SPFLI'. "Specify the container name which u created in the dialog screen.
        CREATE OBJECT alv_con
          EXPORTING
            i_parent          = container.
    /* Use the foll. to dislay the report
    CALL METHOD cl_grid->set_table_for_first_display
            EXPORTING
             I_STRUCTURE_NAME              = 'SFLIGHT'
            CHANGING
              it_outtab                     = it_sflight[]
              IT_FIELDCATALOG               = g_fieldcat.
    First create the container and then place the ALV in the container and for dislaying pass the necessary table.
    Hope this will useful for u.
    Get back if u r unable to do it.
    Regards
    Router

  • Capturing data changes in alv using classes

    Hello All,
    Currently am working on alv report using classes..,In this report am displaying 3 grids in the output in 3 different containers(cl_gui_custom_container)...,Am able to handle the data changes done in the grid  at the run time using event  data_changed ...,
    Now the requirement + problem is ...if i do the changes in all the grids ,,,,,and if i click(hotspot event) on any of the rows/records in any of the grids ...,, I need to be able to capture all the data changes done in all the other grids....,,
    for example:-
    if i modify some records in all the 3 grids ,,, and if I click any of the row in any of the grid at a time,,, all the changes done in all the grids should be captured.....( in simple words one click all changes )
    I tried using data_changed event....., am only able to capture the changes of the grid on which i clicked ( ie.hotspot event) but not the changes which i have done on other grids.....Pls. help me out with the possibilities
    Hope am clear..
    Thanks
    John

    Hi friend,
    METHOD handle_user_command.
      CASE e_ucomm.
    WHEN 'UPDATE'.
                 CALL METHOD r_grid->get_selected_rows
              IMPORTING
                 ET_INDEX_ROWS =
                 et_row_no     = it_rows.
    LOOP AT it_rows INTO wa_rows.
    *****modify the first container data***********
    endloop.
    CALL METHOD r_grid1->get_selected_rows
              IMPORTING
                 ET_INDEX_ROWS =
                 et_row_no     = it_rows1.
    LOOP AT it_rows1 INTO wa_rows1.
    *****modify the second container data***********
    endloop.
    CALL METHOD r_grid1->get_selected_rows
              IMPORTING
                 ET_INDEX_ROWS =
                 et_row_no     = it_rows2.
    LOOP AT it_rows2 INTO wa_rows2.
    *****modify the third container data***********
    endloop.
    endcase.
    Now we can create three container and three different grid class object but we are using same method.
    UPDATE buttton is common to all three containers.
    But one important point when u change the records in container we must select the rows then only selected rows r come to the internal table otherwise it is not come.
    CREATE OBJECT r_container
        EXPORTING
          container_name              = 'CONTAINER_1'
    CREATE OBJECT r_container2
        EXPORTING
          container_name              = 'CONTAINER_2'
    CREATE OBJECT r_container3
        EXPORTING
          container_name              = 'CONTAINER_3'
    CREATE OBJECT r_grid
        EXPORTING
          i_parent          = r_container
    CREATE OBJECT r_grid1
        EXPORTING
          i_parent          = r_container2
    CREATE OBJECT r_grid2
        EXPORTING
          i_parent          = r_container3
    NOW WE CAN CALL THE METHOD.
    CREATE OBJECT event_receiver1.
      SET HANDLER event_receiver1->handle_before_user_command FOR r_grid.
    CREATE OBJECT event_receiver1.
      SET HANDLER event_receiver1->handle_before_user_command FOR r_grid2.
    CREATE OBJECT event_receiver1.
      SET HANDLER event_receiver1->handle_before_user_command FOR r_grid3
    I thing it should be possible.But u must remeber u must select the records when u modifie in three containersBUT UPDATE button is common to all three containers.
    Regards,
    MURALII

  • Reg..ALV using classes

    i have displayed a ALV report with a push button 'HST'.
    When i select a particular line(vbeln) and click on pushbutton 'HST' it has to display me a interactive report based on the condition vbeln and posnr.
    can anyone help me with the detail code using classes..
    answers will be rewarded....
    regards,
    kumar

    Hi,
    Class ALV Specification
    Classes used:
    CL_GUI_ALV_GRID
    Example of ALV using Classes
    DATA: lcl_alv TYPE REF TO cl_gui_alv_grid,
          t_flights TYPE STANDARD TABLE OF FLIGHTS.
    SELECT * FROM flights INTO TABLE t_flights.
    CREATE OBJECT lcl_alv
        EXPORTING I_PARENT = cl_gui_container=>screen0.
    CALL METHOD lcl_alv->set_table_for_first_display
        EXPORTING
           I_STRUCTURE_NAME = 'FLIGHTS'
        CHANGING
           IT_OUTTAB = t_flights.
    CALL SCREEN 100.
    Example Details
    This is a simple example of the class ALV, we do not need to create, in this case, a field catalog because we are using the whole table of FLIGHTS and we will show all the fields that this table contains, we do this at the I_STRUCTURE_NAME = 'FLIGHTS' statement.
    The CL_GUI_ALV_GRID constructor needs the I_PARENT parameter to define where it will be show, in the example we set the entire screen to place the ALV.
    reward if helpful

  • List display for ALV using class and methods

    Hi friends
    I want the list display for the ALV using Class and methods
    which class and methods i can use.
    Here we can't use the REUSE_ALV_LIST_DISPLAY and also GRID
    I was done GRID display using class and methods but i want only list display for using class.
    plz Give me sample code of list display not for grid.
    Thanks
    Nani.

    hi
    please check with this code...
    declare grid and container.
    DATA : o_alvgrid TYPE REF TO cl_gui_alv_grid,
    o_dockingcontainer TYPE REF TO cl_gui_docking_container,
    i_fieldcat TYPE lvc_t_fcat,"fieldcatalogue
    w_layout TYPE lvc_s_layo."layout
    If any events like double click,etc., are needed we have to add additional functionality.
    call the screen in program.
    Then , create the container as follows
    IF cl_gui_alv_grid=>offline( ) IS INITIAL.
    CREATE OBJECT o_dockingcontainer
    EXPORTING
    ratio = '95'
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    create_error = 3
    lifetime_error = 4
    lifetime_dynpro_dynpro_link = 5
    others = 6.
    ENDIF.
    CREATE OBJECT o_alvgrid
    EXPORTING
    i_parent = o_dockingcontainer.
    Build the fieldcatalog
    create a output structure in SEll for the ALV output
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
    i_structure_name = <alv output>
    CHANGING
    ct_fieldcat = i_fieldcat[]
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2
    OTHERS = 3.
    IF sy-subrc <> 0.
    MESSAGE i030."Error in building the field catalogue
    LEAVE LIST-PROCESSING.
    ENDIF.
    *If you need to modify the field catalog,modify it using field sysmbols
    *setting the layout
    w_layout-grid_title = title.
    w_layout-zebra = 'X'.
    then displaying the output
    CALL METHOD o_alvgrid->set_table_for_first_display
    EXPORTING
    i_save = 'A'
    is_layout = w_layout
    CHANGING
    it_outtab = i_output[]
    it_fieldcatalog = i_fieldcat[]
    EXCEPTIONS
    invalid_parameter_combination = 1
    program_error = 2
    too_many_lines = 3
    OTHERS = 4.
    IF sy-subrc <> 0.
    MESSAGE i032 ."Error in Displaying
    LEAVE LIST-PROCESSING.
    ENDIF.
    *After that in PAI of the screen, you need to free the *object while going back from the screen(according to *your requirement)
    MODULE user_command_9001 INPUT.
    CASE sy-ucomm.
    WHEN 'EXIT' OR 'CANC'.
    PERFORM f9600_free_objects:
    USING o_alvgrid 'ALV' text-e02,
    USING o_dockingcontainer 'DOCKING'
    text-e01.
    LEAVE PROGRAM.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_9001 INPUT
    *in the program, write the follwoing code
    FORM f9600_free_objects USING pobject
    value(ptype)
    value(ptext).
    DATA: l_objectalv TYPE REF TO cl_gui_alv_grid.
    CASE ptype.
    WHEN 'ALV'.
    l_objectalv = pobject.
    IF NOT ( l_objectalv IS INITIAL ).
    CALL METHOD l_objectalv->free
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    OTHERS = 3.
    CLEAR: pobject, l_objectalv.
    PERFORM f9700_error_handle USING ptext.
    ENDIF.
    WHEN 'DOCKING'.
    DATA: lobjectdock TYPE REF TO cl_gui_docking_container.
    lobjectdock = pobject.
    IF NOT ( lobjectdock IS INITIAL ).
    CALL METHOD lobjectdock->free
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    OTHERS = 3.
    CLEAR: pobject, lobjectdock.
    PERFORM f9700_error_handle USING ptext.
    ENDIF.
    WHEN 'CONTAINER'.
    DATA: lobjectcontainer TYPE REF TO cl_gui_container.
    lobjectcontainer = pobject.
    IF NOT ( lobjectcontainer IS INITIAL ).
    CALL METHOD lobjectcontainer->free
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    OTHERS = 3.
    CLEAR: pobject, lobjectcontainer.
    PERFORM f9700_error_handle USING ptext.
    ENDIF.
    WHEN OTHERS.
    sy-subrc = 1.
    PERFORM f9700_error_handle USING
    text-e04.
    ENDCASE.
    ENDFORM. " f9600_free_objects
    FORM f9700_error_handle USING value(ptext).
    IF sy-subrc NE 0.
    CALL FUNCTION 'POPUP_TO_INFORM'
    EXPORTING
    titel = text-e03
    txt2 = sy-subrc
    txt1 = ptext.
    ENDIF.
    endform.
    also check with this
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
    Hope this helps
    if it helped, you can acknowledge the same by rewarding
    regards
    dinesh

  • Download Option Not Working in ALV Using Classes

    Hi,
    Can anyone let me know what im missing since i get only my header downloaded when i download my output to EXCEL.
    Im using ALV using CLASSES.
    Thanks,
    Anita

    REPORT ZTMM_STOCK  MESSAGE-ID zmsg
                    LINE-SIZE 270
                    LINE-COUNT 58
                    NO STANDARD PAGE HEADING.
    tables: YGFMLINV,  "Material Ledger - Inventory Data Extract
            lfa1,      "Vendor Master (General Section)
            setheader, "Set Header and Directory(checking profit center grp)
            mseg,
            t001w,
            mslbh,
            mslb,
            t001.
    Internal Tables Declaration
    data: begin of i_ygfmlinv occurs 0,
           BDATJ like ygfmlinv-bdatj,     "Posting date YYYY
           POPER like ygfmlinv-poper,     "Posting period
           BUKRS like ygfmlinv-bukrs,     "Company Code
           PRCTR like ygfmlinv-prctr,     "Profit center
           WERKS like ygfmlinv-werks,     "Plant
           BKLAS like ygfmlinv-bklas,     "Valuation class
           MATNR like ygfmlinv-matnr,     "Material number
           BWTAR  like ygfmlinv-bwtar,    "Valuation type
           STOCK_IND like ygfmlinv-stock_ind, "Stock indicators
           MEINS like ygfmlinv-meins,    "Base unit of measure
           MLAST like ygfmlinv-mlast,  "Material Price Dtermination: Control
           LBKUM like ygfmlinv-lbkum,      "Total valuated stock
           vprsv like ygfmlinv-vprsv,     "Price control indicator
           lc_mvp_prc like ygfmlinv-lc_mvp_prc, "LC:Moving Avg/Periodic Prc
           LC_CURTP like ygfmlinv-LC_CURTP, "Currency Type
           LC_CURRENCY like ygfmlinv-lc_currency, "Currency Key
           gc_curtp like ygfmlinv-gc_curtp, "Grp.Curr Type
           gc_currency like ygfmlinv-gc_currency, " Grp.Curr
           LC_TOT_AMT like ygfmlinv-lc_tot_amt, "LC: Total Amount
           KONTS   LIKE T030-KONTS,       "G/L Account No
           XBILK   LIKE SKA1-XBILK,
           lc_cogs like ygfmlinv-lc_var_amt,
           lifnr like mslbh-lifnr,
           lc_trfix_amt like ygfmlinv-lc_trfix_amt,
           lc_lofix_amt like ygfmlinv-lc_lofix_amt,
           lc_var_amt like ygfmlinv-lc_var_amt,
           lc_utp_amt like ygfmlinv-lc_utp_amt,
          end of i_ygfmlinv.
    data: begin of i_mslbh occurs 0,
          MATNR like mslbh-matnr, "Material number
          SOBKZ like mslbh-sobkz, "Special stock indicator
          LIFNR like mslbh-lifnr, "Account number of vendor or creditor
          WERKS like mslbh-werks, "Plant
          CHARG like mslbh-charg, "Batch number
          LFGJA like mslbh-lfgja, "Fiscal year of current period
          LFMON like mslbh-lfmon, "Current period (posting period)
          LBLAB like mslbh-lblab, "Current period (posting period)
          LBINS like mslbh-lbins, "Stock in quality inspection
         end of i_mslbh.
    data: begin of i_MSLB occurs 0,
           MATNR like mslb-matnr,
           WERKS like mslb-werks,
           SOBKZ like mslb-sobkz,
           LIFNR like mslb-lifnr,
           LFGJA like mslb-lfgja,
           LFMON like mslb-lfmon,
           LBLAB like mslb-lblab,
           LBINS like mslb-lbins,
           LBEIN like mslb-lbein,
          end of i_mslb.
    *data: begin of i_t030 occurs 0,
         KTOPL like t030-ktopl,
         BKLAS like t030-bklas,
         KONTS like t030-konts,
         end of i_t030.
    *data: begin of i_ska1 occurs 0,
         SAKNR like ska1-saknr,
         XBILK like ska1-xbilk,
         end of i_ska1.
    DATA : BEGIN OF i_non_subc OCCURS 0,
          MATNR         LIKE YGFMLINV-MATNR,        "Material
          WERKS         LIKE YGFMLINV-WERKS,    "Plant,
          bukrs         like ygfmlinv-bukrs,    "Company Code
          BKLAS         LIKE YGFMLINV-BKLAS,    "Val Class
          PRCTR         LIKE YGFMLINV-PRCTR,   "Profit Center
          BWTAR         LIKE YGFMLINV-BWTAR,    "Val Type
          LBKUM         LIKE YGFMLINV-LBKUM,        "QTY
          PEINH         LIKE YGFMLINV-PEINH,        "Price Unit
          MEINS         LIKE YGFMLINV-MEINS,        "Unit of Measure
          lc_currency   like ygfmlinv-lc_currency,
          lc_curtp      like ygfmlinv-lc_curtp,
          gc_currency   like ygfmlinv-gc_currency,
          gc_curtp   like ygfmlinv-gc_currency,
          LC_VAR_AMT    LIKE YGFMLINV-LC_VAR_AMT,   "LC :Variable Amt
          LC_TRFIX_AMT  LIKE YGFMLINV-LC_TRFIX_AMT, "LC :Trnsfer Fixed Amt
          LC_LOFIX_AMT  LIKE YGFMLINV-LC_LOFIX_AMT, "LC:Local Fixed Amt.
          LC_COGS       LIKE YGFMLINV-LC_VAR_AMT,  "Total LC fixed COGS
                                                   "added as per CC01507
          LC_UTP_AMT    LIKE YGFMLINV-LC_UTP_AMT,   "LC:UTP Amount.
          LC_TR_VAL     LIKE YGFMLINV-LC_LOFIX_AMT,"TotalLC Transfer value
          XBILK         LIKE SKA1-XBILK,            "Balance Indicator
          gc_var_amt    like ygfmlinv-gc_var_amt,
          gc_trfix_amt like ygfmlinv-gc_trfix_amt,
          gc_lofix_amt like ygfmlinv-gc_lofix_amt,
          gc_cogs      like ygfmlinv-gc_var_amt,
          gc_utp_amt   like ygfmlinv-gc_utp_amt,
          gc_tr_val    like ygfmlinv-gc_lofix_amt,
    END OF i_non_subc.
    Final Output Table
    types: begin of t_output,
          matnr like ygfmlinv-matnr,
          lifnr like mslbh-lifnr,
          werks like ygfmlinv-werks,
          spstk like mslbh-lblab,
          totstk like ygfmlinv-lbkum,
          lc_currency like ygfmlinv-LC_CURRENCY,
          lc_curtp like ygfmlinv-lc_curtp,
          gc_curtp like ygfmlinv-gc_curtp,
          gc_currency like ygfmlinv-gc_currency,
          name1 like lfa1-name1,
          vprsv like ygfmlinv-vprsv,
          bukrs like ygfmlinv-bukrs,
          mlast like ygfmlinv-mlast,
          meins like ygfmlinv-meins,
          bklas like ygfmlinv-bklas,
          maktx like makt-maktx,
          stdprice(18),
          totval like ygfmlinv-lc_tot_amt,
          sobkz like mslbh-sobkz,
          end of t_output.
    Work Area for Final Output Table
    data: wa_output type t_output.
    ALV Display
    Name of Custom Container added on the screen
    data: G_CONTAINER TYPE SCRFNAME VALUE 'ZGRID_CTRL',
    ALV GRID Instance Reference
          G_GRID1 TYPE REF TO CL_GUI_ALV_GRID, "Grid
    Instance Reference to Custom Container
          G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    PBO Status
    data: ok_code like sy-ucomm,
    Field Catalog Table
          gT_FIELDCAT      TYPE LVC_T_FCAT,
    Layout Structure
          gs_layout type lvc_s_layo,
    Sorting anf Subtotal
          gt_sort TYPE lvc_s_sort occurs 0,
    gt_output  type standard table  of t_output.
    data: g_curr(2).
          CLASS lcl_event_receiver DEFINITION
    class lcl_event_receiver definition.
      public section.
    Add SUB TOTAL TEXT to the ALV DISPLAY
        methods handle_subtotal_text
            for event subtotal_text of cl_gui_alv_grid
            importing es_subtottxt_info ep_subtot_line e_event_data.
    endclass.
    Declaration for EVENT Receiver
    data: event_receiver type ref to lcl_event_receiver,
         l_subtxt(60) value 'Subtotal Text'.
    field-symbols: <fs> type t_output,
                   <fs1>.
          CLASS LCL_EVENT_RECEIVER IMPLEMENTATION
    CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
      METHOD HANDLE_SUBTOTAL_TEXT.
    FIELD for which the SUBTOTAL is Calculated
        if es_subtottxt_info-criteria = 'MATNR'.
          ASSIGN EP_SUBTOT_LINE->* TO <FS1>.
          ASSIGN  E_EVENT_DATA->M_DATA->* TO <FS>.
          CONCATENATE es_subtottxt_info-keyword ':MATERIAL'
        <fs>-matnr INTO <fs1>.
        ENDIF.
      ENDMETHOD.                 "HANDLE_SUBTOTAL_TEXT
    ENDCLASS.                    "LCL_EVENT_RECEIVER IMPLEMENTATION
    Constants
    constants: c_eb(2) value 'EB',
               c_m value 'M',
               C_KTOPL(4) VALUE 'TCOA',
               C_KTOSL(3) VALUE 'BSX',
               C_KONTS(4) VALUE '002%'.
    Selection Screen
    selection-screen:begin of block b1 with frame title text-001.
    select-options: s_lifnr for lfa1-lifnr ,       "Vendor
            s_werks for YGFMLINV-werks obligatory, "Plant
            s_prctr for YGFMLINV-prctr, "Pr.Ctr
            s_matnr for ygfmlinv-matnr, "Mat.No
            s_bwtar for mseg-bwtar no-display.
    parameters: p_bukrs like YGFMLINV-bukrs obligatory, "C.Code
          p_pctrgp like  SETHEADER-SETNAME, "Pf.ct.Grp
          p_poper like YGFMLINV-poper obligatory, " Period
          p_bdatj like YGFMLINV-bdatj obligatory, " Year
          r_ccode  radiobutton group rad1 default 'X',
          r_grpcur radiobutton group rad1.
    selection-screen: end of block b1.
    Ranges Declaration
    RANGES : R_PROFIT_CTR FOR CEPC-PRCTR.
           INITIALIZATON
    *initialization.
      Validations for Selection Screen
    Validation for Vendor
    at selection-screen on s_lifnr.
      select single lifnr
               from lfa1
               into lfa1-lifnr
               where lifnr in s_lifnr.
      if sy-subrc ne 0.
        message e039.
      endif.
    Validation for Plant
    at selection-screen on s_werks.
      select single werks
             from t001w
             into t001w-werks
             where werks in s_werks.
      if sy-subrc ne 0.
        message e040.
      endif.
    Validation for Profit Center
    at selection-screen on s_prctr.
      select single prctr
              from ygfmlinv
              into ygfmlinv-prctr
             where prctr in s_prctr.
      if sy-subrc ne 0.
        message e041.
      endif.
    Validation for Company Code
    at selection-screen on p_bukrs.
      select single bukrs
             from t001
             into t001-bukrs
             where bukrs eq p_bukrs.
      if sy-subrc ne 0.
        message e042.
      endif.
    Validation for Profit Center Group
    at selection-screen on p_pctrgp.
      if not p_pctrgp is initial.
        select single setname
              from setheader
              into setheader-setname
              where setname eq p_pctrgp.
        if sy-subrc ne 0.
          message e043.
        endif.
      endif.
    Validation for Fiscal Period
    *at selection-screen on p_poper.
    select single poper
            from YGFMLINV
            into YGFMLINV-poper
            where poper eq p_poper.
    if sy-subrc ne 0.
       message e045.
    endif.
    Validation for Fiscal Year
    *at selection-screen on p_bdatj.
    select single bdatj
            from YGFMLINV
            into YGFMLINV-bdatj
            where bdatj eq p_bdatj.
    if sy-subrc ne 0.
       message e046.
    endif.
    start-of-selection.
      if p_pctrgp ne ' '.
        perform f_profit_center_select.
      endif.
      perform f_data_selection. "using p_profit_center..
    end-of-selection.
      call screen 100.
    *&      Form  f_data_selection
          text
    -->  p1        text
    <--  p2        text
    FORM f_data_selection.
      data: l_flg,
            l_lblab like mslbh-lblab,
            l_name1 like lfa1-name1,
            l_rate like mslbh-lblab,
            l_maktx like makt-maktx,
            l_diff_stk like mslbh-lblab,
            l_totval like ygfmlinv-lc_tot_amt.
    From profit center group get Profit Center
      LOOP AT R_PROFIT_CTR.
        IF R_PROFIT_CTR-LOW EQ R_PROFIT_CTR-HIGH.
          R_PROFIT_CTR-OPTION = 'EQ'.
          R_PROFIT_CTR-HIGH = SPACE.
          MODIFY R_PROFIT_CTR.
        ENDIF.
      ENDLOOP.
      if r_ccode eq 'X'.
        g_curr = '10'.
      else.
        g_curr = '30'.
      endif.
      if g_curr eq '10'.
    Fetch TOTAL STOCK ,VALUE from ML - Inv. Data Extract Table
        select BDATJ POPER BUKRS PRCTR WERKS BKLAS MATNR
                 BWTAR  STOCK_IND MEINS MLAST LBKUM
                 vprsv lc_mvp_prc LC_CURTP
                 LC_CURRENCY LC_TOT_AMT
                 lc_var_amt LC_UTP_AMT
                 lc_trfix_amt lc_lofix_amt
                 gc_curtp gc_currency
                 from YGFMLINV
                 into corresponding fields of table i_YGFMLINV
                 where bdatj eq p_bdatj and
                       poper eq p_poper and
                       bukrs eq p_bukrs and
                       werks in s_werks and
                       matnr in s_matnr and
                     STOCK_IND eq c_m and
                       trans_type eq c_eb and
                       lc_curtp eq g_curr.
      else.
    Fetch TOTAL STOCK ,VALUE from ML - Inv. Data Extract Table
        select BDATJ POPER BUKRS PRCTR WERKS BKLAS MATNR
                 BWTAR  STOCK_IND MEINS MLAST LBKUM
                 vprsv lc_mvp_prc LC_CURTP
                 LC_CURRENCY LC_TOT_AMT
                 lc_var_amt LC_UTP_AMT
                 lc_trfix_amt lc_lofix_amt
                 gc_curtp gc_currency
                 from YGFMLINV
                 into corresponding fields of table i_YGFMLINV
                 where bdatj eq p_bdatj and
                       poper eq p_poper and
                       bukrs eq p_bukrs and
                       werks in s_werks and
                       matnr in s_matnr and
                     STOCK_IND eq c_m and
                       trans_type eq c_eb and
                       gc_curtp eq g_curr.
      endif.
    Delete Entries not in Profit Center range
      LOOP AT I_YGFMLINV.
        IF  NOT I_YGFMLINV-PRCTR IN R_PROFIT_CTR.
          DELETE I_YGFMLINV.
        ENDIF.
      ENDLOOP.
      if not i_ygfmlinv[] is initial.
        data l_date like mkpf-budat.
        move : p_bdatj to l_date(4),
               p_poper to l_date+4(2),
               '31' to l_date+6(2).
    Get the TOTAL STOCK for Vendor and Material
        SELECT     MATNR
                   WERKS
                   CHARG
                   SOBKZ
                   LIFNR
                   LFGJA
                   LFMON
                   LBLAB
                   LBINS
                   FROM MSLBH INTO corresponding fields of TABLE I_MSLBH
                   for all entries in i_ygfmlinv
                   WHERE MATNR eq i_ygfmlinv-matnr and
                        WERKS EQ i_ygfmlinv-WERKS AND
                       SOBKZ in p_stkind AND
                        LIFNR in s_LIFNR AND
                        LFGJA GE P_BDATJ and
                        lfmon eq p_poper.
        if sy-subrc eq 0.
          DELETE I_MSLBH WHERE LFGJA EQ P_BDATJ AND
                               LFMON LT P_POPER.
        endif.
      endif.
      sort i_mslbh by matnr lifnr werks lfgja lfmon.
      sort i_ygfmlinv by matnr  werks bdatj poper.
      loop at i_mslbh.
        l_lblab = l_lblab + i_mslbh-lblab.
        at end of lifnr.
          l_flg = 'X'.
        endat.
        read table i_ygfmlinv with key matnr = i_mslbh-matnr
                                       werks = i_mslbh-werks
                                       bdatj = i_mslbh-lfgja
                                       poper = i_mslbh-lfmon
                                       binary search.
        if sy-subrc eq 0.
          select single name1 from lfa1 into l_name1
                   where lifnr eq i_mslbh-lifnr.
          if sy-subrc eq 0.
            select single maktx
                      from makt
                      into l_maktx
                      where matnr eq i_mslbh-matnr and
                            spras eq sy-langu.
            if l_flg eq 'X'.
    Subtract Total stk from Special Stock Vendor to get the difference
              l_diff_stk =   i_ygfmlinv-lbkum - l_lblab.
              move : i_mslbh-matnr to wa_output-matnr,
                     i_mslbh-lifnr to wa_output-lifnr,
                     i_mslbh-werks to wa_output-werks,
                     l_lblab to wa_output-totstk,
                     l_name1 to wa_output-name1,
                     i_ygfmlinv-vprsv to wa_output-vprsv,
                     i_ygfmlinv-meins to wa_output-meins,
                     i_ygfmlinv-lc_mvp_prc to wa_output-stdprice,
                     i_ygfmlinv-mlast to wa_output-mlast,
                     i_ygfmlinv-bukrs to wa_output-bukrs,
                     i_ygfmlinv-bklas to wa_output-bklas,
                     i_mslbh-sobkz to wa_output-sobkz.
              if g_curr eq '10'.
                move: i_ygfmlinv-lc_curtp to wa_output-lc_curtp,
                      i_ygfmlinv-lc_currency to wa_output-lc_currency.
              else.
                move: i_ygfmlinv-gc_curtp to wa_output-gc_curtp,
                      i_ygfmlinv-gc_currency to wa_output-gc_currency.
              endif.
              if wa_output-totstk ne 0.
                l_rate = i_ygfmlinv-LC_TOT_AMT  / i_ygfmlinv-lbkum.
                wa_output-totval =  l_rate * l_lblab.
              endif.
              append wa_output to gt_output.
              move wa_output-totval to l_totval.
              clear: l_rate,wa_output.
              if l_diff_stk ne 0.
                wa_output-totval = i_ygfmlinv-LC_TOT_AMT  -  l_totval.
                move: i_mslbh-matnr to wa_output-matnr,
    *Included - Remove
                      i_mslbh-matnr to wa_output-matnr,
                      i_mslbh-werks to wa_output-werks,
                      l_diff_stk to wa_output-totstk,
                      i_ygfmlinv-vprsv to wa_output-vprsv,
                      i_ygfmlinv-meins to wa_output-meins,
                      i_ygfmlinv-lc_mvp_prc to wa_output-stdprice,
                      i_ygfmlinv-mlast to wa_output-mlast,
                      i_ygfmlinv-bukrs to wa_output-bukrs,
                      i_ygfmlinv-bklas to wa_output-bklas.
                if g_curr eq '10'.
                  move: i_ygfmlinv-lc_curtp to wa_output-lc_curtp,
                        i_ygfmlinv-lc_currency to wa_output-lc_currency.
                else.
                  move: i_ygfmlinv-gc_curtp to wa_output-gc_curtp,
                        i_ygfmlinv-gc_currency to wa_output-gc_currency.
                endif.
                append wa_output to gt_output.
                clear: i_ygfmlinv,l_flg,l_lblab,l_name1,wa_output,
                       i_mslbh.
              endif.
            endif.
          endif.
        endif.
      endloop.
      sort: i_ygfmlinv by matnr werks,
                i_mslbh by matnr werks.
      LOOP AT I_YGFMLINV.
        read table i_mslbh with key matnr = i_ygfmlinv-matnr
                                        binary search.
        if sy-subrc eq 0.
          delete i_ygfmlinv.
          clear i_ygfmlinv.
        else.
          MOVE-CORRESPONDING I_YGFMLINV TO i_non_subc.
          APPEND i_non_subc.
          CLEAR I_YGFMLINV.
        endif.
      ENDLOOP.
      sort i_non_subc by matnr werks.
      data: l_lc_cogs(16) type p decimals 2,
            l_lc_tr_val(16) type p decimals 2,
            l_gc_cogs(16) type p decimals 2,
            l_gc_tr_val(16) type p decimals 2.
      LOOP AT i_non_subc.
        if g_curr eq '10'.
          l_LC_COGS   = i_non_subc-LC_TRFIX_AMT +
                        i_non_subc-LC_LOFIX_AMT.
          l_LC_TR_VAL = i_non_subc-LC_VAR_AMT + l_LC_COGS +
                        i_non_subc-LC_UTP_AMT.
        else.
          l_gc_cogs  = i_non_subc-gc_trfix_amt + i_non_subc-gc_lofix_amt.
          l_gc_tr_val = i_non_subc-gc_var_amt + i_non_subc-gc_cogs +
                        i_non_subc-gc_utp_amt.
        endif.
        at end of matnr.
          l_flg = 'X'.
        endat.
        if l_flg eq 'X'.
          move: i_non_subc-matnr to wa_output-matnr,
                i_non_subc-werks to wa_output-werks,
                i_non_subc-lbkum to wa_output-totstk,
                i_non_subc-meins to wa_output-meins,
                i_non_subc-bukrs to wa_output-bukrs,
                i_non_subc-bklas to wa_output-bklas,
                i_non_subc-lc_curtp to wa_output-lc_curtp,
                i_non_subc-lc_currency to wa_output-lc_currency,
                i_non_subc-gc_curtp to wa_output-gc_curtp,
                i_non_subc-gc_currency to wa_output-gc_currency.
          if g_curr eq '10'.
            move l_lc_tr_val to wa_output-totval.
          else.
            move  l_gc_tr_val to wa_output-totval.
          endif.
             i_non_subc-mlast to wa_output-mlast.
          select single maktx
                    from makt
                    into l_maktx
                    where matnr eq i_non_subc-matnr and
                          spras eq sy-langu.
          if sy-subrc eq 0.
            move l_maktx to wa_output-maktx.
            append wa_output to gt_output .
            clear: wa_output,l_flg,l_lc_tr_val,l_lc_cogs,
                   l_gc_cogs,l_gc_tr_val.
          endif.
        endif.
      ENDLOOP.
    ENDFORM.                    " f_data_selection
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'ZPF_STATUS'.
      SET TITLEBAR 'ZTITLE'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  alv_display  OUTPUT
          text
    MODULE alv_display OUTPUT.
      data: total type ref to data,
            subtotal1 type ref to data.
    field-symbols <total> like gt_output .
    field-symbols <subtotal1> like gt_output.
      if g_grid1 is initial.
        perform f_create_objects.
        perform f_build_field_catalog changing gt_fieldcat.
        perform f_prepare_layout changing gs_layout.
        perform f_sort_sub_total changing  gt_sort.
        CALL METHOD G_GRID1->GET_SORT_CRITERIA
          IMPORTING
            ET_SORT = gt_sort[]  .
       CALL METHOD g_grid1->GET_SUBTOTALS
         IMPORTING
           EP_COLLECT00   = total
           EP_COLLECT01   = subtotal1 .
               EP_COLLECT02   =
               EP_COLLECT03   =
               EP_COLLECT04   =
               EP_COLLECT05   =
               EP_COLLECT06   =
               EP_COLLECT07   =
               EP_COLLECT08   =
               EP_COLLECT09   =
               ET_GROUPLEVELS =             .
       assign total->* to <total>.
       assign subtotal1->* to <subtotal1>.
    *ALV Display - Specify Sorting,Filtering Criteria
        if gt_output[] is initial.
          message i015.
        endif.
        CALL METHOD G_GRID1->SET_TABLE_FOR_FIRST_DISPLAY
          EXPORTING
       I_BYPASSING_BUFFER            =
       I_BUFFER_ACTIVE               =
       I_CONSISTENCY_CHECK           =
       I_STRUCTURE_NAME              =
       IS_VARIANT                    =
       I_SAVE                        =
       I_DEFAULT                     = 'X'
            IS_LAYOUT                  = gs_layout
       IS_PRINT                      =
       IT_SPECIAL_GROUPS             =
       IT_TOOLBAR_EXCLUDING          =
       IT_HYPERLINK                  =
       IT_ALV_GRAPHICS               =
       IT_EXCEPT_QINFO               =
          CHANGING
            IT_OUTTAB                  = gt_output[]
            IT_FIELDCATALOG            = gt_fieldcat
            IT_SORT                    = gt_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.
      else.
        CALL METHOD G_GRID1->REFRESH_TABLE_DISPLAY
    EXPORTING
       IS_STABLE      =
       I_SOFT_REFRESH =
          EXCEPTIONS
            FINISHED       = 1
            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.
      endif.
    ENDMODULE.                 " alv_display  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
      case ok_code.
        when 'BACK'.
          set screen '0'.
          leave screen.
        when 'EXIT' or 'CANCEL'.
          PERFORM EXIT_PROGRAM.
      endcase.
      clear ok_code.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  f_create_objects
          text
    -->  p1        text
    <--  p2        text
    FORM f_create_objects.
    Creating Custom Container Objects and GRID
      IF G_grid1 IS INITIAL.
    *Creating Custom Container Instance
    Pass the name of the control that you have created on the screen
        CREATE OBJECT G_CUSTOM_CONTAINER
               EXPORTING CONTAINER_NAME = 'ZGRID_CTRL'.
    *Creating ALV Grid Instance
        CREATE OBJECT G_GRID1 EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
      endif.
    ENDFORM.                    " f_create_objects
    *&      Form  f_build_field_catalog
          text
    -->  p1        text
    <--  p2        text
    FORM f_build_field_catalog changing pt_fieldcat type lvc_t_fcat.
      data ls_fcat type lvc_s_fcat.
    Val Type
      ls_fcat-fieldname = 'BUKRS'.
      ls_fcat-inttype    = 'C'.
      ls_fcat-outputlen = '4'.
      ls_fcat-coltext   = 'Val.Type'.
      ls_fcat-seltext   = 'Val.Type'.
      ls_fcat-col_pos   = '1'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    Val.Class
      ls_fcat-fieldname = 'BKLAS'.
      ls_fcat-TABNAME = 'YGFMLINV'.
      ls_fcat-outputlen = '4'.
      ls_fcat-coltext   = 'Val.Class'.
      ls_fcat-seltext   = 'Val.Class'.
      ls_fcat-col_pos   = '2'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    *Plant
      ls_fcat-fieldname = 'WERKS'.
      ls_fcat-TABNAME = 'YGFMLINV'.
      ls_fcat-outputlen = '4'.
      ls_fcat-coltext   = 'Plant'.
      ls_fcat-seltext   = 'Plant'.
      ls_fcat-col_pos   = '3'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    *Material
      ls_fcat-fieldname = 'MATNR'.
      ls_fcat-TABNAME = 'YGFMLINV'.
      ls_fcat-outputlen = '18'.
      ls_fcat-coltext   = 'Material'.
      ls_fcat-seltext   = 'Material'.
      ls_fcat-col_pos   = '4'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    *Description
      ls_fcat-fieldname = 'MAKTX'.
      ls_fcat-TABNAME = 'MAKT'.
      ls_fcat-outputlen = '40'.
      ls_fcat-coltext   = 'Description'.
      ls_fcat-seltext   = 'Description'.
      ls_fcat-col_pos   = '5'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    *Price Control
      ls_fcat-fieldname = 'VPRSV'.
      ls_fcat-TABNAME = 'YGFMLINV'.
      ls_fcat-outputlen = '1'.
      ls_fcat-coltext   = 'Price Control'.
      ls_fcat-seltext   = 'Price Control'.
      ls_fcat-col_pos   = '6'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    *Price Determination
      ls_fcat-fieldname = 'MLAST'.
      ls_fcat-TABNAME = 'YGFMLINV'.
      ls_fcat-outputlen = '1'.
      ls_fcat-coltext   = 'Price Determination'.
      ls_fcat-seltext   = 'Price Determination'.
      ls_fcat-col_pos   = '7'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    Total Stock
      ls_fcat-fieldname = 'TOTSTK'.
      ls_fcat-REF_TABLE = 'YGFMLINV'.
      ls_fcat-REF_FIELD = 'LBKUM'.
      ls_fcat-QFIELDNAME = 'MEINS'.
      ls_fcat-IFIELDNAME = 'YGFMLINV'.
      ls_fcat-coltext   = 'Total Stock'.
      ls_fcat-seltext   = 'Total Stock'.
      ls_fcat-col_pos   = '8'.
      ls_fcat-do_sum = 'X'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    Std. Price
      ls_fcat-fieldname = 'STDPRICE'.
      ls_fcat-TABNAME = 'YGFMLINV'.
      ls_fcat-REF_TABLE = 'YGFMLINV'.
      ls_fcat-ref_field = 'LC_MVP_PRC'.
      ls_fcat-coltext = 'Std.Price'.
      ls_fcat-col_pos   = '9'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
      if g_curr eq '10'.
    Currency Type
        ls_fcat-fieldname = 'LC_CURTP'.
        ls_fcat-TABNAME = 'YGFMLINV'.
        ls_fcat-coltext = 'Currency Type'.
        ls_fcat-seltext = 'Currency Type'.
        ls_fcat-col_pos = '10'.
        append ls_fcat to pt_fieldcat.
        clear ls_fcat.
      else.
    Currency Type
        ls_fcat-fieldname = 'GC_CURTP'.
        ls_fcat-TABNAME = 'YGFMLINV'.
        ls_fcat-coltext = 'Currency Type'.
        ls_fcat-seltext = 'Currency Type'.
        ls_fcat-col_pos = '10'.
        append ls_fcat to pt_fieldcat.
        clear ls_fcat.
      endif.
    *Per Unit Price
      ls_fcat-fieldname = 'STDPRICE'.
      ls_fcat-TABNAME = 'YGFMLINV'.
      ls_fcat-ref_table = 'YGFMLINV'.
      ls_fcat-ref_field = 'LC_MVP_PRC'.
    ls_fcat-currency  = 'LC_CURRENCY'.
      ls_fcat-coltext = 'Per.Unit.Price'.
      ls_fcat-seltext = 'Per.Unit.Price'.
      ls_fcat-col_pos   = '11'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    Quantity Measurement
      ls_fcat-fieldname = 'MEINS'.
      ls_fcat-TABNAME = 'YGFMLINV'.
      ls_fcat-coltext = 'Base Unit'.
      ls_fcat-seltext = 'Base Unit'.
      ls_fcat-col_pos = '12'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    *Total Value
      ls_fcat-fieldname = 'TOTVAL'.
      ls_fcat-TABNAME = 'YGFMLINV'.
      ls_fcat-currency  = 'GC_CURRENCY'.
      ls_fcat-coltext   = 'Total Value'.
      ls_fcat-seltext   = 'Total Value'.
      ls_fcat-col_pos   = '13'.
      ls_fcat-do_sum = 'X'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    *Value/period
      ls_fcat-fieldname = 'TOTVAL'.
      ls_fcat-TABNAME = 'YGFMLINV'.
      ls_fcat-currency  = 'GC_CURRENCY'.
      ls_fcat-coltext   = 'Value/Period'.
      ls_fcat-seltext   = 'Value/Period'.
      ls_fcat-col_pos   = '14'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    *Vendor
      ls_fcat-fieldname = 'LIFNR'.
      ls_fcat-TABNAME = 'LFA1'.
      ls_fcat-coltext   = 'Vendor'.
      ls_fcat-seltext   = 'Vendor'.
      ls_fcat-col_pos   = '15'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    *Vendor Description
      ls_fcat-fieldname = 'NAME1'.
      ls_fcat-TABNAME = 'LFA1'.
      ls_fcat-coltext = 'Vend.Desc'.
      ls_fcat-seltext = 'Vend.Desc'.
      ls_fcat-col_pos   = '16'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    *Special Stock Indicator
      ls_fcat-fieldname = 'SOBKZ'.
      ls_fcat-TABNAME = 'MSLBH'.
      ls_fcat-coltext = 'Spl.Stock Ind'.
      ls_fcat-seltext = 'Spl.Stock Ind'.
      ls_fcat-col_pos   = '17'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    ENDFORM.                    " f_build_field_catalog
    *&      Form  f_prepare_layout
          text
         <--P_GS_LAYOUT  text
    FORM f_prepare_layout CHANGING P_GS_LAYOUT type lvc_s_layo.
      p_gs_layout-zebra = 'X'.
      p_gs_layout-grid_title = 'Material List: Prices and Inventory Values'.
      p_gs_layout-smalltitle ='X'.
    p_gs_layout-no_totline = 'X'.
      p_gs_layout-no_totarr = 'X'.
    p_gs_layout-no_totexp = 'X'.
    p_gs_layout-totals_bef = 'X'.
    ENDFORM.                    " f_prepare_layout
    *&      Form  f_profit_center_select
    Validate the Profit Center Groups with Profit Center
    -->  p1        text
    <--  p2        text
    FORM f_profit_center_select.
      DATA:V_RETCODE LIKE BAPIRET2,
           V_GROUPNAME LIKE  BAPICO_GROUP-GROUPNAME ,
           p_kokrs like CEPC-KOKRS  value 'DU01',
           I_HIERARCHYNODES LIKE BAPISET_HIER OCCURS 0 WITH HEADER LINE,
           I_PRCTR LIKE BAPI1116_VALUES OCCURS 0 WITH HEADER LINE.
      V_GROUPNAME = P_PCTRGP.
      CALL FUNCTION 'BAPI_PROFITCENTERGRP_GETDETAIL'
           EXPORTING
                CONTROLLINGAREA = P_KOKRS
                GROUPNAME       = V_GROUPNAME
           IMPORTING
                RETURN          = V_RETCODE
           TABLES
                HIERARCHYNODES  = I_HIERARCHYNODES
                HIERARCHYVALUES = I_PRCTR.
      LOOP AT I_PRCTR.
        R_PROFIT_CTR-LOW = I_PRCTR-VALFROM.
        R_PROFIT_CTR-HIGH = I_PRCTR-VALTO.
        R_PROFIT_CTR-SIGN = 'I'.
        R_PROFIT_CTR-OPTION = 'BT'.
        APPEND R_PROFIT_CTR.
      ENDLOOP.
    ENDFORM.                    " f_profit_center_select
    *&      Form  f_sort_sub_total
          text
         <--P_GT_SORT  text
    FORM f_sort_sub_total CHANGING P_GT_SORT.
      DATA: ls_sort TYPE lvc_s_sort occurs 0 with header line.
    ls_sort-spos = '1' .
      ls_sort-fieldname = 'MATNR'.
      ls_sort-up = 'X'.
      ls_sort-subtot = 'X'.
      ls_sort-expa ='X'.
      ls_sort-group = 'UL'.
      append ls_sort TO gt_sort.
    ENDFORM.                    " f_sort_sub_total
    *&      Form  EXIT_PROGRAM
          text
    -->  p1        text
    <--  p2        text
    FORM EXIT_PROGRAM.
      data: g_repid like sy-repid.
      g_repid = sy-repid.
      CALL METHOD G_CUSTOM_CONTAINER->FREE.
      CALL METHOD CL_GUI_CFW=>FLUSH.
      IF SY-SUBRC NE 0.
    add your handling, for example
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  TITEL = G_REPID
                  TXT2  = SY-SUBRC
                  TXT1  = 'Error in Flush'(009).
      ENDIF.
      LEAVE PROGRAM.
    ENDFORM.                    " EXIT_PROGRAM

  • Create simple ALV using Classes

    hi all,
    How to create a ALV report using Classes....?
    any links or feedback will be appreciated.
    Thanks in Advance.

    Check this Sample code using Docking container. In case of docking container no need of custom container required on screen.
    REPORT  ztest_oo_a.
    DATA: it_flight TYPE sflight_tab1.
    DATA: dock TYPE REF TO cl_gui_docking_container,
          grid TYPE REF TO cl_gui_alv_grid.
    SELECT *
      FROM sflight
      INTO TABLE it_flight
      UP TO 20 ROWS.
    CALL SCREEN 100.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'SATR'.
      CREATE OBJECT dock
        EXPORTING
          repid     = sy-repid
          dynnr     = '100'
          extension = '1500'
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          lifetime_dynpro_dynpro_link = 5
          OTHERS                      = 6
      IF sy-subrc ne  0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      CREATE OBJECT grid EXPORTING i_parent = dock.
      CALL METHOD grid->set_table_for_first_display
        EXPORTING
          i_structure_name              = 'SFLIGHT'
        CHANGING
          it_outtab                     = it_flight
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4.
      IF sy-subrc ne 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.
      CASE sy-ucomm.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    Flow Logic
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0100.
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_0100.

  • Need help with "class file contains wrong class"

    I have a dbUtil package as
    package dbUtil;
    public class dbConfig {
    public String getHost(String db) {
    This file called dbConfig.java has been compiled with -d option and rthe class files resides in dir <install_dir>/webapps/test/WEB-INF/classes/eb/dbUtil/
    I have a jsp file in <install_dir>/webapps/test/test.jsp which imports the dbUtil package
    <%@ page import="eb.dbUtil.dbConfig" %>
    and I am getting this error:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: -1 in the jsp file: null
    Generated servlet error:
    [javac] Compiling 1 source file
    /opt/hpws/tomcat/work/Standalone/localhost/test/test_jsp.java:12: cannot access eb.dbUtil.dbConfig
    bad class file: /opt/hpws/tomcat/webapps/test/WEB-INF/classes/eb/dbUtil/dbConfig.class
    class file contains wrong class: dbUtil.dbConfig
    Please remove or make sure it appears in the correct subdirectory of the classpath.
    import eb.dbUtil.dbConfig;
    ^
    1 error
    Can anyone tell me what am I doing wrong? I am using tomcat 4.1
    Thanks!
    L.

    Given your java file, the fully qualified name of the class is dbUtil.dbConfig.
    What you are importing is eb.dbUtil.dbConfig
    These things are not the same.
    The root of the classpath for the webapp is the classes directory.
    So either
    1 - specify dbConfig.java to be in package eb.dbUtil
    2 - move the class file into web-inf/classes/dbUtil/dbConfig.class, and import dbUtil.dbConfig.
    Also, by convention, classnames should start with a capital letter ie dbUtil.DbConfig.
    Cheers,
    evnafets

  • A simple ALV report using classes & methods ...

    i want a  simple ALV report using classes & methods ...
    my requirement : i have to use classes & methods instead  of calling a function module to display in grid or list format.
               plz send me with explanation ASAP...it's very urgent..
               Thanks in advance .

    Hi
    Please refer
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
    U can use methods for vreating ALVs.
    There is a method named set_table_for_first_display in OOP Concepts.
    Use this Object Oriented Approach for ALV Creation
    Calling the method set_table_for_first_display
    CALL METHOD cust_alv->set_table_for_first_display
    EXPORTING
    is_layout = gst_layout
    CHANGING
    it_outtab = gt_list
    it_fieldcatalog = gt_fcat
    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.
    Object Creation and all
    Creation of Object for Container
    CREATE OBJECT cust_container
    EXPORTING
    container_name = 'ALV_CONTAINER'
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    create_error = 3
    lifetime_error = 4
    lifetime_dynpro_dynpro_link = 5
    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.
    Creation of Object for ALV Grid
    CREATE OBJECT cust_alv
    EXPORTING
    i_parent = cust_container
    EXCEPTIONS
    error_cntl_create = 1
    error_cntl_init = 2
    error_cntl_link = 3
    error_dp_create = 4
    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.
    Layout settings
    gst_layout-zebra ='X'.
    gst_layout-cwidth_opt = 'X'.
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
    I_BUFFER_ACTIVE =
    I_STRUCTURE_NAME = 'ZCS_INACTV_CUST'
    I_CLIENT_NEVER_DISPLAY = 'X'
    I_BYPASSING_BUFFER =
    CHANGING
    ct_fieldcat = gt_fcat
    EXCEPTIONS
    INCONSISTENT_INTERFACE = 1
    PROGRAM_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.
    Calling the method set_table_for_first_display
    CALL METHOD cust_alv->set_table_for_first_display
    EXPORTING
    is_layout = gst_layout
    CHANGING
    it_outtab = gt_list
    it_fieldcatalog = gt_fcat
    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.
    For object oriented concepts refer this link https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b6cae890-0201-0010-ef8b-f970a9c41d47
    Reaward if helpful

  • Questions on using classes inside BSP pages

    Hi Group,
    I have a few questions on how to use classes,interfaces,parameters in classes,
    and etc., relating to OOPs concepts that can be implemented in BSPs.
    Pls send me some link wherein I can explore things and use it in BSPs.
    Thanks & Regards,
    Vishnu.

    Hi Raja,
    I am facing issues like this:
    1) When I use the code in my BSP as under:
    <%
    class ZCL_MODEL_03 definition load.
    data ref1 type ref to ZCL_MODEL_03.
    data cust_id type c value "1000".
    data c_id type c.
    create object ref1.
    c_id = cust_id.
    call method ref1->CHECK_CUSTOMER changing cid = cust_id.
    %>
    Cannot we define variables in the Scriptlet?? or we need to do only in the attributes sections only?? or in both??
    2)I am not able to use both exporting & importing things in my method call.
    eg.,call method ref1->GET_CUSTOMER
                      exporting cid = cust_id
                      importing c_id = eid.
    In the method definition, I am only using simply logic like, I was trying to send a value into the "cid" defined in the method and putting that value into "eid" which was defined exporting, but, still I could not get the value into "c_id" that I have defined in the BSP page.
    Note: in both the things(in BSP and class definition as well, I am using the same
            type for defining the attributes.
    3)When can we define a "Returning" option in the Class method's parameter    
       Definition? and how can I use it with an example?
    Thanks in advance.
    Regards,
    Vishnu.

  • How to download a text file using classes

    Hi Guys
    I want to download a text file using classes.
    Any idea how to do it ?
    Thanks
    Sameer

    HI sameer,
       It is no different from using a Function module.
    example:
      CALL METHOD cl_gui_frontend_services=>gui_download
        EXPORTING
          filename                  = w_fpath
        append                    = SPACE
          write_field_separator     = 'X'
        CHANGING
          data_tab                  = it_download
        EXCEPTIONS
          file_write_error          = 1
          no_batch                  = 2
          gui_refuse_filetransfer   = 3
          invalid_type              = 4
          no_authority              = 5
          unknown_error             = 6
          header_not_allowed        = 7
          separator_not_allowed     = 8
          filesize_not_allowed      = 9
          header_too_long           = 10
          dp_error_create           = 11
          dp_error_send             = 12
          dp_error_write            = 13
          unknown_dp_error          = 14
          access_denied             = 15
          dp_out_of_memory          = 16
          disk_full                 = 17
          dp_timeout                = 18
          file_not_found            = 19
          dataprovider_exception    = 20
          control_flush_error       = 21
          not_supported_by_gui      = 22
          error_no_gui              = 23
          OTHERS                    = 24
    Regards,
    ravi

Maybe you are looking for