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: 

Problem: Disabling fields on selection screen

Former Member
0 Kudos

There are two date fields on my selection screen that should always remain disabled. In the INITIALIZATION event I have the following code:

LOOP AT SCREEN.
    IF screen-name EQ 'S_BEGDA' OR screen-name EQ 'S_ENDDA'.
      screen-input = 0.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

This works fine when the screen starts up. However, in the AT SELECTION-SCREEN event Iu2019m getting these two dates from the database based on some other fields and want to put the dates in these fields but have them remain disabled. However, after the AT SELECTION-SCREEN event the fields are editable.

Here's my AT SELECTION-SCREEN event code (s_begda s_endda are the selection screen param names)

AT SELECTION-SCREEN.

  DATA: lt_t549q TYPE TABLE OF t549q WITH HEADER LINE.

  SELECT * INTO TABLE lt_t549q
    FROM t549q
    WHERE permo = '02' AND pabrj = '2008' AND pabrp = '01'.

  IF sy-subrc EQ 0.
    READ TABLE lt_t549q INDEX 1.
    s_begda = lt_t549q-begda.
    s_endda = lt_t549q-endda.
  ELSE.
    MESSAGE text-m01 TYPE 'E' DISPLAY LIKE 'I'.
  ENDIF.

  LOOP AT SCREEN.
    IF screen-name EQ 'S_BEGDA' OR screen-name EQ 'S_ENDDA'.
      screen-input = 0.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

I tried using the above loop again at the end of this event but it seems to be being ignored.

Anyone have a suggestion?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

write your condition in event

AT SELECTION-SCREEN OUTPUT.

4 REPLIES 4

Former Member
0 Kudos

write your condition in event

AT SELECTION-SCREEN OUTPUT.

Former Member
0 Kudos

hi check this.....

select-options:s_begda for sy-datum,

s_endda for sy-datum.

initialization.

LOOP AT SCREEN.

IF screen-name EQ 'S_BEGDA-LOW' or

screen-name EQ 'S_BEGDA-HIGH' OR

screen-name EQ 'S_ENDDA-LOW' OR

screen-name EQ 'S_ENDDA-HIGH' .

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

at selection-screen .

LOOP AT SCREEN.

IF screen-name EQ 'S_BEGDA-LOW' or

screen-name EQ 'S_BEGDA-HIGH' OR

screen-name EQ 'S_ENDDA-LOW' OR

screen-name EQ 'S_ENDDA-HIGH' .

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

Former Member
0 Kudos

Hi,

Try putting this same in the AT SELECTION-SCREEN OUTPUT and it should work fine.

Enjoy SAP.

Regards,

Hari

former_member70391
Contributor
0 Kudos

Hi,

Check this code,

REPORT ZTEST.

TABLES: t549q.

SELECT-OPTIONS: S_BEGDA FOR t549q-BEGDA,

S_ENDDA FOR t549q-ENDDA.

INITIALIZATION.

DATA: lt_t549q TYPE TABLE OF t549q WITH HEADER LINE.

SELECT * INTO TABLE lt_t549q

FROM t549q

WHERE permo = '02' AND pabrj = '2008' AND pabrp = '01'.

IF sy-subrc EQ 0.

READ TABLE lt_t549q INDEX 1.

s_begda-SIGN = 'I'.

s_begda-LOW = lt_t549q-begda.

s_begda-OPTION = 'EQ'.

APPEND S_BEGDA.

s_ENDda-SIGN = 'I'.

s_ENDda-LOW = lt_t549q-endda.

s_ENDda-OPTION = 'EQ'.

APPEND S_ENDda.

ELSE.

MESSAGE text-m01 TYPE 'E' DISPLAY LIKE 'I'.

ENDIF.

LOOP AT SCREEN.

IF screen-name EQ 'S_BEGDA-LOW' OR screen-name EQ 'S_ENDDA-LOW'

OR SCREEN-NAME EQ S_BEGDA-HIGH OR SCREEN-NAME EQ S_ENDDA-HIGH.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

Thanks & regards,

nagaraj kalbavi