03-01-2012 10:59 AM
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!!
03-01-2012 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
03-01-2012 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
03-01-2012 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 .
03-01-2012 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
03-01-2012 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.
10-15-2019 12:11 PM
03-01-2012 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.
03-01-2012 2: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
03-02-2012 5:21 AM