Skip to Content
author's profile photo Former Member
Former Member

Disable the container text

hello abapers,

i have use container for display the text in the screen.

now,the problem is How to make the container disable / only output / no input possible properties.

which method i should call.

i have used following code .

CONSTANTS:

line_length TYPE i VALUE 254.

DATA: ok_code LIKE sy-ucomm.

DATA:

*Create reference to the custom container

custom_container TYPE REF TO cl_gui_custom_container,

*Create reference to the TextEdit control

editor TYPE REF TO cl_gui_textedit,

repid LIKE sy-repid.


MODULE status_0100 OUTPUT.

SET PF-STATUS 'PF01'.

SET TITLEBAR 'T1'.

IF editor IS INITIAL.

repid = sy-repid.

* Create obejct for custom container

CREATE OBJECT custom_container

EXPORTING

container_name = 'MYCONTAINER1'

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

create_error = 3

lifetime_error = 4

lifetime_dynpro_dynpro_link = 5

OTHERS = 6.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno

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

ENDIF.

CREATE OBJECT editor

EXPORTING

wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position

wordwrap_position = line_length

wordwrap_to_linebreak_mode = cl_gui_textedit=>true

parent = custom_container

EXCEPTIONS

error_cntl_create = 1

error_cntl_init = 2

error_cntl_link = 3

error_dp_create = 4

gui_type_not_supported = 5

OTHERS = 6.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno

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

ENDIF.

*toolbar and status bar of container disable

CALL METHOD editor->set_toolbar_mode

EXPORTING

toolbar_mode = cl_gui_textedit=>false.

CALL METHOD editor->set_statusbar_mode

EXPORTING

statusbar_mode = cl_gui_textedit=>false.

ENDIF.

SELECT * FROM zsstab INTO wa_zsstab WHERE ss_apl_no = ss_apl_no1.

ss_apl_no = wa_zsstab-ss_apl_no.

proj_name = wa_zsstab-proj_name.

vnd_name = wa_zsstab-vnd_name.

uname = wa_zsstab-uname.

cdate = wa_zsstab-cdate.

ctime = wa_zsstab-ctime.

brief = wa_zsstab-brief.

text = wa_zsstab-justif.

impact = wa_zsstab-impact.

price = wa_zsstab-price.

ccenter = wa_zsstab-ccenter..

CALL METHOD editor->set_textstream

EXPORTING

text = text

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.

ENDSELECT.

ENDMODULE.

================================================================

the Whole code is working fine

i have also define the necessory details

======================================================


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Sep 07, 2013 at 10:27 AM

    Hi Nilesh Mohite,

    Just use this code

    Data : editor TYPE REF TO cl_gui_textedit,

    CALL METHOD editor->set_readonly_mode

    EXPORTING

    readonly_mode = 1.

    In your code like this

    CONSTANTS:

    line_length TYPE i VALUE 254.

    DATA: ok_code LIKE sy-ucomm.

    DATA:

    *Create reference to the custom container

    custom_container TYPE REF TO cl_gui_custom_container,

    *Create reference to the TextEdit control

    editor TYPE REF TO cl_gui_textedit,

    repid LIKE sy-repid.


    MODULE status_0100 OUTPUT.

    SET PF-STATUS 'PF01'.

    SET TITLEBAR 'T1'.

    IF editor IS INITIAL.

    repid = sy-repid.

    * Create obejct for custom container

    CREATE OBJECT custom_container

    EXPORTING

    container_name = 'MYCONTAINER1'

    EXCEPTIONS

    cntl_error = 1

    cntl_system_error = 2

    create_error = 3

    lifetime_error = 4

    lifetime_dynpro_dynpro_link = 5

    OTHERS = 6.

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno

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

    ENDIF.

    CREATE OBJECT editor

    EXPORTING

    wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position

    wordwrap_position = line_length

    wordwrap_to_linebreak_mode = cl_gui_textedit=>true

    parent = custom_container

    EXCEPTIONS

    error_cntl_create = 1

    error_cntl_init = 2

    error_cntl_link = 3

    error_dp_create = 4

    gui_type_not_supported = 5

    OTHERS = 6.

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno

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

    ENDIF.

    *toolbar and status bar of container disable

    CALL METHOD editor->set_toolbar_mode

    EXPORTING

    toolbar_mode = cl_gui_textedit=>false.

    CALL METHOD editor->set_statusbar_mode

    EXPORTING

    statusbar_mode = cl_gui_textedit=>false.

    ENDIF.

    * To Set disply - 1 or edit - 0 mode
    CALL METHOD editor->set_readonly_mode
    EXPORTING
    readonly_mode = 1.

    SELECT * FROM zsstab INTO wa_zsstab WHERE ss_apl_no = ss_apl_no1.

    ss_apl_no = wa_zsstab-ss_apl_no.

    proj_name = wa_zsstab-proj_name.

    vnd_name = wa_zsstab-vnd_name.

    uname = wa_zsstab-uname.

    cdate = wa_zsstab-cdate.

    ctime = wa_zsstab-ctime.

    brief = wa_zsstab-brief.

    text = wa_zsstab-justif.

    impact = wa_zsstab-impact.

    price = wa_zsstab-price.

    ccenter = wa_zsstab-ccenter..

    CALL METHOD editor->set_textstream

    EXPORTING

    text = text

    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.

    ENDSELECT.

    ENDMODULE.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 06, 2013 at 07:28 PM

    Use the method set_readonly_mode of your editor object to achieve this.

    Ex.:

    CALL METHOD editor->set_readonly_mode

    EXPORTING

    readonly_mode = cl_gui_textedit=>true.

    You can also disable your lines if you need, like this:

    Ex.:

    DESCRIBE TABLE ti_your_texts_table[] LINES li_lines.

    CALL METHOD editor->protect_lines

    EXPORTING

    from_line = 0

    protect_mode = cl_gui_textedit=>false

    to_line = li_lines

    enable_editing_protected_text = cl_gui_textedit=>false.

    []'s

    Heber

    Message was edited by: Heber Fabiano Added Example Code

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 07, 2013 at 04:11 AM

    HI Nilesh,

    Use below code after CREATE OBJECT editor.

    CALL METHOD editor->SET_READONLY_MODE
    EXPORTING
    READONLY_MODE = 1.

    Regards,

    Mordhwaj

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.