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

text editor in display mode

Former Member
0 Likes
3,402

hi,

i have created one text editor using cutom container

my requiremant was to change the text editor to display mode from change mode and vice-versa

without exit from the program (i.e)

when i was changing the text editor in change mode .i may go back to diplay mode

in that case text editor to be change to display mode

consider two buttons- change display

if change button selected then text editor should be change mode

if display button selected then text editor should be readable mode

i have used set_readonly_method of class cl_gui_texteditor

but it works when the program was exit.

hi,

i have created one text editor using cutom container

my requiremant was to change the text editor to display mode from change mode and vice-versa

without exit from the program (i.e)

when i was changing the text editor in change mode .i may go back to diplay mode

in that case text editor to be change to display mode

consider two buttons- change display

if change button selected then text editor should be change mode

if display button selected then text editor should be readable mode

i have used set_readonly_method of class cl_gui_texteditor

but it works when the program was exit.

7 REPLIES 7
Read only

Former Member
0 Likes
1,730

HI Aswini,

Aswini Wrote

thanks for your answer 

can we create a screen group for custom container

"If your issue is resolved Close this thread so that it will be useful for others with Similar Issue when they searhc
And also begin new issues in new posts

Use SET_ENABLE method of the CL_GUI_TEXTEDIT or SET_READONLY_MODE

If you need further feel free to revert back

call method editor->set_readonly_mode " 0 Means Read only otherwise editable
          exporting
            readonly_mode =  0.

Cheerz

ram

Read only

Kanagaraja_L
Active Contributor
0 Likes
1,730

Check Program BCALV_EDIT_08

Read only

Former Member
0 Likes
1,730

Hi Aswini,

Try out the code given below:

If Change

CALL METHOD m1->set_readonly_mode

EXPORTING

READONLY_MODE = ' '

EXCEPTIONS

error_cntl_call_method = 1

invalid_parameter = 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.

LOOP AT SCREEN. "Sets the text field on the screen to change mode

IF screen-group1 = 'MM'.

screen-active = '1'.

screen-input = '0'.

screen-output = '1'.

screen-invisible = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

Endif.

ENDIF.

If Display

CALL METHOD m1->set_readonly_mode "Sets the text field on the screen to display mode

  • EXPORTING

  • readonly_mode = ' '

EXCEPTIONS

error_cntl_call_method = 1

invalid_parameter = 2

OTHERS = 3

.

IF sy-subrc <> 0. "#EC NEEDED

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Endif

Read only

0 Likes
1,730

thanks for your answer

can we create a screen group for custom container

Read only

Former Member
0 Likes
1,730

Hi Aswini,

First you check the user command

CASE < user command for your EDIT and DISPLAY buttons>

WHEN 'EDIT' . < when you want the editor in editable mode >

v_mode = '0'.

WHEN 'DISPLAY'. < when you want the editor in display mode >

v_mode = '1'.

And before calling your editor.

Pass the v_mode like the below mentioned.

  • Set Editor to Read/Write mode

CALL METHOD v_obj_editor->set_readonly_mode

EXPORTING

readonly_mode = v_mode

EXCEPTIONS

error_cntl_call_method = 1

invalid_parameter = 2

OTHERS = 3.

Hope this may help you.

Regards,

Smart Varghese

Read only

Former Member
0 Likes
1,730

Hi,

this is how I have achieve it.

create one module in PAI.

module USER_COMMAND_0200 input.

CALL METHOD cl_gui_cfw=>dispatch.

case sy-ucomm.

when 'EDIT'.

IF edit = 'X'.

edit = ' '.

ELSE.

edit = 'X'.

ENDIF.

endcase.

endmodule. " USER_COMMAND_0100 INPUT

and in another module

module CHECK_EDITOR input.

IF edit = 'X'. "Edit long text

CALL METHOD g_gui_editor->set_focus

EXPORTING control = g_gui_editor.

"Display message

"Display message

CALL METHOD g_gui_editor->set_readonly_mode

EXPORTING

readonly_mode = '0'.

....

....

....

other code based on your conditions.

else.

CALL METHOD g_gui_editor->set_readonly_mode

EXPORTING

readonly_mode = '1'.

ENDIF.

Read only

Former Member
0 Likes
1,730

editorm      TYPE REF TO cl_gui_textedit.
CALL METHOD editorp->set_visible
      EXPORTING
        visible           = c_x
      EXCEPTIONS
        cntl_error        = 1
        cntl_system_error = 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 editorp->delete_text
      EXCEPTIONS
        error_cntl_call_method = 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.
    CLEAR is_mdtime.

    READ TABLE it_mdtime INTO is_mdtime WITH KEY ltext = c_x.

    CALL METHOD editorp->set_textstream
      EXPORTING
        text                   = is_mdtime-pfeed
      EXCEPTIONS
        error_cntl_call_method = 1
        not_supported_by_gui   = 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 editorm->set_visible
      EXPORTING
        visible           = c_x
      EXCEPTIONS
        cntl_error        = 1
        cntl_system_error = 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 editorm->delete_text
      EXCEPTIONS
        error_cntl_call_method = 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.

    CLEAR is_mdtime.

    READ TABLE it_mdtime INTO is_mdtime WITH KEY ltext = c_x.

    CALL METHOD editorm->set_textstream
      EXPORTING
        text                   = is_mdtime-mfeed
      EXCEPTIONS
        error_cntl_call_method = 1
        not_supported_by_gui   = 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.
  ELSE.
    MESSAGE e000(ympm) WITH 'Select the Record for Text'(016).
  ENDIF.

Please use the above Methods For u r use..

Regrds,

Srinivas

Edited by: Srininas on Apr 6, 2010 2:50 PM