Developing the inter-connections between SAP and K2
Use K2 in Visual Studio to create the Service Objects. You must run Visual Studio using the Run As Administrator option. If not, when service objects are published, they will not be displayed within the Service Object Designer.
- From the Start Menu, locate Microsoft Visual Studio.
- Right click on the Menu Item.
- Select Run As Administrator.
When K2 connect for SAP is installed, new tools show within Visual Studio - the K2 ServiceObject Designer (which has 2 components - a new design canvas and a browser) and the Test Cockpit.
If the menu option is not present, then there was an error when the K2 connect for SAP components were installed, or the required resources have not been installed. Open the Visual Studio command prompt and run the DevEnv /Setup command as an administrator to reset the toolboxes. If this is not successful, reinstall the K2 connect developer components.
The K2 Service Object Designer can be loaded by selecting it from View > K2 Service Object Designer.
Service Object Designer
The K2 Service Object Designer works with the Visual Studio 'IDE'. The Service Object Designer is structured into two key root applications, the Development Kit, and Service Object Repositories.
Item | How to use it | |
---|---|---|
1 | K2 Service Object Designer: Design Canvas | The design canvas is the location with a project that hosts the service objects. Any number of service containers can be added to this location, and from here the K2 Developer constructs the Service Objects by associating them with SAP BAPIs. |
2 | K2 Service Object Designer: Browser | The browser enables the K2 Developers to access SAP and exposes the areas within SAP that they have access to. This resource is used in conjunction with the Service Object Design Canvas. |
3 | Service Container | The container hosts the service methods. |
Developing Service Objects
K2 connect for SAP provides a user friendly interface for interacting with the SAP BAPI infrastructure. To gain access to the SAP BAPIs, a K2 Service Object is created using the K2 Service Object Designer. Once created, the Service Object is deployed to the K2 connect Server. From the server, the Service Object is accessed by a SmartObject, and through that SmartObject is available to workflows and smartforms. It is important to know that the Service Objects make use of GUIDs as internal names. That way you can have two service objects with the same name (which is useful in a distributed environment with multiple developers).
The K2 connect Service Object is composed using the K2 Service Object Designer. The K2 Service Object Designer requires Microsoft Visual Studio and is resident as an explorer pane. When composing a Service Object, only a standard Visual Studio project is required, and a connection to a SAP instance. The Service Object is composed by including custom methods, for example a GetList, that are used by the SmartObject. The SmartObject will only be able to access the SAP BAPI in terms on the methods available in the Service Object
Service Object Designer: Service Objects
Use the Object explorer to connect to a K2 connect server, see a list of the Destinations configured for that server, and explore the list of BAPI's in the SAP system targeted by that Destination. You can also launch the Test Cockpit from any of the BAPIs listed in the Service Object explorer. See the section Service Object Designer: Object Explorer to learn more about using the Object Explorer.
Service Object Designer: Design Canvas
Use the Design canvas to design your Service Object. You can drag and drop BAPIs from the Destination explorer window to auto-generate a Service Method for the BAPI, or you can manually define the Service methods and configure how the BAPI will be used. From here you can also publish the Service Object to the K2 connect server. See the Service Object Design Canvas section for more on using the Design Canvas.
Test Cockpit
Use the Test Cockpit to test and investigate SAP BAPIs. This is a nice tool to use to understand what the BAPI does, what input values it expects, and what return values are available from the BAPI. See the section Test Cockpit for more information on this development tool.
These are the general steps taken to expose a SAP BAPI as a K2 SmartObject:
- In Visual Studio, connect to a K2 connect Server and select a target Destination
- Use the Service Object explorer to discover the available BAPIs
- Use the Test Cockpit to test and discover a particular BAPI
- Create a new connect Service Object by dragging the BAPI into the Design Canvas and/or creating custom methods
- If using custom Methods, configure parameters, properties and structures
- Publish the connect Service Object. During this process, the connect service will be restarted and the Default Destination’s Service Instance is refreshed. If you are updating an existing Service Object and that Service Object has been used by a SmartObject, you may need to restart the K2 service
- Create a new SmartObject in Advanced mode and use or combine the Service Object methods in your SmartObject
- Once the SmartObject is published, use the SmartObject in a Workflow, User Interface or Report. You can use SAP-backed SmartObject just like you would use any other SmartObject