cancel
Showing results for 
Search instead for 
Did you mean: 

ALV Column Header in 2 Lines

Former Member
0 Kudos

Hi All,

we have a WD4A. Ther is an ALV and the Header from some Columns are very long.

Itis possible to set this Header in 2 lines?

Have anybody an idea?

Thanks

Best ragards,

Markus

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can use WRAP_TEXT functionality.

Check out cl_salv_wd_column_header->ALV column header where you can find the method for warpping.

DATA: lr_alv_header type ref to cl_salv_column.

Get the column reference for that column.

lr_alv_header = lr_column->get_header( ).

Regards,

Lekha.

Edited by: Lekha on Aug 30, 2009 7:14 PM

Former Member
0 Kudos

Hi Lekha,

thanks for the reply.

Now i have at the Header Something like that 'This is a test...'.

What sould i do that i have 2 lines in the Header something like that:

'This is a test with

a long Header line'

I hope you can help me

Best rregards,

Markus

Former Member
0 Kudos

Hi,

set the width of the column,

get the header reference and use the method SET_HEADER_TEXT_WRAPPING by passing abap_true.

CALL METHOD lr_column->get_header
          RECEIVING
            value = lr_alv_header.   "cl_salv_wd_column_header
        lr_alv_header->set_ddic_binding_field(
         if_salv_wd_c_ddic_binding=>ddic_bind_none ).
        lr_alv_header->set_text( 'Desc' ).    "Your text header
        lr_column->set_resizable( abap_true ).
        lr_alv_header->set_header_text_wrapping( abap_true ).

Regards,

Lekha.

Former Member
0 Kudos

Hi,

i have do this but it doenst work.


    lr_column_settings ?= wd_this->r_table.
    lr_column = lr_column_settings->get_column( column_z ).
    lr_column->r_header->set_text( value = value_z_h ).
    lr_column->r_header->set_tooltip( value = value_z_t ).
*    lr_column->set_width( '150' ).
    lr_column->SET_RESIZABLE( abap_true ).
    lr_column->r_header->set_header_text_wrapping( abap_true ).

What do i wrong?

Best regards,

Markus

Former Member
0 Kudos

Hi,

Have you used DDIC binding as NONE. Have you checked the header is set to yours.

Try to reduce the width to 80 or 100 and check it.

Regards,

Lekha.

Former Member
0 Kudos

Hi,

i have changed to:


    lr_column_settings ?= wd_this->r_table.
    lr_column = lr_column_settings->get_column( column_z ).
    lr_column->r_header->set_ddic_binding_field( if_salv_wd_c_ddic_binding=>ddic_bind_none ).
    lr_column->r_header->set_text( value = value_z_h ).
    lr_column->r_header->set_tooltip( value = value_z_t ).
    lr_column->set_width( '80' ).
    lr_column->SET_RESIZABLE( abap_true ).
    lr_column->r_header->set_header_text_wrapping( abap_true ).

but it doesn´t work. I have only one line.

Best ragards,

Markus

Former Member
0 Kudos

Hi,

Where have you written the code.

One more thing, also set the FIXEDLAYOUT for the ALV table as abap_true.

data:

lr_tabset type ref to if_salv_wd_table_settings.

lr_tabset ?= lo_value.

lr_tabset->set_fixed_layout as abaptrue.

Then set the column header as per your code.

I think this should work.

Regards,

Lekha.

Former Member
0 Kudos

Hi,

i have set the fixed_layout.

i have write the code in method WDDOINIT of the Component Controller.

Best regards,

Markus

Former Member
0 Kudos

Hi,

Everything is fine, please tst it agian.

Set the table widht as '100%'.

Try reducing the width of column.

Regards,

Lekha.

Edited by: Lekha on Aug 31, 2009 1:55 PM

Former Member
0 Kudos

Hi,

