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

EDIT_TEXT function

Former Member
0 Likes
2,842

Hi,

I am using EDIT_TEXT function to show and save text.

I need in some cases to open that screen in read-only mode, is there any way I can do this?.

Thanx in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,312

Hi,

You can use the same EDIT_TEXT also to open in read only mode.Just pass parameter DISPLAY as 'X'.

2 REPLIES 2
Read only

Former Member
0 Likes
1,313

Hi,

You can use the same EDIT_TEXT also to open in read only mode.Just pass parameter DISPLAY as 'X'.

Read only

0 Likes
1,312

Use the display parameter.



report zrich_0002.

data: header type thead.
data: txt_lines type table of tline with header line.
<b>data: mode(1) type c.

parameters: p_edit radiobutton group grp1 default 'X',
            p_disp radiobutton group grp1.</b>

* Set up the text header
header-tdobject = 'AUFK'.
header-tdname   = '001000000001'.
header-tdid     = 'LTXT'.
header-tdspras  = sy-langu.
header-tdlinesize = 70.

* First read the text, if there is any.
call function 'READ_TEXT'
  exporting
*   CLIENT                        = SY-MANDT
    id                            = header-tdid
    language                      = sy-langu
    name                          = header-tdname
    object                        = header-tdobject
*   ARCHIVE_HANDLE                = 0
*   LOCAL_CAT                     = ' '
* IMPORTING
*   HEADER                        =
  tables
    lines                         = txt_lines
* 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.



<b>if p_edit = 'X'.
  mode = space.
else.
  mode = 'X'.
endif.</b>

* throw editor, allow user to change
call function 'EDIT_TEXT'
  exporting
<b>    display             = mode</b>
*   EDITOR_TITLE        = ' '
    header              = header
*   PAGE                = ' '
*   WINDOW              = ' '
    save                = 'X'
*   LINE_EDITOR         = ' '
*   CONTROL             = ' '
*   PROGRAM             = ' '
*   LOCAL_CAT           = ' '
* IMPORTING
*   FUNCTION            =
*   NEWHEADER           =
*   RESULT              =
  tables
    lines               = txt_lines
* 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.

* When user comes back from editor, save the text
* Only for edit mode.
<b>check mode = space.</b>

call function 'SAVE_TEXT'
  exporting
    client                = sy-mandt
    header                = header
*   INSERT                = ' '
*   SAVEMODE_DIRECT       = ' '
*   OWNER_SPECIFIED       = ' '
*   LOCAL_CAT             = ' '
* IMPORTING
*   FUNCTION              =
*   NEWHEADER             =
  tables
    lines                 = txt_lines
* 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.