Application Development 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: 

Text area

Former Member
0 Kudos

I have a text area in the screen..whether it is possible to save the texts which we enter in the text area in a database table field..How it can be done..When i give the container name and checked whether the value is there while debugging.But the value is not coming properly

1 ACCEPTED SOLUTION

Former Member
0 Kudos

----


***INCLUDE ZSAP_DYNPR_TEXTEDITOR1_EXITI01 .

----


&----


*& Module EXIT INPUT

&----


  • text

----


&----


*& Module USER_COMMAND_0300 INPUT

&----


  • text

----


MODULE USER_COMMAND_0300 INPUT.

DATA: VAL1 TYPE I.

DATA VAR(500) TYPE C.

*// TEXT HEADER

DATA: GT_HEAD LIKE THEAD,

*// Text lines

GT_TEXT LIKE STANDARD TABLE OF TLINE,

GW_TEXT LIKE TLINE.

  • GT_HEAD-TDOBJECT = 'MVKE' .

  • GT_HEAD-TDID = '0001' .

  • GT_HEAD-TDSPRAS = SY-LANGU.

  • GT_HEAD-TDNAME = 'ivtl'.

**

CASE SY-UCOMM.

WHEN 'INSERT'.

clear sy-ucomm.

*APPEND VAR TO I_TEXTTABLE.

CALL METHOD TEXT_EDITOR2->GET_TEXT_AS_STREAM

IMPORTING

TEXT = I_TEXTTABLE

IS_MODIFIED = VAL1

EXCEPTIONS

ERROR_DP = 1

ERROR_CNTL_CALL_METHOD = 2

OTHERS = 3.

DATA HELP_TLINETAB LIKE TLINE OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'CONVERT_STREAM_TO_ITF_TEXT'

EXPORTING

LANGUAGE = SY-LANGU

TABLES

TEXT_STREAM = I_TEXTTABLE

ITF_TEXT = HELP_TLINETAB

.

GT_HEAD-TDOBJECT = 'MVKE' .

GT_HEAD-TDID = '0001' .

GT_HEAD-TDSPRAS = SY-LANGU.

GT_HEAD-TDNAME = 'ivtl1'.

*

  • GW_TEXT-TDFORMAT = '00'.

  • GW_TEXT-TDLINE = I_TEXTTABLE-LINE.

  • APPEND GW_TEXT TO GT_TEXT.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

CLIENT = SY-MANDT

HEADER = GT_HEAD

INSERT = 'X'

SAVEMODE_DIRECT = 'X'

OWNER_SPECIFIED = ' '

TABLES

LINES = HELP_TLINETAB

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

OBJECT = 4

OTHERS = 5

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

commit work.

CLEAR HELP_TLINETAB.

REFRESH HELP_TLINETAB.

CLEAR: I_TEXTTABLE.

REFRESH I_TEXTTABLE.

WHEN 'CHANGE'.

clear sy-ucomm.

CLEAR HELP_TLINETAB.

REFRESH HELP_TLINETAB.

CLEAR: I_TEXTTABLE.

REFRESH I_TEXTTABLE.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = '0001'

LANGUAGE = SY-LANGU

NAME = 'ivtl1'

OBJECT = 'MVKE'

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

LINES = HELP_TLINETAB

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CLEAR I_TEXTTABLE.

REFRESH I_TEXTTABLE.

CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'

EXPORTING

LANGUAGE = SY-LANGU

TABLES

ITF_TEXT = HELP_TLINETAB

TEXT_STREAM = I_TEXTTABLE

.

CALL METHOD TEXT_EDITOR2->SET_TEXT_AS_STREAM

EXPORTING

TEXT = I_TEXTTABLE

EXCEPTIONS

ERROR_DP = 1

ERROR_DP_CREATE = 2

others = 3

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CLEAR HELP_TLINETAB.

REFRESH HELP_TLINETAB.

CLEAR: I_TEXTTABLE.

REFRESH I_TEXTTABLE.

commit work.

when 'EDIT'.

clear sy-ucomm.

**change

*GT_HEAD-TDOBJECT = 'MVKE' .

  • GT_HEAD-TDID = '0001' .

  • GT_HEAD-TDSPRAS = SY-LANGU.

  • GT_HEAD-TDNAME = 'ivtl'.

  • GT_HEAD-tdlinesize = '72'.

CALL FUNCTION 'DELETE_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

ID = '0001'

LANGUAGE = sy-langu

NAME = 'ivtl1'