all settings doesn´t work :-(.

We have SAP_BASIS 701 0004 SAPKB70104.

Is there a problem with this version maybe?

Have you any other idea?

Best ragards,

Markus

Former Member
0 Kudos

Have you any other idea?

Best regards,

Markus

Former Member
0 Kudos

Hi,

I have applied the text wrapping functionality for both the column and also the cell content.

Also set the column width.

I have checked the SET_FIXED_TBALE_LAYOUT as abap_true/ abap_false both the cases.

I observed that, the wrapping holds good when the set_fixed_table_layout is abap_false.

When it is set to true, wrapping has no effect.

Regards,

Lekha.

Former Member
0 Kudos

Hi,

so if i understand right i should do this -> lr_table_settings->set_fixed_table_layout( abap_false ).

Is that right?

Sorry buit this not solve the problem :-(. Now i have a long Header with the hole name.

Best regards,

Markus

Former Member
0 Kudos

Hi,

There could be some problems with the service pack levels also.

Please check wether some where you code is overwritten.

Try to reduce the wdith of colum. If it is a textview for that column, try to set wrapping for that textview also.

Check this out -

Yes, Im checking that behavior when fixed layout is set.

Regards,

Lekha.

Former Member
0 Kudos

Hi,

the text wrapping for the textview works. Only the Header didn´t do a text wrapping.

This is my code and i think the code is ok:


    lr_column_settings ?= wd_this->r_table.
    lr_column = lr_column_settings->get_column( column_z ).
    lr_column->r_header->set_prop_ddic_binding_field( value = if_salv_wd_c_ddic_binding=>ddic_bind_none ).
    lr_column->r_header->set_text( value = value_z_h ).
    lr_column->r_header->set_tooltip( value = value_z_t ).
    CREATE OBJECT textview.
    textview->set_text_fieldname( column_z ).
    textview->set_wrapping( abap_true ).
    lr_column->set_cell_editor( textview ).

    lr_column->r_header->set_header_text_wrapping( abap_true ).

i don´t know what is wrong

Best regards,

Maarkus

Former Member
0 Kudos

Also set the width of the column

lr_col->set_width( '10' ).

Try checking with fixed layout as false and true. It should work.

Former Member
0 Kudos

Hi,

i have checked all settings.

All settings are not solved the issue. the cell do the wrapping the header not.

I will create a message to SAP if anyone haven´t a another idea?

Thanks

Best regards,

Markus

Former Member
0 Kudos

Hi,

Give me the column name its Dataelement, the width you have set to, it's header... so that i can check it out.

Regards,

Lekha.

Former Member
0 Kudos

Hi,

the Dataelement is 'WOSTD'.

the width of the table is 100% and the width of the column is 80.

Will you check it in your System with this data?

Best regards,

Markus

Former Member
0 Kudos

Hi,

have you something test. Have you a new idea?

Thanks

Best Regards,

Markus

Former Member
0 Kudos

Hi,

This is what I coded. I didnot set any table widht or fixed layout

data: lr_col type ref to cl_salv_wd_column,
      lr_colH type ref to cl_salv_wd_column_header.

CALL METHOD lv_value->if_salv_wd_column_settings~get_column
  EXPORTING
    id     = 'WOSTD'
  receiving
    value  = lr_col.

    lr_col->set_width( '30' ).
    lr_col->SET_RESIZABLE( abap_true ).
 CALL METHOD lr_col->get_header
  receiving
    value  = lr_colh.
lr_colh->set_prop_ddic_binding_field( value = if_salv_wd_c_ddic_binding=>ddic_bind_none ).
lr_colh->set_text( value = 'This is long text for demo' ).
lr_colh->set_header_text_wrapping( abap_true ).

I can see the header getting wrapped.

I also set the width as 80 now also i could see the wrapping.

Regards,

Lekha.

Edited by: Lekha on Sep 2, 2009 8:24 PM

Former Member
0 Kudos

Hi,

i had to the same coding as you but it doesn´t work.

I will ask SAP maybe there is a sp issue.

What is yours?

Best regards,

Markus

Former Member
0 Kudos

Yes, You can do that.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

I want to update the OSS note for anyone who has the same problem:

Note [1383088|https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1383088]

Regards,

Khanh

Former Member
0 Kudos

I had open an OSS Call and get a note from SAP. Now its works.

Thanks for the help.

Best regards,

Markus