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: 

Activate input for a field depending on the input in another field

Former Member
0 Kudos

Hy gurus,

A have a report with select option.

In the select option I'd like to have the following:

I have a checkbox ,if it is flagged the input for another field should be made possible.

The problem is,to activate it right after I flag the checkbox (without having to press ENTER)

Do you have suggestions?

Thanks,Christian

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

Use USER-COMMAND option:

PARAMETERS: p1,
            p2.

PARAMETERS: p_ck AS CHECKBOX USER-COMMAND aaa.

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.
    IF p_ck = 'X'.
      IF screen-name = 'P1'.
        screen-input = 0.
        MODIFY SCREEN.
      ENDIF.
    ELSE.
      IF screen-name = 'P2'.
        screen-input = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDIF.
  ENDLOOP.

Max

6 REPLIES 6

Former Member
0 Kudos

Hi

Use USER-COMMAND option:

PARAMETERS: p1,
            p2.

PARAMETERS: p_ck AS CHECKBOX USER-COMMAND aaa.

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.
    IF p_ck = 'X'.
      IF screen-name = 'P1'.
        screen-input = 0.
        MODIFY SCREEN.
      ENDIF.
    ELSE.
      IF screen-name = 'P2'.
        screen-input = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDIF.
  ENDLOOP.

Max

Former Member
0 Kudos

Sorry, I meant 'Report with Selection Screen' instead of 'with Select option'

0 Kudos

Hi Christian

It's the same, check my sample in the last my answer.

If you want to protect a SELECT-OPTION or more than one parameter it should use the group.

SELECT-OPTIONS: S1 FOR SY-DATUM MODIF ID AAA,
                S2 FOR SY-UNAME MODIF ID BBB
PARAMETERS: p1  MODIF ID AAA,
            p2  MODIF ID BBB.
 
PARAMETERS: p_ck AS CHECKBOX USER-COMMAND aaa.
 
AT SELECTION-SCREEN OUTPUT.
 
  LOOP AT SCREEN.
    IF p_ck = 'X'.
      IF screen-group1 = 'AAA'.
        screen-input = 0.
        MODIFY SCREEN.
      ENDIF.
    ELSE.
      IF screen-group1 = 'BBB'.
        screen-input = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDIF.
  ENDLOOP.

Max

Former Member
0 Kudos

Problem solved! Thanks Max

Former Member
0 Kudos

In case you have defined more than one user-command on selection screen you may check the field sscrfields-ucomm in event AT SELECTION-SCREEN:

PARAMETERS: p_check as CHECKBOX USER-COMMAND UC1,

p_check2 as CHECKBOX USER-COMMAND UC2.

AT SELECTION-SCREEN.

CASE sscrfields-ucomm.

WHEN 'UC1'.

..........

WHEN 'UC2'.

.................

ENDCASE.

Former Member
0 Kudos

This answer was great too! Thanks Daniel