OBJECT = 'MVKE'

SAVEMODE_DIRECT = ' '

  • TEXTMEMORY_ONLY = ' '

  • LOCAL_CAT = ' '

EXCEPTIONS

NOT_FOUND = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

commit work.

break-point.

CALL METHOD TEXT_EDITOR2->GET_TEXT_AS_STREAM

IMPORTING

TEXT = I_TEXTTABLE

IS_MODIFIED = VAL1

EXCEPTIONS

ERROR_DP = 1

ERROR_CNTL_CALL_METHOD = 2

OTHERS = 3.

break-point.

  • DATA HELP_TLINETAB LIKE TLINE OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'CONVERT_STREAM_TO_ITF_TEXT'

EXPORTING

LANGUAGE = SY-LANGU

TABLES

TEXT_STREAM = I_TEXTTABLE

ITF_TEXT = HELP_TLINETAB

.

GT_HEAD-TDOBJECT = 'MVKE' .

GT_HEAD-TDID = '0001' .

GT_HEAD-TDSPRAS = SY-LANGU.

GT_HEAD-TDNAME = 'ivtl1'.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

CLIENT = SY-MANDT

HEADER = GT_HEAD

INSERT = 'X'

SAVEMODE_DIRECT = 'X'

OWNER_SPECIFIED = ' '

TABLES

LINES = HELP_TLINETAB

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

OBJECT = 4

OTHERS = 5

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

commit work.

CLEAR HELP_TLINETAB.

REFRESH HELP_TLINETAB.

CLEAR: I_TEXTTABLE.

REFRESH I_TEXTTABLE.

break-point.

**GT_HEAD-TDOBJECT = 'MVKE' .

    • GT_HEAD-TDID = '0001' .

    • GT_HEAD-TDSPRAS = SY-LANGU.

    • GT_HEAD-TDNAME = 'ivtl'.

    • GT_HEAD-tdlinesize = '72'.

*

*CALL FUNCTION 'EDIT_TEXT'

  • EXPORTING

    • DISPLAY = ' '

    • EDITOR_TITLE = ' '

  • header = GT_HEAD

    • PAGE = ' '

    • WINDOW = ' '

    • save = 'X'

    • LINE_EDITOR = ' '

    • CONTROL = ' '

    • PROGRAM = ' '

    • LOCAL_CAT = ' '

    • IMPORTING

    • FUNCTION =

    • NEWHEADER =

    • RESULT =

  • TABLES

  • lines = HELP_TLINETAB

  • EXCEPTIONS

  • id = 1

  • language = 2

  • linesize = 3

  • name = 4

  • object = 5

  • textformat = 6

  • communication = 7

  • OTHERS = 8.

*

  • IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  • ENDIF.

*

*

*

  • CALL METHOD TEXT_EDITOR2->SET_TEXT_AS_STREAM

  • EXPORTING

  • TEXT = I_TEXTTABLE

  • EXCEPTIONS

  • ERROR_DP = 1

  • ERROR_DP_CREATE = 2

  • others = 3

  • .

  • IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  • ENDIF.

*

*break-point.

*change

  • CLEAR HELP_TLINETAB.

  • REFRESH HELP_TLINETAB.

  • CLEAR: I_TEXTTABLE.

  • REFRESH I_TEXTTABLE.

*

  • CALL FUNCTION 'READ_TEXT'

  • EXPORTING

  • CLIENT = SY-MANDT

  • ID = '0001'

  • LANGUAGE = SY-LANGU

  • NAME = 'ivtl'

  • OBJECT = 'MVKE'

    • ARCHIVE_HANDLE = 0

    • LOCAL_CAT = ' '

    • IMPORTING

    • HEADER =

  • TABLES

  • LINES = HELP_TLINETAB

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • NOT_FOUND = 4

  • OBJECT = 5

  • REFERENCE_CHECK = 6

  • WRONG_ACCESS_TO_ARCHIVE = 7

  • OTHERS = 8

  • .

  • IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  • ENDIF.

*

  • CLEAR I_TEXTTABLE.

  • REFRESH I_TEXTTABLE.

*

  • CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'

  • EXPORTING

  • LANGUAGE = SY-LANGU

  • TABLES

  • ITF_TEXT = HELP_TLINETAB

  • TEXT_STREAM = I_TEXTTABLE

  • .

*

