Changing Variant Values from Program

Question:
Hi all,
How do I change the values of a variant and SAVE it from the report program ? I want to change few set values of a already defined variant with new values from the program and it should save the changes in the Variant.
Does TVARV help here. If yes, how ? Or can I update my changes directly in the table where the variant values are stored ? if yes, in which Table ?
SAP : 40B
Thanx a lot.
Chual
Answer:
Yes the TVARV table will help here.
The variable for a report will pick up the entries held against the TVARV table, which is client independant.
When creating a variant you'll need to tick the 'Selection variable' box and click on the 'Selection variable' button. Here you will be asked for a selection criteria variable name, which you can pull-down on and select from the TVARV table.
Once you've done this everything should fall into place and become obvious. The only other thing to get to grips with is the way the data is saved to the TVARV table. But if you look at existing data this should also become obvious.
Dr Sidewalk.
Answer:
There are a bunch of SAP function modules to manage variants programmatically. They start with RS_VARIANT_*.
_________________
Sudhi Karkada
Answer:
Thanks for the replies..
I have considered both the options stated here as solutions. First, the problem with TVARV is, it blocks/ protects the field for any user change. That is not what is required. The requirement is both user as well as the programs should able to change the fields.
Second, I have gone through all the RS_VARIANT* functions and nothing seems quite helpful. If you can find any function that can change the variant and SAVE it, please let know. The function RS_VARIANT_CHANGE sounds very apt for this problem, but unfortunately it does not deal with the Values of the variants. The RS_VARIANT_CONTENTS gives all the values.. but how do I save the changes ??
Chual
Answer:
call the function module
CALL FUNCTION 'RS_VARIANT_VALUES_TECH_DATA'
EXPORTING
REPORT = RSVAR-REPORT
VARIANT = RSVAR-VARIANT
TABLES
VARIANT_VALUES = IRSPARAMS
EXCEPTIONS
VARIANT_NON_EXISTENT = 1
VARIANT_OBSOLETE = 2
OTHERS = 3
.
*---Cahnge the value of any element in the
loop at IRSPARAMS where SELNAME = 'DD_STIDA'.
IRSPARAMS-LOW = p_STIDA.
modify IRSPARAMS.
endloop.
CALL FUNCTION 'RS_CHANGE_CREATED_VARIANT'
EXPORTING
CURR_REPORT = RSVAR-REPORT
CURR_VARIANT = RSVAR-VARIANT
VARI_DESC = 'Description'
TABLES
VARI_CONTENTS = IRSPARAMS
EXCEPTIONS
ILLEGAL_REPORT_OR_VARIANT = 1
ILLEGAL_VARIANTNAME = 2
NOT_AUTHORIZED = 3
NOT_EXECUTED = 4
REPORT_NOT_EXISTENT = 5
REPORT_NOT_SUPPLIED = 6
VARIANT_DOESNT_EXIST = 7
VARIANT_LOCKED = 8
SELECTIONS_NO_MATCH = 9
OTHERS = 10
.
Answer:
I am sorry for replying back late. Thanks a lot .
The functions 'RS_VARIANT_VALUES_TECH_DATA' & 'RS_CHANGE_CREATED_VARIANT' worked really well.
Chual

More Articles:

Address of a one time vendor?
Project status?
How to find the mandatory parameters for a function module?
q?
Save an ABAP program with all includes and other stuff.?
convert select option?