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: 

New transaction - require variant selection to be disabled

Former Member
0 Kudos

hi all

I have created a new report transaction which runs an existing custom program of ours, with a specific variant which greys out most of the fields in the transaction (this is for the sake of security as the program is normally only ever run by a day end batch job).

However, when running the transaction, the user can simply change the variant to an existing one where the fields are not greyed out!

Is there any way within the transaction definition of "locking" the start variant so it cannot be changed?

Thanks

Jon

1 ACCEPTED SOLUTION

GuyF
Active Participant
0 Kudos

Hi,

You could disable the function code for the variant selection. You can do this by identifying the transaction code, or any other logic you want. I'll give you an example when you disable it by transaction code.

DATA: lt_exclude  TYPE STANDARD TABLE OF syucomm. " Global table of function codes to disable

AT SELECTION-SCREEN OUTPUT.
  IF sy-tcode EQ 'ZZREPORT'. " Replace with your own transaction code
    APPEND 'GET'  TO i_exclude.  " Get variants function code

    CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
      EXPORTING
        p_status  = sy-pfkey
        p_program = sy-repid
      TABLES
        p_exclude = lt_exclude.
  ENDIF.

Hope this helps,

Guy.

12 REPLIES 12

Former Member
0 Kudos

Jon,

Are we talking transaction Varient or ALV Varient?

0 Kudos

No it is not a transaction variant or a display variant.

The transaction calls a "Z" program and defaults in a specific start variant for the selection screen. I want it to be impossible for the user to change that selection variant.

Jon

former_member194669
Active Contributor
0 Kudos

> However, when running the transaction, the user can simply change the variant to an existing one where the fields are not greyed out!

You may need to create a protected variant, so that user can't change the values in variant

0 Kudos

Yes - I have already protected the variant. The problem is that they can simply select a different variant which is already set up.

Jon

0 Kudos

One way could be to define a custom GUI status by copying the standard one. There you can deactivate the variant related function codes. The GUI status then must be set explicitely in your program code.

Thomas

Former Member
0 Kudos

Can you disable fields based on userid or authorization?

Rob

0 Kudos

Yes I thought of removing the PIDs for the user so they cannot select variants but they need to do so for other progs they run.

The GUI idea is one way of doing it but I didn't really want to go down that route. I may end up having to create a customised prog with a limited set of selection options.

Jon

0 Kudos

>

> Yes I thought of removing the PIDs for the user so they cannot select variants but they need to do so for other progs they run.

>

> The GUI idea is one way of doing it but I didn't really want to go down that route. I may end up having to create a customised prog with a limited set of selection options.

>

> Jon

I meant, base on some criteria:

loop at screen.
* Your logic here
      screen-input = '0'.
      modify screen.
    endif.
  endloop.

Rob

0 Kudos

I see. Yes that might work.

I could use auth group against the transaction in SE93 as well I guess.

0 Kudos

I think you need to do it in the program.

Rob

0 Kudos

May be try this way

Make check for field values by the following code


form f_get_variant.
  data : v_field like dd03l-fieldname.
  move SY-SLSET to v_variant.   " <<<<<
  call function 'RS_VARIANT_CONTENTS'
    exporting
      report               = 'YATT3010'
      variant              = v_variant
    tables
      valutab              = i_params
    exceptions
      variant_non_existent = 1
      variant_obsolete     = 2
      others               = 3.
  if sy-subrc eq 0.
    loop at i_params.
      assign (i_params-selname) to <fs>.
      <fs> = i_params-low.  " Make a check here for fields you want user's cannot change the value
    endloop.
  endif.
endform.                                 " F_get_variant

GuyF
Active Participant
0 Kudos

Hi,

You could disable the function code for the variant selection. You can do this by identifying the transaction code, or any other logic you want. I'll give you an example when you disable it by transaction code.

DATA: lt_exclude  TYPE STANDARD TABLE OF syucomm. " Global table of function codes to disable

AT SELECTION-SCREEN OUTPUT.
  IF sy-tcode EQ 'ZZREPORT'. " Replace with your own transaction code
    APPEND 'GET'  TO i_exclude.  " Get variants function code

    CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
      EXPORTING
        p_status  = sy-pfkey
        p_program = sy-repid
      TABLES
        p_exclude = lt_exclude.
  ENDIF.

Hope this helps,

Guy.