2013 Apr 23 10:25 AM
Hi experts,
I am generating a file trough an abap program. I am retrieving my records in a BW infocube (to simplify let's say a SAP table).
The issue is that empty information are generated as ‘#’ in my file. I would like to suppress all ‘#” from my file which contains 5 columns.
The file today is like this:
Field A | Field B | Field C | Field D | Field E |
A | AA | AAA | AAAA | 20 |
B | BB | BBB | # | 55 |
What I would lik to do is this:
Field A | Field B | Field C | Field D | Field E |
A | AA | AAA | AAAA | 20 |
B | BB | BBB | 55 |
I don’t know if in abap there exit something like this (i am also looking for a performant statement because my file may contain too much records):
Loop at all columns of the file
REPLACE ALL OCCURRENCES OF '#' WITH ' '. .
ENDLOOP.
Thanks for your advices.
Amine
2013 Apr 23 10:52 AM
Use field symbols during LOOP, and as BW set the field to # for initial values, don't use a CPU consuming statement like REPLACE but check for each subfield values.
LOOP AT itab ASSIGNING <record>.
DO 5 TIMES.
ASSIGN COMPONENT sy-index OF STRUCTURE <record> TO <fs>.
IF <fs> EQ '#'.
CLEAR <fs>.
ENDIF.
ENDDO.
ENDLOOP.Regards,
Raymond
Hi experts,
I am generating a file trough an abap program. I am retrieving my records in a BW infocube (to simplify let's say a SAP table).
The issue is that empty information are generated as ‘#’ in my file. I would like to suppress all ‘#” from my file which contains 5 columns.
The file today is like this:
Field A | Field B | Field C | Field D | Field E |
A | AA | AAA | AAAA | 20 |
B | BB | BBB | # | 55 |
What I would lik to do is this:
Field A | Field B | Field C | Field D | Field E |
A | AA | AAA | AAAA | 20 |
B | BB | BBB | 55 |
I don’t know if in abap there exit something like this (i am also looking for a performant statement because my file may contain too much records):
Loop at all columns of the file
REPLACE ALL OCCURRENCES OF '#' WITH ' '. .
ENDLOOP.
Thanks for your advices.
Amine
2013 Apr 23 10:43 AM
Hi Amine
You can use REPLACE ALL OCCURRENCE IN TABLE command
Regards
Swati
2013 Apr 23 10:44 AM
Hi,
As # is some garbage character.
You can try like this with this class .
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>cr_lf in text with space.
There are few thread on this,search also.
Thanks
Gourav.
2013 Apr 23 10:47 AM
Hi Amine,
The coding works fine in ABAP but here the # is coming while display in Excel.
Even if you write code in Customer Exit will not work.
2013 Apr 23 1:55 PM
Hi Sai,
Actually, when i consult my file in AL11, the '#" occurences are already present...
Amine
2013 Apr 23 10:52 AM
Use field symbols during LOOP, and as BW set the field to # for initial values, don't use a CPU consuming statement like REPLACE but check for each subfield values.
LOOP AT itab ASSIGNING <record>.
DO 5 TIMES.
ASSIGN COMPONENT sy-index OF STRUCTURE <record> TO <fs>.
IF <fs> EQ '#'.
CLEAR <fs>.
ENDIF.
ENDDO.
ENDLOOP.Regards,
Raymond
2013 Apr 23 1:57 PM
Hi Raymond,
Thank you for your answer.
What would be <record>? Table/Column..... How should i declare it?
And <fs> i guess it's field symbol.How do you advice me to declare it? (type all?)
Thanks.
Amine
2013 Apr 23 2:37 PM
2013 Apr 23 2:41 PM
Ok thanks. I will let you know after my tests on the system.
Amine
2013 Apr 24 1:28 PM
Hi Raymond,
I have a question regarding the statment : DO 5 times
It's because i have 5 columns, right?
Amine
2013 Apr 24 1:47 PM
2013 Apr 24 1:51 PM
2013 Apr 23 2:51 PM
This really scares me: I don't know where is documentation for this: In SAP, # usually means the character can not be displayed because it is a control character like tab, newline etc.
Please use debugger, check hexadecimal value of what looks like # and replace using CL_ABAP_CHAR_UTILITIES attributes, i.e. HORIZONTAL_TAB, VERTICAL_TAB, NEWLINE, CR_LF, FORM_FEED or BACKSPACE.
Regards
Clemens
2013 Apr 23 4:44 PM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |