cancel
Showing results for 
Search instead for 
Did you mean: 

ALV Print Version header - Multiple lines

Former Member
0 Kudos

Hi,

I am attempting to write multiple lines on the header of the Print Version of an ALV Web Dynpro grid. Basically, the aim is to be able display/print the selection criteria that was executed to produce the ALV report.

I have attempted two different techniques:

DATA: lr_pdf_settings TYPE REF TO if_salv_wd_pdf_settings,

lo_value TYPE REF TO cl_salv_wd_config_table,

lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .

lo_interfacecontroller = wd_this->wd_cpifc_usage_alv( ).

lo_value = lo_interfacecontroller->get_model( ).

lr_pdf_settings ?= lo_value.

lr_pdf_settings->set_header_left( if_salv_wd_c_pdf_settings=>text_free ).

data: lv_header type string.

Technique 1:

move 'hello \n world' to lv_header.

Result: Only hello is displayed

Technique 2:

concatenate 'hello' 'world' to lv_header separated by cl_abap_char_utilities=>cr_lf.

Result: Nothing is displayed

lr_pdf_settings->set_header_left_freetext( lv_header ).

Please help. Also, I notice that this only works if the code is placed in the WDDOBEFOREACTION method of the view.

Any help is much appreciated.

TIA

John Kuriakose

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I finally managed to do this. Code below:

DATA: lr_node TYPE REF TO if_wd_context_node,

lr_element TYPE REF TO if_wd_context_element,

lr_top_element TYPE REF TO cl_salv_form_layout_grid,

lr_grid TYPE REF TO cl_salv_form_layout_grid,

lr_header TYPE REF TO cl_salv_form_header_info,

lr_action TYPE REF TO cl_salv_form_action_info.

CREATE OBJECT lr_top_element

EXPORTING

columns = 1.

  • DATA: lv_header TYPE string.

lr_header = lr_top_element->create_header_information(

row = 1

column = 1

text = 'My Title'

tooltip = 'List of Notifications' ).

lr_action = lr_top_element->create_action_information(

row = 2

column = 1

text = 'Selection parameters \r\n Client 500, Cost Center 500320'

tooltip = '' ).

lr_node = wd_context->get_child_node( name = 'TOP_OF_LIST' ).

lr_element = lr_node->get_element( index = 1 ).

CALL METHOD lr_element->set_attribute

EXPORTING

value = lr_top_element

name = 'CONTENT'.