Application Development 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: 

Object oriented ALV

Former Member
0 Kudos

hi,

i am doing object oriented alv in which i need to display some lines at the top of the page . Below is my code where i am using set_gridtitle method for displaying title of the list. but its not working pls suggest

IF gv_custom_container IS INITIAL.

Create the container for screen 100

CREATE OBJECT gv_custom_container

EXPORTING

container_name = gc_container "C_CTRL1

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.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

  • Creating alv grid instance

CREATE OBJECT gv_grid

EXPORTING

i_parent = gv_custom_container

EXCEPTIONS

error_cntl_create = 1

error_cntl_init = 2

error_cntl_link = 3

error_dp_create = 4

OTHERS = 5

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CALL METHOD cl_gui_cfw=>flush.

IF sy-subrc NE 0.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

titel = sy-repid

txt2 = sy-subrc

txt1 = 'Error in flush'.

ENDIF.

PERFORM f_build_layout.

PERFORM f_grid_title.

PERFORM f_build_fcat CHANGING gi_fcat.

CALL METHOD gv_grid->set_gridtitle

EXPORTING

i_gridtitle = gv_title.

Display the output in grid

CALL METHOD gv_grid->set_table_for_first_display

EXPORTING

is_variant =

i_save = gc_a

i_default = 'X'

is_layout = gwa_layout

it_toolbar_excluding =

it_hyperlink =

it_alv_graphics =

it_except_qinfo =

ir_salv_adapter =

CHANGING

it_outtab = gi_final

it_fieldcatalog = gi_fcat

it_sort =

it_filter =

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 3

OTHERS = 4

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msg

ELSE.

CALL METHOD gv_grid->refresh_table_display

EXCEPTIONS

finished = 1

OTHERS = 2.

ENDIF.

ENDIF.

1 REPLY 1

former_member188685
Active Contributor
0 Kudos

check this blog

and if you want only a single line title you can use layout

and set the attribute GRID_TITLE and pas the layout to alv display method