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: 

hi disable other fields

Former Member
0 Kudos
117

hi

i am writing following code in the PBO

loop at screen,

if c1 = 'X'.

screen-name = 'ZMAT'

SCREEN-INPUT = 0.

ELSE.

c1 = ' '.

screen-name = 'ZMAT'

SCREEN-INPUT = 1.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

BUT THIS CODE IS NOT MAKING ZMAT FIELD OR ANY OTHER FIELD DISBLE.

WHAT IS WRONG OR WHAT CODE NEEDED TO BE ADDED IN THE ABOVE CODE OR SHOULD I WRITE IN PAI OR DOES IT HAVE ANY CONNECTION WITH ENTER....WHAT???

PL HELP.

THANX

ROCKY.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
93
if c1 = 'X'.
loop at screen.
if screen-name = 'ZMAT'  "
SCREEN-INPUT = 0.
modify screen.  "---------> this is missing.
endif.
ENDLOOP.

endif.

regards,

vijay

Please close your previous threads .

10 REPLIES 10

Former Member
0 Kudos
93

hi,

do this way

loop at screen,

if c1 = 'X'.

screen-name = 'ZMAT'

SCREEN-INPUT = 0.

<b>MODIFY SCREEN.</b>

ELSE.

c1 = ' '.

screen-name = 'ZMAT'

SCREEN-INPUT = 1.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

Former Member
0 Kudos
93

loop at screen,

if c1 = 'X'.

if screen-name = 'ZMAT' ( u need to use second IF here )

SCREEN-INPUT = 0.

<b>MODIFY SCREEN.</b>

endif.

else.

if screen-name = 'ZMAT' ( here also )

SCREEN-INPUT = 1. (<b>INPUT = 0 can make a field input of but it cannot disable that field</b> )

<b>MODIFY SCREEN.</b>

endif.

endif.

ENDLOOP.

To disable the field u need to use <b>SCREEN-ACTIVE = 0</b>.

reward if it helps u...

sai ramesh

Former Member
0 Kudos
94
if c1 = 'X'.
loop at screen.
if screen-name = 'ZMAT'  "
SCREEN-INPUT = 0.
modify screen.  "---------> this is missing.
endif.
ENDLOOP.

endif.

regards,

vijay

Please close your previous threads .

Former Member
0 Kudos
93

Hi.......

Try this code........

loop at screen,

if c1 = 'X' and screen-name = 'ZMAT'

SCREEN-INPUT = 0.

endif.

MODIFY SCREEN.

ENDLOOP.

no need to make the INPUT = 1 explicitly.......

Reward points if useful......

Suresh......

Former Member
0 Kudos
93

hi Rocky,


loop at screen.
  if screen-name = 'ZMAT'
    if c1 = 'X'.
      SCREEN-INPUT = 0.
    else.
      SCREEN-INPUT = 1.
    endif.
    MODIFY SCREEN.
  endif.
ENDLOOP.

hope this helps,

Sajan Joseph.

Former Member
0 Kudos
93

HI

MY OTHER DOUBT IS, WHEN THIS WILL TRIGGER, WHETHER IT WILL TRIGGER IMMEDIATELY OR AFTER ENTERING SOMTHING OR BY CLICKING OR WHAT?????

MY REQUIREMENT IS TO DISABLE OTHER FIELDS WHEN CHECK BOX IS CLICKED.

PL READ MY QUERY CAREFULLY.

THANX

ROCKY

0 Kudos
93

Then u need to assign all the other fields to some MODIF ID ..

Then these fields with same memory id will be assigned to a GROUP1 of the screen table..

like

parameters :

p_value type i modif id 'GRP',

P_CHAR(20) type c modif id 'GRP'.

<b>But u need to give USER-COMMAND for that check box.

like

parameter c1 as checkbox user-command 'CHECK'.

Then onli the at selection-screen output will get triggered again. and those will disappear .. this is must.</b>

at selection-screen output.

loop at screen,

if c1 = 'X'.

if screen-group1 = 'GRP'

<b>SCREEN-ACTIVE = 0.</b>

MODIFY SCREEN.

endif.

else.

if screen-group1 = 'GRP' ( here also )

<b>SCREEN-ACTIVE = 1. </b>

MODIFY SCREEN.

endif.

endif.

ENDLOOP.

Now both p_value , p_char will not appear when click the check box.

<b>U JUST PASTE THE ABOVE CODE IT WILL WORK....</b>

plz close the thread if ur problem got solved..

reward helpful answers ...

sai ramesh

0 Kudos
93

Hi u can achieve this with the concept of user-command.

Declare the checkbox ca cs follows:

parameters ca AS CHECKBOX USER-COMMAND fcode

The addition USER-COMMAND can be used to assign a function code fcode to the parameter. The function code fcode must be directly specified and may have a maximum length of 20 characters. To evaluate the function code, an interface work area of the structure SSCRFIELDS from the ABAP Dictionary must be declared using the statement TABLES. When the user selects the checkbox on the selection screen, the runtime environment triggers the event AT SELECTION-SCREEN and transfers the function code fcode to the component ucomm of the interface work area sscrfields.

Reward points if useful........

Suresh......

Former Member
0 Kudos
93

hi Rocky,

when the check box is clicked, if you hava FCODE attached to this

check-box, that will trigger a PAI event. after that when it comes to the

PBO, while looping through the screen, the code is checking whther

check-box is selected (C1 =X). If it is selected, it sets ZMAT field

as disabled.

So, you need to have a functioncode attahced to the check box, then only the PAI and consequently the PBO will be triggered, on selecting/deselecting check box. Otherwise, this will happen only on the next user action (like some button clicks).

Hope this helps,

Sajan Joseph.

Yes, as Sai Ramesh has mentioned, you have to assign same

group Id (for eg.001) to all the fields to disabled.

loop at screen.
  if screen-group1 = '001'
    if c1 = 'X'.
      SCREEN-INPUT = 0.
    else.
      SCREEN-INPUT = 1.
    endif.
    MODIFY SCREEN.
  endif.
ENDLOOP.

Message was edited by:

Sajan Joseph

I think you are working with screens, and not with selection screen.

to assign group id to a field, select the field in

the screen and press F2, which will take you to the

properties window, where you have 4 columns for group.

enter 001 or whatever you like, in the first coloumn.

Message was edited by:

Sajan Joseph

Former Member
0 Kudos
93

Hi......

Try the following code.......

PARAMETERS: C1 AS CHECKBOX USER-COMMAND U1,

STR(10).

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF C1 = 'X'.

IF SCREEN-NAME = 'STR'.

SCREEN-INPUT = '0'.

MODIFY SCREEN.

ENDIF.

ENDIF.

ENDLOOP.

Reward points if useful.......

Suresh........