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

GET_READONLY_MODE in class CL_GUI_TEXTEDIT

Former Member
0 Likes
734

Hi all !

I explain to you a bit what I am trying to do;

I have created an enhancenment point in the transaction SCASE to add a button when you display a document.

What I want to do is to add this button only when we'll be in display mode not when they are modifying this document.

This class is the CL_SRM_SP_BDV, I have put the enhancenment point in the method ADD_SPECIAL_TOOLBAR_BUTTON. In this class there is ana ttribute called MY_LOCAL_TEXTEDIT of type CL_GUI_TEXTEDIT. In debugging mode I can see the content of this attribute, but it do not belong how to do to obtain the mode.

I have tried to use the method GET_READONLY_MODE but it is a protected method and gives me a syntax error on having tried to activate.

Also I try to read the value of the attribute M_READONLY_MODE, but it does not change when I change the mode.

Now, I am tried to create a class that inherits from the class CL_GUI_TEXTEDIT to be able to read this value.

But on having tried to activate my test program it gives me the following sintax error;

With SUPER->, you can only call the previous implementation of your own method. (also SUPER->).

This is my code;

REPORT ztest.

CLASS lcl_get_mode DEFINITION INHERITING FROM CL_GUI_TEXTEDIT.
    PUBLIC SECTION.
       METHODS:
                 contructor IMPORTING l_parent TYPE REF TO CL_GUI_CONTAINER,
                 zget_readonly_mode EXPORTING modo TYPE i.
    PRIVATE SECTION.

ENDCLASS.
CLASS lcl_get_mode IMPLEMENTATION.
    METHOD contructor.
           super->constructor( EXPORTING PARENT = l_parent  ).
    ENDMETHOD.

    METHOD zget_readonly_mode.

        CALL METHOD GET_READONLY_MODE
          IMPORTING
            READONLY_MODE          = modo
          EXCEPTIONS
            ERROR_CNTL_CALL_METHOD = 1
            others                 = 2.

    ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.

DATA: lv_texteditor TYPE REF TO CL_GUI_TEXTEDIT,
      lv_container  TYPE REF TO CL_GUI_CONTAINER,
      lv_get_mode   TYPE REF TO lcl_get_mode,
      lv_modo       TYPE i.

 CREATE OBJECT LV_TEXTEDITOR
   EXPORTING
     PARENT                 = lv_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.

CREATE OBJECT lv_get_mode EXPORTING parent = lv_container.

 lv_get_mode ?= lv_texteditor.

 CALL METHOD lv_get_mode->zget_readonly_mode( IMPORTING modo = lv_modo ).

How can I do this?

Thanks in advance.

Hi all !

I explain to you a bit what I am trying to do;

I have created an enhancenment point in the transaction SCASE to add a button when you display a document.

What I want to do is to add this button only when we'll be in display mode not when they are modifying this document.

This class is the CL_SRM_SP_BDV, I have put the enhancenment point in the method ADD_SPECIAL_TOOLBAR_BUTTON. In this class there is ana ttribute called MY_LOCAL_TEXTEDIT of type CL_GUI_TEXTEDIT. In debugging mode I can see the content of this attribute, but it do not belong how to do to obtain the mode.

I have tried to use the method GET_READONLY_MODE but it is a protected method and gives me a syntax error on having tried to activate.

Also I try to read the value of the attribute M_READONLY_MODE, but it does not change when I change the mode.

Now, I am tried to create a class that inherits from the class CL_GUI_TEXTEDIT to be able to read this value.

But on having tried to activate my test program it gives me the following sintax error;

With SUPER->, you can only call the previous implementation of your own method. (also SUPER->).

This is my code;

REPORT ztest.

CLASS lcl_get_mode DEFINITION INHERITING FROM CL_GUI_TEXTEDIT.
    PUBLIC SECTION.
       METHODS:
                 contructor IMPORTING l_parent TYPE REF TO CL_GUI_CONTAINER,
                 zget_readonly_mode EXPORTING modo TYPE i.
    PRIVATE SECTION.

ENDCLASS.
CLASS lcl_get_mode IMPLEMENTATION.
    METHOD contructor.
           super->constructor( EXPORTING PARENT = l_parent  ).
    ENDMETHOD.

    METHOD zget_readonly_mode.

        CALL METHOD GET_READONLY_MODE
          IMPORTING
            READONLY_MODE          = modo
          EXCEPTIONS
            ERROR_CNTL_CALL_METHOD = 1
            others                 = 2.

    ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.

DATA: lv_texteditor TYPE REF TO CL_GUI_TEXTEDIT,
      lv_container  TYPE REF TO CL_GUI_CONTAINER,
      lv_get_mode   TYPE REF TO lcl_get_mode,
      lv_modo       TYPE i.

 CREATE OBJECT LV_TEXTEDITOR
   EXPORTING
     PARENT                 = lv_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.

CREATE OBJECT lv_get_mode EXPORTING parent = lv_container.

 lv_get_mode ?= lv_texteditor.

 CALL METHOD lv_get_mode->zget_readonly_mode( IMPORTING modo = lv_modo ).

How can I do this?

Thanks in advance.

2 REPLIES 2
Read only

Former Member
0 Likes
592

I write the code again without the constructor method, but a dump is trigger when I do the cast.

This is my code;

*include TOP:*

CLASS lcl_get_mode DEFINITION INHERITING FROM CL_GUI_TEXTEDIT.
    PUBLIC SECTION.
       METHODS:
                 zget_readonly_mode EXPORTING modo TYPE i.
    PRIVATE SECTION.

ENDCLASS.
CLASS lcl_get_mode IMPLEMENTATION.

    METHOD zget_readonly_mode.

        CALL METHOD GET_READONLY_MODE
          IMPORTING
            READONLY_MODE          = modo
          EXCEPTIONS
            ERROR_CNTL_CALL_METHOD = 1
            others                 = 2.

    ENDMETHOD.
ENDCLASS.

DATA: lv_texteditor TYPE REF TO CL_GUI_TEXTEDIT,
      lv_container  TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
      lv_get_mode   TYPE REF TO lcl_get_mode,
      lv_modo       TYPE i.

REPORT  ZTEST.

INCLUDE ZTEST_TOP.


START-OF-SELECTION.

CALL SCREEN 9000.


*&---------------------------------------------------------------------*
*&      Module  STATUS_9000  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE STATUS_9000 OUTPUT.

SET PF-STATUS 'TEST'.

    CREATE OBJECT lv_container
      EXPORTING
        container_name              = 'CC_CONTAINER'
      EXCEPTIONS
        cntl_error                  = 1
        cntl_system_error           = 2
        create_error                = 3
        lifetime_error              = 4
        lifetime_dynpro_dynpro_link = 5.

 CREATE OBJECT LV_TEXTEDITOR
   EXPORTING
     PARENT                 = lv_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.


ENDMODULE.                 " STATUS_9000  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_9000  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_9000 INPUT.

 lv_get_mode ?= lv_texteditor.

 CALL METHOD lv_get_mode->zget_readonly_mode( IMPORTING modo = lv_modo ).

ENDMODULE.                 " USER_COMMAND_9000  INPUT

The dump says; CX_SY_MOVE_CAST_ERROR

Any idea?

Read only

Former Member
0 Likes
592

Already I have managed to solve it.

Class: CL_SRM_SP_DOCVIEW_GE

Method: get_document_state