Skip to main content

Dear all,

 

When we call "SAP BAPI" via "K2 Connect For SAP", we encounter the following problems:

SAP BAPI Structure and Method:

SAP BAPI name: SAP Test
Input Parameter: T_ROS(Parameter Name), Table(DataType)
Output Parameter: T_RETURN(Parameter Name), Table(DataType)

Only use the test tool provided by "K2 Connect For SAP" to call the BAPI method. The result is that when two data are passed in "T_ROS", if the first one is in the wrong format, the return value indicates the first format error. If the format is all correct, then Both returned successfully.

However, after using "K2 Connect For SAP" to generate "Service Object" for "SAP BAPI" and then "Smart Object" for "Service Object", the “ExecuteBulkScalar” method provided by K2 backend is used, regardless of whether the first format is wrong or not. Return the second success, and only one return value.

The specific calling logic is as follows:

using(serverName.Connection) {
SmartObject regionSmO = serverName.GetSmartObject("SAP Test");
regionSmO.MethodToExecute = "SAPTest";

using(DataTable inputDataTable = regionSmO.GetInputTable(regionSmO.MethodToExecute))
{
DataRow newRowA = inputDataTable.NewRow();
newRowAn"ID"] = "1";
newRowAn"Name"] = "Tom";
inputDataTable.Rows.Add(newRowA);

DataRow newRowB = inputDataTable.NewRow();
newRowBn"ID"] = "2";
newRowBn"Name"] = "Mary";
inputDataTable.Rows.Add(newRowB);

SmartObject result = serverName.ExecuteBulkScalar(regionSmO, inputDataTable);
}
}

So, I would like to ask if this is the cause of the problem. Is it a method error or a call error?

If the method is wrong, is there any other way to perfectly support the above Smart Object?

 

Thanks very much!

Hi,


 


I’m not really a 'SAP expert' on this. It sounds like when you test the BAPI call via the Test Cockpit tool, it works correctly but the SmartObject generated from the service object (.svd) doesn’t return correctly. Please correct me on this.


Could you let us know if this is a custom BAPI?


I assumed that you have tested SmartObject from SmartObject Tester tool and it had the same results. Perhaps, you might want to setup a custom service object with custom strucutre similar to the sample link below.


https://help.k2.com/onlinetraining/tutorials/default.htm#Resources/Projects/K2connect/Part-3.2-Developing-with-K2-connect.htm


Hi khanh, How to configure and call Smart Object to implement parameters and return values in XML format? Thank you very much.

Reply