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

Variant value in background

Former Member
0 Likes
3,670

Hi friends,

I have created a variant for job scheduling, i wants to use one field value in the

program when background job running from that variant. Please help me to get that value in background.

Thanks in Advance,

SB.

1 ACCEPTED SOLUTION
Read only

Former Member
1,576

Hi Perez,

Thanks for very useful answer.

Seems this FM RS_VARIANT_CONTENTS works out, please tell me how to get

this returns table field values of particular select options. Exapmle Number.

Thanks,

SB.

8 REPLIES 8
Read only

Former Member
0 Likes
1,576

not sure what exactly u need , check if this helps.

sy-batch = 'X' for back ground running , variant = sy-slset

if sy-batch EQ 'X' and sy-SLSET EQ 'Variant_name'.

<do some operations here>

endif.

Read only

0 Likes
1,576

Hi sreejith,

I am creating a variant for some Number field for my BG job,

i want to do some operation in at selection-screen output using this

number value from variant. My question is how to get this value ?

Thanks,

SB.

Read only

0 Likes
1,576

Hi ,

It seems as if u need to run the BG job using some varaint .

So first u need to save a varian with some Name say XYZ .

Now in ur code at the selection-screen ouput even do the code

AT SELECTION-SCREEN output .

If sy-batch = 'X' and sy-selset = 'XYZ.'.

Perform ABC.

ENDIF .

FORM ABC .

**Your functionality*

ENDFORM.

Read only

Former Member
0 Likes
1,576

Hi syed,

goto SE38->program->execute->background.

A screen will displayed in that give your progam name and variant then click the button execute immediatly or schedule what ever you want.

Plz Reward if useful answer,

Mahi.

Read only

Former Member
0 Likes
1,576

Hi Syed,

Hi

first Save the variant for that program and use in Job scheduling

Create a Variant for the Program and

Schedule JOB in background:

Go to SM36 create a Job

enter Program and Variant for that program in STEP..

click on Start Condition

Click on DATE and TIME enter date scheduled Start and END times

click on Period Values

Click on HOURLY/WEEKLY etc

CLick on RESTRICTIONS also to use further criteria.

so your job will be scheduled and run as per your requirement.

and in SM37 Transaction check the status of that JOB

Check this link for scheduling jobs..

http://help.sap.com/saphelp_nw2004s/helpdata/en/c4/3a7f87505211d189550000e829fbbd/content.htm

<b>Kindly reward points if you found the reply helpful.<b>

Cheers,

Chaitanya.

Read only

Former Member
0 Likes
1,576

Hi Syed,

to get values from variant use this FM

RS_VARIANT_CONTENTS

You've to pass Program name and variant to this FM.

then FM returns table. by reading this table you can get values of particular select options.

Read only

Former Member
1,577

Hi Perez,

Thanks for very useful answer.

Seems this FM RS_VARIANT_CONTENTS works out, please tell me how to get

this returns table field values of particular select options. Exapmle Number.

Thanks,

SB.

Read only

0 Likes
1,576

Hi syed,

check this code..


REPORT ztest18.
TABLES : marc.
SELECT-OPTIONS: s_matnr FOR marc-matnr.

DATA : itab LIKE rsparams OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'RS_VARIANT_CONTENTS'
  EXPORTING
    report               = 'ZTEST18' "Report name
    variant              = 'TEST'   "variant name
  TABLES
    valutab              = itab   "output table
  EXCEPTIONS
    variant_non_existent = 1
    variant_obsolete     = 2
    OTHERS               = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


LOOP AT itab.
  WRITE :/ itab-selname, itab-low, itab-high.
ENDLOOP.