Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
ch_loos
Product and Topic Expert
Product and Topic Expert
11,951

Introduction


SAP Business Application Studio is the next-generation SAP Web IDE, available on SAP’s multi-cloud environment (Cloud Foundry).

With Application Studio, you no longer need a Neo account to develop for Cloud Foundry.

SAP Business Application Studio comes with a rich set of tools and templates, including tools for developing workflows with SAP Cloud Platform Workflow Management.

In this blog, we will show how to create a first Workflow application in the Cloud Foundry environment of SAP Cloud Platform.

 

Pre-requisites


Before we continue, please make sure you have the following things in place:

  • SAP Cloud Platform account with Cloud Foundry enabled (Trial also works)

  • Entitlements for Portal, Workflow, Application Runtime and Application Studio

  • Workflow service is configured, including FLP site with My Inbox and Monitor Workflow tiles (follow the steps in the tutorial)

  • Application Studio is configured (see documentation)


 

Create a Dev Space


Note: If you have followed the tutorial to deploy the FLP site, then you can skip this step, and just continue with creating the application in your existing workspace in Application Studio

If you have not open Application Studio yet, you can start it from the “Subscriptions” tab in your Cloud Cockpit, and create a new Dev Space.

Make sure to select “SAP Fiori” and enable the “Workflow Management” extension on the right hand side.


Once the dev space is ready (it might take a while), go ahead and open it.

Finally you need to open a new workspace. Select the “projects” folder and proceed.


Create MTA application


For creating a deployment artifact, we need to create an MTA application.

Open a new terminal window and enter the “yo” command.

Select “Basic Multitarget Application” and enter a project name, e.g. “myworkflowapp”.


A new folder with the project name will now appear in the Explorer view.

It contains a “mta.yaml” file, which describes the application.

 

Create Workflow module


We can now proceed with creating a Workflow module within the MTA project.

In the terminal, go into the application folder below the “projects” folder via the command “cd <folder name>”, e.g. “cd myworkflowapp”.

Then enter “yo” again and select the “workflow/workflow Module” template.

Give a name for the workflow module (e.g. “myworkflow”), the workflow itself (e.g. “SimpleApproval”) and a description.
Confirm to overwrite the “mta.yaml” file.

Now you should see the newly created workflow in the editor.


To fill it with sample data, click on the Start event and go to the “Details” tab in the properties section.

Click on the checkbox “Configure Sample Content”, and then click on “Create File” link.

Enter a file name (e.g. “sampledata”) and continue.


 

Adding a User Task


Let’s add a user task to the workflow for a simple approval.

From the palette, select Tasks -> User Task and click on the connector between Start and End Event.

Click on the User Task, go to the “Details” tab in the properties sheet and enter a task subject (“e.g. Approval”).

The subject will be shown in the task list in My Inbox.

You also need to assign a recipient for the task. In the “Users” field, enter your own user ID (for instance your email address, if you are using the SAP ID service).

If you are using a custom Identity Provider, you need to enter the what is configured as the “Subject Name Identifier” (see documentation).

Finally, we need to define the form, which will be shown when the task is opened in the My Inbox.

In the user task properties, go to the “User Interface” tab.

Select “Type: Form” and click on the “Create File” link.

Now enter a name, ID and Revision for the new form (e.g. “SimpleApprovalForm”, “1.0”).

Once the form editor opens, add a new field of type “String” with label “Product”.
In the “Context Path” column, enter “${context.product}”.
This expression refers to the “product” attribute in the sample JSON file which we have created in the previous step.


In the Form editor, switch from “Fields” to “Decisions” and add a new decision called “Approve”.

 

Build and deploy


We are now ready to build and deploy the Workflow.

Right-click on the “mta.yaml” file in your main application folder and select “Build MTA”.


Note: In case of Trial, you need to edit the mta.yaml file and change the service plan for Workflow from “standard” to “lite”.

Once the build is completed, a new folder “mta_archives” will appear under your application folder.

Right-click on the .mta file and select “Deploy MTA Archive”.

Note: You might be asked to log in to your Cloud Foundry space. Enter the right API endpoint depending on your region (e.g. https://api.cf.eu10.hana.ondemand.com), your username and password, and select your Cloud Foundry org and space.

 

Run the workflow


After deployment has finished, open the Fiori Launchpad site which contains the Workflow applications (refer to the pre-requisites section).

Open the Monitor Workflow (Workflow Definitions) application and select the “SimpleApproval” workflow definition.

Click on “Start new instance”.


Now, go back to the home page and open the “My Inbox” application.

There should be a task “Approval” with a form, showing the product name and an “Approve” button.


 

Summary


You have now modeled your first workflow with SAP Business Application Studio on Cloud Foundry.

SAP Business Application Studio is a very powerful development environment, tightly integrated with the SAP Cloud Platform and well suited for developing business applications.

There is lots more to explore, for instance creating a Fiori SAPUI5 component or calling other services.

We will follow up on this in a future blog.
15 Comments