Sunteți pe pagina 1din 26

Task Gateway Service

PUBLIC | CUSTOMER | INTERNAL | CONFIDENTIAL | STRICTLY CONFIDENTIAL


January 2013

Task Gateway Service

Copyright
Copyright 2013 SAP AG. All rights reserved.
SAP Library document classification: PUBLIC
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express
permission of SAP AG. The information contained herein may be changed without prior notice.
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express
permission of SAP AG. The information contained herein may be changed without prior notice.
Some software products marketed by SAP AG and its distributors contain proprietary software components of other
software vendors.
Microsoft, Windows, Excel, Outlook, PowerPoint, Silverlight, and Visual Studio are registered trademarks of Microsoft
Corporation.
IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, z10,
z/VM, z/OS, OS/390, zEnterprise, PowerVM, Power Architecture, Power Systems, POWER7, POWER6+, POWER6,
POWER, PowerHA, pureScale, PowerPC, BladeCenter, System Storage, Storwize, XIV, GPFS, HACMP, RETAIN, DB2
Connect, RACF, Redbooks, OS/2, AIX, Intelligent Miner, WebSphere, Tivoli, Informix, and Smarter Planet are trademarks
or registered trademarks of IBM Corporation.
Linux is the registered trademark of Linus Torvalds in the United States and other countries.
Adobe, the Adobe logo, Acrobat, PostScript, and Reader are trademarks or registered trademarks of Adobe Systems
Incorporated in the United States and other countries.
Oracle and Java are registered trademarks of Oracle and its affiliates.
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered
trademarks of Citrix Systems Inc.
, XML, XHTML, and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium,
Massachusetts Institute of Technology.
HTML

Apple, App Store, iBooks, iPad, iPhone, iPhoto, iPod, iTunes, Multi-Touch, Objective-C, Retina, Safari, Siri, and Xcode
are trademarks or registered trademarks of Apple Inc.
IOS is a registered trademark of Cisco Systems Inc.
RIM, BlackBerry, BBM, BlackBerry Curve, BlackBerry Bold, BlackBerry Pearl, BlackBerry Torch, BlackBerry Storm,
BlackBerry Storm2, BlackBerry PlayBook, and BlackBerry App World are trademarks or registered trademarks of
Research in Motion Limited.
Google App Engine, Google Apps, Google Checkout, Google Data API, Google Maps, Google Mobile Ads, Google Mobile
Updater, Google Mobile, Google Store, Google Sync, Google Updater, Google Voice, Google Mail, Gmail, YouTube,
Dalvik and Android are trademarks or registered trademarks of Google Inc.
INTERMEC is a registered trademark of Intermec Technologies Corporation.
Wi-Fi is a registered trademark of Wi-Fi Alliance.
Bluetooth is a registered trademark of Bluetooth SIG Inc.
Motorola is a registered trademark of Motorola Trademark Holdings LLC.
Computop is a registered trademark of Computop Wirtschaftsinformatik GmbH.
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP BusinessObjects Explorer, StreamWork, SAP HANA, and
other SAP products and services mentioned herein as well as their respective logos are trademarks or registered
trademarks of SAP AG in Germany and other countries.
Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence,
Xcelsius, and other Business Objects products and services mentioned herein as well as their respective logos are
trademarks or registered trademarks of Business Objects Software Ltd. Business Objects is an SAP company.
Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL Anywhere, and other Sybase products and services
mentioned herein as well as their respective logos are trademarks or registered trademarks of Sybase Inc. Sybase is an
SAP company.
Crossgate, m@gic EDDY, B2B 360, and B2B 360 Services are registered trademarks of Crossgate AG in Germany and
other countries. Crossgate is an SAP company.
All other product and service names mentioned are the trademarks of their respective companies. Data contained in this
document serves informational purposes only. National product specifications may vary.
These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated
companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group
shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and
services are those that are set forth in the express warranty statements accompanying such products and services, if any.
Nothing herein should be construed as constituting an additional warranty.

Task Gateway Service

Table of Contents
Task Gateway Service ..................................................................................................................... 4
Configuring the Task Gateway Service ....................................................................................... 4
Customizing Task Gateway ......................................................................................................... 8
Task Gateway Collections ......................................................................................................... 10
Task Collection ....................................................................................................................... 11
Task Definition Collection ....................................................................................................... 12
Context Collection .................................................................................................................. 12
Filter Option Collection ........................................................................................................... 15
Substitution Collection ............................................................................................................ 16
Potential Owners Collection ................................................................................................... 18
Possible Agents Collection ..................................................................................................... 19
Attachments Collection ........................................................................................................... 20
Comments Collection ............................................................................................................. 21
Description Collection ............................................................................................................. 22
Processing Logs Collection .................................................................................................... 22
Task Definition Data Collection .............................................................................................. 23
Execution Link Collection ....................................................................................................... 23
Task Gateway User Exits ........................................................................................................... 24
User Exits for Scenario Count Items ...................................................................................... 26

Task Gateway Service

Task Gateway Service


