Hi ,
I have an issue with removing the carriage return / Tab from the extracted (Flat File) data from SAP EKPO table.
1) While uploading(Long Back) the Legacy data to SAP tables the carriage returns and Tabs in Product description were uploaded to SAP tables.
2) Now I am extracting data from bkpf,..EKPO.. tables to a flat file .
3) When I extract the data i. PO number, Product description,……
The Product description is going to 3 to 5 lines depending on the carriage returns and Tabs in the Product description. Ekpo-txz01
Ex : Mfg # DS104NA / NET######GEAR DS104 Hub######model
I want this product description in one continuous line. It is possible only by removing the Carriage returns and tabs from product description before concatenating and TRANSFERING the file to Server.
4) What is getting: The line is breaking @gear @ Hub due to Carriage return/Tab
Mfg D NET
GEAR DS104 Hub
model .
5) What is required is: in one line
Mfg D NETGEAR DS104 model
In the process I am extracting product description from Ekpo-txz01 . So it is internal table. Now I want to remove the carriage return / Tab .
How these can be removed.
Thanks,
Vasu
Nablan Umar
Posts: 509
Questions: 4
Forum Points: 410
Registered: 8/3/04
Re: Removing the carriage return / Tab during data extraction
Posted: Nov 4, 2004 4:05 PM Reply E-mail this post
Vasu,
You can replace tab and carriage return of your text using REPLACE command.
REPLACE cl_abap_char_utilities=>horizontal_tab in
Ekpo-txz01 with ‘ ‘.
REPLACE cl_abap_char_utilities=>CR_LF in
Ekpo-txz01 with ‘ ‘.
vasu bandi
Posts: 9
Questions: 1
Forum Points: 0
Registered: 11/4/04
Re: Removing the carriage return / Tab during data extraction
Posted: Nov 4, 2004 6:01 PM Reply E-mail this post
Hi Umar,
First thanks for giving some solution.
When I use the code as suggested,
1. It is removing ‘Tab’ only. It is not removing carriage return.
2. It is removing one TAB at a time.
3. Still I am seeing a BOX [] after the text in flat file. i.e carriage return is not removed from Ekpo-txz01 .
I Used this and passing Ekpo-txz01 in a loop.
REPLACE cl_abap_char_utilities=>horizontal_tab in
Ekpo-txz01 with ‘ ‘.
REPLACE cl_abap_char_utilities=>CR_LF in
Ekpo-txz01 with ‘ ‘.
Can you suggest some solution/idea for this.
Thanks,
Vasu
Message was edited by: vasu bandi
Rosie Brent
Posts: 18
Questions: 0
Forum Points: 8
Registered: 2/18/04
Re: Removing the carriage return / Tab during data extraction
Posted: Nov 5, 2004 4:58 AM Reply E-mail this post
Try using the TRANSLATE statement instead (as this replaces all instances of the constant found in the string being evaluated).
Hope this helps.
Rosie Brent
Message was edited by: Rosie Brent
Nablan Umar
Posts: 509
Questions: 4
Forum Points: 410
Registered: 8/3/04
Re: Removing the carriage return / Tab during data extraction
Posted: Nov 5, 2004 10:48 AM Reply E-mail this post
Double-click on cl_abap_char_utilities=>CR_LF. You will see other attributes that equal to that BOX. Maybe it is NEWLINE.
vasu bandi
Posts: 9
Questions: 1
Forum Points: 0
Registered: 11/4/04
Re: Removing the carriage return / Tab during data extraction
Posted: Nov 5, 2004 1:57 PM Reply E-mail this post
Hi,
I have used all:
REPLACE cl_abap_char_utilities=>horizontal_tab in
ZTEST001_ITAB-DESCTXZ01 with ‘ ‘.
REPLACE cl_abap_char_utilities=>CR_LF in
ZTEST001_ITAB-DESCTXZ01 with ‘ ‘.
REPLACE cl_abap_char_utilities=>VERTICAL_TAB in
ZTEST001_ITAB-DESCTXZ01 with ‘ ‘.
REPLACE cl_abap_char_utilities=>NEWLINE in
ZTEST001_ITAB-DESCTXZ01 with ‘ ‘.
REPLACE cl_abap_char_utilities=>FORM_FEED in
ZTEST001_ITAB-DESCTXZ01 with ‘ ‘.
REPLACE cl_abap_char_utilities=>BACKSPACE in
ZTEST001_ITAB-DESCTXZ01 with ‘ ‘.
REPLACE cl_abap_char_utilities=>SPACE_STR in
ZTEST001_ITAB-DESCTXZ01 with ‘ ‘.
REPLACE cl_abap_char_utilities=>FORM_FEED in
ZTEST001_ITAB-DESCTXZ01 with ‘ ‘.
Still I was getting symbol [] .
In test data I created this error by pressing ENTER key.
I created a flat file with TAB key and Enter key. Then I uploaded to custom table in SAP. I could see the #### symbols in table.
Then I extracted data to a flat file on server. The TAB keys were removed. But the “Enter key” is shown as [].
Any info on this issue please. How to remove these [] from flat file.
Thanks,
Vasu
Note: On double clicking I am not seeing any thing like []. I could see ## # .
vasu bandi
Posts: 9
Questions: 1
Forum Points: 0
Registered: 11/4/04
Re: Removing the carriage return / Tab during data extraction
Posted: Nov 5, 2004 2:05 PM Reply E-mail this post
Hi,
I tried to use:
data x type x value ‘0A’.
TRANSLATE ZTEST001_ITAB-DESCTXZ01 using x.
I am getting eror : X must be a character-type data object(data type C,N,D,T OR string).
Any info in solving this.
Thanks,
Vasu
Serdar Simsekler
Posts: 984
Questions: 17
Forum Points: 1662
Registered: 6/16/04
Re: Removing the carriage return / Tab during data extraction
Posted: Nov 5, 2004 2:27 PM Reply E-mail this post
Hi
It seems TRANSLATE statement doen’t like x-type arguments.
Our system is 4.6D and I have never used it but give a try to:
REPLACE ALL OCCURRENCES OF x IN y WITH z.
Hope it helps…
*–Serdar
vasu bandi
Posts: 9
Questions: 1
Forum Points: 0
Registered: 11/4/04
Re: Removing the carriage return / Tab during data extraction
Posted: Nov 5, 2004 3:16 PM Reply E-mail this post
Hi,
I tried:
data : CR type x value ‘0D’,
NL type x value ‘0A’.
REPLACE ALL OCCURRENCES OF CR IN ZTEST001_ITAB-DESCTXZ01 WITH ”.
I am getting eror : X must be a character-type data object(data type C,N,D,T OR string).
ZTEST001_ITAB-DESCTXZ01 is like ekpo-txz01.
Thanks,
Vasu
Serdar Simsekler
Posts: 984
Questions: 17
Forum Points: 1662
Registered: 6/16/04
Re: Removing the carriage return / Tab during data extraction
Posted: Nov 5, 2004 3:21 PM Reply E-mail this post
Hi Vasu
Can’t you do this removal of special characters before sending data to SAP?
*–Serdar
Nablan Umar
Posts: 509
Questions: 4
Forum Points: 410
Registered: 8/3/04
Re: Removing the carriage return / Tab during data extraction
Posted: Nov 5, 2004 4:08 PM Reply E-mail this post
Vasu,
Replace need the fields to be character type. Since the problem is that you are not able to find the correct code for that [] (newline), why don’t you see the hex representation of that weird character. You can do that by doing this.
1. Put a break point in your program.
2. While in debugging, display that string. Click on binacular plus icon at the right of field contents.
3. Find out the hex representation of that weird character.
4. Then in your program, declare a variable of type ABAP_CHAR1. Set it to the character you found in 3)
5. Then do a replace on this field.
Hope this will work.
vasu bandi
Posts: 9
Questions: 1
Forum Points: 0
Registered: 11/4/04
Re: Removing the carriage return / Tab during data extraction
Posted: Nov 5, 2004 4:34 PM Reply E-mail this post
Hi,
I tried:
data : CR type x value ‘0D’,
NL type x value ‘0A’.
REPLACE ALL OCCURRENCES OF CR IN ZTEST001_ITAB-DESCTXZ01 WITH ”.
I am getting eror : X must be a character-type data object(data type C,N,D,T OR string).
ZTEST001_ITAB-DESCTXZ01 is like ekpo-txz01.
Thanks,
Vasu
Nablan Umar
Posts: 509
Questions: 4
Forum Points: 410
Registered: 8/3/04
Re: Removing the carriage return / Tab during data extraction
Posted: Nov 5, 2004 4:51 PM Reply E-mail this post
Field CR has to be type character if you want to use replace. Try finding out the character representation of that newline in your string as per in my previous reply.
vasu bandi
Posts: 9
Questions: 1
Forum Points: 0
Registered: 11/4/04
Re: Removing the carriage return / Tab during data extraction
Posted: Nov 5, 2004 4:51 PM Reply E-mail this post
Hi ,
What i see is like this:
k####AC##3
6B232323234143232333202020202020202020202020202020202020202020202020202020202020
So it is 23 . How can we remove this.
Thanks,
VAsu
vasu bandi
Posts: 9
Questions: 1
Forum Points: 0
Registered: 11/4/04
Re: Removing the carriage return / Tab during data extraction
Posted: Nov 5, 2004 5:18 PM Reply E-mail this post
HI,
I am giving the values:
cl_abap_char_utilities=>horizontal_tab — 09
cl_abap_char_utilities=>CR_LF ———- 0D0A
cl_abap_char_utilities=>VERTICAL_TAB — 0B
cl_abap_char_utilities=>NEWLINE —- 0A
cl_abap_char_utilities=>FORM_FEED —- 0C
cl_abap_char_utilities=>BACKSPACE — 08