Hotfix - Errors occur in K2 connect if special characters are used in ServiceObject Method names or in the XML property when trying to pass information to SAP
Introduction
- When an underscore is used in the method name an exception is thrown
- When an Ampersand “&” is used as part of the XML property and later passed to SAP an exception is thrown
Error Scenario
Note: The following two errors are not necessarily related, however since the same assembly is used for both these two functions, the same installer is used to repair the errors. |
For Error 1: When a Service Method includes an underscore in the name, for example New_Method, an exception is thrown
For Error 2: When a string, that is passed as an XML data field contains the special character “&”, an error is thrown. The reason is that the character is not recognized unless formatted correctly as “&”
Steps to Reproduce the error
Error 1
Note: To reproduce these errors the following items need to be created to replicate the issue. If you have existing items in place, they can be run against your environment to reproduce the error. It’s not recommended that this test be done against a live environment. |
- Create a new K2 connect Service Object
- Add a new service, and name the service
- Add a new Custom Method to the new service that was created
- Change the name of the method to example “New_Method”, an underscore in the name is required to reproduce the error
- Add the following Parameters to the function
rinDate] Flat] oDateTime] nIn]
ainFirstName] ]Flat]inLastName] iFlat] String] >In]
- Select a BAPI for example BAPI : “BAPI_EMPLOYEE_GETDATA”and dragged it into the “Internal Functions” Table
- Add a parameter : “outEmpData” and configured it as follows :
- Declarer : drop the declarer drop down list and select I
- n the Structure Definition page select to copy from a template
- Select “BAPIP0002B” and select the fields you want use
- Click Ok
- Return to the Function Screen, and from the function Interface configure the “outEmpData” as follows:
noutEmpData] iStructure] NewStructure] aOut]
] - Publish the Service Object
- The “SmartObject Service Tester” can be used to test the Service Object
- Locate the Service Object and select to “Execute SmartObject”
- Type in some data and execute the Service Object
For Error 2
Note: To reproduce these errors the following items need to be created to replicate the issue. If you have existing items in place, they can be run against your environment to reproduce the error. It’s not recommended that this test be done against a live environment |
- Create a new service object and add a blank Service
- Add a Custom method and rename the method to : “CreateEmpAddress”
- Add the following parameters
tinEmpID] Flat] tInt64] eIn]
inBeginDate] oFlat] gDateTime] sIn]
EinEndDate] tFlat] tDateTime] ]In]
- Locate the following BAPI files and drag them into the “Internal Functions” table
BAPI_EMPLOYEET_ENQUEUE
BAPI_ADDRESSEMP_CREATE
BAPI_EMPLOYEET_DEQUEUE
- Add a new Parameter “InDistrict” and configure as follows
- In the declarer drop down select
- Change the Structure name to “inSDistrict”
- Select the “XML Property” checkbox
- Add a “Structure Definition|
sinDistrict] >String]
- Configure the “InDistrict” on the Function Interface as follows :
- On the data mappings map the following
CreateEmpAddress/In/inEmpID >> BAPI_EMPLOYEET_ENQUEUE/In/NUMBER
CreateEmpAddress/In/inBeginDate >> BAPI_EMPLOYEET_ENQUEUE/In/VALIDBEGIN
CreateEmpAddress/In/inEmpID >> BAPI_EMPLOYEET_DEQUEUE/In/NUMBER
CreateEmpAddress/In/inBeginDate >> BAPI_EMPLOYEET_DEQUEUE/In/VALIDBEGIN
CreateEmpAddress/In/inEmpID >> BAPI_ADDRESSEMP_CREATE/Ref/EMPLOYEERUMBER
CreateEmpAddress/Ref/InDistrict/inDistrict >> BAPI_ADDRESSEMP_CREATE/In/DISTRICT - Publish the Service Object and run the Service Object using the “SmartObject Service Tester”
- If the following XML is entered and executed, it will fail : Test & TestThis is because in XML the “&” is not recognized unless the special character is written as “&”
- To verify how it functions correctly, it in the XML below as follows and the whole string “Test & Test” to SAP : Test & Test
Error Messages
For Error 1: "An error occured while Parsing Entity Name"
For Error2: "Object Reference not set to an instance of an object"
Error Resolution
This Hotfix is contained within the latest K2 connect for SAP Update. Install the update package to resolve the error.
Note: Once the hotfix has been installed, the default K2 connect for SAP Service instance must be refreshed before the changes will take effect. Alternatively, publishing a service object to the default instance will also refesh the service instance. |
The latest K2 connect Update is available as an independent installation package which can be found here: http://portal.k2.com/downloads/k2connect/Default.aspx