cancel
Showing results for 
Search instead for 
Did you mean: 

Change variant of /SAPAPO/RTSCOPY in a program

Former Member
0 Kudos

Hi!

I have to change one of the variant of program /SAPAPO/RTSCOPY in an ABAP program.

I know i should use FM RS_VARIANT_CONTENTS to get its content and then use the FM RS_CHANGE_CREATED_VARIANT to change the content.

But there is a problem for the fields "selection condition ".

If in my variant i have a selection in a characterictic (for example ZC_PRD = 100301 ), when i use the FM RS_VARIANT_CONTENTS i get in VALUETAB the line below:

SELNAME = P_SEL

KIND = S

SIGN = I

OPTION = EQ

LOW = ZC_PRD IEQ100301

In this case there isn't problem.

But, if in my variant i have a selection in a characterictic (for example *ZC_PRD from 100301 to 101101* ), when i use the FM RS_VARIANT_CONTENTS i get in VALUETAB the line below:

SELNAME = P_SEL

KIND = S

SIGN = I

OPTION = EQ

LOW = ZC_PRD IBT100301

In fact in this case i don't get the correct selection for ZC_PRD.

How can i get the correct value? Is there any other FM to change variants?

Thank you for help,

regards,

LB

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Please forgive me if I am misunderstanding you but you can just use the transaction /SAPAPO/TSCOPY and specify everything very easily there. You can use a process chain for background job or use program /SAPAPO/TS_BATCH_RUN.

Former Member
0 Kudos

Thank you for your answer.

I can't just use the transaction /SAPAPO/TSCOPY. Indeed, the request is really to modify a same variant from an ABAP program. This variant will be used in a process chain. The user doesn't want to use /SAPAPO/TSCOPY. She wan't a Z transaction witch will modify the variant.

Answers (1)

Answers (1)

srinivas_krishnamoorthy
Active Contributor
0 Kudos

If i have understood this correctly, you need to create a ZRTSCOPY program that looks at a custom selection. In this situation you can always define a TVARVC variable with a range of values. While saving a variant you have the option to protect fields (checkbox) or even hide them. Once this is done, you can then create a Ztransaction or a program out of the variant.

The variables need to be stored in <<CHARNAME>> IEQ<<value>> format.

Also I feel the format for the range should have been

SELNAME = P_SEL

KIND = S

SIGN = I

OPTION = BT

LOW = ZC_PRD IEQ100301

HIGH = ZC_PRD IEQ101101