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: 

Selection-screen disabling

rohit_kaikala
Participant
0 Kudos
173

Hi all,

I have 10 selection screen fields, in that 3 date fields which r given with select-options.

Now If one date field is given, then rest of the rwo date fields should be disabled.

How to do that with clear example.

Thanks,

Rohith.

11 REPLIES 11

GauthamV
Active Contributor
0 Kudos
128

This will sove your problem.



parameters: date1 type sy-datum.
parameters: date2 type sy-datum.
parameters: date3 type sy-datum.

at selection-screen output.

if date1 is not initial.

loop at screen.
if screen-name = 'DATE2' or screen-name = 'DATE3'.
screen-input = 0.
modify screen.
endif.
endloop.

endif.

0 Kudos
128

Hello,

Plz try the code below:


REPORT Y_WA NO STANDARD PAGE HEADING LINE-COUNT 60(5).

TABLES: BKPF.

SELECT-OPTIONS:
S_DT1 FOR BKPF-BLDAT MODIF ID M1,
S_DT2 FOR BKPF-BLDAT MODIF ID M2,
S_DT3 FOR BKPF-BLDAT MODIF ID M3.

AT SELECTION-SCREEN OUTPUT.

  PERFORM F_SUPRESS_FIELDS.
*&---------------------------------------------------------------------*
*&      Form  F_SUPRESS_FIELDS
*&---------------------------------------------------------------------*
FORM F_SUPRESS_FIELDS .

  IF S_DT1 IS NOT INITIAL.
    LOOP AT SCREEN.
      IF SCREEN-GROUP1 = 'M2' OR SCREEN-GROUP1 = 'M3'.
        SCREEN-INPUT = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSEIF S_DT2 IS NOT INITIAL.
    LOOP AT SCREEN.
      IF SCREEN-GROUP1 = 'M3' OR SCREEN-GROUP1 ='M1'.
        SCREEN-INPUT = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSEIF S_DT3 IS NOT INITIAL.
    LOOP AT SCREEN.
      IF SCREEN-GROUP1 = 'M1' OR SCREEN-GROUP1 = 'M2'.
        SCREEN-INPUT = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.

ENDFORM.                    " F_SUPRESS_FIELDS

Hope this helps.

BR,

Suhas

Edited by: Suhas Saha on Jan 7, 2009 6:43 AM

0 Kudos
128

Hi,

With this, the fields will get disable only when the user press 'Enter'.

If he goes with mouse click or Tab button then this will not work.

So for event, after entering one of the fields in the three dates, it should get disable.

<<removed_by_moderator>>

Thank You,

Rohith.

Edited by: Vijay Babu Dudla on Jan 15, 2009 4:47 AM

Former Member

Former Member
0 Kudos
128

Hi Rohit,

Try to use the SCREEN internal table logic.


    LOOP AT SCREEN.

     if so_date is not initila.
    then enabling that button
      IF screen-group1 = c_date. "'date.
        screen-required = c_1.                              "'1'.
        screen-output   = c_1.                              "'1'.
        screen-input    = c_1.                              "'1'.
        MODIFY SCREEN.
      ENDIF.
    endif.

     if so_date is not initial.
    then enabling that button
      IF screen-group1  = c_date1.                            "'date1'.
        screen-required = c_1.                              "'1'.
        screen-output   = c_1.                              "'1'.
        screen-input    = c_1.                              "'1'.
        MODIFY SCREEN.
      ENDIF.
     ENDIF.

     if so_date is not initila.
    then enabling that button
      IF screen-group1  = c_date2.                            "'date2'.
        screen-required = c_1.                              "1'.
        screen-output   = c_1.                              "'1'.
        screen-input    = c_1.                              "'1'.
        MODIFY SCREEN.
      ENDIF.
    ENDIF.

    ENDLOOP.

mention the group properties of that filed in your screen as the DATE ,DATE1 and DATE2 as per your requiremnt.

Thanks!

Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 4:29 PM

Former Member
0 Kudos
128

Hi,

if any one of the date field on the slection screen is filled with value then do it like that.

at selection-screen.

if date1 = 'X'.

display the other 2 with no display option as given in the following format.

[OBLIGATORY|NO-DISPLAY]

[VISIBLE LENGTH vlen]

[NO-EXTENSION]

[NO INTERVALS]

[MODIF ID modid] ... .

hope it will help.

Regards

Rajesh

Former Member
0 Kudos
128

Hi,


  AT SELECTION-SCREEN OUTPUT .
LOOP AT SCREEN.
  If screen-name = date2.
    if date1 IS NOT INITIAL.
      screen-invisible = 1.
       endif.
      endif.
     modify screen.
   If screen-name = date3.
    if date1 IS NOT INITIAL.
      screen-invisible = 1.
       endif.
      endif.
    modify screen.
ENDLOOP.

Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 4:29 PM

0 Kudos
128

This message was moderated.

Mohamed_Mukhtar
Active Contributor
0 Kudos
128

Hi,

SELECT-OPTIONS : s_date1 FOR sy-datum,
                 s_date2 FOR sy-datum,
                 s_date3 FOR sy-datum.

AT SELECTION-SCREEN OUTPUT.

    IF s_date1 IS NOT INITIAL AND s_date2 IS  INITIAL AND s_date3 IS  INITIAL.
    LOOP AT SCREEN.
      IF screen-name = 'S_DATE2-LOW' OR screen-name = 'S_DATE2-HIGH'
       OR screen-name = 'S_DATE3-LOW' OR screen-name = 'S_DATE3-HIGH'.
        screen-input = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSEIF s_date2 IS NOT INITIAL  AND s_date1 IS  INITIAL AND s_date3 IS  INITIAL.
    LOOP AT SCREEN.
      IF screen-name = 'S_DATE1-LOW' OR screen-name = 'S_DATE1-HIGH'
       OR screen-name = 'S_DATE3-LOW' OR screen-name = 'S_DATE3-HIGH'.
        screen-input = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSEIF s_date3 IS NOT INITIAL AND s_date1 IS  INITIAL AND s_date2 IS  INITIAL.
    LOOP AT SCREEN.
      IF screen-name = 'S_DATE1-LOW' OR screen-name = 'S_DATE1-HIGH'
       OR screen-name = 'S_DATE2-LOW' OR screen-name = 'S_DATE2-HIGH'.
        screen-input = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.

Thanks & REgards

Edited by: Always Learner on Jan 7, 2009 7:07 AM

Former Member
0 Kudos
128

Hi,


   LOOP AT SCREEN.
*Put if condition* 

              MODIFY SCREEN.
      ENDIF.
    ENDLOOP.

this will work out for you

fareed

Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 4:30 PM

rohit_kaikala
Participant
0 Kudos
128

Problem solved