on 06-01-2010 12:30 PM
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
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].
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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 ).
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
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.