05-04-2004 11:07 AM
Hi there !
Im quite new to ABAP and I'm having a following problem.
I need to parse a Input from a HTML Textarea component which is a ABAP String but can apparantly contain the 0x10, 0x13 line feed special characters. Now, is it possible that I can escape a line feed similar to "\n" in Java/c and use it in a followin way: SPLIT input AT '\n' INTO TABLE tbl. Till now I haven't really found any infos how to handle special chars in ABAP.
thanks a lot
Astrit
05-04-2004 11:16 AM
Off the top of my head, try:
DATA:
BEGIN OF newline,
hex(2) TYPE x VALUE '0D0A',
END OF newline.
* Split content by carriage return (0D) / line-feed (0A)
SPLIT input AT newline INTO TABLE tab.
This is not unicode compatible.
Scott
05-05-2004 6:30 AM
You will have to make some more changes as you cannot split on Hexadecimal string so for the same.
Please use this code
DATA: str TYPE string,
t1 TYPE string OCCURS 0 WITH HEADER LINE.
DATA hex(2) TYPE x VALUE '0D0A'.
FIELD-SYMBOLS: <fs> TYPE x,
<fs1> TYPE c.
ASSIGN hex TO <fs>.
ASSIGN <fs> TO <fs1> CASTING.
SPLIT str AT <fs1> INTO TABLE t1.
Here I am presuming that the variable str has the string to be parsed.
Then the split string comes up into table t1.
Hope this code is helpful.
Regards,
Pavan
05-05-2004 10:27 AM
I had to change the t1 declaration in "TABLE OF STRING" because of the OO-Context and then it worked perfectly.
Thank's a lot for your support !
Astrit