ABAP ALV-GRID Export to Excel: multiline text output in cells

This is an example of how to fill several lines of data with ALV GRID and the Export to Excel cells. We can first define our text components as text symbols, but you can also use normal string variables.

Textsymbole     Inhalt

001         This is line 1.

002         line 2.

003         third line.

004         last line.

Now we combine the components:

Text + new line  separator + text + new line separator ………

Then the complete text string is provided with a start and end characters. This signals the Excel commands are mixed with text together in a chain.

Start character + Text with commands + end character

Field l_cell_text can now be issued with ALV in an Excel spreadsheet.

It is important to remember the field length of 255 points including new line characters and the beginning and end characters. If the last point is not occupied one end characters then all other data is output in only one Excel cell.

At various points, SAP has a technical limit of 255 characters set for text fields when in other programs, eg Excel to be exported.