---
parser: v2
author_name: Djamai Hania
author_profile: https://github.com/Haniadjamai
auto_validation: true
time: 40
tags: [ tutorial>beginner, software-product>sap-business-technology-platform, tutorial>free-tier ]
primary_tag: software-product>sap-build-process-automation
slug: spa-add-sub-process-automation
canonical_url: https://developers.sap.com/tutorials/spa-add-sub-process-automation
---

# Add a Subprocess to an Automation
<!-- description --> Learn how to use a subprocess in SAP Build Process Automation.

## Prerequisites
- Complete [Add Links to Forms](spa-add-links-forms)
- Complete [Agent Management Settings to Execute the Process with an Automation](spa-run-agent-settings)

## You will learn
  - How to add a subprocess in a process.
  - How to add a subprocess in an automation.
  - How to send tasks to multiple participants.

---

## Intro
Using subprocess in your automation enables you to easily reuse existing code segments in various processes. This re-usability eliminates the need for duplicating the same code multiple times, saving you valuable time and development efforts.

Furthermore, incorporating subprocess in your automation allows you to divide your tasks into smaller and more manageable units. This simplifies the comprehension and maintenance of your automated system.

---
### Create a subprocess in a process project

You will incorporate a subprocess within a primary process.

After completing the [prerequisites](spa-add-links-forms), your process will look like this:
    
![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/1a.png)

1. Navigate to the **Overview** tab. From the editable version of your project, click the **Create** dropdown and choose **Process**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/2a.png)

2. In the **Create Process** dialog box, do the following:

    - Enter a **Process Name** such as Manage Trainees Learning Journey.
    - Choose **Create**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/3.png)

    Your new process opens in the process builder. You will now create a trigger form that will start the process. 

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/4a.png)

3. Choose **Add a Trigger** in the **Trigger** settings.
   
    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/4b.png)

4. Select **Submit a Form**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/4c.png)

5. Choose **Registration Form**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/4d.png)

6. Choose **Save**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/5a.png)

7. Navigate back to the **Overview** tab. Select the **Learning Path** process.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/sub1a.png)

8. Choose the three dots of the Trigger form and select **Remove**.

9.  Choose **Save**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/30a.png)

10. Go back to **Manage Trainees Learning Journey** process, select **+** under **Registration Form**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/sub2a.png)

11. Choose **Subprocess**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/sub2b.png)

12. Choose **Learning Path**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/sub2c.png)

13. **Save** the process.

    Now you have an optimized process that incorporates a subprocess, making it more efficient and streamlined.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/sub3a.png)


### Release, deploy and run the process project

1. To release and deploy a process, please refer to step 1 and 2 of the tutorial on how to release and deploy a process [Run the Business Process](spa-run-process).

2. In the **Overview** section, open the process **Manage Trainees Learning Journey** process of the deployed version, choose **Registration Form** and select the **Copy Link** icon next to the **Form Link** field.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/sub4a.png)

3. Now paste the **Form Link** into a browser. When the form opens in the browser, you will have the course presentation fields that you defined in the Registration Form. Click on **Start**.    

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/sub5.png)

    Now, you will receive the training materials directly in your inbox, just like you did in the [Add Links to Forms](spa-add-links-forms) tutorial.

    >In the next steps, you will cover the usage of a subprocess within an automation and also demonstrate how to distribute the learning path to multiple learners simultaneously.


### Add a table to the registration form

After completing the steps above, your process will look like this:
    
   ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/sub3b.png)

1. From the editable version of your project, select the **Registration Form**, choose the three dots and select **Open Editor**.

     ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/6a.png)

2. Add a **Table** with **Learners** as title.

     ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/7a.png)

3. Choose the **+** icon in the table and select **Text**. 

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/8a.png)

4. Enter **First Name** as the field name.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/8_1a.png)

5. Choose the **+** icon next to the First Name field and select **Text**. 

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/9a.png)

6. Enter **Last Name** as a field name.
   
    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/9_1a.png)

7. Similarly choose the **+** icon next to the Last Name field and select **Text**. 

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/10a.png)

8. Enter **Emails** as a field name.
   
    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/10_1a.png)

9.  **Save** the form.


### Create the automation

1. Navigate back to the **Manage Trainees Learning Journey** process.

2. Select the three dots next to the **Learning Path** subprocess and choose **Remove**.
    
    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/11_0a.png)

    > ### What's going on?
    >
    > You will remove the subprocess from the main process. Our objective is to create an automation that utilizes the **Learning Path** subprocess to send the learning path to multiple users at once.

1. Now choose **+**.
  
    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/11_0b.png)

2. Select **Automation**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/11_0c.png)

3. Select **Blank Automation**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/11a.png)

4. A pop up will appear to configure the Desktop Agent version. Do the following in the pop up:

    - From the dropdown, select the version of the Desktop Agent installed on your machine. It would be displayed with suffix as **Registered**.
    - Select your platform.
    - Choose the **Confirm** button.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/12a.png)

5. A new pop-up will appear to create the automation. Do the following in the pop-up:

    -  Under Name enter: **Assign Learning Journey**.
    -  Choose the **Create** button.
    
    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/13.png)

    An automation **Assign Learning Journey** will be created successfully.

6. Choose **Save**.
  
    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/13_1a.png)


### Create data types

1. Go to the **Overview** Tab. Choose the **Create** button. Create an artifact of the type **Data Type**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/14a.png)

2. A new pop-up will appear.
    - Enter **Name** of the data type: **Learner**.
    - Choose **Create**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/15.png)

