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

SELECTION SCREEN

Former Member
0 Likes
661

dear all,

how can we handle the selection screen to disable the second field if we have two fields in selection screen & one of them is entered.

kindly give me the code

7 REPLIES 7
Read only

Former Member
0 Likes
641

HI,

1.For select-options:

... NO INTERVALS

Effect

If you specify this addition, the second input screen is not created on the selection screen.

Note

The user can only specify a single comparison in the first line in the selection table on the selection screen. The dialog box for multiple selections still allows interval selections.

Example

Declaration of a selection criterion for which a single comparison is possible on the selection screen, but multiple selection isnot possible.

DATA spfli_wa TYPE spfli.

SELECT-OPTIONS s_carrid FOR spfli_wa-carrid

NO-EXTENSION NO-INTERVALS.

2.For screens:

Depending on the flag, enable/disable the screen elements in your AT SELECTION-SCREEN OUTPUT event.

At selection-screen output is the last event triggered before selection screen displayed.

at selection screen on output is used to set screen attributes

AT SELECTION_SCREEN OUTPUT

LOOP AT SCREEN.

if VIEW = 'X' " View radio button selects

IF SCREEN-NAME = 'PR1'.

screen-INPUT = 0.

modify screen.

ENDIF.

IF SCREEN-NAME = 'PR2'.

screen-INPUT = 0.

modify screen.

ENDIF.

ENDLOOP.

Regards,

Shiva Kumar

Read only

Former Member
0 Likes
641

Hi,

Try this -

TYPE-POOLS sscr.

Tables: KOMG.

Select-Options:

s_prod for komg-matnr.

DATA restrict TYPE sscr_restrict.

DATA : optlist TYPE sscr_opt_list,

ass type sscr_ass.

INITIALIZATION.

optlist-name = 'OBJECTKEY1'.

optlist-options-eq = 'X'.

APPEND optlist TO restrict-opt_list_tab.

ass-kind = 'S'.

ass-name = 'S_PROD'.

ass-sg_main = 'I'.

ass-sg_addy = space.

ass-op_main = 'OBJECTKEY1'.

APPEND ass TO restrict-ass_tab.

CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'

EXPORTING

restriction = restrict

EXCEPTIONS

TOO_LATE = 1

REPEATED = 2

SELOPT_WITHOUT_OPTIONS = 3

SELOPT_WITHOUT_SIGNS = 4

INVALID_SIGN = 5

EMPTY_OPTION_LIST = 6

INVALID_KIND = 7

REPEATED_KIND_A = 8

OTHERS = 9.

Hope this helps.

Regds,

Seema.

Read only

Former Member
0 Likes
641

Hi,

It is posible. but you need to press ENTER after entering the value in the first field.

parameters: p_char type c,

p_num type i.

at selection-screen output.

loop at screen.

if screen-name = 'P_NUM'.

if not p_char is initial.

screen-input = 0.

else.

screen-input = 1.

endif.

endif.

modify screen.

endloop.

Read only

Former Member
0 Likes
641

Hello,

You can write the logic to disable/enable the selection screen fields in the event:

AT SELECTION-SCREEN OUTPUT...

You have to use :

LOOP AT SCREEN...

<screen field>-input = 1; Input input-enabled field

<screen field>-output = 1; Output display field

ENDLOOP.

For more details on Loop at screen, refer sap help...

Reward if useful...

Regards

Shiva

Read only

gopi_narendra
Active Contributor
0 Likes
641

As mentioned in my earlier post, your requirement will not be possible without any user intervention like chosing the radiobutton, checkbox, or Enter..

If u wnt to use enter you can go with this code, but you have to Press ENTER after entering the value in either of the fields..

PARAMETER        : p_one(10) TYPE c.
PARAMETER        : p_two(10) TYPE c.


AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.
    IF NOT p_one IS INITIAL.
      IF screen-name = 'P_TWO'.
        screen-input = 0.
        MODIFY SCREEN.
      ENDIF.
    ELSEIF NOT p_two IS INITIAL.
      IF screen-name = 'P_ONE'.
        screen-input = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDIF.
  ENDLOOP.

Regards

Gopi

P.S: Avoid using duplicate threads

Read only

0 Likes
641

thanks gopi...

its solved.

Read only

Former Member
0 Likes
641

HI,

enter the value in first field and press enter then the second field will get disappeared.if the first field is empty the second field will stay as it is.

check this code.


PARAMETERS:mat LIKE mara-matnr,
           mtyp like mara-mtart.

DATA:flag.

AT SELECTION-SCREEN on mat.
IF mat is NOT INITIAL.
  flag = 1.
ELSE.
  flag = 0.
ENDIF.

AT SELECTION-SCREEN OUTPUT.
IF flag = 1.
  LOOP AT SCREEN.
    IF screen-name = 'MTYP' or screen-name = '%_MTYP_%_APP_%-TEXT'.
      screen-active = 0.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.
ENDIF.

rgds,

bharat.