‎2009 May 15 12:08 AM
hi experts,
i have a problem with a split, im trying to split a string into a substring with this '##' as break.
i have this data for example:
msg = 'abcdefg hijk##lmn opq'
and i do this
split msg at '##' into table msg_table.
and in msg_table i have one row with 'abcdefg hijk##lmn opq' when i should have 2 rows.
but if i use
split msg at space into table msg_table.
i have 3 rows as a result.
i tried using a single '#' but it doesnt work neither. Is there a problem using #s as breaks???????
thx in advance.
‎2009 May 15 4:12 AM
try:
data message TYPE string VALUE 'abcdefg hijk##lmn opq'.
data msg_table TYPE TABLE OF string.
SPLIT message AT '##' INTO TABLE msg_table.
it works!
‎2009 May 15 12:25 AM
Hi,
It should work try like this
TYPES : BEGIN OF ty_test,
text(20),
END OF ty_test.
DATA : t_test TYPE TABLE OF ty_test WITH HEADER LINE,
str(1000).
str = 'abcdefg hijk##lmn opq' .
SPLIT str AT '##' INTO TABLE t_test.
LOOP AT t_test.
WRITE : /10 t_test-text.
ENDLOOP.
I got output
abcdefg hijk
lmn opq
Regards
Krishna
‎2009 May 15 3:33 AM
HI,
Try this way...
DATA : tab TYPE C value CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
split msg at tab into table msg_table.
‎2009 May 15 4:12 AM
try:
data message TYPE string VALUE 'abcdefg hijk##lmn opq'.
data msg_table TYPE TABLE OF string.
SPLIT message AT '##' INTO TABLE msg_table.
it works!
‎2009 May 15 4:30 PM
i think wat the problem is....
im getting the string from a function SO_OBJECT_READ that returns a table OBJCONT that is type table of SOLI...
the thing is that this function returns lines of strings but in each string could be '##' that represent line jump... but it looks like it isnt the actuals. ## ...
heres the code...
data: msg_tabla TYPE TABLE OF string.
data: msg_tabla_aux TYPE TABLE OF string.
data: msg_aux type string.
.
.
.
LOOP
CALL FUNCTION 'SO_OBJECT_READ'
EXPORTING
FILTER =
folder_id = fold_id
FORWARDER =
object_id = obj_id
TABLES
OBJCONT = it_OBJCONT
.
.
.
clear msg_aux.
clear msg_tabla_aux.
clear str.
in case it has more than 1 line i concatenate
loop at it_OBJCONT into gwa_IT_OBJCONT .
WRITE: 'mensaje: ', gwa_IT_OBJCONT-LINE.
CONCATENATE msg_aux gwa_IT_OBJCONT-LINE into msg_aux.
ENDLOOP.
SPLIT msg_aux_aux AT '##' INTO TABLE msg_tabla_aux.
append msg_tabla_aux to msg_tabla.
ENDLOOP
in the table msg_tabla should appear all the messages
-
if anyone can help me out .. ill really apreciate it.
thx in advance.
‎2009 May 15 4:36 PM
it migth be CR/LF.
try
SPLIT msg_aux_aux AT CL_ABAP_CHAR_UTILITIES=>CR_LF INTO TABLE msg_tabla_aux
‎2009 May 15 5:50 PM