on 2015 Oct 05 6:24 AM
Hi,
I am trying to do an update in a table with xsodata using procedure. With this documentation Custom Exits for OData Write Requests - SAP HANA Developer Guide for SAP HANA Studio - SAP Library I came to know for update we need to pass 2 input parameters as entity types. For create I passed one input parameter (entity type) as input it worked fine. I used Odata.create() method to create an entity and my entity type as two cols so i passed the input as {"Col1": "Value1", "Col2" : Value2}.
But for update i need to pass two input parameters for entity. One is the old value and the another one is the updated value. I am using Odata.update() method to achieve this but stuck with passing the input parameters. Can anyone suggest me how to pass multiple input parameter for entity types.
Regards,
ThamizharasaN.
Request clarification before answering.
Hello Thamizharasan,
the input parameters you describe ar the parameters which contains the entity values before and after the update? If yes, you just need to specify/use the parameters in your OData write exit. They are supplied automatically.
In an SQLScript exit you need two IN parameters ("new" and "old") typed to the entity. In an XSJS exit you have a parameter (e.g. param) which has the properties "beforeTableName" and "afterTableName". These two properties contain the name of temporary tables which contains the data before and after the update).
Best Regards,
Florian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Below is my service.
service {
"mySchema"."mySchema.table::TEAM" as "TEAM"
create using "mySchema.service::CreateTeam"
update using "mySchema.service::UpdateTeam";
}
Below is my porcedure.
PROCEDURE "mySchema"."mySchema.service::UpdateTeam" (
IN team_detail "mySchema"."mySchema.table::TEAM",
IN team_update_detail "mySchema"."mySchema.table::TEAM",
OUT error "mySchema"."mySchema.service::error_type" )
LANGUAGE SQLSCRIPT
SQL SECURITY INVOKER
--DEFAULT SCHEMA <default_schema_name>
--READS SQL DATA
AS
BEGIN
/*****************************
Write your procedure logic
*****************************
--My procedure logic is here it's working fine.
END
I have tested the procedure in sql script it's working fine. I need to know how to call this service using OData.update() method..
Regards,
ThamizharasaN.
It is called automatically, cause you defined it in the service that it should be called for an update. So it is enough that your ODataModel points to the right OData service. The exit logic is then handled by the OData framework on HANA itself. No additional coding on client side is necessary (beside the update call itself).
Best Regards,
Florian
Hi Florian,
I understood your point. My doubt is about the passing the data to that service. for example..
oModel.update("/TEAM", {we pass data here(in which format the data should be passed)}, {
success: function(response){
},
error: function(error){
console.log(error);
}
});
As you see the update method I'm unable to pass the Input parameters (entity types) to it. In SQLScript we will pass the temporary table to execute the procedure. Whereas here how should we pass the input...?
Regards,
ThamizharasaN.
User | Count |
---|---|
63 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.