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: 

How can we lock and then unlock a Variant ?

Former Member
0 Kudos

Hi friends,

I have a Report Program with selection screen.

I have created a variant for that.

<b>How can we lock and then unlock that Variant ?</b>

Regds,

Rama.Pammi

1 ACCEPTED SOLUTION

harishaginati
Explorer
0 Kudos

This message was moderated.

9 REPLIES 9

Former Member
0 Kudos

While saving the variant, there is a checkbox called

"Protect Variant".

This allows only the creator to change a variant.

Hope this helps you

harishaginati
Explorer
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hello,

In the Variants screen check the checkbox Protect Variant.

Protect variant

If you select this option, the variant can only be changed by the

person who created it or the last person to change it. If you start

a program using a protected variant, none of the fields on the

selection screen accept user input.

Regards,

Deepu.K

0 Kudos

Hello

How do you take the Protect Variant off.

We have created transportable variants using variant prefix CUS& and it automatically selects the protect variant checkbox. You cannot deselect it and so only the user can change this variant.

I have tried Program RSVARENT which is supposed to cancel variant protection but this did not work.

Is it because the variant was for an SAP query report?

Really appreciate any help

cheers

Louisa

0 Kudos

Problem:

How do you take the Protect Variant off.

We have created transportable variants using variant prefix CUS& and it automatically selects the protect variant checkbox.  You cannot deselect it and so only the user can change this variant.

I have tried Program RSVARENT which is supposed to cancel variant protection but this did not work.

Protect variant:

If you select this option, the variant can only be changed by the

person who created it or the last person to change it. If you start

a program using a protected variant, none of the fields on the

selection screen accept user input.

Solution:

*&---------------------------------------------------------------------*
*& Report  ZCV_RSVARENT
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  zrsvarent_partha.


TABLES: varid,rsvar.

DATA: i_varid TYPE STANDARD TABLE OF varid WITH HEADER LINE.

SELECT-OPTIONS: s_report FOR rsvar-report,
s_vari   FOR rsvar-variant.
PARAMETERS: p_mandt  LIKE sy-mandt OBLIGATORY DEFAULT '000'.

START-OF-SELECTION.

SELECT * INTO TABLE i_varid
FROM varid CLIENT SPECIFIED
WHERE mandt     p_mandt
AND report    IN s_report
AND variant   IN s_vari
AND protected NE space .

IF sy-subrc = 0.
LOOP AT i_varid.
CLEAR i_varid-protected.
IF NOT  i_varid-variant(4) EQ 'SAP&'
AND NOT i_varid-variant(4) EQ 'CUS&'.
MOVE 'F' TO i_varid-transport.
ENDIF.
MODIFY i_varid.
ENDLOOP.
MODIFY varid CLIENT SPECIFIED FROM TABLE i_varid .
WRITE:/ 'SY-SUBRC = ' , sy-subrc.
WRITE:/ 'No. of records updated = ' , sy-dbcnt.
COMMIT WORK.
ELSE.
WRITE:/ 'No records found for the selection criteria.'.
ENDIF.

Inputs:

S_REPORT – Report/Program name.

S_VARI – Variant.

P_MANDT – NO CHANGE (Let it be as ‘000’).

Your variant will be unprotected.

Regards,

Partha S Goswami

0 Kudos

Hi,

Did you try using the FM RS_VARIANT_DELETE to delete ?

0 Kudos

Hi Mayur,

This function module (RS_VARIANT_DELETE) deletes a specified variant.

But here the topic is to unchecked the protect variant. So that any any one can go and change the variant values.

If the protect variant is check for any variant then only the person who have created or the last person who have made some change in the variant can only do some change in variant values.

Hope you got my point.

Thanks

Partha S Goswami

0 Kudos

Hi Partha,

I used your program to unlock the variant. Unfortunately it did not work. I have got 5 different clients in the system. Not sure, if I am doing it incorrectly. However, I used the program RSVARENT directly in 000 and it worked.

P.S: I used your program in ECC 6.0..

kiran_k8
Active Contributor
0 Kudos

Rama,

Any reason why you created the variants as CUS& ? We can create the varinat as Z.... and still can transport it using RSTRANSP.

K.Kiran.