07-06-2021 1:26 PM
There is a data of type TRUXS_T_TEXT_DATA which needs to be converted into type string. How can it be done?
I've tried direct method, calling classes, but these methods aren't working.
Any suggestion as to how it can be converted into string type?
07-06-2021 1:43 PM
Don't know this TRUXS_T_TEXT_DATA
did you try :
data(my_string) = conv string( my_truxts_t_text_data ) ?
(maybe it could be a table, in this case --> CL_BCS_CONVERT )
07-06-2021 1:52 PM
07-06-2021 2:00 PM
07-06-2021 2:03 PM
Hi Tanisha,
The data of type TRUXS_T_TEXT_DATA is an internal table consisting of one or more lines of 4096 characters.
There are different methods to 'flatten' the table (convert it to a single line/string).
A simple way is to loop over the table and concatenate each line into a separate variable.
DATA lv_concatenated_line TYPE string.<br>
LOOP AT lt_table ASSIGNING FIELD-SYMBOL(<line>).
lv_concatenated_line = lv_concatenated_line && <line>.
ENDLOOP.
07-06-2021 2:09 PM
07-06-2021 2:03 PM
Hi Tanisha,
Function TEXT_CONVERT_TEX_TO_SAP convert TRUXS_T_TEXT_DATA to an internal table.
I hope following link will be helpful to find a solution.
https://answers.sap.com/questions/6552909/textconverttextosap.html
Best Regards
Thorsten
07-06-2021 2:09 PM
07-06-2021 2:04 PM
There is lv_data of type TRUXS_T_TEXT_DATA which contains some rows and columns filled with the data like field1, field2, field3, etc.
Now it has to be converted into string type.
07-06-2021 3:11 PM
Sounds like a job for the REDUCE operator.
DATA(as_a_string) = REDUCE string( INIT text = `` sep = ``
FOR text_line IN lv_data
NEXT text = |{ text }{ sep }{ text_line }| sep = ` ` ).
This produces in as_a_string all the text, delimited at each line by space. Of course you can change that to, e.g. \n for newline.
07-08-2021 7:32 AM
For Pete's Sake! You've really embraced the new syntax... and I'm still trying to figure the VALUE and NEW sentences *facepalm*
07-08-2021 8:18 AM
I have to look it up every time. And GROUP BY really baffles me. I never get it right on the first go. And Meshes? Say whut?
07-06-2021 6:20 PM
I'm not sure many people know the millions of DDIC types in the system. If you explain the context, people will be more inclined to help you.