Skip to Content
Technical Articles

Getting started with Workflow in SAP Business Application Studio

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.

4 Comments
You must be Logged on to comment or reply to a post.
  • Hello Christian! Thanks for this blog. We need more info about this now that the Neo environment and Web IDE are going to disappear!

    I follow you steps but had some errors at the deployment.  I can image that it is because I still don’t have the FLP with the workflow apps tiles configured. I tried to follow these steps but I cannot find the Fiori Launchpad module inside the Fiori project as the documentation says. https://help.sap.com/viewer/e157c391253b4ecd93647bf232d18a83/Cloud/en-US/97c079f9317c42bba31cc9ca9d4cc7c3.html Could you please document step by step about how did you do this? or share your projects? I would be so much easier to understand how to do it.

    Thank you in advance!

    • Hi Mariajose,

      The easiest and fastest way to set up the FLP is to import the sample project from the starter tutorial:
      https://developers.sap.com/tutorials/cp-starter-ibpm-employeeonboarding-1-setup.html#ae14368a-03fb-42fe-841b-e8d94b5dd98e

      After import, make sure to check the mta.yaml for the right service plans – “lite” for Trial, “standard” or “workflow” for a paid plan (you can check the entitlements in your Cloud Cockpit account).

      Regards,
      Christian

      • Thank you for your fast reply Christian!

        I found a simpler way to enable the FLP. I did something similar as the link you shared with me.

        What I did was to enable both Workflow Management in the entitlements and later started the Booster. After having this process done, I went to the Workflow Management in the Subscriptions and clicked on “go to application”: this link is the FLP already integrated with my default workflow instance. This was without the need to import any other project :). I hope this can be useful for any other developer around!

        • Yes, this will work for the simple example above.

          However, if you want to have a start form, or want to use SAPUI5 to build the task UIs, you’ll still need to have a separate FLP site, as those cannot be integrated into the Workflow Management app.