Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to create a text editor, the one like header text in PO

Dear Ones,

My requirement is that I want to create a text editor for storing terms and condition plant wise.

The editor should be the one like header text in PO. It can take end number of lines.

I created the text object ('TERMS') in table ttxob and text for it in table ttxot.

Also created text id ('L000' and 'L001') in table ttxid and text for it in table ttxit.

Now using FM read_text, save_text and edit_text, I have written a program but it does not save the data.

When I run the program initially it displays me blank, then I enter some data into it. Again when I come back it displays the data and also saves the edition. But if I close my session the data is gone.

It means it is not actually saving the data in database. My code is as below:

&----


*& Report ZAK_TEXT_EDITOR

&----


REPORT zak_text_editor.

DATA : head TYPE STANDARD TABLE OF thead WITH HEADER LINE,

line TYPE STANDARD TABLE OF tline WITH HEADER LINE.

DATA : tdname TYPE thead-tdname.

SELECTION-SCREEN : BEGIN OF BLOCK blk WITH FRAME TITLE text-001.

SELECTION-SCREEN : SKIP 1.

PARAMETERS : id TYPE thead-tdid OBLIGATORY

MATCHCODE OBJECT zak_textid.

SELECTION-SCREEN : SKIP 1.

SELECTION-SCREEN : END OF BLOCK blk.

START-OF-SELECTION.

CONCATENATE 'TERMS' id INTO tdname.

head-tdobject = 'TERMS'.

head-tdname = tdname.

head-tdid = id.

head-tdspras = sy-langu.

head-tdlinesize = 132.

APPEND head.

CALL FUNCTION 'READ_TEXT'

EXPORTING

client = sy-mandt

id = id

language = sy-langu

name = tdname

object = 'TERMS'

  • ARCHIVE_HANDLE = 0

  • LOCAL_CAT = ' '

  • IMPORTING

  • HEADER =

TABLES

lines = line

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.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

client = sy-mandt

header = head

  • INSERT = ' '

  • SAVEMODE_DIRECT = ' '

  • OWNER_SPECIFIED = ' '

  • LOCAL_CAT = ' '

  • IMPORTING

  • FUNCTION =

  • NEWHEADER =

TABLES

lines = line

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.

ENDIF.

CALL FUNCTION 'EDIT_TEXT'

EXPORTING

  • DISPLAY = ' '

  • EDITOR_TITLE = ' '

header = head

  • PAGE = ' '

  • WINDOW = ' '

save = 'X'

  • LINE_EDITOR = ' '

  • CONTROL = ' '

  • PROGRAM = ' '

  • LOCAL_CAT = ' '

  • IMPORTING

  • FUNCTION =

  • NEWHEADER =

  • RESULT =

TABLES

lines = line

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.

Former Member
Not what you were looking for? View more on this topic or Ask a question