The Task Gateway service provides an access point for consumer applications to display and
execute different types of tasks using SAP NetWeaver Gateway. This OData service allows
different task providers to expose tasks within one harmonized view. The BPM and Business
Workflow task providers are included out-of-the box together with the service. The service can be
enhanced with additional providers.

Configuring the Task Gateway Service


The Task Gateway service provides an access point for consumer applications to different tasks
using SAP NetWeaver Gateway. This OData service allows different task providers to expose
tasks within one harmonized view.
Prerequisites
If you have a BPM system, you must create a logical port to it before installing the Task Gateway
service.
To create a logical port:
1. In your SAP NetWeaver Gateway system, open transaction SOAMANAGER.
2. Select the Service Administration tab.
3. Choose Single Service Configuration.
4. From the Search by: by drop-down list, select Consumer Proxy.
5. In the Search Pattern: field, enter TaskFacade.
6. From the Field: by drop-down list, select External Name.
7. Choose Go.
8. In the Search Results table, select the consumer proxy.
9. Choose Apply Selection.
10. In the Details of Proxy Definition section, select the Configurations tab.
11. Choose Create Logical Port. The SOA Management popup is displayed.
12. In the Logical Port Name field, enter the port name.
13. In the Description field, enter a description providing additional information about the
connection.
14. Under Configuration Type, select the Manual Configuration radio button.
15. Choose Apply Settings.
16. In the Configuration for Logical Port section, select the Transport Settings tab.
17. In the URL Access Path field, enter TaskFacadeService/TaskFacade.
18. In the Computer Name of Access URL field, enter the computer's name.
19. In the Port Number of Access URL field, enter the relevant port number.
20. Select the Consumer Security tab.
21. Under the Authentication Settings section, select the User ID / Password radio button.
22. Under the User ID / Password section, enter the relevant user name and password.
23. Save the changes.

Task Gateway Service

Installing the Service


To use the Task Gateway service, your SAP NetWeaver Gateway Hub system must be deployed
with the PGW and BEP add-ons.
To support the Business Workflow, the BEP add-on must be deployed on the SAP ERP system.
Activating the Service
Activating the service consists of 2 main steps:
1. Setting up the service in the Gateway system:
o

Create a system alias.

Activate the service.

Assign the software version to the service.

2. Connecting the service to the backend system where you want to have the Gateway
information displayed:
o

Add additional system aliases.

The service uses the Multi-origin composition (MOC) component. For more information, see the
Multiple Origin Composition section.
To create a system alias:
1. On the SAP NetWeaver Gateway system, open transaction SPRO.
2. Choose SAP Reference IMG.
3. Select SAP Customizing Implementation Guide SAP NetWeaver Gateway
OData Channel Configuration Connection Settings SAP NetWeaver Gateway
to SAP System.
4. Open the Manage SAP System Aliases activity. The Change View Manage SAP
System Aliases: Overview page is displayed.
5. Choose New Entries.
6. In the Manage SAP System Aliases table, enter the following:
o Under SAP System Alias, enter the new system alias. For example,
GWQ_800_BEP.
o

Under Description, enter a description for the system alias.

Under Local GW, make sure the checkbox is not selected.

Under For Local App, select the checkbox.

Under RFC Destination, enter the trusted RFC destination to the SAP system.
NOTE
If you have a SAP NetWeaver BPM system, set WS Provider System as the
RFC Destination.

Under Software Version, press F4 and select the relevant data provider
(software version), for example, /IWPGW/BWF or/IWPGW/BPM (for a BPM
server).

7. Choose Save.
8. To create additional system aliases for other providers like BPM repeat steps 5 to 7.

Task Gateway Service

To activate the service:


1. On the SAP NetWeaver Gateway system, open transaction SPRO.
2. Choose SAP Reference IMG.
3. Select SAP Customizing Implementation Guide SAP NetWeaver
OData Channel Development with IW_BEP Registration.

Gateway

4. Open the Activate and Maintain Services activity.


5. Choose Add New Service.
displayed.

(Add New Service). The Add Service page is

6. In the System Alias field, press F4 and select the system alias you created in the
procedure above.
7. Press Enter. The Add Service table is populated.
8. From the Technical Service Name column, double-click /IWPGW/TASKPROCESSING.
The Add Service page is displayed.
9. Copy the name that appears in the Technical Model Name field, you will need it to
assign the software version to the service.
10. In the Package field, enter the package to which you want to assign the service.
11. Choose the checkmark. The Activate and Maintain Services page is displayed.
12. Under the ICF Nodes section, make sure the ODATA node status is set to Active.
13. Under the System Aliases section, make sure the system alias we activated is
displayed.
To assign the software version to the service:
1. On the SAP NetWeaver Gateway system, open transaction SPRO.
2. Choose SAP Reference IMG.
3. Select SAP Customizing Implementation Guide SAP NetWeaver
OData Channel Development with IW_BEP Registration.

Gateway

4. Open the Assign Data Provider to Data Model activity. The Change View Assign
Data Provider to Data Model: Overview page is displayed.
5. Choose New Entries.
6. In the Assign Data Provider to Data Model table, enter the following:
o

Under Model Identifier, enter the technical name you obtained in the previous
step (To activate the service) followed by _0001_BE. For example, <model
identifier name>_0001_BE.

