2006 May 05 1:12 AM
Hi,
im trying to use split and im having problems with it.
record : 12345|aaaa|12345.00-|12345.00|
im using SPLIT record at '|' into A B C D. These are of type char.everything is fine except for the field which has a negative sign.im getting zeros.
your help would be appreciated.
Thanks,
kranthi.
2006 May 05 4:22 AM
HI
GOOD
TRY TO USE THIS LOGIC IN YOUR REPORT
DATA: STRING(60),
P1(20) VALUE '++++++++++++++++++++',
P2(20) VALUE '++++++++++++++++++++',
P3(20) VALUE '++++++++++++++++++++',
P4(20) VALUE '++++++++++++++++++++',
DEL(3) VALUE '***'.
STRING = ' Part 1 *** Part 2 *** Part 3 *** Part 4 *** Part 5'.
WRITE STRING.
SPLIT STRING AT DEL INTO P1 P2 P3 P4.
WRITE / P1.
WRITE / P2.
WRITE / P3.
WRITE / P4.
THANKS
MRUTYUN
2006 May 05 1:18 AM
Hi,
are you sure the '|' is actually that? It may be some other hex value represented as '|'. You could try the following:
SPLIT record at CL_ABAP_CHAR_UTILITIES=>VERTICAL_TAB
into A B C D.
Otherwise, how are your fields record,a,b,c and d defined?
this code seems to work (though of course the final field has the '|' still):
data: a(10),b(10),c(10),d(10).
data record(40)
value '12345|aaaa|12345.00-|12345.00|'.
SPLIT record at '|' into A B C D.
write:/ a,b,c,d.
2006 May 05 4:14 AM
Hi,
The below code will work for you...
Report test.
data: value1 type string value '12345|aaaa|12345.00-|12345.00|',
a type string,
b type string,
c type string,
d type string,
e type string.
SPLIT value1 at '|' into A B C D E.
write:/ a,
/ b,
/ c,
/ d,
/ e.
Regards,
Anjali
2006 May 05 4:16 AM
Hey Kranthi,
just copy and paste . Then run . You will get the correct output.
data : record(30) type c value '12345|aaaa|12345.00-|12345.00|'.
data : a type str,
b type str,
c type str,
d type str.
split record at '|' into a b c d.
d = d+0(8).
write : / a,/ b,
/ c,
/ d.
Regards,
Kunal.
2006 May 05 4:22 AM
HI
GOOD
TRY TO USE THIS LOGIC IN YOUR REPORT
DATA: STRING(60),
P1(20) VALUE '++++++++++++++++++++',
P2(20) VALUE '++++++++++++++++++++',
P3(20) VALUE '++++++++++++++++++++',
P4(20) VALUE '++++++++++++++++++++',
DEL(3) VALUE '***'.
STRING = ' Part 1 *** Part 2 *** Part 3 *** Part 4 *** Part 5'.
WRITE STRING.
SPLIT STRING AT DEL INTO P1 P2 P3 P4.
WRITE / P1.
WRITE / P2.
WRITE / P3.
WRITE / P4.
THANKS
MRUTYUN