Application Development 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: 

Transaction Variants

PrasadRaghavan
Employee
Employee
0 Kudos

Hi,

I have created a transaction Variant, (zspra_abcd) for transaction MM01. I have also activated it to be the standard variant.

Now consider the peice of code below as written in my report program.

constants: c_tcode like sy-tcode value 'MM01'.

DATA: L_TVARIANT LIKE SHDTV-TCVARIANT,

L_FLAG_CLIENT_INDEPENDENT,

L_RC LIKE SY-SUBRC.

SY-TCODE = 'MM01'.

CALL FUNCTION 'RS_HDSYS_GET_TC_VARIANT'

IMPORTING

TCVARIANT = L_TVARIANT

FLAG_CLIENT_INDEPENDENT = L_FLAG_CLIENT_INDEPENDENT

RC = L_RC

  • TABLES

  • T_SCREEN_VARIANTS =

  • T_INACTIVE_FUNCTIONS =

.

if l_rc eq 0.

CALL FUNCTION 'RS_HDSYS_CALL_TC_VARIANT'

EXPORTING

TCODE = C_TCODE

VARIANT = L_TVARIANT

I_FLAG_CLIENT_INDEPENDENT = L_FLAG_CLIENT_INDEPENDENT

CALL_MODE = 'X'

AUTHORITY_CHECK = ' '

VARIANT_CHECK = ' '

EXCEPTIONS

OTHERS = 0. "cannot occur since no

endif.

This has no effect, on the transaction MM01.

If i debug the above program, i get l_rc = 0.

RC = 0 means that "variant active, but not yet values in ABAP memory" as documented in the FM RS_HDSYS_GET_TC_VARIANT.

But, l_tvariant is initial.

Your quick tips would be highly appreciated.

I am new to Transaction Variants.

Thanks

Prasad S

1 REPLY 1

nablan_umar
Active Contributor
0 Kudos

The GET function probably not the one you should use. If you need to call the variant transaction in your program, just do CALL TRANSACTION 'ZSPRA_ABDC'. If you want to use function module 'RS_HDSYS_CALL_TC_VARIANT' instead, I am sure you know the variant name for transaction ZSPRA_ABCD.