*

  • CALL METHOD TEXT_EDITOR2->SET_TEXT_AS_STREAM

  • EXPORTING

  • TEXT = I_TEXTTABLE

  • EXCEPTIONS

  • ERROR_DP = 1

  • ERROR_DP_CREATE = 2

  • others = 3

  • .

  • IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  • ENDIF.

*

*break-point.

*CALL FUNCTION 'INIT_TEXT'

  • EXPORTING

  • id = '0001'

  • language = sy-langu

  • name = 'ivtl'

  • object = 'MVKE'

  • IMPORTING

  • header = GT_HEAD

  • TABLES

  • lines = HELP_TLINETAB

  • EXCEPTIONS

  • id = 1

  • language = 2

  • name = 3

  • object = 4

  • OTHERS = 5.

*

  • IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  • ENDIF.

*

*commit work.

endcase.

*

*

*data: n type i,

  • l type i,

  • k type i,

  • temp(132).

  • describe table HELP_TLINETAB lines n.

    • k = n * 132.

**constants l type i value k.

**l = n * 132.

*data whole(528).

  • do n times.

  • read table HELP_TLINETAB index sy-index .

  • temp = HELP_TLINETAB-tdline.

  • concatenate whole temp into whole.

  • enddo.

    • REFRESH TDLINETAB.

    • LOOP AT HELP_TLINETAB.

    • APPEND HELP_TLINETAB-TDLINE TO TDLINETAB.

    • ENDLOOP.

***<<<<<<<<BEGIN OF INSERTION NOTE 335328<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    • CALL FUNCTION 'APPEND_LANGTEXT_REFS'

    • EXPORTING

    • IV_MODUS = 'T'.

***<<<<<<<<END OF INSERTION NOTE 335328<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    • CALL METHOD cl_gui_cfw=>flush "TF 4.6C for safety

    • EXCEPTIONS "TF 4.6C for safety

    • OTHERS = 1. "TF 4.6C for safety

    • ENDIF.

*

*

*

*

**

**CALL METHOD TEXT_EDITOR2->GET_TEXT_AS_STREAM

    • EXPORTING

    • TABLE = I_TEXTTABLE

    • EXCEPTIONS

    • ERROR_DP = 1

    • ERROR_DP_CREATE = 2

    • others = 3

    • .

**IF SY-SUBRC <> 0.

      • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

      • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

**ENDIF.

*

*

*

  • CALL METHOD TEXT_EDITOR2->set_text_as_r3table

  • EXPORTING table = I_TEXTTABLE.

*

**break-point.

**ENDCASE.

    • WHEN 'UNCOMMPRO'.

    • NEW ** 99a:

  • CALL METHOD TEXT_EDITOR2->uncomment_selection

  • EXPORTING

  • enable_editing_protected_text = cl_gui_textedit=>true.

*

    • WHEN 'UNCOMMENT'.

    • NEW ** 99a:

  • CALL METHOD TEXT_EDITOR2->uncomment_selection.

*

    • CASE text_type.

    • WHEN standard_text.

  • CALL METHOD TEXT_EDITOR2->set_wordbreak_procedure

  • EXPORTING

  • text_type = cl_gui_textedit=>text_standard

  • EXCEPTIONS

  • OTHERS = 1.

    • WHEN abap_code.

  • CALL METHOD TEXT_EDITOR2->set_wordbreak_procedure

  • EXPORTING

  • text_type = cl_gui_textedit=>text_abap

  • EXCEPTIONS

  • OTHERS = 1.

    • CALL METHOD TEXT_EDITOR2->set_autoindent_mode

    • EXPORTING

    • auto_indent = cl_gui_textedit=>false

    • EXCEPTIONS

    • OTHERS = 1.

  • CALL METHOD TEXT_EDITOR2->set_autoindent_mode

  • EXPORTING

  • auto_indent = cl_gui_textedit=>true

  • EXCEPTIONS

  • OTHERS = 1.

*

  • CALL METHOD TEXT_EDITOR2->set_comments_string.

  • CALL METHOD TEXT_EDITOR2->set_highlight_comments_mode.

*

*

ENDMODULE. " USER_COMMAND_0300 INPUT

MODULE EXIT INPUT.

LEAVE TO SCREEN 0.

ENDMODULE. " EXIT INPUT

3 REPLIES 3

Former Member
0 Kudos

Hi Mahesh,

The texts entered in area will be able to store it in Data base table eg

editor->get_text_as_r3table(

IMPORTING

table = source_table ).

from this method u will get the text in the source table and then store it in one variable source and the modify the database table .

eg..

LOOP AT source_table INTO source_line.

