Application Development and Automation 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: 
Read only

Problem with custom container (ALV)

Former Member
0 Likes
1,637

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.

5 REPLIES 5
Read only

Former Member
0 Likes
923

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

Read only

Former Member
0 Likes
923

HI,

Refer to this link..https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/abap-7StepstocreateOOPS+ALV

Read only

former_member376453
Contributor
0 Likes
923

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

Read only

uwe_schieferstein
Active Contributor
0 Likes
923

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

Read only

Former Member
0 Likes
923

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.