o
o

Under Type, select (Adaptation) Data Provider from the drop-down list.
Under Software Version, press F4 and select the relevant software version for
example /IWPGW/BPM or /IWPGW/BWF.

o
o
o

Under Class/Interface, enter /IWFND/CL_MGW_RUNT_RCLNT_PRXY.


Under Description, enter a description of the data model.
Under Model Name, enter enter the technical name you obtained in the previous
step (To activate the service).
7. Choose Save.
8. To create additional software versions, repeat steps 5 to 7.

Task Gateway Service

To add additional system aliases:


1. Create a new system alias as described in the procedure above.
2. On the SAP NetWeaver Gateway system, open transaction SPRO.
3. Choose SAP Reference IMG.
4. Select SAP Customizing Implementation Guide SAP NetWeaver Gateway
OData Channel OData Channel Development with IW_BEP Registration.
5. Open the Activate and Maintain Services activity. The Activate and Maintain
Services page is displayed.
6. In the Service Catalog table, search for TASKPROCESSING in the External Service
Name column and select the entire line.
7. In the System Aliases section, choose
(Add System Alias). The Change
View Assign SAP System Aliases to OData Service: Overview page is displayed.
8. Select an existing SAP system alias and choose Copy.
9. In the SAP System Alias field, press F4 and select the System Alias you have created.
10. In the Default System field, the checkbox does not need to be selected. If the checkbox
is selected, the corresponding SAP system will be called by default.
11. Choose

(Copy).

12. Choose Save.


Once your service is activated you can navigate to the Task collection to get all your inbox tasks
from the implemented providers, such as Business Workflow and BPM. For example:
http://<Server>:<Port>/sap/opu/odata/IWPGW/TASKPROCESSING;mo/TaskCollec
tion

Task Gateway Service

Customizing Task Gateway


Defining Scenarios
A scenario is an aggregation of different task activities that are visualized by the same business
application. For example, Purchase Order approval, which is implemented in the SAP system by
different task types.
Each scenario needs to be assigned to at least one Consumer Type (for example, Mobile,
Desktop, Tablet).
You can also specify roles for each consumer type and scenario definition to restrict access to the
scenario.
Each scenario aggregates the Task Definition IDs and System Alias from which the Tasks source
originates.
To add a new scenario:
1. From you Gateway system, open transaction SPRO.
2. Choose SAP Reference IMG.
3. Select SAP NetWeaver > Gateway Service Enablement > Content > Task Gateway
Service.
4. Open the Scenario Definition activity. The Change View Scenario Definition:
Overview page is displayed.
5. Choose New Entries.
6. In the Scenario Identifier field, enter a key for the scenario.
7. In the Scenario Display Name field, enter a description for the scenario.
8. In the Scenario Order field, specify the scenario ranking within the Scenario List.
(optional).
9. In the Technical Service Name field, press F4 and select the scenario service identifier
and version. By default, TASKPROCESSING is displayed.
10. In the EntitySet External Name field, specify the entity to which the URL navigates.
11. In the Property External Name field, define the property name of the specific entity
containing the Task Definition ID.
12. In the Default Sort by Property field, enter the property by which the application will sort
the list (optional).
13. Select the MassAction checkbox to enable performing actions on several items at the
same time. (For example, mass approval.)
Note: If the scenario is not a part of the Business Workflow engine, and you want to see the
number of tasks pending for this scenario, in the Class for Scenario Count field, enter
the name of the class that implements the /IWWRK/IF_TGW_SCENARIO interface in
the SAP system.

Task Gateway Service

To assign a consumer type for a scenario:


1. In the Scenario Definition table, select the row containing the desired scenario.
2. From the Dialog Structure section, double-click Assign Consumer Type to Scenario.
3. Choose New Entries.
4. In the Task Gateway Consumer Type field, press F4 and select the desired consumer
type.
To assign a role to a consumer type and scenario:
1. In the Task Gateway Consumer Type table, select the row containing the desired
consumer type.
2. From the Dialog Structure section, double-click Assign Role to Consumer Type and
Scenario.
3. Choose New Entries.
4. In the Role column, press F4 and select the desired role.
To set task definition for a scenario:
1. From the Dialog Structure section, double-click Scenario Definition.
2. Select the desired scenario row.
3. From the Dialog Structure section, double-click Task Definition for Scenario.
4. Choose New Entries.
5. In the Task Type field enter the relevant task ID for the selected scenario.
6. In the SAP System Alias field, enter the source system alias for the task type. (The Task
Gateway service should be connected to the selected system aliases.)

Consuming the Scenarios


Once you have created a scenario, you can consume it in your application using the Consumer
Scenario collection.

Task Gateway Service

Task Gateway Collections


The service contains the following collections:
Addressable Collections:

Task Collection

Task Definition Collection

Consumer Scenario Collection

Context Collection

Filter Option Collection

Substitution Collection

Collections Associated to the Task Collection:

Potential Owners Collection

Possible Agents Collection

Attachments Collection

Comments Collection

Description Collection

Processing Logs Collection

Task Definition Collection

