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

Using no_headers in ALV grid

Former Member
0 Likes
631

I am trying to suppress the headers in an ALV grid by setting the parameter no_headers to 'X' in the layout structure and then passint this in the call to set_table_for_first_display. However the headers are still displayed.

Is there any trick to getting this parameter to be recognised?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
558

Hi Michael,

This option is only used to suppress the headings. this works fine for me .... check this code...

IF CUSTOM_CONTAINER1 IS INITIAL.

  • SELECTING DATA FROM SFLIGHT.

PERFORM SELECT_TABLE_SFLIGHT CHANGING GT_SFLIGHT.

  • create a custom container control for our ALV Control

CREATE OBJECT CUSTOM_CONTAINER1

EXPORTING

CONTAINER_NAME = SALES_DOC_HEADER

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

CREATE_ERROR = 3

LIFETIME_ERROR = 4

LIFETIME_DYNPRO_DYNPRO_LINK = 5.

IF SY-SUBRC <> 0.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

TITEL = G_REPID

TXT1 = SY-SUBRC

TXT2 = 'CONTROL COULD NOT BE CREATED'(510).

ENDIF.

CREATE OBJECT GRID1

EXPORTING I_PARENT = CUSTOM_CONTAINER1.

<b> GS_LAYOUT-GRID_TITLE = 'FLIGHTS'(100).

GS_LAYOUT-SEL_MODE = 'A'.

gs_layout-NO_HEADERS = 'X'.</b>

*call method EVENT_RECEIVER->call_handle_toolbar.

*call method grid1->set_toolbar.

<b>

CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING I_STRUCTURE_NAME = 'SFLIGHT'

IS_LAYOUT = GS_LAYOUT

CHANGING IT_OUTTAB = GT_SFLIGHT.</b>

CREATE OBJECT EVENT_RECEIVER.

  • SET HANDLER EVENT_RECEIVER->HANDLE_TOOLBAR FOR GRID1.

SET HANDLER EVENT_RECEIVER->HANDLE_TOOLBAR FOR all instances.

SET HANDLER EVENT_RECEIVER->HANDLE_USER_COMMAND FOR GRID1.

CALL METHOD GRID1->SET_TOOLBAR_INTERACTIVE.

CALL METHOD CL_GUI_CONTROL=>SET_FOCUS EXPORTING CONTROL = GRID1.

ENDIF.

CALL METHOD CL_GUI_CONTROL=>SET_FOCUS EXPORTING CONTROL = GRID1.

Regards,

Vidya

2 REPLIES 2
Read only

Former Member
0 Likes
559

Hi Michael,

This option is only used to suppress the headings. this works fine for me .... check this code...

IF CUSTOM_CONTAINER1 IS INITIAL.

  • SELECTING DATA FROM SFLIGHT.

PERFORM SELECT_TABLE_SFLIGHT CHANGING GT_SFLIGHT.

  • create a custom container control for our ALV Control

CREATE OBJECT CUSTOM_CONTAINER1

EXPORTING

CONTAINER_NAME = SALES_DOC_HEADER

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

CREATE_ERROR = 3

LIFETIME_ERROR = 4

LIFETIME_DYNPRO_DYNPRO_LINK = 5.

IF SY-SUBRC <> 0.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

TITEL = G_REPID

TXT1 = SY-SUBRC

TXT2 = 'CONTROL COULD NOT BE CREATED'(510).

ENDIF.

CREATE OBJECT GRID1

EXPORTING I_PARENT = CUSTOM_CONTAINER1.

<b> GS_LAYOUT-GRID_TITLE = 'FLIGHTS'(100).

GS_LAYOUT-SEL_MODE = 'A'.

gs_layout-NO_HEADERS = 'X'.</b>

*call method EVENT_RECEIVER->call_handle_toolbar.

*call method grid1->set_toolbar.

<b>

CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING I_STRUCTURE_NAME = 'SFLIGHT'

IS_LAYOUT = GS_LAYOUT

CHANGING IT_OUTTAB = GT_SFLIGHT.</b>

CREATE OBJECT EVENT_RECEIVER.

  • SET HANDLER EVENT_RECEIVER->HANDLE_TOOLBAR FOR GRID1.

SET HANDLER EVENT_RECEIVER->HANDLE_TOOLBAR FOR all instances.

SET HANDLER EVENT_RECEIVER->HANDLE_USER_COMMAND FOR GRID1.

CALL METHOD GRID1->SET_TOOLBAR_INTERACTIVE.

CALL METHOD CL_GUI_CONTROL=>SET_FOCUS EXPORTING CONTROL = GRID1.

ENDIF.

CALL METHOD CL_GUI_CONTROL=>SET_FOCUS EXPORTING CONTROL = GRID1.

Regards,

Vidya

Read only

0 Likes
558

Ok, It seems that the problem is around using the parameter is_variant. When passing a variant at the same time, the no_headers parameter appears to be ignored.

I would like to be able to pass a variant and also suppress the headers. Does anyone know if this is possible?