Hi,
I'm trying out ALV using OO approach. Im building a very basic alv, However the alv is not displaying anything. Can any one tell me where is the bug ?
Here is my code
REPORT ztest.
TYPES:BEGIN OF REC,
A(30),
END OF REC.
*--- ALV Grid instance reference
DATA gr_alvgrid TYPE REF TO cl_gui_alv_grid .
*--- Name of the custom control added on the screen
DATA gc_custom_control_name TYPE scrfname." VALUE u2018cc_alvu2019 .
*--- Custom container instance reference
DATA gr_ccontainer TYPE REF TO cl_gui_custom_container .
*--- Field catalog table
DATA gt_fieldcat TYPE lvc_t_fcat .
*--- Layout structure
DATA gs_layout TYPE lvc_s_layo .
DATA: int_tab TYPE STANDARD TABLE OF rec WITH HEADER LINE.
BREAK-POINT.
PERFORM populate_data.
IF gr_ccontainer IS INITIAL.
CREATE OBJECT gr_ccontainer
EXPORTING
container_name = 'CC_ALV'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
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.
CALL METHOD gr_alvgrid->set_table_for_first_display
EXPORTING
I_STRUCTURE_NAME = 'REC'
is_layout = gs_layout
CHANGING
it_outtab = int_tab[]
it_fieldcatalog = gt_fieldcat[]
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4 .
SY-SUBRC = SY-SUBRC.
ELSE.
CALL METHOD gr_alvgrid->refresh_table_display
EXCEPTIONS
finished = 1
OTHERS = 2 .
SY-SUBRC = SY-SUBRC.
ENDIF.
&----
*& Form populate_data
&----
text
----
FORM populate_data.
DATA ls_fcat TYPE lvc_s_fcat .
INT_TAB-A = 'HI'.
APPEND INT_TAB.
INT_TAB-A = 'HELLO'.
APPEND INT_TAB.
ls_fcat-tabname = 'INT_TAB'.
ls_fcat-fieldname = 'A' .
LS_FCAT-COL_POS = 1.
ls_fcat-inttype = 'C' .
ls_fcat-outputlen = '30' .
ls_fcat-coltext = 'test' .
ls_fcat-seltext = 'TEST' .
APPEND ls_fcat TO gt_fieldcat .
clear ls_fcat.
ENDFORM. "populate_data