UI Execution Link Collection

User Info Collection

Task Gateway Service

10

Task Collection
This collection represents the user's tasks exposed by the respective providers (for example,
Business Workflow (BWF) and BPM). When navigating to the Task collection, users receive their
inbox tasks and their completed tasks.
Properties Table
Property Name

Description
Key field.

SAP__Origin
Contains the system alias of the task's source.
Key field.
InstanceID
Contains the task instance ID. (For example, work item ID from BWF.)
TaskDefinitionID

The task ID. It can also be retrieved using the TaskDefinitionData


association.

TaskDefinitionName

The name of the Task ID. (Maintained by customization on the PGW AddOn. It can also retrieved using the TaskDefinitionData association.)

TaskTitle

The item's subject. (It can be changed using a BAdI in the PGW Add-On)

Priority

The technical name of the item's priority. For the possible values of this
property and the display name, use the FilterOptionCollection.

Status

The technical name of the item's status. For the possible values of this
property and the display name, use the FilterOptionCollection.

CreatedOn

The time and date when the item was created.

CreatedBy

Full name of the user who created the item (source system user).

Processor

The current processor of the item (source system user).

StartDeadLine

The time and date of the started item's deadline.

CompletionDeadLine

The time and date when the item deadline ends.

ExpiryDate

The time and date when the item expires. (For BPM items only.)

IsEscalated

This flag indicates the item was escalated.

HasComments

This flag indicates the existence of comments.

HasAttachments

This flag indicates the existence of attachments.

HasPotentialOwners

This flag indicates the existence of potential owners.


The relative URL of the service that holds the context data for the item.

ContextServiceURL
For more information, see the Context Collection section.

Task Gateway Service

11

Task Definition Collection


This collection displays additional details of the task. It is an addressable collection so it can be
read without a specific ID. All tasks definitions in the system are retrieved.
You can navigate to this collection from the Task collection using:
TaskCollection(SAP__Origin='ERP',InstanceID='<instance_id>')/TaskDefinit
ionData
Properties Table
Property Name

Description
Key field.

SAP__Origin
Contains the task's source system alias.
TaskDefinitionID

The provider's task ID.

TaskName

The name of the Task ID (maintained by customizing the SAP NetWeaver


Gateway Add-on).

Category

The task category.

ProviderID

The Task provider ID. (Can be BWF for the Business Workflow.)

Context Collection
This collection enables you to add Business Context data to the Generic Workflow Task Object.
This helps the user to make better decisions by reading related Business data.
The Task Gateway service enables to link additional Gateway service which will return the
business context of a collection or a single entry.
At runtime, the consumer application retrieves the business data context using the link supplied.

Implementation
The business context is retrieved from an additional Gateway service. For the context service to
work properly, a predefined collection must be implemented in the new context service.
To create the context service metadata provider class (MPC):
1. In your SAP NetWeaver Gateway system, open transaction SE24. The Class Builder:
Initial Screen is displayed.
2. Note: Make sure the IW_BEP is installed in this system.
3. In the Object type field, enter the name of the new MPC class.
4. Choose Create.
5. In the Object type dialog box, select the Class radio button and choose the checkmark.
6. In the Create Class dialog box, enter a description and choose Save. The Create Object
Directory Entry page is displayed.
7. In the Package field, assign a valid package and choose the checkmark. The Class
Builder: Change Class page is displayed.
8. Select the Properties tab.

Task Gateway Service

12

9. Derive your class from super class /IWPGW/CL_TGW_CONTEXT_MD_ABS and choose


Save.
10. Select the Methods tab.
11. Redefine and implement the CREATE_CONTEXT_ENTITY method, adding the desired
properties that will be used for holding business context data. For example,
METHOD create_context_entity.
DATA lo_property TYPE REF TO /iwbep/if_mgw_odata_property.
lo_property = io_entity->create_property( iv_property_name
'MaterialName'
iv_abap_fieldname = 'TXZ01' ).

lo_property = io_entity->create_property( iv_property_name


'MaterialID'
iv_abap_fieldname = 'MATNR' ).

lo_property = io_entity->create_property( iv_property_name


'Quantity'
iv_abap_fieldname = 'BSTMG' ).

lo_property = io_entity->create_property( iv_property_name


'Price'
iv_abap_fieldname = 'BAPICUREXT' ).

ENDMETHOD.
12. Activate your class. Your metadata class is created.
To create the context service data provider class (MPC):
1. In your SAP NetWeaver Gateway system, open transaction SE24. The Class Builder:
Initial Screen is displayed.
2. Note: Make sure the IW_BEP is installed in this system.
3. In the Object type field, enter the name of the new DPC class.
4. Choose Create.
5. In the Object type dialog box, select the Class radio button and choose the checkmark.
6. In the Create Class dialog box, enter a description and choose Save. The Create Object
Directory Entry page is displayed.
7. In the Package field, assign a valid package and choose the checkmark. The Class
Builder: Change Class page is displayed.
8. Select the Properties tab.
9. Derive your class from super class /IWPGW/CL_TGW_CONTEXT_RT_ABS and choose
Save.
10. Select the Methods tab.
11. Redefine and implement the ENTITYSET_CONTEXT and the ENTITY_CONTEXT
methods, to retrieve the business context data on runtime either to get a context entity
set or a context entity respectively.
12. Activate your class. Your metadata class is created.

