Skip to Content
avatar image
-1
Former Member

Update the custom table using XS ODATA services

Hi All,

I am unable to insert or update the custom table using the INSERT/UPDATE operations in the XSODATA file ,But I am able to update using the XSJS file with front end as .html .

The process which I have followed which I have created in the SAP HANA Development Perspective :

1. Created .xsaccess file

{ "exposed": true, "authentication": [{ "method" : "Form" }], "prevent_xsrf" : true }

2. Created .xsapp file

{}

3. Created stored procedure(Reg_Proc.hdbprocedure) to update the custom table

PROCEDURE "BHARAT"."APL::Reg_Proc"( IN im_row "BHARAT"."REGION", OUT ex_error "BHARAT"."APL::WRITEMODEL.Procedures.tt_errors" )

LANGUAGE SQLSCRIPT

SQL SECURITY INVOKER AS

BEGIN DECLARE lv_Regionid STRING;

DECLARE lv_Regionname STRING;

DECLARE lv_subregionname STRING;

IF (:lv_Regionid = 'NULL') THEN ex_error = SELECT 500 AS http_status_code, 'Invalid Regionid ' || lv_Regionid AS error_message, 'Please enter the correct Region id' AS detail FROM dummy;

ELSE

INSERT INTO "BHARAT"."REGION" VALUES(5, 'FRANCE', 'LYON');

END IF;

END;

4. Created .hdbdd file ( WRITEMODEL.hdbdd) for handling error

namespace "APL"; @Schema: 'BHARAT' context WRITEMODEL { /*@Catalog.tableType: #COLUMN Entity RegDetails { key REGION_ID: String(10); REGION_NAME: String(60); SUB_REGION_NAME: String(60);

};*/ context Procedures { Type tt_errors { HTTP_STATUS_CODE : Integer; ERROR_MESSAGE : String(100); DETAIL : String(100); }; } }

5. Created xsodata(Update.xsodata) file to call the stored procedure created in the step 3.

service { "BHARAT"."REGION" as "Region" create using "APL::Reg_Proc" ; }

Everything is activated fine , but it is unable to update / insert the data into the custom table

I am able to display the metadata using $metadata in the URL and also display the values using the Entity key .

But I am unable to update or insert the data to the already existing table .

Could you please check my code and suggest me if any further modifications need to be done to update / insert the data in to the custom table.

Thank you.

Regards,

Bharat Kumar

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers