Skip to Content
0
Former Member
Oct 22, 2014 at 03:17 PM

Is the Update and Delete working in XSODATA CRUD SP6 or above?

172 Views

Hi All,

I have been experimenting with the web-based development workbench for SAP Hana based on the following and the youtube video of Thomas Jung:

"Develop Your First SAP HANA Native Application

on SAP HANA Platform Using the SAP HANA

Web-based Development Workbench

Version 1.1 | March 2014 | Bertram Ganz, Jens Glander | SAP AG"

I then wanted to extend it to try the "Update" and "Deletion" extension of the XSODATA.

Thus, my data model:

namespace dev.devuser00.perslist.data;

@Schema: 'devuser00_perslist'

context mymodel {

type SString: String(60);

@Catalog.tableType: #COLUMN

Entity person {

key ID: String(10); // element modifier 'key' defines that ID is primary key

FIRSTNAME: SString;

LASTNAME: SString;

};

context procedures{

type pers {

ID: String(10);

FIRSTNAME: SString;

LASTNAME: SString;

};

type persNames {

FIRSTNAME: SString;

LASTNAME: SString;

};

type errors {

HTTP_STATUS_CODE : Integer;

ERROR_MESSAGE : String(100);

DETAIL : String(100);

};

};

};

My XSODATA: person.xsodata

service {

"dev.devuser00.perslist.data::mymodel.person" as "Persons"

create using "dev.devuser00.perslist.procedures::createPerson";

update using "dev.devuser00.perslist.procedures::updatePerson"

delete using "dev.devuser00.perslist.procedures::deletePerson";

}

The service is not activated because of the update procedure (Even when bypassing the update, the delete does not work):

Error while activating:

Invalid procedure or parameter list in procedure "dev.devuser00.perslist.procedures::updatePerson".


Here is the update procedure:


PROCEDURE

"devuser00_perslist"."dev.devuser00.perslist.procedures::updatePerson" (

IN intab "devuser00_perslist"."dev.devuser00.perslist.data::mymodel.procedures.persNames",

OUT outtab "devuser00_perslist"."dev.devuser00.perslist.data::mymodel.procedures.errors"

)

LANGUAGE SQLSCRIPT

SQL SECURITY INVOKER

DEFAULT SCHEMA "devuser00_perslist"

--READS SQL DATA AS

AS

begin

declare lv_firstname string;

declare lv_lastname string;

select FIRSTNAME, LASTNAME into lv_firstname, lv_lastname from :intab;

if :lv_lastname = '' then

outtab = select 500 as http_status_code,

'Invalid last name ' || lv_firstname as error_message,

'No Way! Last name field must not be empty' as detail from dummy;

else

update "dev.devuser00.perslist.data::mymodel.person"

set FIRSTNAME = lv_firstname, LASTNAME = lv_lastname

where LASTNAME = lv_lastname;

end if;

end;

I have also attached the perslist.controller.js, the perslist.view.js and the index.html.

I am in SP 7.

Can anyone plase have any clue ?

Many thanks in advance.