2023 May 16 4:57 AM
Hello All,
I have been trying to create an split container on SALV, but the second ALV does not come when i click on the hot spot. I have tried with Refresh the ALV but it didn't help me out.
Any suggestion?
Appreciate you help. Thank you
data: lv_vbeln type vbak-vbeln.
select-options:
s_vbeln for lv_vbeln.
*----------------------------------------------------------------------*
* CLASS lcl_hotspot DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class lcl_hotspot definition.
public section.
methods display.
methods:
on_link_click_order for event link_click
of cl_salv_events_table
importing row
column.
data:
gt_vbak type table of vbak,
go_salv type ref to cl_salv_table.
endclass. "lcl_hotspot DEFINITION
*----------------------------------------------------------------------*
* CLASS lcl_hotspot IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class lcl_hotspot implementation.
method on_link_click_order.
data ls_vbak type vbak.
data:
lt_vbap type standard table of vbap with default key.
data:
lo_splitter type ref to cl_gui_splitter_container,
lo_container1 type ref to cl_gui_container,
lo_container2 type ref to cl_gui_container.
data:
lo1_salv type ref to cl_salv_table,
lo1_func type ref to cl_salv_functions_list,
lo1_columns type ref to cl_salv_columns_table,
lo1_column type ref to cl_salv_column,
lo1_column_set type ref to cl_salv_column_table,
lo1_events type ref to cl_salv_events_table.
go_salv->refresh( refresh_mode = if_salv_c_refresh=>full ).
cl_gui_cfw=>flush( ).
read table gt_vbak into ls_vbak index row.
select * from vbap into table lt_vbap
where vbeln = ls_vbak-vbeln.
create object lo_splitter
exporting
parent = cl_gui_container=>screen0
rows = 2
columns = 1.
lo_container1 = lo_splitter->get_container( row = 1 column = 1 ).
lo_container2 = lo_splitter->get_container( row = 2 column = 1 ).
try.
call method cl_salv_table=>factory
exporting
r_container = lo_container1
importing
r_salv_table = lo1_salv
changing
t_table = lt_vbap.
lo1_func = lo1_salv->get_functions( ).
lo1_func->set_all( abap_true ).
lo1_columns = lo1_salv->get_columns( ).
lo1_columns->set_optimize( abap_true ).
"Display
lo1_salv->display( ).
catch cx_salv_msg .
endtry.
endmethod. "on_link_click_order
method display.
data:
lo_func type ref to cl_salv_functions_list,
lo_columns type ref to cl_salv_columns_table,
lo_column type ref to cl_salv_column,
lo_column_set type ref to cl_salv_column_table,
lo_events type ref to cl_salv_events_table.
select * from vbak into table gt_vbak
where vbeln in s_vbeln.
try.
call method cl_salv_table=>factory
importing
r_salv_table = go_salv
changing
t_table = gt_vbak.
lo_func = go_salv->get_functions( ).
lo_func->set_all( abap_true ).
lo_columns = go_salv->get_columns( ).
lo_columns->set_optimize( abap_true ).
lo_column_set ?= lo_columns->get_column( 'VBELN' ).
lo_column_set->set_cell_type( if_salv_c_cell_type=>hotspot ).
"Event- Set Handler
lo_events = go_salv->get_event( ).
set handler me->on_link_click_order for lo_events.
"Display
go_salv->display( ).
catch cx_salv_msg .
endtry.
go_salv->refresh( refresh_mode = if_salv_c_refresh=>full ).
cl_gui_cfw=>flush( ).
endmethod. "display
endclass. "lcl_main IMPLEMENTATION
start-of-selection.
data lo_hotspot type ref to lcl_hotspot.
create object lo_hotspot.
lo_hotspot->display( ).
2023 May 16 9:03 AM
You are playing with cl_gui_container=>screen0, but that's more a trick than a good practice.
What happens is that two controls share the same space hence the issue you encounter (the second ALV grid is shown behind the first one).
If you want to use cl_gui_container=>screen0 for some reason (I personally use it only to go beyond the maximum dynpro size, if absolutely required), I recommend to first use call screen (or call selection-screen), and you won't have a conflict as cl_gui_container=>screen0 is different if you use different screens.
NB: if you master Control Framework, you can play with special methods like SET_VISIBLE to hide the first ALV grid so that the second ALV grid is not overwritten, and other possible solutions.
NB: the refresh method is only needed if you change the contents of the internal table by ABAP code.
NB: be careful, your code makes the internal table local, it must be defined as global or any other solution so that the variable is not be freed from memory otherwise you risk a short dump (if you scroll next rows for instance).
2023 May 16 8:27 AM
You have a splitter container, but you use the splitter container for the second SALV (showing VBAP) only. I guess, you want to show the VBAK-data in one part of the splitter container and the VBAP-data in the other. If this is right, you need global data for splitter-container and the container in the splitter.
2023 May 16 9:03 AM
You are playing with cl_gui_container=>screen0, but that's more a trick than a good practice.
What happens is that two controls share the same space hence the issue you encounter (the second ALV grid is shown behind the first one).
If you want to use cl_gui_container=>screen0 for some reason (I personally use it only to go beyond the maximum dynpro size, if absolutely required), I recommend to first use call screen (or call selection-screen), and you won't have a conflict as cl_gui_container=>screen0 is different if you use different screens.
NB: if you master Control Framework, you can play with special methods like SET_VISIBLE to hide the first ALV grid so that the second ALV grid is not overwritten, and other possible solutions.
NB: the refresh method is only needed if you change the contents of the internal table by ABAP code.
NB: be careful, your code makes the internal table local, it must be defined as global or any other solution so that the variable is not be freed from memory otherwise you risk a short dump (if you scroll next rows for instance).
2023 May 24 6:43 PM
2023 May 24 8:32 PM
2023 May 24 6:41 PM
I am trying to display the split containers in the second screen.