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: 

How to add the title for a cl_salv_table

Former Member
0 Kudos
22,150

Hello,Everyone,

I am looking for the method to add a title for a cl_salv_table ,for telling user

this table displaying for what ,but I can't find any method to achieve that,could someone help me?

Thanks a lot.

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
2,865

Here is an example. Use the set_list_header method of the cl_salv_display_Settings class.



report  zalvom_demo1.

data: ispfli type table of spfli.

data: gr_table     type ref to cl_salv_table.
data: gr_functions type ref to cl_salv_functions.
data: gr_display   type ref to cl_salv_display_settings.

start-of-selection.

  select * into table ispfli from spfli.


  cl_salv_table=>factory( importing r_salv_table = gr_table
                           changing t_table      = ispfli ).

  gr_functions = gr_table->get_functions( ).
  gr_functions->set_all( abap_true ).

  gr_display = gr_table->get_display_settings( ).
  gr_display->set_list_header( 'This is the title' ).

  gr_table->display( ).

Regards,

RIch Heilman

6 REPLIES 6

RichHeilman
Developer Advocate
Developer Advocate
2,866

Here is an example. Use the set_list_header method of the cl_salv_display_Settings class.



report  zalvom_demo1.

data: ispfli type table of spfli.

data: gr_table     type ref to cl_salv_table.
data: gr_functions type ref to cl_salv_functions.
data: gr_display   type ref to cl_salv_display_settings.

start-of-selection.

  select * into table ispfli from spfli.


  cl_salv_table=>factory( importing r_salv_table = gr_table
                           changing t_table      = ispfli ).

  gr_functions = gr_table->get_functions( ).
  gr_functions->set_all( abap_true ).

  gr_display = gr_table->get_display_settings( ).
  gr_display->set_list_header( 'This is the title' ).

  gr_table->display( ).

Regards,

RIch Heilman

0 Kudos
2,865

Hi,Rich,

Thanks very much !

0 Kudos
2,865

That worked properly. Thank you.

0 Kudos
2,865

Hi edmilson.. for me it is showing get_functions and get_display_settings is unknown.How u use this and declare instance method for this

0 Kudos
2,865

It is showing get_functions and get_display_settings is unknown..how to solve that issue...how to use these instance method

0 Kudos
2,865

vivekmalhotra981

Hello, While we're happy that you've come to SAP Community to get an answer to your question, you posted your question as a comment in an old thread.

If you're looking for help, you should ask a new question: https://answers.sap.com/questions/ask.html.
Here are some tips to help you craft an effective question for our community: https://community.sap.com/resources/questions-and-answers, https://developers.sap.com/tutorials/community-qa.html, https://groups.community.sap.com/t5/welcome-corner-discussions/advice-from-sap-champions-questions-a....
I encourage you to follow this guidance, as I'd really like to see you get a solution to your problem.
I hope you find this advice useful!