Task Gateway Service

13

To create a new context service:


1. Inherit metadata class /IWPGW/CL_TGW_CONTEXT_MD_ABS and runtime class
/IWPGW/CL_TGW_CONTEXT_RT_ABS.
2. Implement the abstract methods accordingly.
For more information on how to create an SAP NetWeaver Gateway service see the Creating
OData Channel Content [External] section.

Mapping the Context Service


You can map your new context service to the Task Gateway in the following manner:
1. On your SAP NetWeaver Gateway system, register your Model and Service as described
in the Register the Model / Service [External] section.
2. Activate the service as described in the Activate the Service [External] section.
3. Maintain the context service in customization table /IWPGW/C_TGW_CTX.
Field

Description

Example

Task Type

Task ID.

TS00008267

System Alias

System alias according to the Task Gateway


service.

ERP

Technical
Service
Name

Technical service name for the context service


as maintained in transaction
/IWFND/MAINT_SERVICE.

ZCONTEXT_PURCHASE_ORDER

Version

Service version as maintained in transaction


/IWFND/MAINT_SERVICE.

For example:
1. Navigate to the Task Gateway service.
http://ldcigiq.wdf.sap.corp:50015/sap/opu/odata/IWPGW/TASKPROCESSING/?$format=
xml
2. Navigate to the ContextCollection. You must use a filter on the TaskDefinitionID to get
the context according to the task type.
http://ldcigiq.wdf.sap.corp:50015/sap/opu/odata/IWPGW/TASKPROCESSING/ContextCo
llection?$filter=TaskDefinitionID eq 'TS00008267'. The Context service link is displayed.
3. Use the link and navigate to the context service query.
http://ldcigiq.wdf.sap.corp:50015/sap/opu/odata/sap/
zcontext_purchase_order;v=1/ContextCollection?$filter=TaskDefinitionID eq
'TS00008267'
4. On the Query collection level, the business context retrieved is implemented by the
customer. (The client application can merge this data with the Workflow Task data.)
5. Navigate to the specific entity to see the specific business data context.
http://ldcigiq.wdf.sap.corp:50015/sap/opu/odata/sap/
zcontext_purchase_order;v=1/ContextCollection('000000065629')

Task Gateway Service

14

Filter Option Collection


This addressable collection contains consolidated values across task providers for certain fields.
It is used to filter tasks according to different parameters.
The filter option enforces one value of status and priority property in the Task Collection for any
Task faade provider. It also displays a list of possible Status and Priority values and the Display
Name. The consumer application uses this list to filter the relevant data and the Display Name is
used for translation.
To consume the optional filtering value for Status and Priority:
1. Open the Task Gateway service document.
2. Navigate to the Filter Option Collection. The different Status and Priority options are
displayed. For example,
<d:SAP__Origin<ERP<d:SAP__Origin<ERP
<d:Type>PRIORITY</d:Type>
d:TechnicalName>HIGH</d:TechnicalName>
<d:DisplayName>High</d:DisplayName>
or
<d:SAP__Origin>ERP</d:SAP__Origin>
<d:Type>STATUS</d:Type>
<d:TechnicalName>COMPLETED</d:TechnicalName>
<d:DisplayName>Completed</d:DisplayName>
To add new entries for mapping Status and Priority from the task provider:
1. On the SAP NetWeaver Gateway system, open transaction SM30.
2. In the Table/View field, enter /IWPGW/I_TGW_FLM.
3. Choose Maintain.
4. Choose New Entries.
5. From the Proper Type drop-down list, select the type of field you want to map (Status or
Priority).
6. In the Software Version field, enter the task faade provider (for BWF it is
/IWPGW/BWF).
7. In the Provider source value for mapping field, enter the initial value you want to map.
(For example, if the priority value from the source system is 4, enter 4).
8. In the Filter Type Technical Name field, press F4 and choose the value to which you want
to map. This value will be used in the Task Collection as the technical name for the
Priority type.

Task Gateway Service

15

Substitution Collection
This is an addressable collection. It reflects all the current user's substitutions, that is, users that
are authorized to execute tasks on behalf or instead of the current user. The Substitution entity
contains the following properties:
Properties Table
Property
Name

Description

User

User name of the substitute.

BeginDate

Start date of the substitution.

EndDate

End date of the substitution.

FullName

Full name of the substitute.

IsActive

This flag indicates that the substitution active.

Mode

In BPM, there are substitution modes for Receiver and Replacer. In BWF, all
substitutes are Receivers.

All CRUD operations are allowed in this collection.

GET To retrieve the Substitution collection, perform a GET operation on the relevant
URL.
To obtain the URL:
1. On the SAP NetWeaver Gateway system, go to transaction SPRO and choose
SAP Reference IMG.
2. Navigate to SAP NetWeaver > Gateway > OData Channel > Administration >
General Settings Activate and Maintain Services.
3. Select the Task Gateway service.
4. Choose Call Browser.
5. Navigate to SubstitutionCollection.

