‎2008 Jul 16 6:05 AM
Data file at application server is like this.
RAJU#SOM#1701 AVENUE#DELI#IN#EN#12345 --->record1
ARTHUR##1701 NW 23 AVENUE####12345 -
>record2
-
Read file into work_area.
SPLIT work_area AT '#' INTO f1
f2
f3
f4
f5
f6
f7.
if the work_area is seperated by one # then it is splitting and sy-subrc is 0. That is first record is spliting fine.
for the second record. sy-subrc is 4, i.e., this split is not splitting work_area into the 7 fields.
Please help out with this urgent.
‎2008 Jul 16 11:20 AM
Wipee,
This appears to work.
J
REPORT ZJKSW_TREST1.
Constants: Tab_mark type string value cl_abap_char_utilities=>HORIZONTAL_TAB.
Data: c_hash type string,
c_pipe type string.
c_pipe = '|'.
c_hash = '#'.
data : a type string,
b type string,
c type string.
data: f1(10),f2(10),f3(10),f4(10),f5(10),f6(10),f7(10).
concatenate 'RAJU' tab_mark tab_mark tab_mark tab_mark 'SPRING' tab_mark 'Smith' tab_mark into c.
replace tab_mark with c_pipe into c.
replace tab_mark with c_pipe into c.
replace tab_mark with c_pipe into c.
replace tab_mark with c_pipe into c.
replace tab_mark with c_pipe into c.
replace tab_mark with c_pipe into c.
SPLIT c AT '|' INTO f1
f2
f3
f4
f5
f6
f7.
write:/ f1,f2,f3,f4,f5,f6,f7.
‎2008 Jul 16 8:05 AM
Why not try the following:
REPLACE ALL OCCURRENCES OF '#' IN work_area WITH '|'.
SPLIT work_area AT '|' INTO f1
f2
f3
f4
f5
f6
f7.
Often on your dataloads we use the pipe field to delimit data
Hope this helps
J
‎2008 Jul 16 9:22 AM
Hi J,
Replace ALL OCCURANCE IS NOT WORKING.
THAT IS, # is not replacing with |.
and if there is only one # in between 2 fields its replacing.
if there are two # in between its not replacing.
Can you please explain why
‎2008 Sep 11 2:36 PM
Hi J,
My requirement is to add a custom button in the ALV output and handle that button after user presses.
So, can any body please tell in which method of BADI: CATS_REPORTING, a custom button can be added in the ALV output of tcode CATS_APPR_LITE and in which method the custom button can be handled.
This tcode is related to Cats Time Approve.
Thanks in advance
‎2008 Jul 16 9:33 AM
My6 guess is that ## is being treated as a Unicode character. Looking at Tabs, Line Feeds and Carriage returned these are displayed as #.
If the | works why worry.
J
‎2008 Jul 16 9:39 AM
Hey J,
For two # i.e., ## replace all occurance and split is not working so can you please tell me any solution to seperate the fields.
Thanks.
‎2008 Jul 16 9:55 AM
This works in ECC6.0
Otherwise the old and trusted method.
Do 6 times
replace '#' with '|' into work_area.
enddo.
J
‎2008 Jul 16 10:07 AM
‎2008 Jul 16 10:16 AM
Your code works on our system so you are not going mad, I cut and pasted it into a test program.
test
RAJU SOM 1701 AVENU DELI IN EN 12345
ARTHUR 1701 NW 23 12345
sorry can't add the screen print to this
I have checked it out - what version of SAP are you on? May be that is the difference.
Does the file have to be delimited by # what if it is delimited by |. My concerns are unicode.
J
‎2008 Jul 16 10:24 AM
Hi J,
I am using ECC 6.0
and yes the file is delimited by # only
RAJU#SOM#1701 AVENUE#DELI#IN#EN#12345 --->record1
ARTHUR##EUM###12345 -
>record2
record 1 is working fine.
record 2 giving problem because fields are delimited by more than one #
‎2008 Jul 16 10:30 AM
This has got to be something to do with unicode. What does the file look like before it is loaded to the application server. I have seen ',' transfered to the application server as # due to Unicode
J
‎2008 Jul 16 10:37 AM
the file is tab delimited .txt file
which is uploaded into application server.
That is the reason the fields in the application server is seperated by #
Edited by: Jalaaluddin Syed on Jul 16, 2008 3:10 PM
‎2008 Jul 16 10:44 AM
Definitely a unicode thing
try.
Constants: Tab_mark(2) type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
Split at tab_mark.......................etc.
Or
Also when the file is being transfered to the application servce I assume by FTP try different settings maybe IBM.( this is a guess I as Don't have access to FTP stuff'.
J
‎2008 Jul 16 11:19 AM
Hey J
there are 2 transfer format 1. is BIN and other is ASC
so i have used both but its delimiting with # only
and can you please explain me wht you have sent in ur last forum
***************************************************
Constants: Tab_mark(2) type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
Split at tab_mark.......................etc.
Or
Also when the file is being transfered to the application servce I assume by FTP try different settings maybe IBM.( this is a guess I as Don't have access to FTP stuff'.
‎2008 Jul 16 9:41 AM
This works so you must have missed a step.
J
REPORT ZJKSW_TREST.
types w_area(252) type c.
data work_area type standard table of w_area with header line.
data: f1(20) type c,
f2(20) type c,
f3(20) type c,
f4(20) type c,
f5(20) type c,
f6(20) type c,
f7(20) type c.
work_area = 'RAJU#SOM#1701 AVENUE#DELI#IN#EN#12345'.
append work_area.
work_area = 'ARTHUR##1701 NW 23 AVENUE####12345'.
append work_area.
Loop at work_area.
replace all occurrences of '#' in work_area with '|'.
SPLIT work_area AT '#' INTO f1
f2
f3
f4
f5
f6
f7.
endloop.
‎2008 Jul 16 9:42 AM
‎2008 Jul 16 9:55 AM
Hey J its moving only the first field.
and as i said replace all occurance is not working at all
‎2008 Jul 16 10:02 AM
hi syed,
it will not give sy-subrc = 4.
what it will do is that it will split on every # and your string in f2, f4,f5,f6 will be empty as there is no space between #### in second record
check this code
data: a type string,
b type string.
data: f1(20),f2(20),f3(20),f4(20),f5(20),f6(20),f7(20).
a = 'RAJU#SOM#1701 AVENUE#DELI#IN#EN#12345'.
b = 'ARTHUR##1701 NW 23 AVENUE####12345'.
SPLIT a AT '#' INTO f1
f2
f3
f4
f5
f6
f7.
write:/ f1,f2,f3,f4,f5,f6,f7.
SPLIT b AT '#' INTO f1
f2
f3
f4
f5
f6
f7.
write:/ f1,f2,f3,f4,f5,f6,f7.
Sachin
‎2008 Jul 16 10:11 AM
ya sachin its filling on the first field i.e., f1.
rest of the fields are empty.
Can you please tel me the solution of this
‎2008 Jul 16 11:20 AM
Wipee,
This appears to work.
J
REPORT ZJKSW_TREST1.
Constants: Tab_mark type string value cl_abap_char_utilities=>HORIZONTAL_TAB.
Data: c_hash type string,
c_pipe type string.
c_pipe = '|'.
c_hash = '#'.
data : a type string,
b type string,
c type string.
data: f1(10),f2(10),f3(10),f4(10),f5(10),f6(10),f7(10).
concatenate 'RAJU' tab_mark tab_mark tab_mark tab_mark 'SPRING' tab_mark 'Smith' tab_mark into c.
replace tab_mark with c_pipe into c.
replace tab_mark with c_pipe into c.
replace tab_mark with c_pipe into c.
replace tab_mark with c_pipe into c.
replace tab_mark with c_pipe into c.
replace tab_mark with c_pipe into c.
SPLIT c AT '|' INTO f1
f2
f3
f4
f5
f6
f7.
write:/ f1,f2,f3,f4,f5,f6,f7.
‎2008 Jul 16 11:38 AM
‎2008 Jul 16 11:40 AM