‎2007 Jun 12 2:20 PM
Hi,
Please tell me How to set the values in a variant dynamically for a particular report program. I need to run a report as a background job with the same variant everytime but need to put the values in the variant dynamically. How can i achieve this?
regards,
Priyank
‎2007 Jun 13 7:07 AM
Hi,
Try this.
1. read the variant using the FM <b>RS_VARIANT_CONTENTS</b>
2. Change the variant using the FM <b>RS_CHANGE_CREATED_VARIANT</b>
---Patil
Message was edited by:
Santhosh Patil
‎2007 Jun 12 2:24 PM
HAI,
See the types of varients.
Use transaction variant to make your fields mandatory, hidden or display. You can hide unwanted screens and fields in any of the standard SAP programs without changing any of the standard programs. Additional features such as making the variant as default on the standard SAP transaction code is only available on 4.6x.
Steps:
Transaction SHD0 - Create a variant for the required transaction bychanging the layout through hiding fields and screens.
Transaction SE93 - Create a variant transaction (e.g. for VA02 you canname it as ZA02). Next allocate the transaction variant to this varianttransaction.
Create and change the Zxxx area menu with the new transaction variant. In this way, the user does have to remembers any extra transaction codes.
In 4.6c, you can default your transaction variant as the standard variant. (SHD0 - Edit -> Activate/Deactivate asstandard variant)
An example for using transaction variant (restricting the field displayfor CO11N - Goods movement) :-
If you want to restrict changes to the fields in Goods movement forone group of users.
1. Create a transaction variant for CO11N
2. Create a new transction code for the transaction variant and assign an authorization object to it
3. Divide the users into this two transaction code. Those who can change the field using CO11N. For those that have limited
field change, give them the authorizationfor ZCO11 (this is a new transaction code you have to create).
For more information, please check this links:
http://help.sap.com/saphelp_webas620/helpdata/en/eb/5fab41d79b11d296190000e82de14a/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/43/132f9803d76f40e10000000a422035/content.htm
http://www.sapgenie.com/abap/tvar.htm
Don't forget to reward if useful
‎2007 Jun 12 2:32 PM
Hi Ashok,
I do not need to change the format in the variant. Just want to populate the values in the respective fields dynamically..
any further hints???
‎2007 Jun 12 3:29 PM
You could set up your variant with a variable providing the value of the field that you want to change. Go to transaction STVARV and create a parameter; enter a value for the parameter. Now go to transaction SE38 and type in your program name. Click on the "Variants" button. Give your variant a name and click on the "Create" button. Enter the values you want and then click on the "Attributes" button. Give your variant name a meaning. Now scroll down to find the field that you want to set dynamically. Select the field. Now in column "Selection Variable" click on the dropdown button at the right end of the field. Choose "T" for type of variable and click the check mark. In the column for "Name of Variable" click on the dropdown button at the right end of the field. Scroll down and select the parameter that you created in STVARV. Click on the check mark. Save your variant. Now you can change the value of the field in your variant by changing the parameter value in STVARV whenever you want. I hope this helps.
- April King
‎2007 Jun 13 6:56 AM
Hi April,
Thanks for the reply.
You mean that whenever i want to change the value in the selection variable, i need to update the table TVARVC through an update statement for the parameter i create there and thereafter i can execute the report with the respective variant.
Is my understanding correct?
-Priyank
‎2007 Jun 13 1:15 PM
‎2007 Jun 13 7:07 AM
Hi,
Try this.
1. read the variant using the FM <b>RS_VARIANT_CONTENTS</b>
2. Change the variant using the FM <b>RS_CHANGE_CREATED_VARIANT</b>
---Patil
Message was edited by:
Santhosh Patil
‎2007 Jun 13 11:16 AM
I wish I could give both April and Santosh the full 10 points.
I am opting to use the solution given by Santosh.
+ 10 for you Santosh. Thanks a lot.
regards,
Priyank
‎2007 Jun 13 7:32 AM
Hi,
1. What u can do list.
Get all the variant of the standard report and
data: variant(14).
variant = 'VARIANT1'. " Based on ur condition change the value to the variable
SUBMIT REPORT01
VIA SELECTION-SCREEN
USING SELECTION-SET VARIANT "Check here
USING SELECTION-SETS OF PROGRAM 'REPORT00'
AND RETURN.
2 .Use the fm: RS_VARIANT_CONTENTS to get the values of the different values in the screen.
move those values to screen fields in the INITIALIZATION event
Regards