02-06-2009 4:00 PM
Is there an abap class that will convert a string field into a table that will include wordwrap ?
02-06-2009 6:35 PM
Try below code:
CALL FUNCTION 'RKD_WORD_WRAP'
EXPORTING
textline = input_string
delimiter = ' '
outputlen = 100
TABLES
out_lines = output_itab
EXCEPTIONS
outputlen_too_large = 1
OTHERS = 2.
02-06-2009 6:35 PM
Try below code:
CALL FUNCTION 'RKD_WORD_WRAP'
EXPORTING
textline = input_string
delimiter = ' '
outputlen = 100
TABLES
out_lines = output_itab
EXCEPTIONS
outputlen_too_large = 1
OTHERS = 2.
02-06-2009 9:49 PM
Hi
You can use class CL_GUI_TEXTEDIT method TRANSFORM_STRING_TO_TABLE.
Nat
05-12-2011 4:32 PM
CL_GUI_TEXTEDIT=>TRANSFORM_STRING_TO_TABLE is a protected method, so can't be used outside of a class inherited from CL_GUI_TEXTEDIT. Did you actually try the code out before suggesting it, or are you just fishing for forum points?
05-12-2011 4:45 PM
If he did, then he stopped more than two years ago
Nevertheless, thanks for the clarification, and keep challenging the more recent points chasers.
Thomas
05-12-2011 6:47 PM
Dale:
Try class CL_SWF_UTL_CONVERT_XSTRING. The methods in it are named with XSTRING, but also work with type STRING as well.
Regards,
D.
05-16-2011 5:05 AM
Try class CL_SWF_UTL_CONVERT_XSTRING method TABLE_TO_XSTRING.
CALL METHOD cl_swf_utl_convert_xstring=>table_to_xstring
EXPORTING
i_table = my_internal_table
i_size = size_of_my_internal_table
RECEIVING
r_stream = revceiving_string
EXCEPTIONS
invalid_input = 1
OTHERS = 2.
Hope this will help you.
Click answered if your purpose is solved
06-20-2011 9:26 PM
You can use method '/SAPSLL/TEXT_TABLE_TO_STRING' to convert text lines to string
*convert text lines to string
data: lv_string type string.
clear lv_string.
CALL FUNCTION '/SAPSLL/TEXT_TABLE_TO_STRING'
EXPORTING
IT_TLINES = lt_lines
IMPORTING
EV_TXTSTRING = lv_string
To Covnert String to Text Lines, use - '/SAPSLL/TEXT_STRING_TO_TABLE'
Convert text lines to string
CALL FUNCTION '/SAPSLL/TEXT_STRING_TO_TABLE'
EXPORTING
IV_TXTSTRING = ls_extension-value
IMPORTING
ET_TLINES = lt_lines
.
05-12-2022 5:06 PM
Just thought I would share this since my google search landed me here.
I was trying to pass a string from a UI5 app through the Gateway server into an RFC to result in being header text on a sales order and needed to go from string -> bapisdtext_t table
This method converts a string to the ITF format of TLINE which is the TDFORMAT and TLINE segment. The TDFORMAT contains an '*' when a new line exists but leaves it blank when the wordwrap happens.
Hope it helps...
After reading the above, I found cl_cnv_mbt_utils=>convert_string_to_table
FORM %string_to_bapisdtext USING text_id TYPE tdid
input_string TYPE string
CHANGING bapi_text TYPE bapisdtext_t.
DATA(tline_table) = cl_cnv_mbt_utils=>convert_string_to_table( iv_string = input_string ).
LOOP AT tline_table ASSIGNING FIELD-SYMBOL(<tline>).
APPEND INITIAL LINE TO bapi_text ASSIGNING FIELD-SYMBOL(<bapi>).
<bapi>-text_id = text_id.
<bapi>-langu = sy-langu.
<bapi>-format_col = <tline>-tdformat.
<bapi>-text_line = <tline>-tdline.
ENDLOOP.
ENDFORM.