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 to fix variant value?

Former Member
0 Kudos

Hi all,

In ABAP report, i have create a report. and i have create a variant.

but user can change the value of variant in input field.

i want the value of variant is fix and can't change by user..

is it possible??

<removed by moderator>

Edited by: Thomas Zloch on May 17, 2011 2:38 PM

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Do you want that the particular field should be having only one value. In that case you can just make this field's input prpery as zero. Give the value which you want as a default value inside the fields, then in Initialization event, loop at screen and disable the screen field's input parameter.

If not clear then let me know will post you a sample code.

6 REPLIES 6

Former Member
0 Kudos

Do you want that the particular field should be having only one value. In that case you can just make this field's input prpery as zero. Give the value which you want as a default value inside the fields, then in Initialization event, loop at screen and disable the screen field's input parameter.

If not clear then let me know will post you a sample code.

0 Kudos

yes you are right but in variant ,

for example i have save the variant 'xyz' with the employee_id = 1.

when the user use that variant 'xyz' , the employee_id value 1 is display..

but user can change value of employee_id to 2.

i want user can't chage the value of that variant.

user cant change employee_id value to 2.

0 Kudos

HI,

when you are creating a variant, select te check box 'PROTECT FIELD' for the field which you want the data not to be changed.

the filed will be in non editable mode as u required.

<removed by moderator>

Edited by: Thomas Zloch on May 17, 2011 2:38 PM

0 Kudos

Even if you use 'Protect Field' there is nothing to stop the user entering the selection screen with their own values from scratch and not utilise the Variant at all etc...

Another better solution would be to use System Variants (CUS&xxxx) ..... create a Z report transaction code to the Selection Screen (SE93) where the value in the system variant is locked. You would then lock the original report, thus user only has access to the Z report transaction with certain values locked in etc...

Rgds,

Derrick

0 Kudos

What is your requirement?

If you don't want to change the selection field value at all, why do you need that on the selection screen?

if you want to change the field by any specific user you can then use initialize event in the report to see if the user can change or not.

You can achieve this by using initialize event + authorization object + Modif ID

Under the initialize event, you can code some authorization checks and depending on the authorization check pass or fail, you can loop the screen then disable/enable the field with modif id.

If you can read the help for each one of the words above might solve your issue. It is not impossible but you have to work other way... just not the variant.

atul_mohanty
Active Contributor
0 Kudos

There is a way to do this.

1. Store the value of variable in a custom table or TVARVC table.

2. In the program , in event AT SELECTION-SCREEN OUTPUT,

check the field sy-slset, if it matches to your varaint name, then retrieve the value of the filed from TVARVC or custom table and populate the selection screen parameter .

3. In the program , in event AT SELECTION-SCREEN.

check the field sy-slset, if it matches to your varaint name, then retrieve the value of the filed from TVARVC or custom table and validate the selection screen parameter .

Let me know, if it helps you. Thanks.

Edited by: Atul Mohanty on May 17, 2011 5:27 PM