Skip to Content
0
Jul 31, 2012 at 02:41 PM

Access T Code , Created For WebDynpro Application

191 Views

Hi All,

I have created a WebDynpro application named ZWD_RGP having two views.

In first view i have added three buttons : (CREATE CHANGE DISPLAY)

Also i have created three T Code one ZRGP_CREATE , second ZRGP_CHANGE and third ZRGP_DISPLAY.

Now what the requirement is " When user runs application through Tcode ZRGP_CREATE then only Create button should be visible

When user runs application through Tcode ZRGP_CHANGE then only Change button should be visible

When user runs application through Tcode ZRGP_DISPLAY then only Display button should be visible"

For that i have created a method that is below

*- Constants
constants : lc_btn_hide type string VALUE 'BUTTON_HIDE'.

data : lref_Context_node type ref to if_wd_Context_node,
ls_btn_hide type wd_This->element_button_hide.

lref_Context_node = wd_context->get_child_node( lc_btn_hide ).

if sy-tcode = 'ZRGP_CREATE'.
ls_btn_hide-create = '02'. "Show
ls_btn_hide-change = '01'. "hide
ls_btn_hide-display = '01'. "hide
elseif sy-tcode = 'ZRGP_CHANGE'.
ls_btn_hide-create = '01'. "hide
ls_btn_hide-change = '02'. "show
ls_btn_hide-display = '01'. "hide
elseif sy-tcode = 'ZRGP_DISPLAY'.
ls_btn_hide-create = '01'. "hide
ls_btn_hide-change = '01'. "hide
ls_btn_hide-display = '02'. "show
else.
ls_btn_hide-create = '02'. "Show
ls_btn_hide-change = '02'. "show
ls_btn_hide-display = '02'. "show
endif.

call method lref_context_node->set_static_Attributes
EXPORTING
static_Attributes = ls_btn_hide
.

But whenever i am running application through TCODE ZRGP_CREATE , or ZRGP_CHANGE or ZRGP_DISPLAY

I am not getting any value in SY-TCODE.

Please solve my problem.

Thanks in advance

Abhishek