Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

CL_SALV_HIERSEQ_TABLE and CL_GUI_ALV_GRID one screen

Former Member
0 Kudos

hi

i have screen 0100 and wonna place my CL_SALV_HIERSEQ_TABLE and cl_gui_alv_grid one screen on it. I create two containers, one for CL_SALV_HIERSEQ_TABLE and an other one for CL_GUI_ALV_GRID. When i executed program, it shows me only CL_SALV_HIERSEQ_TABLE why?

8 REPLIES 8

FredericGirod
Active Contributor
0 Kudos

Did you use a splitter container ?

did you use a docking container ?

Did you create two custom container ?  did you create one object for each custome container ....

give us more informations about your code

regards

Fred

0 Kudos

i had create two seperate containers for each of them.

former_member209120
Active Contributor
0 Kudos

Hi Anujit,

See this link http://wiki.sdn.sap.com/wiki/display/ABAP/TWO+ALV%27S+IN+SAME+OUTPUT+SCREEN

or try like this

data: imara type table of mara.
data: xmara like line of imara.
data: imarc type table of marc.

data: dockingbottom type ref to cl_gui_docking_container,
       dockingtop  type ref to cl_gui_docking_container,
       alv_bottom    type ref to cl_gui_alv_grid,
       alv_top     type ref to cl_gui_alv_grid,
       repid type syrepid.

*---------------------------------------------------------------------*
*       CLASS lcl_event_handler DEFINITION
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
class lcl_event_handler definition.

   public section.

     class-methods handle_double_click
                for event double_click of cl_gui_alv_grid
                               importing e_row e_column.

endclass.

*---------------------------------------------------------------------*
*       CLASS lcl_event_handler IMPLEMENTATION
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
class lcl_event_handler implementation.

   method handle_double_click.

     read table imara into xmara index e_row-index.

     select * into table imarc from marc
                   where matnr = xmara-matnr.
     call method alv_bottom->refresh_table_display( ).


   endmethod.

endclass.


parameters: p_check type c.

start-of-selection.

at selection-screen output.

   repid = sy-repid.

   select * into corresponding fields of table imara
               from mara up to 100 rows.

   check dockingbottom is initial.


   create object dockingtop
               exporting repid     = repid
                         dynnr     = sy-dynnr
                         side      = dockingtop->dock_at_top
                         extension = 200.

   create object alv_top
               exporting i_parent = dockingtop.


   call method alv_top->set_table_for_first_display
      exporting
           i_structure_name       = 'MARA'
      changing
           it_outtab       = imara[].


*   handler for ALV grid
   set handler lcl_event_handler=>handle_double_click for alv_top.



   create object dockingbottom
               exporting repid     = repid
                         dynnr     = sy-dynnr
                         side      = dockingbottom->dock_at_bottom
                         extension = 200.

   create object alv_bottom
                 exporting i_parent = dockingbottom.


   call method alv_bottom->set_table_for_first_display
       exporting
            i_structure_name       = 'MARC'
       changing
            it_outtab       = imarc[].

0 Kudos

this is refer to my question, i am asking about CL_SALV_HIERSEQ_TABLE and CL_GUI_ALV_GRID on the same screen.

0 Kudos

What you put inside your container is not important.

You create two container, you create two objects for each container, you refer to the first object container for the HIERSEQ .. and to the second object container for the ALV Grid ?

can you copy past the part of the code where you create the object ? 

regards

Fred

Former Member
0 Kudos

Hi Anujit,

In CL_GUI_ALV_GRID, the container can be specified. The ALV is displayed within that container.

Sample Coding:

IF go_alv_cc IS NOT BOUND.

     CREATE OBJECT go_alv_cc

       EXPORTING

         container_name              = 'SALV_CONT'

       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.

   ENDIF.


IF go_grid IS NOT BOUND.

     CREATE OBJECT go_grid

       EXPORTING

         i_parent          = go_alv_cc        "Custom Container Object

       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.

   ENDIF.

Whereas in CL_SALV_HIERSEQ_TABLE, the container cannot be specified. So I guess that the ALV is displayed fully.

Sample Coding:

IF go_halv IS NOT BOUND.

     TRY.

         gs_hier-master = 'VBELN'.

         gs_hier-slave = 'VBELN'.

         APPEND gs_hier TO gt_hier.

         CLEAR: gs_hier.

         CALL METHOD cl_salv_hierseq_table=>factory

           EXPORTING

             t_binding_level1_level2 = gt_hier

           IMPORTING

             r_hierseq               = go_halv

           CHANGING

             t_table_level1          = gt_vbak

             t_table_level2          = gt_vbap.

       CATCH cx_salv_data_error .

       CATCH cx_salv_not_found .

     ENDTRY.

   ENDIF.

   IF go_halv IS BOUND.

     CALL METHOD go_halv->display.

   ENDIF.

Thanks & Regards,

T. Prasanna Kumar

0 Kudos

this is code for alv

method create_matnr_choices.

     data lcl_matnr_container  type ref to cl_gui_custom_container.
     data lcl_matnr_grid       type ref to cl_gui_alv_grid.
     data lf_name_container    type scrfname value 'MATNR_CHOICE'.

     if lcl_matnr_container is initial.
       create object lcl_matnr_container
         exporting
           container_name = lf_name_container.

       create object lcl_matnr_grid
         exporting
           i_parent = lcl_matnr_container.

       call method lcl_matnr_grid->set_table_for_first_display
         exporting
           i_structure_name = 'ZPP_BOM_COMPARE_C'
         changing
           it_outtab        = ct_bom_compare_c.
     endif.

   endmethod.                    "create_matnr_choices

and this code is for hierseq

     cl_salv_hierseq_table=>factory(
       exporting
         t_binding_level1_level2 = lt_binding
       importing
         r_hierseq               = c_gobj_salv_hierseq_table
       changing
         t_table_level1          = me->c_gt_bom_compare_h
         t_table_level2          = me->c_gt_bom_compare_p
         ).

i think it is not possible to use both on same screen..

0 Kudos

Hi Anujit,

I also think the same. Because, in cl_salv_hierseq_table, we cannot specify the container.

Thanks & Regards,

T. Prasanna Kumar