Commit 197eb625 authored by tiven wang's avatar tiven wang 🤞

Create xsjs and xsodata

parent 22ad0c83
FULLTEXT INDEX "CUSTOMER_NAME_FTI" ON "Customers" (NAME)
\ No newline at end of file
INDEX "CUSTOMER_NAME_IDX" ON "Customers" (NAME)
\ No newline at end of file
using Core as EPM;
context Conversions {
type MandtT: String(3);
Entity T006 {
key MANDT: MandtT;
key MSEHI: String(3);
KZEX3: String(1);
KZEX6: String(1);
ANDEC: Integer;
KZKEH: String(1);
KZWOB: String(1);
KZ1EH: String(1);
KZ2EH: String(1);
DIMID: String(6);
ZAEHL: Integer;
NENNR: Integer;
EXP10: Integer;
ADDKO: Decimal(9,6);
EXPON: Integer;
DECAN: Integer;
ISOCODE: String(3);
PRIMARY: String(1);
TEMP_VALUE: BinaryFloat;
TEMP_UNIT: String(3);
FAMUNIT: String(3);
PRESS_VAL: BinaryFloat;
PRESS_UNIT: String(3);
};
Entity T006A {
key MANDT: MandtT;
key SPRAS: EPM.ABAPLanguage;
key MSEHI: String(3);
KZEX3: String(3);
KZEX6: String(6);
MSEHT: EPM.BusinessKey null;
MSEHL: String(30) null;
};
Entity TCURC {
key MANDT: MandtT;
key WAERS: EPM.CurrencyT;
ISOCD: String(3);
ALTWR: String(3);
GDATU: EPM.ABAPDate;
XPRIMARY: String(1);
};
Entity TCURF {
key MANDT: MandtT;
key KURST: String(4);
key FCURR: EPM.CurrencyT;
key TCURR: EPM.CurrencyT;
key GDATU: EPM.ABAPDate;
FFACT: Decimal(9,0);
TFACT: Decimal(9,0);
ABWCT: String(4);
ABWGA: String(8);
};
Entity TCURN {
key MANDT: MandtT;
key FCURR: EPM.CurrencyT;
key TCURR: EPM.CurrencyT;
key GDATU: EPM.ABAPDate;
NOTATION: String(1);
};
Entity TCURR {
key MANDT: MandtT;
key KURST: String(4);
key FCURR: EPM.CurrencyT;
key TCURR: EPM.CurrencyT;
key GDATU: EPM.ABAPDate;
UKURS: Decimal(9,5);
FFACT: Decimal(9,0);
TFACT: Decimal(9,0);
};
Entity TCURT {
key MANDT: MandtT;
key SPRAS: EPM.ABAPLanguage;
key WAERS: EPM.CurrencyT;
LTEXT: String(40);
KTEXT: String(15) null;
};
Entity TCURV {
key MANDT: MandtT;
key KURST: String(4);
XINVR: String(1);
BWAER: EPM.CurrencyT;
XBWRL: String(1);
GKUZU: String(4);
BKUZU: String(4);
XFIXD: String(1);
XEURO: String(1);
};
Entity TCURW {
key MANDT: MandtT;
key SPRAS: EPM.ABAPLanguage;
key KURST: String(4);
CURVW: String(40);
};
Entity TCURX {
key CURRKEY: EPM.CurrencyT;
CURRDEC: Integer;
};
};
context Core {
type BusinessKey : String(10);
//SP09 requirement - HANA Primitive datatype
type SString : hana.VARCHAR(40);
type MString : String(60);
type LString : String(255);
type VLString : String(1024);
type SDate : LocalDate;
type PhoneT : String(30);
type CurrencyT : String(5);
type ABAPLanguage : String(1);
type ISOLanguageT : String(2);
type AmountT : Decimal(15, 2);
type QuantityT : Decimal(13, 3);
type UnitT : String(3);
type StatusT : String(1);
type ABAPDate : String(8);
//SP09 requirement - Multi File Support
type Source : String(30);
type ValidityT {
STARTDATE : SDate;
ENDDATE : SDate;
};
entity MapKeys {
key KEYID : String(10);
APP_ID : String(50);
APP_CODE : String(50);
EXT1 : String(50);
EXT2 : String(50);
};
entity SHINE_TIME_DIM {
key DATETIMESTAMP : UTCTimestamp;
DATE_SQL : LocalDate;
DATETIME_SAP : hana.VARCHAR(14);
DATE_SAP : hana.VARCHAR(8);
YEAR : hana.VARCHAR(4);
QUARTER : hana.VARCHAR(2);
MONTH : hana.VARCHAR(2);
WEEK : hana.VARCHAR(2);
WEEK_YEAR : hana.VARCHAR(4);
DAY_OF_WEEK : hana.VARCHAR(2);
DAY : hana.VARCHAR(2);
HOUR : hana.VARCHAR(2);
MINUTE : hana.VARCHAR(2);
SECOND : hana.VARCHAR(2);
CALQUARTER : hana.VARCHAR(5);
CALMONTH : hana.VARCHAR(6);
CALWEEK : hana.VARCHAR(6);
YEAR_INT : Integer;
QUARTER_INT : hana.TINYINT;
MONTH_INT : hana.TINYINT;
WEEK_INT : hana.TINYINT;
WEEK_YEAR_INT : Integer;
DAY_OF_WEEK_INT : hana.TINYINT;
DAY_INT : hana.TINYINT;
HOUR_INT : hana.TINYINT;
MINUTE_INT : hana.TINYINT;
SECOND_INT : hana.TINYINT;
MONTH_LAST_DAY : hana.TINYINT;
TZNTSTMPS : Decimal(15, 0);
TZNTSTMPL : Decimal(21, 7);
};
};
\ No newline at end of file
COLUMN TABLE "Customers" (
"ID" INTEGER COMMENT 'Customer ID',
"NAME" NVARCHAR(256) COMMENT 'Customer Name',
"ACTIVE" TINYINT COMMENT 'Currently active?',
"COUNTRY" NVARCHAR(256) COMMENT 'Customer Country',
PRIMARY KEY ("ID") )
COMMENT 'Table with Customer data'
\ No newline at end of file
using Core.Source;
context JobsDemo {
Entity Details {
key TIME: UTCTimestamp;
SOURCE: Source;
};
Entity RuntimeSchedules {
key NAME: hana.VARCHAR(40);
ID: Integer;
JOBTYPE: hana.VARCHAR(40);
};
};
using Core as EPM;
using Util;
context MD {
Type HistT {
CREATEDBY : Association to Employees;
CREATEDAT : EPM.SDate;
CHANGEDBY : Association to Employees;
CHANGEDAT : EPM.SDate;
};
Type NameT {
FIRST : EPM.SString;
MIDDLE : EPM.SString;
LAST : EPM.SString;
INITIALS : EPM.BusinessKey;
};
type SexT : String(1);
Entity Addresses {
key ADDRESSID: EPM.BusinessKey;
CITY: EPM.SString;
POSTALCODE: EPM.BusinessKey;
STREET: EPM.MString;
BUILDING: EPM.BusinessKey;
COUNTRY: String(3);
REGION: String(4);
ADDRESSTYPE: String(2);
VALIDITY: EPM.ValidityT;
LATITUDE: Double;
LONGITUDE: Double;
POINT: hana.ST_POINT;
} technical configuration {
unload priority 8;
};
Entity BusinessPartner {
key PARTNERID: EPM.BusinessKey;
PARTNERROLE: String(3); //Business Partner Role
EMAILADDRESS: EPM.LString;
PHONENUMBER: EPM.PhoneT;
FAXNUMBER: EPM.PhoneT null;
WEBADDRESS: EPM.VLString;
ADDRESSES: Association to Addresses null;
COMPANYNAME: String(80);
LEGALFORM: EPM.BusinessKey;
HISTORY: HistT;
CURRENCY: EPM.CurrencyT;
} technical configuration {
partition by HASH (PARTNERID) Partitions GET_NUM_SERVERS();
};
Entity Employees {
key EMPLOYEEID: EPM.BusinessKey;
NAME: NameT null;
SEX: SexT;
LANGUAGE: EPM.ABAPLanguage;
PHONENUMBER: EPM.PhoneT null;
EMAILADDRESS: EPM.LString;
LOGINNAME: String(12);
ADDRESSES: Association to Addresses null;
VALIDITY: EPM.ValidityT;
CURRENCY: EPM.CurrencyT;
SALARYAMOUNT: EPM.AmountT;
ACCOUNTNUMBER: EPM.BusinessKey;
BANKID: EPM.BusinessKey;
BANKNAME: EPM.LString;
EMPLOYEEPICURL: EPM.LString;
FULLNAME: String(100) = NAME.FIRST || ' ' || NAME.LAST;
};
Entity Products {
key PRODUCTID: EPM.BusinessKey;
TYPECODE: String(2);
CATEGORY: EPM.SString;
HISTORY: HistT;
NAMEID: EPM.BusinessKey;
DESCID: EPM.BusinessKey;
SUPPLIER: Association to MD.BusinessPartner;
TAXTARIFFCODE: Integer;
QUANTITYUNIT: EPM.UnitT;
WEIGHTMEASURE: EPM.QuantityT;
WEIGHTUNIT: EPM.UnitT;
CURRENCY: EPM.CurrencyT;
PRICE: EPM.AmountT;
PRODUCTPICURL: EPM.LString null;
WIDTH: EPM.QuantityT;
DEPTH: EPM.QuantityT;
HEIGHT: EPM.QuantityT;
DIMENSIONUNIT: EPM.UnitT;
} technical configuration {
fulltext index FTI_CATEGORY on (CATEGORY) ASYNC SEARCH ONLY off;
};
Entity productLog{
key PRODUCTID: String(10);
key LOGID: Integer;
key DATETIME: UTCDateTime;
key USERNAME: String(20);
LOGTEXT: String(500);
};
};
using Core as EPM;
using Util;
using PO;
using SO;
using MD;
//using sap.common::UI as UI;
using annotations.Importance;
using annotations.EndUserText;
using annotations.valueList;
context MDViews {
define view BPView as
select from MD.BusinessPartner
mixin
{
ORDERS : association [ * ] to SO.Header on
ORDERS.PARTNER.PARTNERID = $projection.PARTNERID;
}
into
{
PARTNERID,
ORDERS
};
view BPOrdersView as
select from BPView
{
PARTNERID,
ORDERS[
LIFECYCLESTATUS = 'N'
].SALESORDERID as orderId
};
view BPOrders2View as
select from BPView
{
PARTNERID,
ORDERS[
LIFECYCLESTATUS = 'N'
].{
SALESORDERID as orderId,
GROSSAMOUNT as grossAmt
}
};
view BPOrders3View as
select from BPView
{
PARTNERID,
ORDERS[
LIFECYCLESTATUS = 'N'
].{
SALESORDERID as orderId,
GROSSAMOUNT as grossAmt,
ITEMS[
NETAMOUNT > 200
].{
PRODUCT.PRODUCTID,
NETAMOUNT
}
}
};
define view BuyerView as
select from MD.BusinessPartner
{
PARTNERID as "Id",
EMAILADDRESS as "EmailAddress",
COMPANYNAME as "CompanyName",
ADDRESSES.CITY as "City",
ADDRESSES.POSTALCODE as "PostalCode",
ADDRESSES.STREET as "Street",
ADDRESSES.BUILDING as "Building",
ADDRESSES.COUNTRY as "Country",
ADDRESSES.REGION as "Region",
HISTORY.CREATEDBY.LOGINNAME as "CreatedBy"
}
where
PARTNERROLE = '1';
define view SupplierView as
select from MD.BusinessPartner
{
PARTNERID as "Id",
EMAILADDRESS as "EmailAddress",
COMPANYNAME as "CompanyName",
ADDRESSES.CITY as "City",
ADDRESSES.POSTALCODE as "PostalCode",
ADDRESSES.STREET as "Street",
ADDRESSES.BUILDING as "Building",
ADDRESSES.COUNTRY as "Country",
ADDRESSES.REGION as "Region",
HISTORY.CREATEDBY.LOGINNAME as "CreatedBy"
};
define view SupplierViewVH as
select from SupplierView
{
@UI.lineItem : [ {
importance : Importance.High
} ]
@UI.fieldGroup : [ {
position : 10
} ]
@EndUserText.label : [ {
language : 'EN',
text : 'Supplier ID'
} ]
"Id" as "Supplier_Id",
@UI.lineItem : [ {
importance : Importance.High
} ]
@UI.fieldGroup : [ {
position : 20
} ]
@EndUserText.label : [ {
language : 'EN',
text : 'Supplier Name'
} ]
"CompanyName" as "Supplier_CompanyName"
};
define view BPAddrExt as
select from MD.BusinessPartner
{
PARTNERID,
ADDRESSES.STREET || ', ' || ADDRESSES.CITY as FULLADDRESS,
round(ADDRESSES.POINT.st_distance(new st_point(8.644072, 49.292910), 'meter') / 1000, 1) as distFromWDF03
};
define view NewYorkEmployees as
select from MD.Employees as emp
{
NAME.FIRST,
NAME.LAST,
ADDRESSES.ADDRESSID as "ADDID",
ADDRESSES.CITY as CITY
}
where
'New York' = ADDRESSES.CITY;
define view ProductViewSub as
select from MD.Products as prod
{
PRODUCTID as "Product_Id",
(select from PO.Item as a {
sum("GROSSAMOUNT") as SUM
}
where
a.PRODUCT.PRODUCTID = prod.PRODUCTID
) as PO_SUM
};
define view ProductView as
select from MD.Products
mixin
{
PO_ORDERS : association [ * ] to PO.ItemView on
PO_ORDERS."ProductID" = $projection."Product_Id";
}
into
{
PRODUCTID as "Product_Id",
NAMEID,
DESCID,
CATEGORY as "Product_Category",
CURRENCY as "Product_Currency",
PRICE as "Product_Price",
TYPECODE as "Product_TypeCode",
WEIGHTMEASURE as "Product_WeightMeasure",
WEIGHTUNIT as "Product_WeightUnit",
SUPPLIER.PARTNERID as "Supplier_Id",
SUPPLIER.COMPANYNAME as "Supplier_CompanyName",
SUPPLIER.ADDRESSES.CITY as "Supplier_City",
SUPPLIER.ADDRESSES.POSTALCODE as "Supplier_PostalCode",
SUPPLIER.ADDRESSES.STREET as "Supplier_Street",
SUPPLIER.ADDRESSES.BUILDING as "Supplier_Building",
SUPPLIER.ADDRESSES.COUNTRY as "Supplier_Country",
PO_ORDERS
};
define view productCategoryVH as
select from MD.Products distinct
{
@UI.lineItem : [ {
importance : Importance.High
} ]
@UI.fieldGroup : [ {
position : 10
} ]
@EndUserText.label : [ {
language : 'EN',
text : 'Product Category'
} ]
CATEGORY as "Product_Category"
};
define view ProductsConsumption as
select from MD.Products
{
@UI.lineItem : [ {
importance : Importance.High
} ]
@UI.fieldGroup : [ {
position : 10
} ]
@EndUserText.label : [ {
language : 'EN',
text : 'Product ID'
}, {
language : 'DE',
text : 'Produkt ID'
} ]
@EndUserText.quickInfo : [ {
language : 'EN',
text : 'Product ID Quick'
}, {
language : 'DE',
text : 'Produkt ID Schnell'
} ]
@valueList : {
collectionPath : 'ProductsVH',
searchSupported : false,
parameterInOut : [ {
localDataProperty : 'Product_Id',
valueListProperty : 'Product_Id'
} ],
parameterDisplayOnly : [ {
valueListProperty : 'Product_Name'
} ]
}
PRODUCTID as "Product_Id",
@UI.lineItem : [ {
importance : Importance.High
} ]
@UI.fieldGroup : [ {
position : 20
} ]
@EndUserText.label : [ {
language : 'EN',
text : 'Product Category'
} ]
@valueList : {
collectionPath : 'ProductCatVh',
searchSupported : false,
parameterInOut : [ {
localDataProperty : 'Product_Category',
valueListProperty : 'Product_Category'
} ]
}
CATEGORY as "Product_Category",
@UI.lineItem : [ {
importance : Importance.Medium
} ]
@EndUserText.label : [ {
language : 'EN',
text : 'Currency'
} ]
@UI.fieldGroup : [ {
position : 30
} ]
CURRENCY as "Product_Currency",
@UI.lineItem : [ {
importance : Importance.Medium
} ]
@EndUserText.label : [ {
language : 'EN',
text : 'Product Price'
} ]
@UI.fieldGroup : [ {
exclude : true
} ]
PRICE as "Product_Price",
@UI.lineItem : [ {
importance : Importance.Medium
} ]
@EndUserText.label : [ {
language : 'EN',
text : 'Type Code'
} ]
@UI.fieldGroup : [ {
position : 40
} ]