POST To create a Substitution, perform a POST operation on the relevant URL.


To obtain the URL:
1. On the SAP NetWeaver Gateway system, go to transaction SPRO and choose
SAP Reference IMG.
2. Navigate to SAP NetWeaver > Gateway > OData Channel > Administration >
General Settings > Activate and Maintain Services.
3. Select the Task Gateway service.
4. Choose Call Browser.
5. Navigate to SubstitutionCollection.
Fill the request body as follows:
>atom:entry xmlns:atom="http://www.w3.org/2005/Atom">

Task Gateway Service

16

>atom:content type="application/xml">
>m:properties
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices
/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices
">
>d:User>FISHMANROY>/d:User>
>d:FullName>Roy FISHMAN>/d:FullName>
>d:IsActive>true>/d:IsActive>
>d:BeginDate>2012-05-08T00:00:00>/d:BeginDate>
>d:EndDate>9999-12-31T00:00:00>/d:EndDate>
>d:Mode>RECEIVE_TASKS>/d:Mode>
>/m:properties>
>/atom:content>
>/atom:entry>

PUT To update the status of the substitution (activate or deactivate), perform a PUT
operation on the relevant URL.
To obtain the URL:
1. On the SAP NetWeaver Gateway system, go to transaction SPRO and choose
SAP Reference IMG.
2. Navigate to SAP NetWeaver > Gateway > OData Channel > Administration >
General Settings > Activate and Maintain Services.
3. Select the Task Gateway service.
4. Choose Call Browser.
5. Navigate to SubstitutionCollection.
6. Navigate to the collection on the specific user ID
SubstitutionCollection(User=>user>,BeginDate=>BeginDate>,EndDate=>
EndDate>).
Fill the request body as follows:
>atom:entry xmlns:atom="http://www.w3.org/2005/Atom">
>atom:content type="application/xml">
>m:properties
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices
/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices
">
>d:User>FISHMANROY>/d:User>
>d:FullName>Roy FISHMAN>/d:FullName>
>d:IsActive>true>/d:IsActive>
>d:BeginDate>2012-05-08T00:00:00>/d:BeginDate>
>d:EndDate>9999-12-31T00:00:00>/d:EndDate>
>d:Mode>RECEIVE_TASKS>/d:Mode>
>/m:properties>
>/atom:content>
>/atom:entry>
To activate the substitution, set the IsActive field to true.
To deactivate the substitution, set the IsActive field to false.

Task Gateway Service

17

DELETE To delete a Substitution, perform a DELETE operation on the relevant URL.


To obtain the URL:
1. On the SAP NetWeaver Gateway system, go to transaction SPRO and choose
SAP Reference IMG.
2. Navigate to SAP NetWeaver > Gateway >Data Channel > Administration >
General Settings > Activate and Maintain Services.
3. Select the Task Gateway service.
4. Choose Call Browser.
5. Navigate to SubstitutionCollection.
6. Navigate to the collection on the specific user ID
SubstitutionCollection(User=>user>,BeginDate=>BeginDate>,EndDate=>
EndDate>).
7. Select Delete.

Potential Owners Collection


This collection displays the details of the user who currently owns the task.
You can navigate to this collection from the Task collection using:
TaskCollection(SAP__Origin='ERP',InstanceID='<instance_id>')/PotentialOw
ners
Properties Table
Property Name

Description
Key field.

SAP__Origin
Contains the task's source system alias.
Key field.
InstanceID
Contains the task instance ID. (For example, work item ID from BWF.)
Key field.
Owner
The user who owns the item. (Source system user.)
Type

Type of the owner, can be Approver or Substitute.

Task Gateway Service

18

Possible Agents Collection


This collection displays the details of the users who are authorized to receive tasks that are not
defined as general tasks.
You can navigate to this collection from the Task collection using:
TaskCollection(SAP__Origin='ERP',InstanceID='<instance_id>')/Possible
Agents
Properties Table
Property Name

Description
Key field.

SAP__Origin
Contains the task's source system alias.
Key field.
InstanceID
Contains the task instance ID. (For example, work item ID from BWF.)
Key field.
UserName
The user who is authorized to receive the item. (Source system user.)
FullName

Full name of the user.

Task Gateway Service

19

Attachments Collection
This collection retrieves the task's attachment data.
You can navigate to this collection from the Task collection using:
TaskCollection(SAP__Origin='ERP',InstanceID='<instance_id>')/Attachments
Each entry contains a media link to retrieve the attachment content.
This collection supports create and delete using media links. For more information, see the
Adding and Deleting Attachments using the Task Gateway Service section below.
Properties Table
Property Name

Description
Key field.

SAP__Origin
Contains the task's source system alias.
Key field.
InstanceID
Contains the task instance ID. (For example, work item ID from BWF.)
Key field.
ID
Attachment's GUID ID.
FileName

The attachment's file name.

CreatedAt

The date and time of the attachment creation.

CreatedBy

The user who created the attachment (source system user).

mime_type

The attached document's mime type.

Adding and Deleting Attachments using the Task Gateway Service


