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

Module pool programming

Former Member
0 Likes
500

Hi All,

I am having two buttons on selection screen(say button 1 and button2) .

if i press the button1 i need to display the text editor in display mode.

if i press the button2 i need to display the text editor in enable mode.

any suggestions....... urgent.

thanx,

krish...

3 REPLIES 3
Read only

Former Member
0 Likes
469

hi Krishna,

based on SY-UCOMM, you need to set

read-only-mode = true or false in method

<b>SET_READONLY_MODE</b> of class <b>CL_GUI_TEXTEDIT</b>

Please use the following code for reference:


data:
    gi_container  type ref to cl_gui_custom_container,
    gi_te_control type ref to cl_gui_textedit        ,
    gt_texttab    type table of tdline               .

constants:
    gc_container(13) value 'TEC_CONTAINER'           .
data lv_button(7).
at selection-screen.
     lv_button = sy-ucomm.
endcase.

start-of-selection.

  set pf-status '9000'.
  create object gi_container
  exporting
      container_name              = gc_container
  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.
      call method gi_container->set_focus
      exporting
          control = gi_container.

      call method cl_gui_cfw=>flush
      exceptions
          others = 1.
      create object gi_te_control
      exporting
          parent                     = gi_container
          wordwrap_mode              = cl_gui_textedit=>wordwrap_at_fixed_position
          wordwrap_to_linebreak_mode = cl_gui_textedit=>true
      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.
          if lv_button = 'BUTTON1'.
                 call method gi_te_control->set_readonly_mode
                 exporting
                       readonly_mode          = cl_gui_textedit=>true
                 exceptions
                       error_cntl_call_method = 1
                       invalid_parameter      = 2
                       others                 = 3                  .
          endif.
          call method gi_te_control->set_text_as_r3table
            exporting
              table           = gt_texttab
            exceptions
              error_dp        = 1
              error_dp_create = 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 cl_gui_cfw=>flush
          exceptions
              others = 1.
      endif.
  endif.

Hope this helps,

Sajan Joseph.

Read only

Former Member
0 Likes
469

Hi

check with this example :

REPORT demo_sel_screen_pushbutton.

TABLES sscrfields.

DATA flag(1) TYPE c.

SELECTION-SCREEN:

BEGIN OF SCREEN 500 AS WINDOW TITLE tit,

BEGIN OF LINE,

PUSHBUTTON 2(10) but1 USER-COMMAND cli1,

PUSHBUTTON 12(10) text-020 USER-COMMAND cli2,

END OF LINE,

BEGIN OF LINE,

PUSHBUTTON 2(10) but3 USER-COMMAND cli3,

PUSHBUTTON 12(10) text-040 USER-COMMAND cli4,

END OF LINE,

END OF SCREEN 500.

AT SELECTION-SCREEN.

MESSAGE i888(sabapdocu) WITH text-001 sscrfields-ucomm.

CASE sscrfields-ucomm.

  • here u write the code for making the text editor enable or display mode, by *using the function modules :

  • call method gi_te_control->set_readonly_mode

  • exporting

  • readonly_mode = cl_gui_textedit=>true

  • exceptions

  • error_cntl_call_method = 1

  • invalid_parameter = 2

  • others = 3 .

  • call method gi_te_control->set_text_as_r3table

  • exporting

  • table = gt_texttab

  • exceptions

  • error_dp = 1

  • error_dp_create = 2

  • others = 3 .

ENDCASE.

START-OF-SELECTION.

tit = 'Four Buttons'.

but1 = 'Button 1'.

but3 = 'Button 3'.

CALL SELECTION-SCREEN 500 STARTING AT 10 10.

CASE flag.

WHEN '1'.

WRITE / 'Button 1 was clicked'.

WHEN '2'.

WRITE / 'Button 2 was clicked'.

WHEN '3'.

WRITE / 'Button 3 was clicked'.

WHEN '4'.

WRITE / 'Button 4 was clicked'.

WHEN OTHERS.

WRITE / 'No Button was clicked'.

ENDCASE.

Regards,

Prasanth

  • Reward if it helps

Read only

Former Member
0 Likes
469

just go to PBO of the screen and write

if checkbox/radiobutton = 'X'.

loop at screen.

IF screen-name = 'FIELD NAME'.

screen-input = '0'.

screen-output = '1'.

modify screen.

ENDIF.

endloop.

no need to go through this much of lengthy sample codes,reward if helpful