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: 

Saving text editor

Former Member
0 Kudos

I have this text editor and I want to save what the user typed in the text editor into my database (ZPROGRAM_TABLE) under the column name called PROGRAM_CODE.

How am i suppose to do this? Code examples is appreciated.

Points will be awarded to any relevant answers.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

So in order to to save the text in the text editor, I will have to use read_text function module to read the text first before i use save_text function module is it?

6 REPLIES 6

Former Member
0 Kudos

Hi,

DATA: XTHEADTYPE thead,

i_tline TYPE STANDARD TABLE OF tline,

wa_tline TYPE tline.

XTHEAD-tdobject = 'VBBK'.

XTHEAD-tdname = delivery number.

XTHEAD-tdspras = language.

XTHEAD-tdid = text id. "for example: Z022

Tlines-tdformat = '*'.

Tlines-tdline = your text that you want to write .

You have to pass the Internal table TLINES with the Text that needs to be saved inTables Parameter LINES

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

header = st_head

INSERT = SPACE

SAVEMODE_DIRECT = 'X'

OWNER_SPECIFIED = SPACE

TABLES

lines = i_tline.

http://help.sap.com/saphelp_40b/helpdata/en/d6/0db8ef494511d182b70000e829fbfe/content.htm

Don't forget to reward if useful.....

Former Member
0 Kudos

Hi,

Check the sample program RSDEMO_DRAG_DROP_EDIT_TREE.

Save teh text as explained in the above answer. Read texts using fm READ_TEXT.

Regards,

Renjith Michael.

Former Member
0 Kudos

So in order to to save the text in the text editor, I will have to use read_text function module to read the text first before i use save_text function module is it?

0 Kudos

Hi,

To save a text initially, u can use SAVE_TEXT and to read an existing text use READ_TEXT.

Regards,

Renjith Michael.

0 Kudos

Any code example of that? I read the program but still do not understand it well.

0 Kudos

Hi,

See the sample code in program: SAPTEXTEDIT_DEMO_3

Inside that the text values will be available in g_mytable.

pass it to tables in SAVE_TEXT.

and use like

CLEAR g_mytable.

CALL METHOD g_editor->set_text_as_r3table

EXPORTING

table = g_mytable

EXCEPTIONS

OTHERS = 1.

wa_name = <specify a key like value here>.

CLEAR wa_head.

wa_head-tdobject = <specify a head..

wa_head-tdid = '001'.

wa_head-tdname = wa_name.

wa_head-tdspras = sy-langu.

wa_head-tdlinesize = '072'.

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = '001'

language = sy-langu

name = wa_name

object = '<ur object name>' that u created in se75 transaction

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

IMPORTING

header = wa_head

************************************************************

TABLES

lines = it_tline

*************************************************************

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.

IF g_mytable IS INITIAL.

LOOP AT it_tline INTO wa_tline.

wa_g_mytable-line = wa_tline-tdline.

APPEND wa_g_mytable TO g_mytable.

ENDLOOP.

ENDIF.

CALL METHOD g_editor->delete_text.

CALL METHOD g_editor->set_text_as_r3table

EXPORTING

table = g_mytable.

ELSE.

CLEAR it_tline.

CLEAR g_mytable.

ENDIF.

Regards,

Renjith Michael.