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: 

Hide/Show parameter based on another parameter

Former Member
0 Kudos

Hi All,

Is there a way to hide the parameters initially on the screen and only showing them when another field is selected?

For example, when I click on "range" then I want to to display two fields....start date and end date.

Thanks,

~Mark

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Mark

If the click you are referring to is on a check box or radio button, yes we can do it. But if selection are to be invoked when you click on label, i think it may not be possible.

An example on a possible scenario is:


parameters: p_rd1 radiobutton group rad1 default 'X' user-command but,
            p_rd2 radiobutton group rad1,
            p_text type char128 obligatory.

at selection-screen output.

  loop at screen.
     if screen-name CP '*P_TEXT*'.
        if not p_rd1 is initial.
           screen-active = 1.
           screen-required = 1.
        else.
           screen-active = 0.
           screen-required = 0.
        endif.
        modify screen.
     endif.
  endloop.

Regards

Eswar

10 REPLIES 10

former_member156446
Active Contributor
0 Kudos

Hi Mark

In the selection screen

you can use the code


AT SELECTION-SCREEN OUTPUT.

IF pa_equip <> 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'I1'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.

IF pa_logic <> 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'I2'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.

You will get many examples if you search the forum.

Former Member
0 Kudos

Hi Mark

If the click you are referring to is on a check box or radio button, yes we can do it. But if selection are to be invoked when you click on label, i think it may not be possible.

An example on a possible scenario is:


parameters: p_rd1 radiobutton group rad1 default 'X' user-command but,
            p_rd2 radiobutton group rad1,
            p_text type char128 obligatory.

at selection-screen output.

  loop at screen.
     if screen-name CP '*P_TEXT*'.
        if not p_rd1 is initial.
           screen-active = 1.
           screen-required = 1.
        else.
           screen-active = 0.
           screen-required = 0.
        endif.
        modify screen.
     endif.
  endloop.

Regards

Eswar

0 Kudos

Thanks for your reply Eswar.

This code will hide the entire screen and not the specific fields? How do I hide just the fields?

~Mark

0 Kudos

Mark in my example above am doing the manipulations only to parameter P_TEXT.

Check another example:


PARAMETERS: p_chb AS CHECKBOX USER-COMMAND chb,
            p_file TYPE localfile.

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.
    IF screen-name CP '*P_FILE*'.
      IF p_chb IS INITIAL.
        screen-active = 0.
      ELSE.
        screen-active = 1.
      ENDIF.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

To have a better feel, execute in a temporary program.

Regards

Eswar

0 Kudos

Thanks I got it. I missed online.

So initially when the checkbox is not checked the other field does not appear, then when I make it checked can I make the field appear dynamically?

Thanks,

~Mark

0 Kudos

Yes.

0 Kudos

It does not appear when I check the box.

0 Kudos

Mark,

Can you post your code?

Thanks

Eswar

0 Kudos

*SELECT-OPTIONS

SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE frametxt.

Parameter: cttyp type p0016-cttyp.

SELECT-OPTIONS: s_date for p0016-aedtm NO-extension.

SELECTION-SCREEN END OF BLOCK block1.

SELECTION-SCREEN BEGIN OF BLOCK block2 WITH FRAME TITLE frame.

parameters: Test as checkbox.

parameters: m_run as checkbox.

Parameters: st_date type p0016-begda MODIF ID MOD.

Parameters: en_date type p0016-endda.

SELECTION-SCREEN END OF BLOCK block2.

*AT SELECTION-SCREEN OUTPUT.

Loop at Screen.

if m_run is initial.

if Screen-name CP 'st_date'.

Screen-active = 0.

screen-required = 0.

ELSE.

screen-active = 1.

Endif.

modify screen.

endif.

Endloop.

Former Member
0 Kudos

MArk,

EX:

PARAMETERS: p_chb AS CHECKBOX USER-COMMAND chb,

p_sdate LIKE sy-datum MODIF ID mod,

p_edate LIKE sy-datum MODIF ID mod.

AT SELECTION-SCREEN OUTPUT.

IF p_chb NE 'X'.

LOOP AT SCREEN.

IF screen-group1 EQ 'MOD'.

screen-active = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSE.

IF p_chb NE 'X'.

LOOP AT SCREEN.

IF screen-group1 EQ 'MOD'.

screen-active = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

Don't forget to reward if useful...