Application Development 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: 

Make the field disabled in the screen

Former Member
0 Kudos

Hi Everyone,

In my selection screen program, my screen has all fields radio buttons, check boxes etc. Two of the fields are parameters of type I. I want to make them disabled and also i have the date field in the screen i want to make this greyed out. How do i achieve this. Can anyone please help me on this.

Thanks,

Prabs.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Use the following code.

put your code between Loop and Endloop.

loop at screen.

Endloop.

If you need full code let me know.

Aman

8 REPLIES 8

Former Member
0 Kudos

Use the following code.

put your code between Loop and Endloop.

loop at screen.

Endloop.

If you need full code let me know.

Aman

0 Kudos

Hi Aman,

How it is possible with loop and endloop, see in the selection screen i have one field as

parameter date type sy-datum default 'sy-datum'.

In my screen i want to make this greyed out. It must not be an editable field. I want it to be totally a disabled field.

Similarly for the other field which are of type I .

Thanks,

Prabs.

Former Member
0 Kudos

Hi, look this code for reference, hope it will be helpful

PARAMETER: LC_FIELD TYPE XXXX DEFAULT XX.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF SCREEN-NAME = 'LC_FIELD'.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

0 Kudos

Thanks a lot Gu

It worked, but for the text fields i want to make it editable fields when i press a pushbutton how do i achieve this. Any help will be of great use.

Regards,

Prabs.

0 Kudos

Here is a quick little sample.



report zrich_0002 .

selection-screen begin of block b1 with frame title text-001.

selection-screen pushbutton 1(20) gocfg user-command gocfg.

selection-screen end of block b1.
selection-screen begin of block b2 with frame title text-002.
parameters: p_kunnr type kna1-kunnr,
            p_kdgrp type vbkd-kdgrp,
            p_check(1) type c no-display default '0'.
selection-screen end of block b2.

initialization.

at selection-screen .

  case sy-ucomm.
    when 'GOCFG'.

      if p_check = '0'.
        p_check = '1'.
      elseif p_check = '1'.
        p_check = '0'.
      endif.

  endcase.

start-of-selection.


at selection-screen output.

* Write pushbutton text
  gocfg = 'Configuration'.

* Toggle selection screen boxes
    perform toggle_screen using p_check.


*********************************************************************
*       FORM TOGGLE_SCREEN
*********************************************************************
form toggle_screen using mode.

* 1=Active, 0=Don't display
  loop at screen.
    if screen-group4 > '003'.
      screen-active = mode.
      modify screen.
    endif.
  endloop.

endform.

Regards,

Rich Heilman

Former Member
0 Kudos

Hi, try the code like this

PARAMETER: LC_FLAG AS CHECKBOX USER-COMMAND XX.

PARAMETER: LC_FIELD TYPE XXXX DEFAULT XX.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF SCREEN-NAME = 'LC_FIELD'.

IF LC_FLAG = 'X'.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ELSE.

SCREEN-INPUT = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

hope it will be useful. thanks a lot

0 Kudos

Hi Gu,

It worked thanks a lot, but when i used a pushbutton instead of the check box it doesn't work. Which will be more efficient way to change a text field whether using a check box or a push button.

Thanks,

Prabs.

Former Member
0 Kudos

Sorry for the give you the checkbox sample, here is the pushbutton box sample, hope it will be useful.

PARAMETER: LC_FLAG AS CHECKBOX USER-COMMAND XX.

PARAMETER: LC_FIELD TYPE XXXX DEFAULT XX.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.

SELECTION-SCREEN PUSHBUTTON 1(20) BUTTON USER-COMMAND BT.

PARAMETER: LC_FIE2 TYPE XXXX DEFAULT XX.

SELECTION-SCREEN END OF BLOCK B1.

DATA: LC_FLAG2 TYPE C.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF SCREEN-NAME = 'LC_FIELD'.

IF LC_FLAG = 'X'.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ELSE.

SCREEN-INPUT = 1.

MODIFY SCREEN.

ENDIF.

ENDIF.

IF SCREEN-NAME = 'LC_FIE2'.

IF LC_FLAG2 = 'X'.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ELSE.

SCREEN-INPUT = 1.

MODIFY SCREEN.

ENDIF.

ENDIF.

ENDLOOP.

AT SELECTION-SCREEN .

IF SY-UCOMM = 'BUTTON'

AND LC_FLAG2 IS INITIAL.

LC_FLAG2 = 'X'.

ELSE.

CLEAR LC_FLAG2.

ENDIF.