Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Custom container text box editor issue

Former Member
0 Likes
1,652

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,230

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.

7 REPLIES 7
Read only

Former Member
0 Likes
1,230
Read only

0 Likes
1,230

Its helpful..but I need to  track  text editor contained '' last line number ''

Then only i can use that last line number ..

Thanks

Read only

Former Member
0 Likes
1,230

Hi,

Use FM READ_TEXT_INLINE and FORMAT_TEXTLINES to achieve your requirement.

Just try to go through these Function Modules.

Regards,

Sumit

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,230

As can be read in the thread found by  , who used the search tool (did you), use FM READ_TEXT_INLINE "SAPscript: Read text for inline editing" Read SAP online documentation.

Regards,

Raymond

Read only

Venkat_Sesha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,230

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.

Read only

Former Member
0 Likes
1,230

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

Read only

Former Member
0 Likes
1,231

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.