Skip to Content

Hide Variant button

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!!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Best Answer
    Posted on Mar 01, 2012 at 11:26 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 01, 2012 at 11:41 AM

    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.   
    

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 01, 2012 at 11:22 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 01, 2012 at 11:25 AM

    Hi Srinivas,

    To hide variant butoon for a particular tcode:

    IF sy-tcode = ZCODE1.

    Hide button code.

    ENDIF.

    hope this helps,

    Regards,

    Gaurav .

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 01, 2012 at 11:45 AM

    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.
    

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 01, 2012 at 02:01 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 02, 2012 at 05:21 AM

    Achieved through SHD0

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.