cancel
Showing results for 
Search instead for 
Did you mean: 

Access T Code , Created For WebDynpro Application

former_member185241
Active Participant
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member184578
Active Contributor
0 Kudos

Hi,

You cannot get sy-tcode in WDA. Instead I would suggest you one work around.

1. Create one Z table with one field trans_code.

2. create a simple report in SE38 and Insert the sy-tcode to the Z table (use modify statement)  and call transaction 'ZWDA_TRANS' " here ZWDA_TRANS is the transaction code of your web dynpro abap component.

3. In your WDDOINIT method read the transaction code from Z table and change accordingly.

note that you have to use the transaction code of Report instead of the Web dynpro transaction code.

If you are calling in browser instead of in GUI it would be easy as you can pass parameters in the web dynpro URL and read it.

Hope this helps u.,

Thanks & Regards,

Kiran

former_member185241
Active Participant
0 Kudos

so , in report i have to insert all t code into z table ?

in report i can get value in sy-tcode( i think) and i will use CALL TRANSACTION ZRGP_CREATE

but  in web dynpro how will i take the Transaction Value ?