on 06-13-2015 10:52 PM
Dear Experts,
I can able to perform multi read using $Batch.
For Ex : SurveyEmpSet - Entity Set Name
GET SurveyEmpSet(EmpId='12345',EmpName='Test Emp1') HTTP/1.1
GET SurveyEmpSet(EmpId='45678',EmpName='Test Emp2') HTTP/1.1
But now I need the same for the function import to get output. What's the change I need to do in the above.
For Ex: ContList is the Function Import Name.
/sap/opu/odata/sap/ZTEST_SRV/ContList?Lang='E'
/sap/opu/odata/sap/ZTEST_SRV/ContList?Lang='A'
Regards,
Srinivasan K
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ashwin,
I tried the same way. But its not hitting the execute action method.
I tried the below.
URL : /sap/opu/odata/sap/<Service Name>/$batch
Content-Type : multipart/mixed; boundary=batch
Http Method : Post
--batch
Content-Type: application/http
Content-Transfer-Encoding: binary
GET <Function Import Name>?Lang='E' HTTP/1.1
--batch
Content-Type: application/http
Content-Transfer-Encoding: binary
GET <Function Import Name>?Lang='E' HTTP/1.1
--batch--
Please correct the above. So that I will try again.
Regards,
Srinivasan K
Hello Srini,
It should trigger.
You will get 2 separate calls.
Check the format of the payload.
Below is just a sample for your reference ->
Model ->
Implement Execute Action Method in DPC_EXT class.
URL ->
/sap/opu/odata/sap/<Service_Name>/$batch
Header ->
Method : POST
Content-Type : multipart/mixed; boundary=batch
Payload ->
--batch
Content-Type: application/http
Content-Transfer-Encoding: binary
GET Test?A='XYZ' HTTP/1.1
--batch
Content-Type: application/http
Content-Transfer-Encoding: binary
GET Test?A='ABC' HTTP/1.1
--batch--
Run-time ->
Regards,
Ashwin
Hi Aswin
I am trying to trigger a batch request for Function Import.
Though we specify "POST" method, the values should be appended to URL as you have created in the payload above.
The function import implementation works fine when called using callFunction of ODataModel.
But this seems to be difficult to trigger using batch. Did you try batch for function import?
Below is my SAPUI5 code.
---------------------------
var oModel = new sap.ui.model.odata.ODataModel("/sap/opu/odata/SAP/ZEMPLOYEES1_SRV/"); //CreateUser
var data2 = {
Userid: "134",
FirstName: "Kumaraswamy",
LastName: "Gowda",
Country: "IN"
};
var batchChanges = [];
batchChanges.push( oModel.createBatchOperation("CreateUser", "POST", {urlParameters: data2 } ) );
//batchChanges.push( oModel.createBatchOperation("CreateUser", "POST", {method: "GET", urlParameters: data2 } ) ); //DID NOT WORK
//batchChanges.push( oModel.createBatchOperation("CreateUser", "GET", {urlParameters: data2 } ) ); //DID NOT WORK
---------------------------
OData Model:
Whatever the combination i try to add function import from batch, it does not create required payload format. I think, there should be a specific way to embed callFunction into batch. Otherwise, this does not seem to happen as the method should be mentioned as POST but the form values should be URL appended.
Let me know the work around in this case.
Thanks.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.