How to create and delete variant using program(may be funct

Question: HI Abapers,
Sub: How to create and delete variant using program(may be function module or what what ever.)

Description:
I am selecting column( username ) from table aufk.
And selecting column(variant) from table VARID aganist program RKOSEL00.

I have to createVARIANT for the username as ['V' + username]
If there is no variant like ['V' + username] in Table varid.
using program.
And if the variant does not have user then delete that variant.
How please?
I tried with Function called RS_VARIANT_CHANGE in 'svar' function group. But it is not working. Can any body tell me how.
YOUR HELP SHALL BE HIGHLY APPRECIATED.
If you dont understand my point I will explain you more clearly please....
It is URGENT.
Waiting for your reply.
Much thanks in ADV.

Answer:
Most of these FMs are avlabl in FGrp SVAR.

For naming It is better you use V+ SY-UNAME + SY-DATUM + SY-UZEIT

All this Assuming one User uses One M/c. If Multiple Users use the same SAP Login ID you may have to take the Terminal also into consideration.

KRK

Answer:
For me naming is not a problem please. I already did it.
I just want to create variants , when user has no variant.
And delete variant when variant exists with out User.
So i need to create and some where in my program delete variant.
Which function modules or is there another way while writing normal report program I need to use.

Answer:
Hi abap_cons

To check if a variant exists you can use:
RS_VARIANT_EXISTS

If you want to delete a variant then this FM is available:
RS_VARIANT_DELETE

And finally to create a variant use this:
RS_CREATE_VARIANT

I hope this helps
Copyright ?2007 - 2008 www.jt77.com