2015 Jan 30 7:36 PM
Hello, I have a requirement to take data stored in a string data type and then use the SAVE_TEXT function to store this data in a text object/id. I know how to use the SAVE_TEXT function. I just don't know how to take the data stored it in a string data type and convert it to the table format this function requires.
The String data is defined as:
user_comments TYPE STRING
The SAVE_TEXT_Function requires that the data be passed as a table with the TLINE structure data type. The table has 2 fields:
- TDFORMAT char2
-TDLINE Char132
So somehow I need to break up the data in this user_comments field into 132 character pieces and store it in this table format. There is probably an easy answer out their somewhere, but I have not been able to find it. Does anyone have any suggestions/code examples?
2015 Feb 02 5:38 AM
2015 Jan 30 7:43 PM
Go to SE37 and look for FMs like *STRING*SPLIT* or *SPLIT*STRING*..
Rob
2015 Jan 30 7:56 PM
I previously looked at quite a few and some were obsolete, some would not run at all, some are more for Char types, some only split it into 2 lines etc. etc.
2015 Jan 30 8:07 PM
OK, if you can't find a FM, it should be fairly easy to do it yourself:
Start looking for a space at position 132 of the string and move back to the left until you find one. Positions 1 to the position of that space is your first line. Move the rest of the string to the left to position one and start again. You just have to be careful to stop once you reach the end.
Rob
2015 Jan 30 8:12 PM
thx Rob, I had already thought of something like this and that will be my path forward if no one else has any ideas. I was hoping to not have to do something like this though. Surely there must be something out there in ABAP land.
2015 Jan 30 8:48 PM
I think you might be able call FM TEXT_SPLIT iteratively.
Rob
2015 Jan 31 6:51 AM
I've had to do this a few times and never found a better way than coding it myself.
2015 Jan 31 8:49 AM
Hi,
Try,
DATA: lv_data type string value '123456#78910#11121315 ',
lv_table type table of string with header line initial size 0.
start-of-selection.
split lv_data at '#' into table lv_table.
Hope it helpful.
Regards,
Venkat.
2015 Jan 31 9:21 AM
Hi,
Try Function Module CONVERT_STREAM_TO_ITF_TEXT.
Do a where used and you will find examples of how to use it.
Regards,
Ron
2015 Feb 02 5:38 AM
2015 Feb 02 1:46 PM
thx to everyone for your replies. My client has just changed his mind on a few things and this is no longer a requirement, so I won't need to explore this further.