IF source IS INITIAL.

source = source_line.

ELSE.

CONCATENATE source source_line INTO source

SEPARATED BY cl_abap_char_utilities=>cr_lf.

ENDIF.

ENDLOOP.

.

regards,

Santosh Thorat

Former Member
0 Kudos

----


***INCLUDE ZSAP_DYNPR_TEXTEDITOR1_EXITI01 .

----


&----


*& Module EXIT INPUT

&----


  • text

----


&----


*& Module USER_COMMAND_0300 INPUT

&----


  • text

----


MODULE USER_COMMAND_0300 INPUT.

DATA: VAL1 TYPE I.

DATA VAR(500) TYPE C.

*// TEXT HEADER

DATA: GT_HEAD LIKE THEAD,

*// Text lines

GT_TEXT LIKE STANDARD TABLE OF TLINE,

GW_TEXT LIKE TLINE.

  • GT_HEAD-TDOBJECT = 'MVKE' .

  • GT_HEAD-TDID = '0001' .

  • GT_HEAD-TDSPRAS = SY-LANGU.

  • GT_HEAD-TDNAME = 'ivtl'.

**

CASE SY-UCOMM.

WHEN 'INSERT'.

clear sy-ucomm.

*APPEND VAR TO I_TEXTTABLE.

CALL METHOD TEXT_EDITOR2->GET_TEXT_AS_STREAM

IMPORTING

TEXT = I_TEXTTABLE

IS_MODIFIED = VAL1

EXCEPTIONS

ERROR_DP = 1

ERROR_CNTL_CALL_METHOD = 2

OTHERS = 3.

DATA HELP_TLINETAB LIKE TLINE OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'CONVERT_STREAM_TO_ITF_TEXT'

EXPORTING

LANGUAGE = SY-LANGU

TABLES

TEXT_STREAM = I_TEXTTABLE

ITF_TEXT = HELP_TLINETAB

.

GT_HEAD-TDOBJECT = 'MVKE' .

GT_HEAD-TDID = '0001' .

GT_HEAD-TDSPRAS = SY-LANGU.

GT_HEAD-TDNAME = 'ivtl1'.

*

  • GW_TEXT-TDFORMAT = '00'.

  • GW_TEXT-TDLINE = I_TEXTTABLE-LINE.

  • APPEND GW_TEXT TO GT_TEXT.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

CLIENT = SY-MANDT

HEADER = GT_HEAD

INSERT = 'X'

SAVEMODE_DIRECT = 'X'

OWNER_SPECIFIED = ' '

TABLES

LINES = HELP_TLINETAB

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

OBJECT = 4

OTHERS = 5

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

commit work.

CLEAR HELP_TLINETAB.

REFRESH HELP_TLINETAB.

CLEAR: I_TEXTTABLE.

REFRESH I_TEXTTABLE.

WHEN 'CHANGE'.

clear sy-ucomm.

CLEAR HELP_TLINETAB.

REFRESH HELP_TLINETAB.

CLEAR: I_TEXTTABLE.

REFRESH I_TEXTTABLE.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

ID = '0001'

LANGUAGE = SY-LANGU

NAME = 'ivtl1'

OBJECT = 'MVKE'

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

LINES = HELP_TLINETAB

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CLEAR I_TEXTTABLE.

REFRESH I_TEXTTABLE.

CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'

EXPORTING

LANGUAGE = SY-LANGU

TABLES

ITF_TEXT = HELP_TLINETAB

TEXT_STREAM = I_TEXTTABLE

.

CALL METHOD TEXT_EDITOR2->SET_TEXT_AS_STREAM

EXPORTING

TEXT = I_TEXTTABLE

EXCEPTIONS

ERROR_DP = 1

ERROR_DP_CREATE = 2

others = 3

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CLEAR HELP_TLINETAB.

REFRESH HELP_TLINETAB.

CLEAR: I_TEXTTABLE.

REFRESH I_TEXTTABLE.

commit work.

when 'EDIT'.

clear sy-ucomm.

**change

*GT_HEAD-TDOBJECT = 'MVKE' .

  • GT_HEAD-TDID = '0001' .

  • GT_HEAD-TDSPRAS = SY-LANGU.

  • GT_HEAD-TDNAME = 'ivtl'.

  • GT_HEAD-tdlinesize = '72'.

CALL FUNCTION 'DELETE_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

ID = '0001'

LANGUAGE = sy-langu

NAME = 'ivtl1'

OBJECT = 'MVKE'

