4 weeks ago
Hello,
Need inputs on below requirement:
I would like to move data into excel of an internal table which has a field that stores long text with multiple lines separated by '#' (cl_abap_char_utilities=>newline). I would like to replace "#' with some character so that it will add that entry in a new line in the downloaded excel.
Please find the below use case:
say, I have data in internal table it_tab1 with work area ls_tab1.
Now, this lstab1-<field> = string1 #string2 #string3
Now, I want input of the field in the downloaded excel as below:
string1
string2
string3
Please provide possible solutions.
Note: I have used below statement still not able to get data as expected.
REPLACE ALL OCCURRENCES OF '#' IN lstab1-<field> WITH cl_abap_char_utilities=>newline.
and I am using SCMS_STRING_TO_XSTRING FM to convert string to xstring.
Thanks in Advance!
First of all: the # character you're seeing isn't really a # at all, but a placeholder for a non-printable character which cannot be displayed in the debugger. (If you switch the display of the variable to hex, you'll see that the hex value of e.g. a line feed character is 0A, whereas an actual hash character in hex would be 23).
So, replacing '#' with NEWLINE will presumably return a SY-SUBRC <> 0, because there are no real # characters in your string.
Now, to your problem. The way I understand it, you have an internal table containing something like this (whereas the # stands for a NEWLINE character):
string1#string2#string3
string4#string5#string6
And you would like to transform this into a table like this:
string1
string2
string3
string4
...et cetera.
Correct?
If so, I would first do this splitting in ABAP (SPLIT ls_tab1 AT cl_abap_char_utilities=>newline), building a new table, which then you download in a second step.
As for downloading tables as Excel, there's hundreds of examples here already, so I won't say any thing about that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
57 | |
10 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.