Technical Articles
MDG: CR URL Generation
Navigating to MDG CRs can be cumbersome at times. If users are on the Go and the CRs are awaiting their action, a direct CR link would help users. Although we can setup extended notifications will a link in the emails to navigate to NWBC Home Page(hard coded link) via variables.
Business Need:
- Better User Experience.
- Direct link of CR in Emails helps tracking efficient.
Use Cases:
- Accessing CRs remotely on mobile device via emails.
- Approval/Rejection of CRs on mobile/desktop.
Implementation:
This solution would be a 2 part development:
- Generate Direct CR URL via below Code:
DATA:
lv_url TYPE string,
lf_guid TYPE sysuuid_c26,
lt_para TYPE tihttpnvp,
lv_application_name TYPE string VALUE ‘USMD_CREQUEST_PROCESS’.
APPEND INITIAL LINE TO lt_para
ASSIGNING FIELD-SYMBOL(<fs_para>).
<fs_para>-name = ‘CREQUEST’.
<fs_para>-value = <Pass CR Number>.
APPEND INITIAL LINE TO lt_para
ASSIGNING <fs_para>.
<fs_para>-name = ‘CREQUEST_WORKITEM’.
<fs_para>-value = <Pass Current active Workitem ID>.
APPEND INITIAL LINE TO lt_para
ASSIGNING <fs_para>.
<fs_para>-name = ‘SAP-CLIENT’.
<fs_para>-value = sy-mandt.
* Generate URL for NWBC link of Direct CR
cl_wd_utilities=>construct_wd_url(
EXPORTING
application_name = lv_application_name
in_parameters = lt_para
IMPORTING
out_absolute_url = lv_url ).
- Enhance User Decision to add Exit for email generation:
- Create custom class implementing interface IF_SWF_IFS_WORKITEM_EXIT.
- Implement method EVENT_RAISED
- If IM_EVENT_NAME = IF_SWF_IFS_WORKITEM_EXIT~C_EVTTYP_AFTER_CREATE.
- LWA_HEADER = IM_WORKITEM_CONTEXT->GET_HEADER( ).
- Select CR number from USMD2400 passing LWA_HEADER-WI_CHCKWI
- Use above code to generate URL.
- Create email content & recipients.
- Trigger email via CL_BCS.
- If IM_EVENT_NAME = IF_SWF_IFS_WORKITEM_EXIT~C_EVTTYP_AFTER_CREATE.
This solution will increase user’s experience and turnaround time on all change request actions. We have seen a visible difference in user satisfaction.
Very helpful. Thanks for sharing.
Thank you for sharing this blog but it didn't work on my side.
When I open the CR via a link that generated the way you explain, the CR is not editable. A validation message appears and it mentioned that I'm not the processor of CR.
On the other hand, if I open the same CR in my Change Request inbox, it is editable and looks normal.
CR opened via link;
CR opened via my change request inbox;
Are you sure about using application no with the value USMD_CREQUEST_PROCESS’ as a parameter to the cl_wd_utilities=>construct_wd_url?
Best regards,
Beykan
Looks like browser user session is creating issue, try to use the link a session where you have this ID logged in.
Also, check the user for session in browser this link opened into.