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: 

Activating radiobuttons using variant on selection screen

Former Member
0 Kudos

Hi,

I need to create 2 radiobuttons on a selection screen . The conditions are: Once I execute my program one out of those should be selected by default and that block should either be invisible or uneditable (this part is pretty okay and doable).

However, I need to create a variant for this program such that when I select this particular variant, those radiobuttons might become active or editable.

Are there any settings for the variant which might help me incorporate this functionality???

I have done the other way round that is when i select a particular variant we can hide a block of the selection screen. I am not getting a way across this one.

Please provide me with your opinions.

Thanks and regards,

Aastha

1 ACCEPTED SOLUTION

Clemenss
Active Contributor
0 Kudos

as far as I remember the variant does not care id the field is visible editable or not - values are just passed to parameters (Try!)

Regards

Clemens

16 REPLIES 16

former_member196490
Active Participant
0 Kudos

Is your requirement, that when you select a varaint, none of the radiobuttons be selected and both the blocks should be displayed.

Former Member
0 Kudos

Hi Aastha,

I wasnt able to get your problem completely, but from what I could understand, please find my suggestion below:

Step 1:Follow the following code:

PARAMETERS:

             p_rad1    RADIOBUTTON GROUP rad USER-COMMAND cmd,

             p_rad2    RADIOBUTTON GROUP rad.

PARAMETERS:

             p_1        MODIF ID rad1,

             p_2        MODIF ID rad1,

             p_3        MODIF ID rad2,

             p_4        MODIF ID rad2.

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.

    IF screen-group1 = 'RAD1' or

        screen-group1 = 'RAD2'.

        screen-invisible = 1.

        screen-active = 0.

    ENDIF.

    IF p_rad1 = 'X' AND screen-group1 = 'RAD1'.

        screen-invisible = 0.

        screen-active = 1.

    ENDIF.

    IF p_rad2 = 'X' AND screen-group1 = 'RAD2'.

        screen-invisible = 0.

        screen-active = 1.

    ENDIF.

    MODIFY SCREEN.

  ENDLOOP.

Step 2: Create different variants in which different radio buttons are selected.

When individual variants will get loaded, it will switch on and off respective blocks of parameters.

Best regards,

Anand.

0 Kudos

Hi Anand,

The issue is that there is a hidden block of selection screen in which I have two radio buttons.

I have to make changes to those radio buttons at the variant level. I have to create a variant such that the hidden block is visible there.

Regards,

Aastha

0 Kudos

Hi Aastha

Now, I understand your problem better.

First identify the condition which makes this mentioned hidden block visible e.g. it could be some checkbox or a radio button. You could identify this condition by looking into the report program if you are new to your particular report.

Then you can save your variant in the state in which this hidden block becomes visible.

Best regards,

Anand

0 Kudos

Hi Anand,

I totally agree with your reply that we would require a particular condition to enable that block. But the client requires this thing to be done on selection of a particular variant This is the entire dilemma all about.

Otherwise, this would have been done

Thanks,

Aastha

Kartik2
Contributor
0 Kudos

Dear Aastha Mehrotra,

I think your question is how to hide selection screen feilds using variants ? Yes hiding selection screen elements using variants is one of the important functionalities of a variant.

Variant has got an attribute called 'Hide'. you have to set this attribute for all those fields which you want to hide on the selection screen. Please see the attached image where a parameter is being hidden by checking the hide attribute of variant.

Hope this helps. Thank you.

Regards,

kartik

Former Member
0 Kudos

Hi Kartik,

As I mentioned in the post, I have already done this particular thing i.e hiding something at the variant level. What I need to accomplish here is the exact opposite. I need to activate something that is inactive or hidden.

Thanks though.

Aastha

Former Member
0 Kudos

Hi,

Probably silly but what about handling SY-SLSET field and, based on his value, adapt your selection screen appropriately under SELECTION-SCREEN OUTPUT event?

Kr,

Manu

raymond_giuseppi
Active Contributor
0 Kudos

A variant wont set editable fields hidden in AT SELECTION-SCREEN OUTPUT, so

- In the program (without variant) the radiobutons must be selectable (do nothing...)

- Create a variant which will be called in the transaction definion, the radiobuttons must not be selectable

Lauch report

Check the default radiobutton

click on SAVE

go to attributes

Set every other field as "without value" in variant

Set the radobuttons as protected, even not-displayed

- Create another variant where the radiobuttons are selectable

set every field as "without value" in variant

(Save field without value, will prevent overide of current values when selecting variants)

Regards,

Raymond

Former Member
0 Kudos

Why not simply create two separate variant transactions, each starting with a different variant?

Rob

Clemenss
Active Contributor
0 Kudos

as far as I remember the variant does not care id the field is visible editable or not - values are just passed to parameters (Try!)

Regards

Clemens

Former Member
0 Kudos

True! However, we are not considering the values in the screen fields here we have to activate a screen block when we select a particular variant.

Thanks,

Aastha

0 Kudos

Hi Aastha,

              If the variant name is know then you can use the method suggested by Manu using SY-SLSET value. Check what are the values of the SY-SLSET and the SCREEN-NAME value of the selection block which you want to hide in the debugger and use those values for screen modification.

Sample Code

  TABLES : bsad, bsak.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS : s_bukrs FOR  bsad-bukrs OBLIGATORY.

PARAMETERS :    p_gjahr TYPE  bsad-gjahr OBLIGATORY.

SELECT-OPTIONS : s_wrbtr FOR  bsak-wrbtr OBLIGATORY,
                s_blart FOR  bsak-blart.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

PARAMETERS : p_ccode RADIOBUTTON GROUP r1,
            p_cdoct RADIOBUTTON GROUP r1 DEFAULT 'X'.

SELECTION-SCREEN END OF BLOCK b2.



AT SELECTION-SCREEN OUTPUT.

  IF sy-slset = 'TEST 1'.    " Hide the selection block for TEST 1 variant
    LOOP AT SCREEN.

      CASE screen-name.
        WHEN 'P_CCODE'.
          screen-invisible = 1.
          screen-required = 0.
          MODIFY SCREEN.
        WHEN 'P_CDOCT'.
          screen-invisible = 1.
          screen-required = 0.
          MODIFY SCREEN.
        WHEN '%B002009_BLOCK_1000'.
          screen-invisible = 1.
          MODIFY SCREEN.
        WHEN OTHERS.
      ENDCASE.

    ENDLOOP.

  ENDIF.


START-OF-SELECTION.

Thanks & Regards

Bala Krishna

Former Member
0 Kudos

Thanks Bala this one works!

Regards,

Aastha

Clemenss
Active Contributor
0 Kudos

Hi Aashta,

when you choose a particular variant, the values for the fields in the variants are set and then event AT SELECTION-SCREEN OUTPUT is processed.

Here you can use LOOP AT SCREEN to change screen apperarance as you like. It is far more easier if you add MODIF ID xyz to all parameters/select-options in the block.

Then you can use screen-group1 in LOOP AT SCREEN to determine where to set screen-active = 0. If all screen fields in a block are inactive, the whole block is inactive ad it is not displayed.

Regards

Clemens

Former Member
0 Kudos

Hi Clemens,

Thanks for responding. The functionality has been achieved using the value in sy-slset. I looped at screen in selection screen output if sy-slset is not that particular variant.

Regards,

Aastha