I've created a table using CDS that uses a structured type. This is a simplified example I've created to experiment:
namespace f14e.S001.GBI.data; @Schema: 'MYSCHEMA' context new { type TestType2 { A : String(1); B : String(1); }; @Catalog.tableType: #COLUMN entity TEST { key ID : Integer; TEST : TestType2; }; context procedures{ type testStructure { ID : Integer; TEST : TestType2; }; type errorsStructure { HTTP_STATUS_CODE : Integer; ERROR_MESSAGE : String(100); DETAIL : String(100); }; }; };
Now I want to use a procedure to handle the create operation with an oData service. This is the procedure:
PROCEDURE "MYSCHEMA"."f14e.S001.GBI.data::createTest" ( IN intab "f14e.S001.GBI.data::new.procedures.testStructure", OUT outtab "f14e.S001.GBI.data::new.procedures.errorsStructure" ) LANGUAGE SQLSCRIPT SQL SECURITY INVOKER AS --DEFAULT SCHEMA <schema> --READS SQL DATA AS begin declare lv_id string; declare lv_a string; declare lv_b string; select ID, "test.a", "test.b" into lv_id, lv_a, lv_b from :intab; if :lv_id = '' then outtab = select 500 as http_status_code, 'Invalid ID ' as error_message, 'No Way! ID field must not be empty' as detail from dummy; else insert into "f14e.S001.GBI.data::new.TEST" values (lv_id, lv_a, lv_b); end if; end;
The error I get when activating this is:
[07:02:40] Error while activating /f14e/S001/GBI/data/createTest.hdbprocedure:
Could not create catalog object: invalid column name; test.a: line 15 col 12 (at pos 402)
I've a variety of variations to get this work and I'm beginning to wonder if it's possible. Should I move on and drop the structured type?
Thanks,
Ross