‎2009 Mar 25 1:56 PM
Hi,
I am a beginner in OO ALV, i am facing a problem in using cutom container to display ALV grid.
I am creating a custom container as follows:
DATA o_custom_container TYPE REF TO cl_gui_custom_container.
CREATE OBJECT o_custom_container
EXPORTING container_name = 'ZSD'.
After that i am creating a grid and calling the method for display.
When i use docking container instead of custom, everything works fine but with custom
container, a blank screen is displayed. Nothing is displayed in output.
Please suggest a relevant solution.
Thanks.
‎2009 Mar 25 3:55 PM
DATA o_custom_container TYPE REF TO cl_gui_custom_container.
PBO:
CREATE OBJECT o_custom_container
EXPORTING container_name = 'ZSD'.
Container on the srceen should have name ZSD .
create object t_grid
exporting
i_parent = o_custom_container.
T_GRID->SET_TABLE_FOR_FIRST_DISPLAY.[Reference|https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/a%252bsimple%252bprogram%252bon%252balv%252boops]
Regards,
Gurpreet
‎2009 Mar 25 4:04 PM
HI,
Refer to this link..https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/abap-7StepstocreateOOPS+ALV
‎2009 Mar 25 4:06 PM
You can refer to the below code:
" Create Event Receiver
CREATE OBJECT lv_event_receiver1.
" Create custom container
CREATE OBJECT v_contan
EXPORTING
container_name = v_gcntrl
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc EQ 0.
" Populate ALV control: Variant structure
w_varnt-report = sy-repid. " Program name
" Add the event with instance of controller
SET HANDLER lv_event_receiver1->double_click FOR v_gridc.
SET HANDLER lv_event_receiver1->top_of_page FOR v_gridc.
" Call the first Display mode
CALL METHOD v_gridc->set_table_for_first_display
EXPORTING
i_structure_name = 'T_MATNR'
is_variant = w_varnt " Variant
CHANGING
it_outtab = t_matnr
it_fieldcatalog = t_fieldcat.
" Call method to refresh table display
CALL METHOD v_gridc->refresh_table_display.
ENDIF.
For more reference, you can check program :
BCALV_GRID_01 -> BCALV_GRID_11
Check any of the above program. This will help you.
Kuntal
‎2009 Mar 25 7:45 PM
Hello
The solution is quite simple: you need to "attach" your custom container to a custom control element on the screen. Example:
DATA o_custom_container TYPE REF TO cl_gui_custom_container.
CREATE OBJECT o_custom_container
EXPORTING container_name = 'ZSD'. " <<< screen must contain custom control with name = 'ZSD'
Regards
Uwe
‎2009 Mar 26 10:30 AM
data : lcl_w_custom_cont type ref to cl_gui_custom_container.
perform create_top_con.
perform create_grid_con.
form create_top_con.
create object lcl_w_custom_cont
exporting
container_name = 'CUSTOM'.
create object lcl_dyndoc_id
exporting
style = 'ALV_GRID'.
create object lcl_splitter
exporting
parent = lcl_w_custom_cont
rows = 2
columns = 1.
call method lcl_splitter->get_container
exporting
row = 1
column = 1
receiving
container = lcl_top_cont.
call method lcl_splitter->get_container
exporting
row = 2
column = 1
receiving
container = lcl_grid_cont.
call method lcl_splitter->set_row_height
exporting
id = 1
height = 24.
endform.
form create_grid_con.
create object lcl_alv
exporting
i_parent = lcl_grid_cont.
create object handler_event.
Hope this helps u.