Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8868

Re: How can we lock and then unlock a Variant ?

$
0
0

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


Viewing all articles
Browse latest Browse all 8868

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>