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: 

Modifying input field dynamically in selection screen

Former Member
0 Kudos

Hi All ,

I am having two input fields say s1 and s2 in my selection screen.

How can i disable the user input for s2 if the cursor is presently in s1.

Scenario:

select-options : s1 for vbrk-vbeln MODIF ID inv,

s2 for vbrk-erdat MODIF ID sal.

In the selection-screen if the user gets the focus of S1 input field , S2 be made input disabled and vice-versa.

Please help me in this regard.

Thanks to all in advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Correct code is

report ztest.

data v_fld(50).

tables mara.

select-options :

s_invno for mara-matnr MODIF ID INV ,

s_ordno for mara-mtart MODIF ID ORD.

AT SELECTION-SCREEN OUTPUT.

IF v_fld = 'S_INVNO-LOW' or v_fld = 'S_INVNO-HIGH'.

loop at screen.

check screen-group1 eq 'ORD'.

screen-input = 0 .

modify screen.

endloop.

ELSEIF v_fld = 'S_ORDNO-LOW' or v_fld = 'S_ORDNO-HIGH' .

loop at screen.

check screen-group1 eq 'INV'.

screen-input = 0.

modify screen.

endloop.

ENDIF.

AT SELECTION-SCREEN.

Get CURSOR FIELD v_fld.

10 REPLIES 10

Vinod_Chandran
Active Contributor
0 Kudos

Hi Siva,

This can be achieved but not like the way you have described because there must always be an event, like 'Enter' to do some processing.

You can use the GET CURSOR FIELD <fieldname> to get the field where the cursor is. Now you have to use

LOOP AT SCREEN.

IF SCREEN-FIELD = 'ABCD'.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

Hope this will help you.

Thanks

Vinod

Former Member
0 Kudos

There is no way to trigger user command with just by palcing cursor on Select Option Field.

After pressing cursor you will have to trigger AT Selection SCreen by pressing enter or any other user action.

AT SELECTION-SCREEN.

Get CURSOR FIELD FLD.

IF FLD(2) = 'S1'.

Loop at screen.

Check Screen-group1 eq 'sal.

screen-input = 0 .

modify screen.

endloop.

ELSEIF FLD(2) = 'S2'.

Loop at screen.

Check Screen-group1 eq 'inv.

screen-input = 0 .

modify screen .

endloop.

ENDIF.

Former Member
0 Kudos

Hi Siva,

1.If you want to change the input fields on some user input then use 'user-command ac' after the field on which you want the action.

2.Specify the modif id 'xxx' for each screen object.

3.Then in the event 'AT SELECTION-SCREEN ON OUTPUT' loop at screen. check the screen-group1(modif id ) of screen objects and change the status of the object.

4.You can view all the screen attribute from se11.

The following example may help you:

SELECTION-SCREEN BEGIN OF BLOCK 001.

PARAMETERS: P_MRU RADIOBUTTON GROUP SEL DEFAULT 'X' USER-COMMAND AC,

P_PART RADIOBUTTON GROUP SEL.

SELECT-OPTIONS P1 FOR <field> MODIF ID PRT.

SELECT-OPTIONS G1 FOR <field> MODIF ID MRU.

SELECTION-SCREEN END OF BLOCK 001.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF P_MRU = 'X'.

IF SCREEN-GROUP1 = 'PRT'.

SCREEN-INPUT = '0'.

ENDIF.

IF SCREEN-GROUP1 = 'MRU'.

SCREEN-INPUT = '1'.

ENDIF.

ELSEIF P_PART = 'X'.

IF SCREEN-GROUP1 = 'MRU'.

SCREEN-INPUT = '0'.

ENDIF.

IF SCREEN-GROUP1 = 'PRT'.

SCREEN-INPUT = '1'.

ENDIF.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

Hope it helps u.

Thanks&Regards,

Ruthra.R

Former Member
0 Kudos

Hello Siva,

There seems to be something wrong with the kind of functionality you're asking for in this case. Let us say the user ahd put his cursor in the first field. the second field will now be disabled. Now, why will the user put his cursor in the second field when he sees that it is disabled for input. this is not a very good UI-Design, I must say.

On the other hand, there's something that you can do. If you look at the Initial screen of the SE11 transaction, each field is preceded by a Radio Button. So, In your case, you can have one radi button beside each of your select-options fields and when the user the user changes the radio button, you can make the corresponding select-options input enabled. This is done by assigning a Function Code to the radio buttons. That will ensure that the PAI event is triggerred when the user changes the Radio-button selection.

Regards,

Anand Mandalika.

Former Member
0 Kudos

Hi All,

As Vinod and Sanjay told I have tried out but I can't achieve yet.

Even if I press Enter after entering one value into an input field , the other one is not getting disabled.

select-options :

s_invno for ztvesstatus-zinvoiceno MODIF ID INV

s_ordno for ztvesstatus-zsalesordno MODIF ID ORD

AT SELECTION-SCREEN .

Get CURSOR FIELD v_fld.

IF v_fld = 'S_INVNO-LOW' or v_fld = 'S_INVNO-HIGH'.

loop at screen.

check screen-group1 eq 'ORD'.

screen-input = 0 .

modify screen.

endloop.

ELSEIF v_fld = 'S_ORDNO-LOW' or v_fld = 'S_ORDNO-HIGH' .

loop at screen.

check screen-group1 eq 'INV'.

screen-input = 0.

modify screen.

endloop.

ENDIF.

I have also tried this under event .

AT SELCTION-SCREEN ON s_invno.

But I can't achieve the same.

Please help me out.

0 Kudos

Hi Siva,

As Sanjay mentioned, your code must be under AT SELECTION-SCREEN OUTPUT. This is the PBO of the report selection screen. Hope your code will work now.

Thanks

Vinod

Former Member
0 Kudos

Correct code is

report ztest.

data v_fld(50).

tables mara.

select-options :

s_invno for mara-matnr MODIF ID INV ,

s_ordno for mara-mtart MODIF ID ORD.

AT SELECTION-SCREEN OUTPUT.

IF v_fld = 'S_INVNO-LOW' or v_fld = 'S_INVNO-HIGH'.

loop at screen.

check screen-group1 eq 'ORD'.

screen-input = 0 .

modify screen.

endloop.

ELSEIF v_fld = 'S_ORDNO-LOW' or v_fld = 'S_ORDNO-HIGH' .

loop at screen.

check screen-group1 eq 'INV'.

screen-input = 0.

modify screen.

endloop.

ENDIF.

AT SELECTION-SCREEN.

Get CURSOR FIELD v_fld.

Former Member
0 Kudos

Hi siva,

Please follow "Ruthra"'s example. I personally feel it is more appropriate for your requirements.

Sri

Former Member
0 Kudos

Hi All,

Thanks to you all. My problem is solved now .

Thanks a lot Sanjay.

Former Member
0 Kudos

Hi All,

Thanks a lot Sanjay. My problem is solved now .

I extend my great thanks to all of you.