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

checkbox

Former Member
0 Likes
495

Hello,

I have a SELECTION-SCREEN, including a PARAMETER defined as CHECKBOX. Now I want to open fields for input, when the parameter is checked and close them, if it is not checked. How can I solve the problem?

thx

Mike

1 ACCEPTED SOLUTION
Read only

guillaume-hrc
Active Contributor
0 Likes
477

Hi Mike,

Should be something like this (sorry, but I am not in front of a SAP system right now...) :

AT SELECTION-SCREEN OUTPUT.

IF p_check = 'X'.
  LOOP AT SCREEN.
    CHECK screen-name = 'P_INPUT'.
    screen-active = 1.
    MODIFY screen.
  ENDLOOP.

ELSE.
  LOOP AT SCREEN.
    CHECK screen-name = 'P_INPUT'.
    screen-active = 0.
    MODIFY screen.
  ENDLOOP.

ENDIF.

Best regards,

Guillaume

4 REPLIES 4
Read only

guillaume-hrc
Active Contributor
0 Likes
478

Hi Mike,

Should be something like this (sorry, but I am not in front of a SAP system right now...) :

AT SELECTION-SCREEN OUTPUT.

IF p_check = 'X'.
  LOOP AT SCREEN.
    CHECK screen-name = 'P_INPUT'.
    screen-active = 1.
    MODIFY screen.
  ENDLOOP.

ELSE.
  LOOP AT SCREEN.
    CHECK screen-name = 'P_INPUT'.
    screen-active = 0.
    MODIFY screen.
  ENDLOOP.

ENDIF.

Best regards,

Guillaume

Read only

Former Member
0 Likes
477

Hi

Use the USER-COMMAND addition while you define your checkbox:

PARAMETERS check AS CHECKBOX USER-COMMAND chk.

PARAMETERS p_bukrs LIKE t001-bukrs MODIF ID chk.

DATA: fl_input_off.

AT SELECTION-SCREEN OUTPUT.

CHECK check = 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'CHK'.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

max

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
477

Here is a sample.



report zrich_0002.


parameters: p_check1 as checkbox user-command check default 'X',
            p_input(20) type c modif id CHK.

at selection-screen output.

    if  p_check1  = 'X'.
      loop at screen.
        if screen-group1 = 'CHK'.
          screen-invisible = '0'.
                    screen-active = '1'.
          modify screen.
        endif.
      endloop.
    endif.
    if  p_check1  = space.
      loop at screen.
        if screen-group1 = 'CHK'.
          screen-invisible = '1'.
          screen-active = '0'.
          modify screen..
        endif.
      endloop.
    endif.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
477

Hi Mike,

You can do this way.

At SELECTION-SCREEN.

IF P_CHECK = 'X'.

LOOP AT SCREEN.

IF SCREEN-NAME = 'P_WERKS'.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.