3.  In the Data Type **Learner** add 3 new fields as such:.

    |  Field Name           | Type
    |  :-------------       | :-------------
    |  `email`              | String
    |  `firstname`          | String
    |  `lastname`           | String

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/16.png)

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/17.png)

4. Choose **Save**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/17_1.png)

    Your data type gets created and you can view it in the list of artifacts in the **Overview** page.

    Now you will create a second data type.

5. Similarly, go to the **Overview** tab. Choose the **Create** button. Create an artifact of the type **Data Type**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/18a.png)

6. A new pop-up will appear.
    - Enter **Name** of the data type: **dataset**.
    - Choose **Create**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/19.png)

7.  In the Data Type **dataset** add a new field such as:

    |  Field Name           | Type
    |  :-------------       | :-------------
    |  `Learner`            | Learner

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/19_1.png)

8. Check List. 

9. Choose **Save**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/20.png)


### Configure the automation

1. Navigate back to the **Manage Trainees Learning Journey** process and select the three dots next to **Assign Learning Journey** automation, choose **Open Editor**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/21a.png)

2. In the Automation Details section on the right, search for the **For Each** activity and drag and drop the activity into the automation flow.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/22.png)

3. Select the **Input/Output** section in Automation Details. 

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/23a.png)

4. Add an input parameter as following:

    - In Parameter Name enter: `learners`.
    - In Data Type choose: **Learner**.
    - Check **List**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/24.png)

5. Click on the **For Each**, enter the value of Set looping List as `learners`.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/25.png)

6. Click on the canvas and select the **Processes** section in Automation Details. 

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/26.png)

7. Select **Learning Path** and drag and drop the activity into the automation flow inside the **For Each** loop.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/27.png)

8. **Save** your work.


### Configure the subprocess

1. Go to the **Overview** tab. Select the **Learning Path** process.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/29.png)

2. Open the **Process Details** side panel.
   
    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/29a.png)
   
3. Select the **Variables** tab in Process Details.

4. For **Process Inputs**, select **Configure**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/31_1a.png)

5. Click on **add input**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/31_2.png)

6. Configure the **Process Input** as such: 

    - In Inputs Name enter: `learner`.
    - In Inputs Type choose: **Learner**. 

7. Select **Apply**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/32.png)

8. Now, click on **Build Your First Business Process** form and configure the **General** section.

9.  In the **Recipients** section, under **Users** select **email** from Process Inputs.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/36a.png)

10.  Select the **Boost Your Business Process with Automation** form to configure the **General** section. In the **Recipients** section, under **Users** select **email**.

   ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/37a.png)

11. Similarly, select the **Create Tables in the Form** form to configure the **General** section. In the **Recipients** section, under **Users** select **email**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/38a.png)

12. **Save** your work.

13. Go to the **Overview** tab. Click on the **Assign Learning Journey** automation.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/38_1.png)

14. Select **Learning Path** and enter the value of learner as `currentMember`.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/38_2.png)

15. **Save** your work.

16. Navigate back to **Manage Trainees Learning Journey**, select **Assign Learning Journey** automation to configure the **Inputs** parameters.

17. In the **Inputs** section, in **Select list** field, choose **Learners**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/38_4a.png)

18. **Save** your work.


### Release and deploy the project

After completing [Agent Management Settings to Execute the Process with an Automation](spa-run-agent-settings) tutorial, you may release and deploy the process.

1. In the **Manage Trainees Learning Journey** process, choose the **Release** button on the top right corner.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/39a.png)

2. In the **Release Project** popup, select **Release**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/40.png)

3. In the **Overview** section that appears, choose **Deploy**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/41a.png)

4. Choose an Environment and click on **Upgrade**.
   
    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/41b.png)

    Your project is deployed.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/45a.png)


### Run the process

1. In the **Overview** section, open the process **Manage Trainees Learning Journey** of the deployed version, select **Registration Form** and choose the **Copy Link** icon next to **Form Link** field.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/46a.png)

2. In a new tab in your browser, paste the form link. Enter the information of the learners in the table for whom you intend to send the learning path and choose **Start**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/47a.png)
   
    > After clicking on **Start**, all the learners you have added to the table will receive the project tasks in their Inbox.

3. Navigate to **SAP Build** lobby, choose **My Inbox** icon.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/48.png)

4. You will see the first task **First Learning Mission** appear in the My Inbox application that ships with SAP Build. The task will have the description of the training to be followed and the link to the tutorial. After finishing the mission, select **I have completed the first mission** and click on **Next**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/49.png)

5. Refresh the inbox again to get the second notification to the second mission. Now you can see task **Second Learning Mission** appear in My Inbox. After finishing the mission, click on **Next**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/50.png)

6. Similarly, refresh the inbox again to get the third mission. Once the mission is completed, click on **Done**.

    ![subprocess](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/51.png)


### Retrieve sample project from the store

This sample project can be downloaded from the SAP Build Store.

To retrieve this sample, please follow these steps:
    
1. From the SAP Build Lobby, navigate to Store.
   
2. Search for the sample project: **Learning Journey**.
   
3. Choose **Create from Template** to retrieve the sample and save it as a new project in your lobby.

    ![Store](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/store.png)

4. Give your project a name and choose **Create**.

    ![Create](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/create.png)

    Your project gets created in editable version. You may release and deploy it and run the project.
    
5. Navigate back to the lobby by clicking on the SAP logo.
  
    ![Project](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/project.png)

    You can see your project is available in the lobby.
  
    ![Lobby](https://raw.githubusercontent.com/sap-tutorials/sap-build-process-automation/main/tutorials/spa-add-sub-process-automation/lobby.png)

