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

Create dynamic variant name

kamesh_g
Contributor
0 Likes
1,994

Hi

I am creating jobs through a SE38 program and building variant through program only .

I cannot hard code the variant name because program can be executed multiple times with out completing the current running job .

I need to have a unique variant name every time to resolve the issue . Here length of the variant name is14 characters only .

So i cannot concatenate sy-uname sy-date and sy-uzeit . Do we have any other option to have unique variant name every time .

i checked with FMs to create random number like NUMBER_GET_NEXT , ICL_ULAE_RUN_NUMBER_GET_NEXT and etc .but these are random numbers so cannot concatenate with this number as this number may repeat frequently also.

Can any body worked on this kind of requirement let me know the ideas .

Thanks

Kamesh

14 REPLIES 14
Read only

Former Member
0 Likes
1,880

Hi Kamesh

Why not use the same variant name, and manage the run parameters within the program you are running.

Regards

Arden

Read only

0 Likes
1,880

I explained the issue if I use same variant name . Multiple users can execute the report multiple times a day . So if earlier job is not completed variant is not taking new parameter values . And i tried with change variant also.

Read only

Former Member
0 Likes
1,880

Hi Kamesh,

'NUMBER_GET_NEXT' will get a random number? i don`t think so.

It`s must be sequential as you defined in SNRO.

To create a BJob, using 'JOB_OPEN', SUMIT report WITH parameter, 'JOB_CLOSE', seems not need a unique variant name.

regards,

Archer

Read only

0 Likes
1,880

I explained why I need unique variant name in the thread itself .

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
1,880

HI Kamesh,

What about defining a table or using TVARC entry and updating every time whenever a job is executed and then increasing the number once it is finished?

Read only

0 Likes
1,880

Hi Jayanthi,

Even job name is same every time .Only variant parameters are different . So I am not able to check which job is related to .  There is no inputs how many times program will be executed also .

Thanks

Kamesh

Read only

0 Likes
1,880

Hi Jayanthi,

Currently I am doing variant in the program like below because variant can be of 14 characters only .

<2char identifier><sy-uname ><hours and minutes of sy-uzeit>

Read only

0 Likes
1,880

Hi Kamesh,

Define entry in a table for maintaining a value which is of type numeric(say variant_val = 1).

In program, before you execute the job, read the table and then take the value variant_val from the table.
Once the job is finished, in program, update the table entry value to +1(now it will be 2).

Next time, it will read different value from the table. Every time, value will be different.

Read only

0 Likes
1,880

Hi Kamesh,

You may even think about concatenating variant value from table with current date.

This way, even you can reset the variant value to 1 whenever it reaches 1000 while updating.

Read only

0 Likes
1,880

Hi Kamesh,

you can use below blog, which is created by me.

Where, i have to try to execute the program in background with the help of Dynamic Variant.

Code is attached in attachment.

ZPRV_BACKGROUND_PROCESS.txt.zip

Regards.

Praveer.

Read only

0 Likes
1,880

Hi Kamesh,


KAMESH G wrote:

Hi Jayanthi,

Currently I am doing variant in the program like below because variant can be of 14 characters only .

<2char identifier><sy-uname ><hours and minutes of sy-uzeit>

  The Maximum variant length is 14. The Username length is up-to 12 characters, in those case, I hope creating variant based on username with hours/minutes, may have some complications.


As Jayanthi Jayaramansuggested, it is better to maintain the table for variant. Even for maintaining program standards, instead of hard coding, it is better to use tables.

Regards

Rajkumar Narasimman

Read only

0 Likes
1,880

not sure . For this simple thing customer accepts custom table or not . And again clean up program needed to delete the custom table entries .

Read only

0 Likes
1,880

Instead of creating custom table I think we can take index from table VARID also and we can use that . But I am exploring do we have any other option to create some unique number so that I can concatenate with user name or other .

Read only

0 Likes
1,880

HI Kamesh,

You don't need to write clean up program since you will be updating the same entry(either TVARC or some other custom table) in the same program after the job is successful.