2007 May 23 3:14 PM
I have dragged a custom control onto my screen painter in order
to display an ALV Grid.
In my ABAP code I have created an instance of the grid in
a PBO event handler. How do I bind the created grid to the
custom control on the screen?
2007 May 23 3:20 PM
Something like this -:)
IF CUSTOM_CONTAINER IS INITIAL.
CREATE OBJECT CUSTOM_CONTAINER
EXPORTING
CONTAINER_NAME = MYCONTAINER
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
CREATE OBJECT GRID
EXPORTING I_PARENT = CUSTOM_CONTAINER.
CREATE OBJECT EVENT_RECEIVER.
SET HANDLER EVENT_RECEIVER->HANDLE_TOOLBAR FOR GRID.
CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING IS_VARIANT = GS_VARIANT
I_SAVE = X_SAVE
I_DEFAULT = 'X'
IS_LAYOUT = GS_LAYOUT
CHANGING IT_FIELDCATALOG = GT_FIELDCAT
IT_SORT = GT_SORT[]
IT_OUTTAB = T_ZTSEQL_ZTSEQS[].
ELSE.
CALL METHOD GRID->REFRESH_TABLE_DISPLAY.
ENDIF.
Where the Custom Control is stored in MYCONTAINER...
DATA: MYCONTAINER TYPE SCRFNAME VALUE 'ALV_ZTSEQL_ZTSEQS'.
Greetings,
Blag.
Hi,
Check the BALVGRID* programs in SE38..
OR
Check the development class SLIS for sample ALV programs..
Thanks,
Naren
2007 May 23 3:20 PM
Something like this -:)
IF CUSTOM_CONTAINER IS INITIAL.
CREATE OBJECT CUSTOM_CONTAINER
EXPORTING
CONTAINER_NAME = MYCONTAINER
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
CREATE OBJECT GRID
EXPORTING I_PARENT = CUSTOM_CONTAINER.
CREATE OBJECT EVENT_RECEIVER.
SET HANDLER EVENT_RECEIVER->HANDLE_TOOLBAR FOR GRID.
CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING IS_VARIANT = GS_VARIANT
I_SAVE = X_SAVE
I_DEFAULT = 'X'
IS_LAYOUT = GS_LAYOUT
CHANGING IT_FIELDCATALOG = GT_FIELDCAT
IT_SORT = GT_SORT[]
IT_OUTTAB = T_ZTSEQL_ZTSEQS[].
ELSE.
CALL METHOD GRID->REFRESH_TABLE_DISPLAY.
ENDIF.
Where the Custom Control is stored in MYCONTAINER...
DATA: MYCONTAINER TYPE SCRFNAME VALUE 'ALV_ZTSEQL_ZTSEQS'.
Greetings,
Blag.
2007 May 23 3:25 PM
Hi,
Check the BALVGRID* programs in SE38..
OR
Check the development class SLIS for sample ALV programs..
Thanks,
Naren
2007 May 23 3:40 PM
Hello,
FORM display_alv
IF gr_alvgrid IS INITIAL .
*----Creating custom container instance
CREATE OBJECT gr_ccontainer
EXPORTING
container_name = gc_custom_control_name
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.
*--Exception handling
ENDIF.
*----Creating ALV Grid instance
CREATE OBJECT gr_alvgrid
EXPORTING
i_parent = gr_ccontainer
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5 .
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
*----Preparing field catalog.
PERFORM prepare_field_catalog CHANGING gt_fieldcat .
*----Preparing layout structure
PERFORM prepare_layout CHANGING gs_layout .
*----Here will be additional preparations
*--e.g. initial sorting criteria, initial filtering criteria, excluding
*--functions
CALL METHOD gr_alvgrid->set_table_for_first_display
EXPORTING
I_BUFFER_ACTIVE =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
is_layout = gs_layout
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
CHANGING
it_outtab = gt_list[]
it_fieldcatalog = gt_fieldcat
IT_SORT =
IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4 .
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
ELSE .
CALL METHOD gr_alvgrid->refresh_table_display
EXPORTING
IS_STABLE =
I_SOFT_REFRESH =
EXCEPTIONS
finished = 1
OTHERS = 2 .
IF sy-subrc <> 0.
*--Exception handling
ENDIF.
ENDIF .
ENDFORM .
2007 May 23 3:50 PM
I am using CL_SALV_GRID
It has an optional importing parameter of type cl_gui_container.
I assign the custom control to this parameter, but still see only the
custom control when launching the application. The other controls
on the screen painter are not rendered and visible.
2007 May 23 4:03 PM
Thanks Alvaro,
Your code answered my question. I just had to change it
for my class -- cl_salv_table.
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |