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: 

Hide Variant button

former_member305388
Active Contributor
0 Kudos

Hi experts!!

We have a report ZREPORT for which we have created 2 t-codes ZCODE1 and ZCODE2. Now, ZCODE1 should start with variant TEST and should not be changed by any means. And hence we are planning to hide variant button only for ZCODE1 t-code. But for ZCODE2 t-code variants can be changed.

Can somebody suggest how this can be handled?

Thanks a lot!!

1 ACCEPTED SOLUTION

SuhaSaha
Advisor
Advisor
0 Kudos

Hello Srinivas,

As a workaround you can throw an error message when the user tries to modify the variant:

AT SELECTION-SCREEN.

  IF sy-tcode = `ZCODE1`
  AND sy-ucomm = `SPOS`. "Funct. Code for the variant button
    MESSAGE 'You cannot save/modify the variant' TYPE 'E'.
  ENDIF.

BR,

Suhas

8 REPLIES 8

Harsh_Bansal
Contributor
0 Kudos

Hi,

If you want to run that variant for zcode1 and don't want it to be changed then in your program, you can check sy-tcode.

If it is zcode1, then make your fields non-editable.

For zcode2, let them as it is.

Regards,

Harsh Bansal

Former Member
0 Kudos

Hi Srinivas,

To hide variant butoon for a particular tcode:

IF sy-tcode = ZCODE1.

Hide button code.

ENDIF.

hope this helps,

Regards,

Gaurav .

SuhaSaha
Advisor
Advisor
0 Kudos

Hello Srinivas,

As a workaround you can throw an error message when the user tries to modify the variant:

AT SELECTION-SCREEN.

  IF sy-tcode = `ZCODE1`
  AND sy-ucomm = `SPOS`. "Funct. Code for the variant button
    MESSAGE 'You cannot save/modify the variant' TYPE 'E'.
  ENDIF.

BR,

Suhas

kesavadas_thekkillath
Active Contributor

to hide variant button in screen use


DATA:repid TYPE sy-repid.
DATA:it TYPE TABLE OF sy-ucomm.

PARAMETERS:pa TYPE c.

AT SELECTION-SCREEN OUTPUT.
  if sy-tcode = 'ZCODE1'.
  clear it.
  repid = sy-repid.
  APPEND 'GET' TO it. "To disable Select Variant button
APPEND 'SPOS' TO it. "To disable SAVE button
  CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
       EXPORTING
            p_status  = '%_00'
            p_program = repid
       TABLES
            p_exclude = it.
  endif.   

0 Kudos

Great, Thank you.

SharathSYM
Contributor
0 Kudos

Hi Srinivas,

To hide variant butoon for a particular tcode try this:


include rsdbc1xx.

...
...

at selection-screen output.
IF sy-tcode = ZCODE1.
    append 'SPOS' to current_scr-excl. 
endif.

raymond_giuseppi
Active Contributor
0 Kudos

Try something similar to

AT SELECTION-SCREEN OUTPUT.
  IF sy-tcode = 'ZCODE1'.
    DATA: status TYPE sy-pfkey,
          prog   TYPE sy-repid,
          excl_tab TYPE rsexfcode OCCURS 1 WITH HEADER LINE.
    " identify current status
    GET PF-STATUS status PROGRAM prog EXCLUDING excl_tab.
    " disable some function codes
    excl_tab-fcode = 'GET'. " Get Variant...
    APPEND excl_tab.
    excl_tab-fcode = 'VSHO'. " Variants, Display...
    APPEND excl_tab.
    excl_tab-fcode = 'VDEL'. " Variants, Delete...
    APPEND excl_tab.
    excl_tab-fcode = 'SPOS'. " Save as Variant...
    APPEND excl_tab.
    SORT excl_tab.
    DELETE ADJACENT DUPLICATES FROM excl_tab.
    " update status
    CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
      EXPORTING
        p_status  = status
        p_program = prog
      TABLES
        p_exclude = excl_tab.
  ENDIF.

Regards,

Raymond

former_member305388
Active Contributor
0 Kudos

Achieved through SHD0