SAVEMODE_DIRECT = ' '

  • TEXTMEMORY_ONLY = ' '

  • LOCAL_CAT = ' '

EXCEPTIONS

NOT_FOUND = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

commit work.

break-point.

CALL METHOD TEXT_EDITOR2->GET_TEXT_AS_STREAM

IMPORTING

TEXT = I_TEXTTABLE

IS_MODIFIED = VAL1

EXCEPTIONS

ERROR_DP = 1

ERROR_CNTL_CALL_METHOD = 2

OTHERS = 3.

break-point.

  • DATA HELP_TLINETAB LIKE TLINE OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'CONVERT_STREAM_TO_ITF_TEXT'

EXPORTING

LANGUAGE = SY-LANGU

TABLES

TEXT_STREAM = I_TEXTTABLE

ITF_TEXT = HELP_TLINETAB

.

GT_HEAD-TDOBJECT = 'MVKE' .

GT_HEAD-TDID = '0001' .

GT_HEAD-TDSPRAS = SY-LANGU.

GT_HEAD-TDNAME = 'ivtl1'.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

CLIENT = SY-MANDT

HEADER = GT_HEAD

INSERT = 'X'

SAVEMODE_DIRECT = 'X'

OWNER_SPECIFIED = ' '

TABLES

LINES = HELP_TLINETAB

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

OBJECT = 4

OTHERS = 5

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

commit work.

CLEAR HELP_TLINETAB.

REFRESH HELP_TLINETAB.

CLEAR: I_TEXTTABLE.

REFRESH I_TEXTTABLE.

break-point.

**GT_HEAD-TDOBJECT = 'MVKE' .

    • GT_HEAD-TDID = '0001' .

    • GT_HEAD-TDSPRAS = SY-LANGU.

    • GT_HEAD-TDNAME = 'ivtl'.

    • GT_HEAD-tdlinesize = '72'.

*

*CALL FUNCTION 'EDIT_TEXT'

  • EXPORTING

    • DISPLAY = ' '

    • EDITOR_TITLE = ' '

  • header = GT_HEAD

    • PAGE = ' '

    • WINDOW = ' '

    • save = 'X'

    • LINE_EDITOR = ' '

    • CONTROL = ' '

    • PROGRAM = ' '

    • LOCAL_CAT = ' '

    • IMPORTING

    • FUNCTION =

    • NEWHEADER =

    • RESULT =

  • TABLES

  • lines = HELP_TLINETAB

  • EXCEPTIONS

  • id = 1

  • language = 2

  • linesize = 3

  • name = 4

  • object = 5

  • textformat = 6

  • communication = 7

  • OTHERS = 8.

*

  • IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  • ENDIF.

*

*

*

  • CALL METHOD TEXT_EDITOR2->SET_TEXT_AS_STREAM

  • EXPORTING

  • TEXT = I_TEXTTABLE

  • EXCEPTIONS

  • ERROR_DP = 1

  • ERROR_DP_CREATE = 2

  • others = 3

  • .

  • IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  • ENDIF.

*

*break-point.

*change

  • CLEAR HELP_TLINETAB.

  • REFRESH HELP_TLINETAB.

  • CLEAR: I_TEXTTABLE.

  • REFRESH I_TEXTTABLE.

*

  • CALL FUNCTION 'READ_TEXT'

  • EXPORTING

  • CLIENT = SY-MANDT

  • ID = '0001'

  • LANGUAGE = SY-LANGU

  • NAME = 'ivtl'

  • OBJECT = 'MVKE'

    • ARCHIVE_HANDLE = 0

    • LOCAL_CAT = ' '

    • IMPORTING

    • HEADER =

  • TABLES

  • LINES = HELP_TLINETAB

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • NOT_FOUND = 4

  • OBJECT = 5

  • REFERENCE_CHECK = 6

  • WRONG_ACCESS_TO_ARCHIVE = 7

  • OTHERS = 8

  • .

  • IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  • ENDIF.

*

  • CLEAR I_TEXTTABLE.

  • REFRESH I_TEXTTABLE.

*

  • CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'

  • EXPORTING

  • LANGUAGE = SY-LANGU

  • TABLES

  • ITF_TEXT = HELP_TLINETAB

  • TEXT_STREAM = I_TEXTTABLE

  • .

*

*

  • CALL METHOD TEXT_EDITOR2->SET_TEXT_AS_STREAM

  • EXPORTING

  • TEXT = I_TEXTTABLE

  • EXCEPTIONS

  • ERROR_DP = 1

  • ERROR_DP_CREATE = 2

  • others = 3

  • .

  • IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  • ENDIF.

