2013 Oct 02 7:47 AM
Hi All,
I have created a custom container text box , where I am writing some text .
Issue is suppose I have write 6 lines (line length max. for editor is 72)..and save then
read_text FM retriving all the lines sucessfully with in LT_LINES in. table.
But the probleam is text box edtitor , line number increases suddenly but data same exists .So I am unable to capture the
number of lines in the text editor ..Accordingly call method g_editor->protect_lines syntax unable to assign the'' to_line '' number
Pl. help me how to capture the number of lines in the text box editor after saving the editor.??
Thanks
Asis.
2013 Oct 02 11:22 AM
USE THESE
CALL METHOD gd_texteditor->get_text_as_stream
IMPORTING
text = text_modified.
THAN SAVE IT
READ TABLE text_modified INTO textline INDEX 1.
IF sy-subrc EQ 0.
l_line-tdline = textline .
ENDIF.
INSERT l_line INTO it_lines INDEX 1.
READ TABLE text_modified INTO textline INDEX 1.
IF sy-subrc EQ 0.
l_line-tdline = textline .
ENDIF.
INSERT l_line INTO it_lines INDEX 1.
CASE wa_subscreen-gd_screen.
WHEN '0110'.
IF gd_prev_tab_2 EQ 'HEADER'.
l_header-tdobject = 'VBBK'.
l_header-tdname = g_node_key.
l_header-tdid = '0001'.
l_header-tdspras = sy-langu.
ELSEIF gd_prev_tab_2 EQ 'ITEM'.
l_header-tdobject = 'VBBP'.
l_header-tdname = g_node_key.
l_header-tdid = '0001'.
l_header-tdspras = sy-langu.
ENDIF.
WHEN '0120'.
IF gd_prev_tab_2 EQ 'HEADER'.
l_header-tdobject = 'EKKO'.
l_header-tdname = g_node_key.
l_header-tdid = 'F01'.
l_header-tdspras = sy-langu.
ELSEIF gd_prev_tab_2 EQ 'ITEM'.
l_header-tdobject = 'EKPO'.
l_header-tdname = g_node_key.
l_header-tdid = 'F01'.
l_header-tdspras = sy-langu.
ENDIF.
ENDCASE.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
header = l_header
savemode_direct = 'X'
IMPORTING
function = l_func
TABLES
lines = it_lines.
CALL METHOD gd_texteditor->set_text_as_stream
EXPORTING
text = it_lines
EXCEPTIONS
error_dp = 1
error_dp_create = 2.
2013 Oct 02 8:30 AM
2013 Oct 02 9:22 AM
Its helpful..but I need to track text editor contained '' last line number ''
Then only i can use that last line number ..
Thanks
2013 Oct 02 8:57 AM
Hi,
Use FM READ_TEXT_INLINE and FORMAT_TEXTLINES to achieve your requirement.
Just try to go through these Function Modules.
Regards,
Sumit
2013 Oct 02 9:21 AM
As can be read in the thread found by Susmitha, who used the search tool (did you), use FM READ_TEXT_INLINE "SAPscript: Read text for inline editing" Read SAP online documentation.
Regards,
Raymond
2013 Oct 02 9:27 AM
Hi Sahoo,
If you want a text to display in a popup then use this simple function module.
POPUP_DISPLAY_TEXT
Its helpful in that case and if you want to maintain texts use SE64 transaction.
2013 Oct 02 9:33 AM
Hi
You can use the fm CONVERT_STREAM_TO_ITF_TEXT in order to convert the text from Editor to Sapscript format.
* Get the text from editor
CALL METHOD G_EDITOR->GET_TEXT_AS_STREAM
IMPORTING
TEXT = NOTETAB.
* Convert the text for standard text
CALL FUNCTION 'CONVERT_STREAM_TO_ITF_TEXT'
TABLES
TEXT_STREAM = NOTETAB
ITF_TEXT = TLINES.
Max
2013 Oct 02 11:22 AM
USE THESE
CALL METHOD gd_texteditor->get_text_as_stream
IMPORTING
text = text_modified.
THAN SAVE IT
READ TABLE text_modified INTO textline INDEX 1.
IF sy-subrc EQ 0.
l_line-tdline = textline .
ENDIF.
INSERT l_line INTO it_lines INDEX 1.
READ TABLE text_modified INTO textline INDEX 1.
IF sy-subrc EQ 0.
l_line-tdline = textline .
ENDIF.
INSERT l_line INTO it_lines INDEX 1.
CASE wa_subscreen-gd_screen.
WHEN '0110'.
IF gd_prev_tab_2 EQ 'HEADER'.
l_header-tdobject = 'VBBK'.
l_header-tdname = g_node_key.
l_header-tdid = '0001'.
l_header-tdspras = sy-langu.
ELSEIF gd_prev_tab_2 EQ 'ITEM'.
l_header-tdobject = 'VBBP'.
l_header-tdname = g_node_key.
l_header-tdid = '0001'.
l_header-tdspras = sy-langu.
ENDIF.
WHEN '0120'.
IF gd_prev_tab_2 EQ 'HEADER'.
l_header-tdobject = 'EKKO'.
l_header-tdname = g_node_key.
l_header-tdid = 'F01'.
l_header-tdspras = sy-langu.
ELSEIF gd_prev_tab_2 EQ 'ITEM'.
l_header-tdobject = 'EKPO'.
l_header-tdname = g_node_key.
l_header-tdid = 'F01'.
l_header-tdspras = sy-langu.
ENDIF.
ENDCASE.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
header = l_header
savemode_direct = 'X'
IMPORTING
function = l_func
TABLES
lines = it_lines.
CALL METHOD gd_texteditor->set_text_as_stream
EXPORTING
text = it_lines
EXCEPTIONS
error_dp = 1
error_dp_create = 2.