To add an attachment to the Workflow item using the service:
1. On the SAP NetWeaver Gateway system, go to transaction SPRO and choose SAP
Reference IMG.
2. Navigate to SAP NetWeaver > Gateway > OData Channel Development with IW_BEP
> Registration.
3. Open the Activate And Maintain Services activity.
4. Select the service with the description Task Gateway Service.
5. Choose Call Browser. The services base URL is displayed in your browser.
6. If the SAP GUI Security window is displayed, allow the action to proceed.
7. To add the multiple origin option, add ;mo to the service name in the URL:
TaskCollection(SAP__Origin = <system_alias>, InstanceID=<workitem
id>)/Attachments

Task Gateway Service

20

8. Execute a POST request on the obtained URL with the attachment content as the
request body and the following request header parameters:
o

slug file name without extension

Content-Type MIME type of the attachment

To delete an attachment from the Workflow item using the service:


1. On the SAP NetWeaver Gateway system, go to transaction SPRO and choose SAP
Reference IMG.
2. Navigate to SAP NetWeaver > Gateway > OData Channel Development with IW_BEP
> Registration.
3. Open the Activate And Maintain Services activity.
4. Select the service with the description Task Gateway Service.
5. Choose Call Browser. The services base URL is displayed in your browser.
6. If the SAP GUI Security window is displayed, allow the action to proceed.
7. Navigate to the attachments content by adding the following to the services base URL:
URL: AttachmentCollection(SAP__Origin = <system_alias>,
InstanceID='<workitem_id>',id='<Attachment_id>')/$value
8. Execute a DELETE request on the obtained URL.

Comments Collection
This collection retrieves the task's comments. Unlike attachments, the comments are always
simple text.
You can navigate to this collection from the Task collection using:
TaskCollection(SAP__Origin='ERP',InstanceID='<instance_id>')/Comments
Properties Table
Property Name

Description
Key field.

SAP__Origin
Contains the task's source system alias.
Key field.
InstanceID
Contains the task instance ID. (For example, work item ID from BWF.)
Key field.
ID
The comment's GUID ID.
CreatedAt

The date and time of the comment creation.

CreatedBy

The user who created the comment (source system user).

Text

The text displayed in the comment.

Task Gateway Service

21

Description Collection
This collection contains the task's description text. Unlike the Task Title, the description contains
a long text which contains a description of the task for the user.
You can navigate to this collection from the Task collection using:
TaskCollection(SAP__Origin='ERP',InstanceID='<instance_id>')/Description
Properties Table
Property Name

Description
Key field.

SAP__Origin
Contains the task's source system alias.
Key field.
InstanceID
Contains the task instance ID. (For example, work item ID from BWF.)
Description

The task description.

Processing Logs Collection


This collection retrieves the task's logging history, for example, changing status, adding
attachments, and so on.
You can navigate to this collection from the Task collection using:
TaskCollection(SAP__Origin='ERP',InstanceID='<instance_id>')/ProcessingL
ogs
Properties Table
Property Name

Description
Key field.

SAP__Origin
Contains the task's source system alias.
Key field.
InstanceID
Contains the task instance ID. (For example, work item ID from BWF.)
Key field.
OrderID
Describes the order of the log action.
Timestamp

Displays the date and time of the action in the log.

ActionName

Displays the text of the action in the log.

PerformedB

Displays the user that performed the action (source system user).

Comments

The action's comment in the log.

TaskStatus

The task status after the action is performed. (Optional field.)

Task Gateway Service

22

Task Definition Data Collection


This collection retrieves the logging history for the task, for example: changing status, add
attachments etc.
You can navigate to this collection from the Task collection using:
TaskCollection(SAP__Origin='ERP',InstanceID='<instance_id>')/ProcessingL
ogs
Properties Table
Property Name

Description

SAP__Origin

Key field.
Contains the task's source system alias.

InstanceID

Key field.
Contains the task instance ID (for example, work item ID from BWF).

OrderID

Key field.
Describes the order of the log action.

Timestamp

Date and time of the action in the log

ActionName

display text of the action in the log

PerformedB

User that performed the action (source system user).

Comments

The action comment in the log.

TaskStatus

the task status when the action was performed

Execution Link Collection


This collection retrieves a link for executing the work item via WebGUI.
You can navigate to this collection from the Task collection using:
TaskCollection(SAP__Origin='ERP',InstanceID='<instance_id>')/UIExecution
Link.
Properties Table
Property
Name

Description

SAP__Origin

Key field.
Contains the task's source system alias.

InstanceID

Key field.
Contains the task instance ID. (For example, work item ID from BWF.)

GUI_Link

Contains the link for executing the work item via WebGUI. The link is relative,
this means you must add the protocol, host, and port before the link to execute
it.

Task Gateway Service

23

Task Gateway User Exits


User exits provide flexibility and extensibility options to the Workflow service developers.
There are four types of user exits:

