Hi Santosh,
Write this code on the action of the selection of SAP GUI.
data: lv_guid TYPE string,
lv_filename TYPE string,
lv_mimetype TYPE string,
lv_content TYPE xstring,
lv_sct TYPE string.
data: lo_api_component TYPE REF TO CL_WDR_COMPONENT.
lo_api_component ?= WD_COMP_CONTROLLER->WD_GET_API( ).
lv_guid = LO_API_COMPONENT->GET_ID( ).
CALL FUNCTION 'SWN_CREATE_SHORTCUT'
EXPORTING
* I_TRANSACTION = ''
I_REPORT = 'Z******'
* I_SYSTEM_COMMAND = ''
* I_PARAMETER =
* I_SAPLOGON_ID =
I_SYSID = SY-SYSID
* I_GUIPARM ='
I_CLIENT = SY-MANDT
I_USER = SY-UNAME
I_LANGUAGE = SY-LANGU
* I_WINDOWSIZE = 'Normal window'
* I_TITLE =
* I_CUSTOM =
IMPORTING
* SHORTCUT_TABLE =
SHORTCUT_STRING = lv_sct
* EXCEPTIONS
* INCONSISTENT_PARAMETERS = 1
* OTHERS = 2
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
cl_http_utility=>if_http_utility~encode_utf8(
EXPORTING
unencoded = lv_sct
RECEIVING
encoded = lv_content
EXCEPTIONS
conversion_failed = 1
OTHERS = 2 ).
CONCATENATE lv_guid '.sap' INTO lv_filename.
lv_mimetype = 'application/x-sapshortcut'.
cl_wd_runtime_services=>attach_file_to_response(
i_filename = lv_filename
i_content = lv_content
i_mime_type = lv_mimetype
* i_in_new_window = abap_false
* i_inplace = ABAP_false
).
After this in the report (Z*****) for which u created shortcut call the web dynpro application with the FM wdy_execute_in_place.
Hope it helps.
Regards,
Taiyeb