Technical Articles
Integrating 3rd Party Workflow to Fiori MyInbox
This document contains steps how to integrate 3rd Party Workitems in Fiori MyInbox.
To show how this framework works, have taken example of Ariba API.
Same approach is applicable for all other type of 3rd party workitems.
1 Pre-Requisite
- Component SAP_GWFND 7.51
- Good understanding on 3rd party system and connectivity
- List of 3rd party API
- HTML knowledge (Will be used to display details on MyInbox)
2 Create a new Provider (Software Version)
Navigate to SM30, maintain below entry in /IWFND/V_COCCOL (Common list of Codes for SAP Gateway)
Type: 1 Software Version for ‘Instance Manager’
Identifier: ZCUSTPROV_ARIBA
Description: Custom Task Provider for Ariba System
3 Custom Task Provider class
Create custom task provider class ZCL_CUST_TASK_PROV_ARIBA with super class as
/IWPGW/CL_TGW_TASK_FACADE_ABS
3.1 Method Definition
Method Name | Method Usage | APIs which can be used |
/IWPGW/IF_TGW_TASK_FACADE~QUERY_TASKS | Method is triggered when initially Fiori launchpad is rendered. In this method write code to fetch workitems from 3rd Party (Ariba) via API (or any applicable way). Populate exporting parameter COUNT of this method with number of workitems from 3rd Party (Ariba).Same method is triggered on navigating inside MyInbox.Populate exporting parameter ET_TASKS (/IWPGW/IF_TGW_TYPES=>TT_TASKS) from output of 3rd party (Ariba) API. |
https://openapi.ariba.com/api/approval/v1/prod/pendingApprovables?realm={ }&documentType={requisitions/invoice}&user={ }&passwordAdapter=PasswordAdapter1′ https://openapi.ariba.com/api/approval/v1/prod/requisitions/{RequisitionNumber} |
/IWPGW/IF_TGW_TASK_FACADE~READ_TASK |
Method is triggered on selecting workitem in MyInbox. Put the code to fetch more details specific to selected workitem. Populate exporting parameter ES_TASK (/IWPGW/IF_TGW_TYPES=>TY_TASK) from output of 3rd party (Ariba) API. |
https://openapi.ariba.com/api/approval/v1/prod/requisitions/{RequisitionNumber} |
/IWPGW/IF_TGW_TASK_FACADE~QUERY_TASK_ATTACHMENTS |
Method is triggered on selecting workitem in MyInbox. Put the code to fetch list of Attachment for selected workitem. Populate exporting parameter ET_ATTACHMENTS (/IWPGW/IF_TGW_TYPES=>TT_ATTACHMENTS) from output of 3rd party (Ariba) API. |
https://openapi.ariba.com/api/approval/v1/prod/requisitions/{RequisitionNumber} (Refer to ATTACHMENTS section in JSON output) |
/IWPGW/IF_TGW_TASK_FACADE~READ_TASK_ATTACHMENT_STREAM |
Method is triggered on selecting attachment.
Put the code to fetch Attachment content for selected attachment. Populate exporting parameter ES_ATTACHMENT_STREAM (/IWPGW/IF_TGW_TYPES=>TY_MEDIA_RESOURCE_E) from output of 3rd party (Ariba) API. |
https://openapi.ariba.com/api/approval/v1/prod/requisitions/{RequisitionNumber}/attachments/{AttachmentId} |
/IWPGW/IF_TGW_TASK_FACADE~READ_TASK_DESCRIPTION |
Method is triggered on selecting workitem in MyInbox. Put the code to fetch details specific to selected workitem. Populate exporting parameter DESCRIPTION_HTML of structure ES_DESCRIPTION (/IWPGW/IF_TGW_TYPES=>TY_DESCRIPTION) from output of 3rd party (Ariba) API. Based on Output from API prepare an HTML content and pass it to ES_DESCRIPTION-DESCRIPTION_HTML. |
https://openapi.ariba.com/api/approval/v1/prod/requisitions/{RequisitionNumber} |
/IWPGW/IF_TGW_TASK_FACADE~GET_TASK_DECISION_OPTIONS |
Method is triggered on selecting workitem in MyInbox. Put the code to define Action buttons for selected workitem. Populate exporting parameter ET_DEC_OPT (/IWPGW/IF_TGW_TYPES=>TT_DECISION_OPTIONS) with list of action buttons. |
|
/IWPGW/IF_TGW_TASK_FACADE~APPLY_DECISION_ON_TASK |
Method is triggered on selecting particular action button for a Workitem in MyInbox. Put the code to define action needs to be performed on click of button. Use importing parameter IV_DECISION_KEY and IV_COMMENTS and trigger API to perform action on workitem. |
https://openapi.ariba.com/api/approval/v1/prod/operations/rest/requisitions/{approve/deny/withdraw}?realm={ }&user={ }&passwordadapter=PasswordAdapter1 { approvableId = iv_instance_id comment = iv_comments } |
/IWPGW/IF_TGW_USER_DET_FACADE~READ_USER_DETAILS_BY_CONTEXT |
Method is triggered on selecting the hyperlink related to UserId. Put the code to fetch user specific details which will be shown on pop-up which comes on click of username. Populate exporting parameter ES_USER_DETAILS (/IWPGW/IF_TGW_TYPES=>TY_USER_DETAIL). |
API to generate ARIBA token
https://api.ariba.com/v2/oauth/token
Request method: POST
Header Field: Content-Type & Authorization
Body (Form) Field: grant_type = ‘openapi_2lo’
4 Configure the new Provider
Inside transaction code SPRO, navigate to:
SAP NetWeaver à SAP Gateway Service Enablement à Content à Task Gateway à Task Gateway Service à Registration à Provider Implementation
Perform this activity to register new task providers (for example, third party task engines) for Task Gateway. Map new task provider to the provider class.
Create a new entry with following values:
Software Version: ZCUSTPROV_ARIBA (created in previous step)
Service: /IWPGW/TASKPROCESSING
Version: 2
Provider: ARBA (any dummy value)
Provider Description: Custom Task Provider for Ariba
Task Façade Implementation Class: ZCL_CUST_TASK_PROV_ARIBA
Value in column Provider can be any value.
5 Creating System Alias
Inside transaction code SPRO, navigate to:
SAP NetWeaver à SAP Gateway à OData Channel à Configuration à Connection Settings à SAP Gateway to SAP System à Manage SAP System Aliases
Create System-Alias with following details:
- System Alias : GWXCLNT010_ARIBA
- RFC Destination : NONE
- Local Gateway : NOT CHECKED
- For Local App : CHECKED
- OData on Backend : NOT CHECKED
- Target System : BLANK
- Target Client : BLANK
- Software Version : ZCUSTPROV_ARIBA (Created in step 1)
- Description : System Alias for ARIBA system
6 Mapping ZTASKPROCESSING 2.0 with newly created System Alias
Go to transaction code /N/IWFND/MAINT_SERVICES and select the service ZTASKPROCESSING 2.0 from list and maintain the entry as shown in below screen shot.
7 Maintain STATUS and PRIORITY for 3rd Party
Navigate to SM30, maintain below entry in Table /IWPGW/I_TGW_FLM for value mapping with software version.
8 Debugging
In case if debugger doesn’t stops at external/internal breakpoints in your custom methods(defined in above steps), then you may try below approach.
Inside SE24 transaction, open method /IWFND/CL_MGW_MDC_DISPATCHER à RDES_EXECUTE, and put external debugger at line shown in screen shot.
Once control comes to this point, do an F5.
This will open a new session. Do F8, and now control should ideally reach to your custom code.
9 Reference
- https://wiki.scn.sap.com/wiki/display/Fiori/Fiori+My+Inbox
- https://blogs.sap.com/2018/04/05/apis-for-sap-saas-applications/
Request you to kindly share feedback so I can add/modify content.
Very informative Blog.
Thank you,
Syam
I was able to pull the Requisition from ARIBA in the My Inbox but I am having an issue where the Actions are not getting displayed.
I have implemented the method GET_TASK_DECISION_OPTIONS as mentioned above but i dont see any buttons on the individual tasks.
Can you let me know what am i missing?
Hi Husain,
Will it be possible for you to share the code you have written in GET_TASK_DECISION_OPTIONS method.
Regards,
Harish
HI Harish,
I was able to Get the approve and Reject buttons now. There was a bug in the standard code and I had to implement the note '2951305 - Decision options are not displayed for the tasks'.