When executing a GET action on the Task Collection feed (which retrieves all the current
user's tasks). This changes the task title for all inbox tasks.

When executing a GET action on a Task Collection entry (which retrieves a specific task).
This changes the task title for a specific task.

When executing a GET action on the Description Collection. This changes the task
description.

When executing a GET action on the User Info Collection. This allows you to fetch user
details from the desired user storage.

To implement you code in the user exits, you must create a BAdI that enables new functionality at
the chosen entry point.
To create a new BAdI:
1. In your SAP system, open transaction SE19. The BAdI builder initial screen for
Implementations page is displayed.
2. In the Create implementation area, select the New BAdI radio button.
3. In the Enhancement Spot field, enter the following:
o

To change the task title for all items when executing a query operation on the
Task Collection (Query BAdI), enter /IWPGW/ES_TGW_TASK_QUERY.

To change the task title or task description for a specific item when executing a
Read operation on the Task Collection or Task Description Collection (Read
BAdI), enter /IWPGW/BADI_TGW_TASK_DATA.

To change the user details that are returned by the service, enter
/IWPGW/ES_TGW_USER_DETAIL.

4. Choose Create Impl. The Create Enhancement Implementation page is displayed.


5. In the Enhancement Implementation field, enter the name of the new BAdI that will
contain the code to be added.
6. In the Short Text field, add a short explanation of the BAdIs function.
7. Choose the checkmark. The Create Object Directory Entry page is displayed.
8. Save the BAdI in the package supplied to you by an administrator. The Enhancement
Implementation: Create BAdI Impl. page is displayed.
9. In the BAdI Implementation column, enter a name for the BAdI implementation, for
example, BADI_IMPLEMENTATION.
10. In the Implementation Class column, enter a name for the BAdI implementation class, for
example, ZBADI_IMPL_CLASS.
11. In the BAdI Definition column, open the drop-down list and select the BAdI definition
name (there is only one definition name in Workflow for SAP NetWeaver Gateway).
12. Choose the checkmark. The Enhancement Implementation Display page is displayed.
13. Under BAdI implementations, expand the BAdI you have just created.
Note: If no filter values are entered, your code is applied to ALL workflows.

Task Gateway Service

24

14. Double-click Filter Val.


15. Choose Create Combination. The Choose Filter page is displayed.
16. Select the PROVIDER_ID and the TASK_DEF_ID rows and choose the checkmark.
Note: For the /IWPGW/BADI_TGW_TASK_QUERY BAdI the filter name TASK_DEF_ID
does not exist.
17. In the Filter Values section, replace the question marks in the Value 1 column with the
Task Provider ID and the Task Definition ID numbers, each in its relevant row.
18. For each row, choose the question marks in the Comparator field. The Display Filter
Value page is displayed.
19. From the Comparator 1 drop-down list, select the equals sign (=).
20. Choose the checkmark.
21. In the Enhancement Implementation: Change page, double-click the implementing
class node in the BAdI implementations section.
22. Double-click the relevant method displayed.
23. Choose the checkmark. The ABAP editor is displayed.
24. When prompted, choose Yes.
25. Add your desired code in the ABAP editor.
Note:
o

For the Query BAdI: The import parameters are the task provider ID and the table
containing all task header details. The output parameter is a table containing the task
IDs and the corresponding task IDs after modification.

For the READ BAdI: The import parameters are the task provider's ID and the task
header details.

In the MODIFY_TASK_TITLE method, the output (Changing) parameter is the


task title after modification.

In the MODIFY_TASK_DESCRIPTION method, the output (Changing) parameter


is the task description after modification.

For the User Info BAdI: There are two methods in the BAdI interface, one retrieves
user textual details, and the other retrieves the users image. Both methods receive
an instance ID, navigation path, URL parameters, and a reference to the current
provider faade implementation. The output parameter for the first method is the user
details structure and, for the second one, a media resource structure.
The BAdI needs to find the user according to the import parameters and then retrieve
the users details/image.

26. Choose Save and then Activate. The Inactive Objects page is displayed.
27. Select all objects and choose the checkmark.

Task Gateway Service

25

User Exits for Scenario Count Items


If you choose to retrieve the task count from an alternative/external source, you need to
implement an interface in a new class.
To create a new class implementation:
1. In your SAP system, open transaction SE24.
2. In the Object Type field, enter the desired object name, for example,
ZCL_IMPLEMENTATION.
3. Choose Create. The Object type page is displayed.
4. Select the Class radio button and choose Continue. The Create Class page is
displayed.
5. In the Description field, enter the relevant description for the class and choose Save.
The Create Object Directory Entry page is displayed.
6. Select the relevant package name and choose Save. The Class Builder: Change Class
page is displayed.
7. Select the Interfaces tab.
8. In the Interface field, enter /IWWRK/IF_TGW_SCENARIO.
9. Choose Save.
10. Select the Methods tab.
11. Double-click the method displayed.
12. Enter your desired code.
13. Choose Save and activate all the newly created objects.
Note: The method interface input consists of a list of tasks. The output consists of a list of
tasks and their respective count. It is your responsibility to bring the relevant data
according to the input and assign it to the output.
To add the new user exit newly created class to the scenario customization, follow the To add a
new scenario procedure in the Customizing Task Gateway section.

Task Gateway Service

26

S-ar putea să vă placă și