Application Development and Automation 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: 
Read only

how to create variants in abap program?

Former Member
0 Likes
13,796

hi all,

how to create variants for an abap program. for one abap program can we create differents variants.

If so pls let me know how to create as well as how to transport varaints.

if u have any docs send it across to my email id ha_rock@yahoo.com

regds

haritha

13 REPLIES 13
Read only

Former Member
0 Likes
5,049

In selectin screen give the data and press save and create variant.

Read only

Former Member
0 Likes
5,049

For creating varient just run ur program,

And enter the values into the inpur parameters or select-options.

then press the save button,

after it will display another screen which will ask about the varient name and its discription, fill it and save it,

your varient will created.

Same way u can create another varient also

Read only

Former Member
0 Likes
5,049

hi haritha

after input to selection-screen PRESS SAVE button

The varient screen will opens give the text to create varient(related as program input)

and save it.

Read only

Former Member
0 Likes
5,049

hi all,

in which tables does those abap varaints are stored can anyone tell me the table name in which those variants are stored.\

regds

haritha

Read only

0 Likes
5,049

Hi Harita,

Variants are stored in table VARID.

Regards,

Raghu.

*Reward points if useful

Read only

Former Member
0 Likes
5,049

HI,

to create a varient,

just run the program

on the selection screen give the values you want in ur varient

press save

give varient decription

ur varient will be saved

for more details about varients

see this saphelp site

http://help.sap.com/saphelp_nw04/helpdata/en/c0/980389e58611d194cc00a0c94260a5/content.htm

thanks

vivekanand

Read only

Former Member
0 Likes
5,049

hi,

in selection screen which u get before output [input screen] after giving all values -> click save -> give name and desc for variant -> u can get it automatically in standard tool bar .

for transporting variants :

Execute program RSTRANSP (via se38) and give the source and target program and variant names..

hope this is helpful..

with regards,

Suresh Aluri.

Read only

Former Member
0 Likes
5,049

hi,

go to transaction shd0.

select the tab transaction variants.

in transaction code: give the tr code for which u want to create variant ie fb50.

in transaction variant givwe the name of variant ie zfb50.

now click create it will take u to the initial screen of fb50.

hit enter it will throw another screen which would show technical name of the fields with check boxes have different options i.e withg contents ,invisible, required etc.

just check check boxes as per your need.

<b>click save & move to the next screen.

but when u get to the last screen click exit & save</b>.

i hope this helps rgds.

reward points if it helps

Read only

RaymondGiuseppi
Active Contributor
0 Likes
5,049

Variants can easily be saved when running a report program by clicking the save/disk icon, there you give a name and can input some attributes of variant (hide, protect or fill parameters and select-options)

These variants are stored in three tables

- VARID - header

- VARIT- texts

- VARI - data and attributes (INDX like file, via IMPORT/EXPORT FROM DATABASE)

To access VARI, use FM of group SVAR (exist, copy, add, maintain)

RS_VARIANT_VALUES_TECH_DATA will give you values stored in variant

Regards

Read only

Former Member
0 Likes
5,049

This message was moderated.

Read only

Former Member
0 Likes
5,049

hi haritha,

To create a variant, just run the program i.e (F8) then in the selection-screen give the values for select-options or parameters or anything else.., and then press the save button then a window will open in that specify the variant name and description and press SAVE button.

<b>please reward points if helpfull.</b>

with regards,

radhika kolluru.

Read only

arvind_aj
Product and Topic Expert
Product and Topic Expert
5,049

Hello,

Use the FM: RS_CREATE_VARIANT.

Code:

DATA: ls_vari_desc TYPE varid,

lt_var_val TYPE TABLE OF rsparams,

ls_var TYPE rsparams,

ls_varit TYPE varit,

lt_varit TYPE TABLE OF varit,

lv_variant_exists TYPE sy-subrc,

lt_var TYPE TABLE OF raldb_vari.

ls_vari_desc-mandt = sy-mandt.

ls_vari_desc-environmnt = 'A'.

ls_vari_desc-ename = sy-uname.

ls_vari_desc-edat = sy-datum.

ls_vari_desc-etime = sy-uzeit.

ls_vari_desc-report = <<Your report name>>.

ls_vari_desc-variant = <<Required variant name for above mentioned report>>.

**values for variants

ls_var-kind = 'P'. "if its of type parameter... or value 'S' for select-option

**Assign values for all required fields

ls_var-selname =

ls_var-low =

APPEND ls_var TO lt_var_val.

ls_var-selname =

ls_var-low =

APPEND ls_var TO lt_var_val.

**Text table -> description for a variant

ls_varit-mandt = sy-mandt.

ls_varit-langu = 'EN'.

ls_varit-report =

ls_varit-variant =

ls_varit-vtext =

APPEND ls_varit TO lt_varit.

CALL FUNCTION 'RS_CREATE_VARIANT'

EXPORTING

curr_report =

curr_variant =

vari_desc = ls_vari_desc

TABLES

vari_contents = lt_var_val

vari_text = lt_varit

EXCEPTIONS

illegal_report_or_variant = 1

illegal_variantname = 2

not_authorized = 3

not_executed = 4

report_not_existent = 5

report_not_supplied = 6

variant_exists = 7

variant_locked = 8

OTHERS = 9.

Cheers,

Arvind

Read only

Former Member
0 Likes
5,049

Hi,

In se38, give program name, following below steps would helpful

execute goto -> variant from the pull down menu

here you can see the existing variants for the program or create a new one

to execute the program with a variant, from the main screen in SE38, execute Shift+F6, click on variant and execute.