Skip to Content

SLT replication to HANA on Cloud Foundry and reuse in CDS

Hello SCP Cloud Foundry Experts,

one of the extension architecture patterns of the OpenSAP course Extending SAP S/4HANA with SAP HANA Cloud Platform was Replicating Back-End Data to the Cloud with SLT. As this course was based on SCP Neo I would like to know if this integration pattern can and should be used on Cloud Foundry. Also it would be great to know if the now propagated Application Programming Model does allow to include the replicated entities in the CDS definitions for easier consumption.

Best regards
Gregor

CC: Thomas Jung Murali Shanmugham Sven Kohlhaas DJ Adams

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Sep 17, 2018 at 11:23 AM

    >Also it would be great to know if the now propagated Application Programming Model does allow to include the replicated entities in the CDS definitions for easier consumption.

    The new CDS implementation that is part of the Application Programming Model for the cloud? If so, we want to improve the reuse of existing catalog objects in the future. However, right now, there is a way to do this but its not particularly nice. You have to completely redefine the entity in CDS (including matching columns and data types). But then you use the @cds.persistence.exists annotation. This will keep CDS from recreating the object in the DB and instead connect to the existing object. However all the metadata is read from the CDS layer, not the catalog which is why its important to that the complete redefinition matches. I have an example of this here:

    https://github.com/jungsap/hana-xsa-opensap-hana7/blob/master/db/import.cds

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 30, 2018 at 11:41 AM

    Sorry about that change in link. We are moving that repo to its permanent home in github.com/SAP, but the new repo isn't ready to be public yet. In the mean time here is the complete source code of the import.cds file. The real "magic" is the @cds.persistence.exists annotation and the making the names of the entity and columns match EXACTLY (including case).


    type BusinessKey : String(10);
    type SDate : DateTime;
    type CurrencyT : String(5)  @title: '{i18n>currency}';
    type AmountT : Decimal(15, 2);
    type QuantityT : Decimal(13, 3) @(title: '{i18n>quantity}', Measures.Unit: Units.Quantity );
    type UnitT : String(3) @title: '{i18n>quantityUnit}';
    type StatusT : String(1);
        
    
    @cds.persistence.exists
    entity PURCHASE_ORDER_ITEM_VIEW {
      key PO_ITEM_ID: Integer @(title: '{i18n>po_items}', Common: { Text: {$value: PRODUCT_ID, "@UI.TextArrangement": #TextOnly }});
      PARTNER_ID: BusinessKey @title: '{i18n>partner_id}';
      key PRODUCT_ID: BusinessKey @(title: '{i18n>product}', Common.FieldControl: #Mandatory, Search.defaultSearchElement);
      CURRENCY_CODE: CurrencyT @(
                	Common: {
    					Text: {$value: CURRENCY.CURRENCY, "@UI.TextArrangement": #TextOnly},
    					ValueList: {entity: 'CURRENCY', type: #fixed},
    					ValueListWithFixedValues
    				}
    			);
      AMOUNT: AmountT @( title: '{i18n>grossAmount}', Measures.ISOCurrency: currency);
      NET_AMOUNT: AmountT @( title: '{i18n>netAmount}', Measures.ISOCurrency: currency);
      TAX_AMOUNT: AmountT @( title: '{i18n>taxAmount}', Measures.ISOCurrency: currency);
      QUANTITY: QuantityT;
      QUANTITY_UNIT: UnitT;
      DELIVERY_DATE: SDate @title: '{i18n>deliveryDate}';
    }
    
    @cds.persistence.exists 
    Entity BUYER {
     	BUILDING: String(10) @title: '{i18n>building}'; 
    	CITY: String(40) @title: '{i18n>city}'; 
    	COMPANYNAME: String(80) @title: '{i18n>company}'; 
    	COUNTRY: String(3) @title: '{i18n>country}'; 
    	EMAILADDRESS: String(255) @title: '{i18n>email}'; 
    	LEGALFORM: String(10) @title: '{i18n>legal}';  
    	key PARTNERID: Integer @title: '{i18n>partnerId}'; 
    	PARTNERROLE: String(3) @title: '{i18n>partnerRole}';  
    	POSTALCODE: String(10) @title: '{i18n>postalCode}';  
    	REGION: String(4) @title: '{i18n>region}';  
    	STREET: String(60)  @title: '{i18n>street}';  
    }
    
    @cds.persistence.exists 
    Entity USER_DETAILS {
    	 EMAIL: String(255)  @title: '{i18n>email}';  
    	 FIRSTNAME: String(40) @title: '{i18n>fname}';
    	 LASTNAME: String(40) @title: '{i18n>lname}';
         key USERID: Integer @title: '{i18n>userId}';	 
    }
    
    @cds.persistence.exists 
    Entity CURRENCY {
    	 key CODE: String(3) @title: '{i18n>currCode}';
    	 CURRENCY: String(80) @title: '{i18n>currDesc}';
    }
    Add comment
    10|10000 characters needed characters exceeded