cancel
Showing results for 
Search instead for 
Did you mean: 

How can you wordwrap text in an ALV GRID Column

Former Member
0 Kudos

IS there any way I can set an ALV GRID Column to wordwap onto the second line if there is too much text for the Column Width?

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi Janice,

i have a workaround for you if you like it.

The basic idea is to use the EXCEL view instead of the ALV-Grid view - you can change this in the view section within the change layout function and define this as the default view.

Now you need to create an own EXCEL template, which reformats the column as you like. For this please have first a look into the SAP note number 548409.

The code for your problem could look like this:

Sub CellLineBreak()

Dim suchen As Boolean

Dim Text() As String

Sheets("Format").Select

Sheets("Format").Copy Before:=Sheets(1)

Sheets("Format (2)").Select

Sheets("Format (2)").Name = "Data"

Sheets("Data").Select

Set c = ActiveSheet.Cells(2, 1)

suchen = True

While suchen

If Len(Trim(c.Value)) > 0 Then

Set c1 = c.Offset(0, 😎

Text = Split(c1.Value, "/")

c1.FormulaR1C1 = ""

For j = 1 To UBound(Text)

If j < UBound(Text) Then

c1.FormulaR1C1 = c1.FormulaR1C1 & Text(j) & Chr(10)

Else

c1.FormulaR1C1 = c1.FormulaR1C1 & Text(j)

End If

Next

Set c = c.Offset(1, 0)

Else

suchen = False

End If

Wend

Sheets("Format").Select

ActiveSheet.Name = "Formate"

Sheets("Data").Select

End Sub

Upload this new EXCEL template into your report by using the function "upload document to BDS" in the View section within the change layout function - it is the 5th button left. Now mark this as default template and save this as the default layout of this report (standard ALV functionality).

When you now start your report the output list will be an EXCEL list and you will find the reformated data in the sheet "Daten" - by now i was not able to delete the other (SAP-)sheets because the EXCEL method "DisplayAlerts" doesn't work for what reason however???

I hope i explained my solution in a way that you could follow - otherwise let me know where you stopped reading (or understanding)

All the best

Günter

Former Member
0 Kudos

Hi,

Take a look at the artcle:

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d97...

cheers

Aveek

Reward with points if useful.

Former Member
0 Kudos

Janice,

I am sure that this not the answer that you wanted.

But don't forget to reward those points. Thanks!!!

Note - You can surf through the SDN using search phrase "wrap text" to further confirm that it is NOT possible... just yet.

Former Member
0 Kudos

Hi there,

That's why the purpose of the short text, medium text and long text are used here for display.

Weidong

Former Member
0 Kudos

What do you mean by the short text, medium text and long text are used here for display? thx

Former Member
0 Kudos

In the field catalog on an ALV, you can tell the GUI what text to display as the column width gets expanded or shrunk.

This is done in the field catalog variables:

SCRTEXT_L

SCRTEXT_M

SCRTEXT_S

This is not truly a word wrap... but it does provide for extra text on a single line.

Former Member
0 Kudos

Janice,

If you are looking for a work around to display some long text of a PO / Material, what you can do add a extra column to the report, make it a button. When the user clicks on the button, show the TEXT EDIT control in a dialog container and do a READ TEXT of the long text and display it there.

WORD WRAP is NOT possible in ALV.

Regards,

Ravi

Note : Please mark the helpful answers.

Former Member
0 Kudos

Hi Janice,

In my knowledge i dont think there is a wordwrap functionality in the column of alv grid.

instead of that

1. you can make the column text as link so that even if the whole text in a column is not seen the user can see the entire text on mouse over.

2. or you can make a functionality where in on clicking on the cell, a popup comes with the entire text.

hope you find the answer useful.

regards,

Kinshuk

Former Member
0 Kudos

No there is not. Hopefully it will be part of the product in the future.