Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
Trinidad
Product and Topic Expert
Product and Topic Expert

In a previous blog SAP Business One Service Layer HANA XS sample I shared with you a sample we have developed in HANA XS (Java Script) connecting to SAP Business One Service Layer. In this blog I’ll like to give you some details about the TypeScript auto generation source code that was used to create the client side proxy class “B1SLReference.js”.


 

The auto generation source code includes two C# .NET solutions:


 

  1. oDataClassesGenerator – Generates a TypeScript or Java Script file out of the SAP Business One Service Layer metadata file.


  2. TypeScript – .NET application using the TypeScript autogenerated file from oDataClassesGenerator.


 

 

How to get this application working in your environment


 

oDataClassesGenerator .NET solution




  • Extract and unzip the Autogeneration.zip file and open the oDataClassesGenerator solution.

  • Run the solution:

    • choose if you want to generate a Java Script or a Type Script file

    • select your xml file containing the Service Layer metadata.

      • To generate your Service Layer metadata establish a connection to Service Layer via Postman for example and retrieve the metadata file (after a successful login, use the metadata link to ask for the Service Layer full metadata, save the response as an xml file). For more details on metadata file please check the User Guide at: https://yourhanaserver:50000.

      • Read carefully the “ModifsMetadata.txt” file (inside the Autogeneration.zip, ODataClassesGenerator folder). Some small changes are required to be applied to the metadata original file in order to have the classes auto generated by this application.






 

TypeScript .NET solution


This solution provides a sample showing how simple it is to use TypeScript language and get JavaScript code as auto generated output.


 

Important notions


TypeScript


The oDataClassesGenerator .NET solution has the option to generate TypeScript code. TypeScript is a typed superset of JavaScript that compiles to clean, simple JavaScript code which runs on any browser, in Node.js, or in any JavaScript engine that supports ECMAScript 3 (or newer).
You can find details about TypeScript at:
https://www.typescriptlang.org/

 

Download


You can download the source code of the full sample containing the different projects from here.