*

*break-point.

*CALL FUNCTION 'INIT_TEXT'

  • EXPORTING

  • id = '0001'

  • language = sy-langu

  • name = 'ivtl'

  • object = 'MVKE'

  • IMPORTING

  • header = GT_HEAD

  • TABLES

  • lines = HELP_TLINETAB

  • EXCEPTIONS

  • id = 1

  • language = 2

  • name = 3

  • object = 4

  • OTHERS = 5.

*

  • IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  • ENDIF.

*

*commit work.

endcase.

*

*

*data: n type i,

  • l type i,

  • k type i,

  • temp(132).

  • describe table HELP_TLINETAB lines n.

    • k = n * 132.

**constants l type i value k.

**l = n * 132.

*data whole(528).

  • do n times.

  • read table HELP_TLINETAB index sy-index .

  • temp = HELP_TLINETAB-tdline.

  • concatenate whole temp into whole.

  • enddo.

    • REFRESH TDLINETAB.

    • LOOP AT HELP_TLINETAB.

    • APPEND HELP_TLINETAB-TDLINE TO TDLINETAB.

    • ENDLOOP.

***<<<<<<<<BEGIN OF INSERTION NOTE 335328<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    • CALL FUNCTION 'APPEND_LANGTEXT_REFS'

    • EXPORTING

    • IV_MODUS = 'T'.

***<<<<<<<<END OF INSERTION NOTE 335328<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    • CALL METHOD cl_gui_cfw=>flush "TF 4.6C for safety

    • EXCEPTIONS "TF 4.6C for safety

    • OTHERS = 1. "TF 4.6C for safety

    • ENDIF.

*

*

*

*

**

**CALL METHOD TEXT_EDITOR2->GET_TEXT_AS_STREAM

    • EXPORTING

    • TABLE = I_TEXTTABLE

    • EXCEPTIONS

    • ERROR_DP = 1

    • ERROR_DP_CREATE = 2

    • others = 3

    • .

**IF SY-SUBRC <> 0.

      • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

      • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

**ENDIF.

*

*

*

  • CALL METHOD TEXT_EDITOR2->set_text_as_r3table

  • EXPORTING table = I_TEXTTABLE.

*

**break-point.

**ENDCASE.

    • WHEN 'UNCOMMPRO'.

    • NEW ** 99a:

  • CALL METHOD TEXT_EDITOR2->uncomment_selection

  • EXPORTING

  • enable_editing_protected_text = cl_gui_textedit=>true.

*

    • WHEN 'UNCOMMENT'.

    • NEW ** 99a:

  • CALL METHOD TEXT_EDITOR2->uncomment_selection.

*

    • CASE text_type.

    • WHEN standard_text.

  • CALL METHOD TEXT_EDITOR2->set_wordbreak_procedure

  • EXPORTING

  • text_type = cl_gui_textedit=>text_standard

  • EXCEPTIONS

  • OTHERS = 1.

    • WHEN abap_code.

  • CALL METHOD TEXT_EDITOR2->set_wordbreak_procedure

  • EXPORTING

  • text_type = cl_gui_textedit=>text_abap

  • EXCEPTIONS

  • OTHERS = 1.

    • CALL METHOD TEXT_EDITOR2->set_autoindent_mode

    • EXPORTING

    • auto_indent = cl_gui_textedit=>false

    • EXCEPTIONS

    • OTHERS = 1.

  • CALL METHOD TEXT_EDITOR2->set_autoindent_mode

  • EXPORTING

  • auto_indent = cl_gui_textedit=>true

  • EXCEPTIONS

  • OTHERS = 1.

*

  • CALL METHOD TEXT_EDITOR2->set_comments_string.

  • CALL METHOD TEXT_EDITOR2->set_highlight_comments_mode.

*

*

ENDMODULE. " USER_COMMAND_0300 INPUT

MODULE EXIT INPUT.

LEAVE TO SCREEN 0.

ENDMODULE. " EXIT INPUT

Former Member
0 Kudos

HI,

use the method <b>get_text_as_r3table</b>.

MODULE pai INPUT.

case ok_code.

WHEN 'SAVE'.

call method TEXT_AREA->get_text_as_r3table

importing table = mytable.

loop at mytable into wa.

concatenate txt wa into txt

separated by '|'.

endloop.

endcase.

endmodule.

rgds,

bharat.