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

Disable Fields

former_member227596
Participant
0 Likes
694

Dear Abapers,

I want to enable or disable fields when a user command hits. pl. help.

vikas

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
676

Hello,

DO like this.

IF SY-UCOMM = 'DISABLE'.
LOOP AT SCREEN.
IF SCREEN-NAME = 'FIELD'.
SCREEN-INPUT = 0.
SCREEN-OUTPUT = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.

Vasanth

4 REPLIES 4
Read only

Former Member
0 Likes
677

Hello,

DO like this.

IF SY-UCOMM = 'DISABLE'.
LOOP AT SCREEN.
IF SCREEN-NAME = 'FIELD'.
SCREEN-INPUT = 0.
SCREEN-OUTPUT = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.

Vasanth

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
676

Hi,

You need to use some flag and set that flag for your user command and then in the PBO or AT SELECTION-SCREEN OUTPUT you need to hide the fileds using

AT SELECTION SCREEN.

IF SY-UCOMM = 'Your use command'.

flag = 'X.

ENDIF.

AT SELECTION-SCREEN OUTPUT.

IF flag = 'X'.

LOOP AT SCREEN.

IF screen-name = 'field name'.

screen-active = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

Regards,

Sesh

Read only

Former Member
0 Likes
676

Hi,

parameters: p_chk1 as checkbox user-command chk,

p_fld1 type c,

p_fld2 type c.

at selection-screen output.

if p_chk1 = space.

loop at screen.

if screen-name = 'P_FLD2'.

screen-input = '0'.

modify screen.

endif.

endloop.

endif.

[/code]

Regards

Read only

gopi_narendra
Active Contributor
0 Likes
676

This can be done in the PBO of the screen if it is dialog programming

    LOOP AT SCREEN.
      IF screen-name = 'SCREEN FIELD NAME'.
        screen-input = 0. " Disable
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.

If its a report.

AT SELECTION-SCREEN OUTPUT.
  IF w_par2 = 'X'.
    LOOP AT SCREEN.
      IF screen-name = 'SCREEN FIELD NAME'.
        screen-input = 1. " Enable
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF

Regards

Gopi