2014 Jul 30 4:01 PM
I am writing a program /DURS/OOOP_V2 (Capture1.png).
--------------------------------------------------------------------------------------------
Program's code is like this:
report /DURS/OOOP_V2.
call screen 200.
include /durs/ooop_v2_incl1.
INCLUDE /durs/ooop_v2_incl2.
--------------------------------------------------------------------------------------------
Screen 0200 has screen logic like this:
PROCESS BEFORE OUTPUT.
module GetPorocilo.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0200.
--------------------------------------------------------------------------------------------
The code (GetPorocilo and USER_COMMAND_0200) is stored in include file /DURS/OOOP_V2_INCLThere is also defined class lcl_alv, inherited from CL_GUI_ALV_GRID (see attached file). This clas has select_alv and display_alv methods for selecting and displaying data.
I create lcl_alv in module GetPorocilo (in include file), like this:
module GetPorocilo output.
if save_ok2 = ''.
data o_alv type ref to lcl_alv.
create object G_CUSTOM_CONTAINER2 "container for o_alv
exporting
CONTAINER_NAME = 'ALVGRID2'.
create object o_alv
exporting
I_PARENT = G_CUSTOM_CONTAINER2. "parent control should be ALVGRID2
o_alv->select_alv( 20 ).
o_alv->display_alv( ).
endif.
endmodule.
--------------------------------------------------------------------------------------------
The problem is the following: I want alv grid o_alv to be embedded in container ALVGRID2, which is in screen 0200. That's why I inherited it from CL_GUI_ALV_GRID, where I can specify the parent control. But when I display it with o_alv->display_alv( ), the program jumps over screen 0200 and opens new SAPLSLVC_FULLSCREEN screen with o_alv. I got this:
run program /DURS/OOOP_V2 -----> screen 0200 ------> SAPLSLVC_FULLSCREEN
In short, I don't want SAPLSLVC_FULLSCREEN to display my grid, screen 0200 should do it.
Thanks in advance
I am writing a program /DURS/OOOP_V2 (Capture1.png).
--------------------------------------------------------------------------------------------
Program's code is like this:
report /DURS/OOOP_V2.
call screen 200.
include /durs/ooop_v2_incl1.
INCLUDE /durs/ooop_v2_incl2.
--------------------------------------------------------------------------------------------
Screen 0200 has screen logic like this:
PROCESS BEFORE OUTPUT.
module GetPorocilo.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0200.
--------------------------------------------------------------------------------------------
The code (GetPorocilo and USER_COMMAND_0200) is stored in include file /DURS/OOOP_V2_INCLThere is also defined class lcl_alv, inherited from CL_GUI_ALV_GRID (see attached file). This clas has select_alv and display_alv methods for selecting and displaying data.
I create lcl_alv in module GetPorocilo (in include file), like this:
module GetPorocilo output.
if save_ok2 = ''.
data o_alv type ref to lcl_alv.
create object G_CUSTOM_CONTAINER2 "container for o_alv
exporting
CONTAINER_NAME = 'ALVGRID2'.
create object o_alv
exporting
I_PARENT = G_CUSTOM_CONTAINER2. "parent control should be ALVGRID2
o_alv->select_alv( 20 ).
o_alv->display_alv( ).
endif.
endmodule.
--------------------------------------------------------------------------------------------
The problem is the following: I want alv grid o_alv to be embedded in container ALVGRID2, which is in screen 0200. That's why I inherited it from CL_GUI_ALV_GRID, where I can specify the parent control. But when I display it with o_alv->display_alv( ), the program jumps over screen 0200 and opens new SAPLSLVC_FULLSCREEN screen with o_alv. I got this:
run program /DURS/OOOP_V2 -----> screen 0200 ------> SAPLSLVC_FULLSCREEN
In short, I don't want SAPLSLVC_FULLSCREEN to display my grid, screen 0200 should do it.
Thanks in advance
2014 Jul 30 4:07 PM
Have you tried to create the alv_grid and the parent object before calling the pbo ?
Have you tried the use the example from "Easy Reference for ALV Grid Control" ?
Br,
Nikolaus
2014 Jul 30 4:11 PM
Hi
You're using cl_salv_table class so you don't need any container (and support screen)
Max
2014 Jul 30 6:57 PM
Hi Miran,
I had the same situation as you have, and it worked fine for me.
I created my ALV using the following code (also using a module in PBO as you are doing).
CREATE OBJECT r_container
EXPORTING
container_name = 'CONT_1'.
CREATE OBJECT r_grid
EXPORTING
i_parent = r_container.
CALL METHOD r_grid->set_table_for_first_display
EXPORTING
it_toolbar_excluding = lt_exclude
is_layout = gs_layout
CHANGING
it_outtab = gt_outtab
it_fieldcatalog = gt_fieldcat
EXCEPTIONS
OTHERS = 4.
On my TOP include I put the following:
*&-----------------------------------------------------------------
*& CONTAINER And ALV-OO
*&-----------------------------------------------------------------
CLASS lcl_eventos DEFINITION DEFERRED.
DATA: r_container TYPE REF TO cl_gui_custom_container,
r_grid TYPE REF TO cl_gui_alv_grid,
o_eventos TYPE REF TO lcl_eventos.
*---------------------------------------------------------------------*
* CLASS LCL_evento DEFINITION *
*---------------------------------------------------------------------*
CLASS lcl_eventos DEFINITION.
PUBLIC SECTION.
METHODS:
* Toolbar
handle_toolbar
FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING e_object e_interactive....
2014 Jul 31 9:51 AM
Thanks you for your answer(s), but I don't see any connection between r_grid and o_eventos/lcl_eventos.
regards
Miran
2014 Jul 31 10:10 AM
Hi
What I can't understand is why you're using the class CL_SALV_TABLE,: this class can create a GRID by yourself, whitout any other support.
I would like to know what yuo need to do
Max
2014 Jul 31 10:17 AM
Thank you for your answer.
I am trying to create a grid with functionallities like dbl click, link, click on column header, etc.
But this grid should be embedded in a screen with some other objects or grids.
It looks like I am mixing CL_SALV_TABLE and CL_GUI_ALV_GRID ?
regards
Miran
2014 Jul 31 10:24 AM
Uhm
I don't think CL_SALV_TABLE is good for you, because this class is very powerfull and usefull if you it needs to create a report showing data by ALV
In this case it needs to tansfers the output table and class will do all,
but if you need to show the ALV insede your screen I believe you need to do all by yourself using CL_GUI_ALV_GRID,
Max
2014 Jul 31 10:27 AM
Thanks again (to all).
I will try with CL_GUI_ALV_GRID.
regards
Miran
2014 Jul 31 10:32 AM
But anyway - how do I add methods like double click to CL_GUI_ALV_GRID.
Thanks in advance
Miran
2014 Jul 31 10:39 AM
Hello, Have you red the alv guide?
You have to set up an reciever class
CLASS lcl_event_handler DEFINITION .
PUBLIC SECTION .
METHODS:
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row e_column .
PRIVATE SECTION.
ENDCLASS.
CLASS lcl_event_handler IMPLEMENTATION .
*--Handle Double Click
METHOD handle_double_click .
PERFORM handle_double_click USING e_row e_column es_row_no .
ENDMETHOD .
ENDCLASS .
Then create and register the handler:
DATA gr_event_handler TYPE REF TO lcl_event_handler .
.. ..
*--Creating an instance for the event handler
CREATE OBJECT gr_event_handler .
*--Registering handler methods to handle ALV Grid events
SET HANDLER gr_event_handler->handle_double_click FOR gr_alvgrid .
And build your routine to do something meaningful.
FORM handle_double_click USING i_row TYPE lvc_s_row
i_column TYPE lvc_s_col
is_row_no TYPE lvc_s_roid.
READ TABLE gt_list INDEX is_row_no-row_id .
IF sy-subrc = 0 AND i_column-fieldname = 'SEATSOCC' .
CALL SCREEN 200 . "Details about passenger-seat matching
ENDIF .
ENDFORM .
Best Regards,
Nikolaus
2014 Jul 31 10:49 AM
Hi Sorry
I've said a stupid thing.....I'm very sorry:
- Definitions:
class lcl_handle_events definition deferred.
data: g_alv type ref to cl_salv_table.
data: my_container type ref to cl_gui_custom_container.
data: g_events type ref to cl_salv_events_table.
data: alv_events type ref to lcl_handle_events.
data: begin of itab occurs 0,
lifnr type lfa1-lifnr,
name1 type lfa1-name1,
end of itab.
Class for evetns:
*----------------------------------------------------------------------*
* CLASS LCL_HANDLE_EVENTS DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class lcl_handle_events definition.
public section.
methods:
on_double_click for event double_click of cl_salv_events_table
importing row column.
endclass. "LCL_HANDLE_EVENTS DEFINITION
*----------------------------------------------------------------------*
* CLASS LCL_HANDLE_EVENTS IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class lcl_handle_events implementation.
method on_double_click.
read table itab into itab index row.
check sy-subrc = 0.
message i398(00) with 'Double click on' row.
endmethod. "ON_DOUBLE_CLICK
endclass. "LCL_HANDLE_EVENTS IMPLEMENTATION
Start program:
start-of-selection.
do 10 times.
itab-lifnr = sy-index.
itab-name1 = 'Max'.
append itab.
enddo.
call screen 0100.
PBO screen 100:
module pbo output.
check my_container is initial.
create object my_container
exporting
container_name = 'TEST'.
try.
call method cl_salv_table=>factory
exporting
r_container = my_container
importing
r_salv_table = g_alv
changing
t_table = itab[].
catch cx_salv_msg.
endtry.
* Events
g_events = g_alv->get_event( ).
create object alv_events.
set handler alv_events->on_double_click for g_events.
*
g_alv->display( ).
endmodule. " PBO OUTPUT
Max
2014 Jul 31 10:52 AM
2014 Jul 31 10:42 AM
Thank you for your answer. Right now I am trying to set the code and your post will be a great help.
Regards
Miran
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |