cancel
Showing results for 
Search instead for 
Did you mean: 

Passing the Parameter value from one variant to another

nanda_kumar21
Active Contributor
0 Kudos

Hi ,

Build version M33.104.

I'm trying to pass the parameter value from one variant to another.

Variant 1 of Job 1, has two parameters, which i want to set as out parameters of Job 1 and map it to the duplicate of Store Variant job parameters.

The Variant 1 has a lot of parameters, so i'm trying to iterate through them to the one i want (also because there is no getSAPAbapVariantParametersByName() method is not available, or is it? there is one for selection but not a parameter?)

The following code didn't compile, because of the error: object mismatch between vpar and it.next().


Iterator it = variant.getSAPAbapVariantParameters();

while(it.hasNext()){

SAPAbapVariantParameter vpar = it.next();

if((vpar.getName()).equals("PAR_BUDA")){

//more code where i get the parameter's value

}

Following are my questions:

  1. Why is the returned object of getSAPAbapVariantParameters() is a collection of SAPAbapVariantParameters but i couldn't assign it to the object vpar, through it.next();?
  2. should i use this --> String param1 = (String)it.next(); to get the parameter?
    casting helped:
    SAPAbapVariantParameter vpar = (SAPAbapVariantParameter) it.next();
  3. I am not able to figure out how to get the value of the parameter inside the if condition.
    • getHigh and  getLow methods are available, but the API documentation says, they are deprecated and not to use.
      Tried the  getLow() method, didn't work.

Please help me fix this, or an alternate solution you might have come across.

Thanks

Nanda

Message was edited by: Nanda Kumar

Accepted Solutions (1)

Accepted Solutions (1)

h_carpenter
Active Contributor
0 Kudos

Hi Nanda,

I am not sure what you are trying to do, but if you want to iterate of the values of a variant, you should use getSAPAbapVariantParameterValues().

You can also use getSAPAbapVariantParameterValueByName(<name>) on the SAPAbapVariant to get a specific one.

I do not understand what you are trying to do, you mention variant 1 of job 1 and Out parameters ?

regards,

HP

nanda_kumar21
Active Contributor
0 Kudos

hi HP,

I have

Variant 1 in Job A

Variant 2 in Job B

Variant 1 has a lot of parameters out of which, one has the values for posting date and another for ID number. Now, i want to get these two values and use the Store variant job to store these two values for the two corresponding parameters for Variant 2.

The values of those two parameters will change everyday.

I used the getSAPAbapVariantParameterValueByName and it solved my issue.

The method's name is confusing, getSAPAbapVariantParameterValueByName threw me off. Could have been better if it was just getSAPAbapVariantParameterByName.

Thanks

Nanda

gmblom
Active Contributor
0 Kudos

Hello Nanda,

Maybe a bit easier to maintain would be to add the variant parameters you want to change to your abap job definition. Then you do not need the update variant job in between but it can do both things in 1 go.

Regards Gerben

Answers (0)