Application Development and Automation 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: 
Read only

Hide Variant button

Former Member
0 Likes
4,723

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
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,710

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
Read only

Harsh_Bansal
Contributor
0 Likes
2,710

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

Read only

Former Member
0 Likes
2,710

Hi Srinivas,

To hide variant butoon for a particular tcode:

IF sy-tcode = ZCODE1.

Hide button code.

ENDIF.

hope this helps,

Regards,

Gaurav .

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,711

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

Read only

kesavadas_thekkillath
Active Contributor
2,710

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.   

Read only

0 Likes
2,710

Great, Thank you.

Read only

SharathYaralkattimath
Contributor
0 Likes
2,710

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.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,710

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

Read only

Former Member
0 Likes
2,710

Achieved through SHD0