cancel
Showing results for 
Search instead for 
Did you mean: 

Line break in ALV cells?

Former Member
0 Kudos

Hi,

I want to use line break in alv columns. If column data is very big, it should come in next line(ie. text should get wrapped). Is it possible in ALV? I have used the input field in ALV cells. Pls help me on this.

Thanks,

GS

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I don't have any idea on ALV column wrapping but it is quite possible with ALV column header. You can do this by using the method SET_HEADER_TEXT_WRAPPING of class CL_SALV_WD_COLUMN_HEADER.

Check out the SAP help for [Line Breaks in Column Headers|http://help.sap.com/saphelp_nw70/helpdata/EN/f7/924a3de0384c2c893ca867cb936551/content.htm].

Former Member
0 Kudos

Hi,

Thank you fro your reply. But i already aware of this. I want to wrap in ALv cells. Is it possible?

Thanks,

SathishkumarGs

Former Member
0 Kudos

I have not tested it but are you able to change the ALV cell UI elements from Input field to TextView? As Textview having a property of wrapping.

TomVanDoo
Active Contributor
0 Kudos

Very correct Sanket.

As per default, for editing the ALV grid uses the "inputfield" element, which is single line based. in other words, no multiple lines, no wrapping. For display the "textview" element is used. In neither cases, a fixed width is used, which means that the column explands as the text grows longer

For edit, you can change the element that must be used in a specific column of your alv (plenty of topics and how to's on that subject). If you change the element type to a "textedit" element you can get wrapping.

However, you still have to set a property for fixed with, to make sure the column doesn't just expand, but keeps it's width and turn on the wrapping property. by doing so, the text will wrap in your defined with.

(if you put a textedit, or textview directly in your layout, you'll notice the 'wrapping' property.)

Edited by: Tom Van Doorslaer on Jun 1, 2010 2:27 PM

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Here is a code sample for what you are asking for (using the textView as a column within the ALV with wrapping).

data: l_ref_cmp_usage type ref to if_wd_component_usage.
  l_ref_cmp_usage =   wd_this->wd_cpuse_alv_basic( ).
  if l_ref_cmp_usage->has_active_component( ) is initial.
    l_ref_cmp_usage->create_component( ).
  endif.

  data l_salv_wd_table type ref to iwci_salv_wd_table.
  l_salv_wd_table = wd_this->wd_cpifc_alv_basic( ).
  data l_table type ref to cl_salv_wd_config_table.
  l_table = l_salv_wd_table->get_model( ).

  data l_column type ref to cl_salv_wd_column.
  data textview type ref to cl_salv_wd_uie_text_view.
  l_column = l_table->if_salv_wd_column_settings~get_column( 'ADD_PARTICIPANTS' ).
  create object textview.

  textview->set_text_fieldname( 'ADD_PARTICIPANTS' ).
  textview->set_wrapping( abap_true ).
  l_column->set_cell_editor( textview ).

Former Member
0 Kudos

Hi,

Thank you very much for your reply. I have a question. Can we edit the textview in alv? Because my requirement is like i should edit the alv cells and enter the big data, and if i save, it should get wrapped.

Thanks,

GS

Former Member
0 Kudos

You can try with Textedit.

Former Member
0 Kudos

hi,

Thank you. Do we have any specific class type for using textedit.?

Thanks,

GS

Former Member
0 Kudos

There are only below classes to change the UI Element in Cells of ALV Output. So I have no idea that we can use Textedit in ALV cell or not.

Just wait for Thomas or any other perosons reply on the same.

CL_SALV_WD_UIE

CL_SALV_WD_UIE_A_BUTTON

CL_SALV_WD_UIE_A_CAPTION

CL_SALV_WD_UIE_A_DRDN_BY_IN

CL_SALV_WD_UIE_A_DRDN_BY_KE

CL_SALV_WD_UIE_A_DROPDOWN

CL_SALV_WD_UIE_A_INPUT

CL_SALV_WD_UIE_A_LINK

CL_SALV_WD_UIE_A_TOGGLE

CL_SALV_WD_UIE_A_TOGGLE_BUT

CL_SALV_WD_UIE_BUTTON

CL_SALV_WD_UIE_CAPTION

CL_SALV_WD_UIE_CHECKBOX

CL_SALV_WD_UIE_CHECKBOX_TRI

CL_SALV_WD_UIE_DROPDOWN_BY_INDEX

CL_SALV_WD_UIE_DROPDOWN_BY_KEY

CL_SALV_WD_UIE_FILE_DOWNLOA

CL_SALV_WD_UIE_IMAGE

CL_SALV_WD_UIE_INPUT_FIELD

CL_SALV_WD_UIE_LINK_TO_ACTI

CL_SALV_WD_UIE_LINK_TO_URL

CL_SALV_WD_UIE_PROGR_INDICA

CL_SALV_WD_UIE_TEXT_VIEW

CL_SALV_WD_UIE_TOGGLE_BUTTO

CL_SALV_WD_UIE_VALUE_CMP

Former Member
0 Kudos

Hi Thomas,

Can you please help me on this?

Thanks,

GS

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Sorry. There is no TextEdit cell editor - only TextView. If you would need to edit such data I would suggest opening a record at a time in a form via lead selection or in a dialog popup, so that you can use any UI element you want.

Answers (0)