Skip to Content
Technical Articles
Author's profile photo Sudhir Lenka

Develop a full-stack multi module business application(MTA) by using java as middle-ware.

Hello All,

In this blog, I will explain the step by step process to create a multi module business application(MTA) by using java as the middle-ware component with the help of SAP Web IDE full-stack and this application will be deployed onto the Cloud Foundry trail account.

Functionality of the Application :- Here I am going to display the list of employees of an organization.

Technical Architecture : –

Prerequisites: – 

  1. Access to SAP Web IDE Full-Stack.
  2. Enable SAP HANA Database Development Tools, Tools for Java Development, SAP HANA Database Explorer and SAP Cloud Platform Business Application Development Tools features in Web IDE.
  3. Enable Cloud foundry in the SCP trail account.
  4. Create Space and Organisation in the Cloud Foundry account.
  5. Configure the Cloud Foundry space and install the Builder.

Application: –

  • Launch SAP Web IDE full-stack and create a MTA application from the template.

  • One MTA project will be created in your workspace with name MTA_Employee.
  • Create a DB module for the MTA project as shown below.

  • Create a CDS view in the DB module as shown below.

  • Give the name of the CDS view as Organization.
  • One CDS view will be created under scr folder, now open the CDS view in the Code Editor and replace the entire code with the code given in the path Organization.hdbcds..
  • Build the CDS view to create the Employee table in the HANA DB.

  • Once the Build is successful one table will be created in the DB, which can be checked from the Data Base explores by adding the DB to the  DB explorer in the Web IDE.

  • Add some records into the table by generating and executing the insert statement.

  • Execute the above SQL query by putting some values as shown in the screenshot.
  • Create a calculation view in the DB module to read the Employee table.

  • One Calculation view will be created under the src folder with name GetEmployees, now open it in the Code Editor and replace the entire code with the code given in the path GetEmployees.hdbcalculationview.
  • Build the DB module by right clicking and selecting Build on the DB folder.
  • Now we will create Java module.

  • Now Java module is created and the folder structure will look like as below.

  • Open the pom.xml and replace the entire content with code given in the path pom.xml.

  • Open the web.xml and replace the entire content as given in the path web.xml.

  • Java module is now created, build the Java module as shown below.

  • Now Create UI module.

  • UI module is now created and the folder structure will look like as below.

  • Open the mta.yml file in the editor mode and replace the entire content with the code from the path mta.yaml.

  • MTA application is now ready, build the MTA application to create the achieve file.

  • Once the build is successful then you can find the archive file under the mta_archives folder.

  • Deploy the .mtar file to the Cloud Foundry.

  • You will be prompted to enter the details of the Cloud Foundry.
  • Once the deployment is successful then you can see three applications in the Cloud Foundry.

  • Click the UI application to find out the URL of the MTA App.

  • Click the URL to run the application.

This project is available in the Git repository at the location  https://github.com/sudhirlenka/MTA_Employee .

Same project can also be deployed onto HANA XSA system by doing few changes to mta.yml file and in the config file.

Hope this helps!!

Thanks,

Sudhir.

Assigned Tags

      10 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Mohit Tyagi
      Mohit Tyagi

      Thank you so much Sudhir. Its very informative blog to start it.

       

      Regards

      Mohit

      Author's profile photo Sudhir Lenka
      Sudhir Lenka
      Blog Post Author

      Thank you so much Mohit for the feedback!!.

      -Sudhir

      Author's profile photo Nabheet Madan
      Nabheet Madan

      Thanks Sudhir for the great blog showcasing MTA app.

      Author's profile photo Sudhir Lenka
      Sudhir Lenka
      Blog Post Author

      Thank you so much Nabheet for the feedback!!.

      -Sudhir

      Author's profile photo Vinay K
      Vinay K

      Hi Sudhir,Nice Blog. But when i deploy mtar to SAP Cloud Platform, i get error as below.

      "Error monitoring creation of services: Error creating service "hdi_DB" from offering "hana" and plan "hdi-shared": Failed to create HDI container on database '4e7659f0-cbae-4064-afb7-12f9d2b21ec8:trialdb01' (10.253.93.93:30041), because of: Call to HANA DI failed, requestId 817254, because of: Creating the container "SL_SCHEMA"... failed (8214129), because of: Could not create the container "SL_SCHEMA" (8211042), because of: Could not create the DTC "SL_SCHEMA" (8211011), because of: The container "SL_SCHEMA" already exists (8211040), because of: Database error 301: : unique constraint violated: Table(CONTAINERS_) (8201003)Unexpected error: Error creating service "hdi_DB" from offering "hana" and plan "hdi-shared": Failed to create HDI container on database '4e7659f0-cbae-4064-afb7-12f9d2b21ec8:trialdb01' (10.253.93.93:30041), because of: Call to HANA DI failed, requestId 817254, because of: Creating the container "SL_SCHEMA"... failed (8214129), because of: Could not create the container "SL_SCHEMA" (8211042), because of: Could not create the DTC "SL_SCHEMA" (8211011), because of: The container "SL_SCHEMA" already exists (8211040), because of: Database error 301: : unique constraint violated: Table(CONTAINERS_) (8201003)To download logs of the process, use the multi-target application plug-in for the Cloud Foundry CLI command "cf dmol -i 91129854" directly in your Cloud Foundry space.For more information see https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/e93b231895b64cbc9221a62953563a6f.html.Job failed."

       

      Can you please help.

      Author's profile photo Sudhir Lenka
      Sudhir Lenka
      Blog Post Author

      Hi Vinay,

      Thank you so much for your comment!!

      It looks like the schema(SL_SCHEMA) already exist in the DB,

      please delete this schema or create the schema with a different name.

      Thanks,

      Sudhir.

      Author's profile photo Daniel Gent
      Daniel Gent

      Thanks, this was very helpful.

       

      Btw., I had to increase the memory for the JAVA part in mta.yml file, otherwise the deployment would fail.

      Author's profile photo ilhame oaharra
      ilhame oaharra

      Hi suddhir. thank you for this amazing tutorial. simple and easy to understand.

      please can you help me when i had followed this tuto.

      i got this error have you any idea how to solve this

      Error determining actions to execute on service "hdi_DB": Service described by MTA resource "hdi_DB" of type [hana/hdi-shared] does not match already existing service "hdi_DB" of type [hanatrial/hdi-shared] and needs to be recreated. Use command line option "--delete-services" to enable the deletion of the existing one. 

      Updating service "uaa_MTA_Employee"...
      To download the process logs, use the "cf dmol -i e833311a-952c-11ea-9592-eeee0a887fc9" command in the Cloud Foundry CLI directly in your Cloud Foundry space.
      See https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/e93b231895b64cbc9221a62953563a6f.html.
      Job failed
      Author's profile photo Shiyam Raghul
      Shiyam Raghul

      Hi Sudhir Lenka ,

      I followed the steps and i was able to deploy the application into cloud platform,

      but i have another question, what if we want to make some changes(bug fixing/enhancement) to the already deployed project,

      for example iam adding new fields to the existing calculation view GetEmployees.hdbcalculationview,

      and now how do i make this changes reflect in the deployed version.

       

      Thanks

      shiyam

      Author's profile photo Jimmy Arnold Moreno Nuñez
      Jimmy Arnold Moreno Nuñez

      Hi Sudhir, this was very helpful. I have this error when I try to deploy.

      Error staging application "MyApp": BuildpackCompileFailed - App staging failed in the buildpack compile phase

       

      Thanks in advance.