Skip to Content
author's profile photo Former Member
Former Member

Problem: Disabling fields on selection screen

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?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 23, 2008 at 03:03 PM

    write your condition in event

    AT SELECTION-SCREEN OUTPUT.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 23, 2008 at 03:04 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 23, 2008 at 03:06 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 23, 2008 at 03:04 PM

    Hi,

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

    Enjoy SAP.

    Regards,

    Hari

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.