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.
Showing results for 
Search instead for 
Did you mean: 

In the previous article, I explained Custom Variable. In that article, I mentioned that this feature also makes it easier to perform rework.

This is also described in the Help. However, some people have commented that the flow described in the help is only illustrative and that it is difficult to understand the actual implementation method, so I would like to explain my "personal" implementation method.

Note1:In actual business operations, the "rework process" may differ depending on your corporate culture, business style, and operations. Therefore, we have rearranged the flow of what we believe to be a common practice based on a little research. I am Japanese. Therefore, it may be different from other cultures.

Note2:Since SAP Build Process Automation is a development tool, there is more than one way to implement the same. This article should be viewed as sample code. It does not mean that it has to be this way. (It's just my way of doing things.)

Sample scenario

In this case, I would like to create a scenario of an application for the purchase of a laptop used in the help snapshot.
In this scenario, the applicant applies for the purchase of a laptop, and the approver receives the application and either approves or denies it.

・If the approver refers back, he/she enters the reason and sends it back to the applicant.

 ・The above can be a loop. (It could be returned, reapplied for, and then returned again.)

・Sometimes the application is denied rather than sent back.

Overall view of flow

The overall flow to be designed looks like the following

The form and the type of form used are different from the flow described in Help. I have tried to make the names of the steps easy to understand, so you can get some idea of what kind of processing is being done from the step names.

Custom variables to use

The three custom variables are C_Price, C_ModelNo, and C_Comment. (C_ is a preposition I often use to identify it as a custom variable.)

Application Form (Trigger Form)

The form used by the applicant for the application should look like this

Simply enter the model number of the laptop you are applying to purchase and its price.

Assign to custom variables

Currently, there is a limitation that "values entered in the trigger form cannot be directly assigned to custom variables." Therefore, to assign values entered in the trigger form to custom variables, use the dummy decision introduced previously, and assign the model number and price values of the trigger form to C_ModelNo and C_Price in this output.

Approval Form

The approval form has a checkbox for the application and whether it should be returned, and a text field for the comments to be returned to the applicant.
If the applicant checks the "return" box and clicks the "Denial/Return" button at the bottom, the application is returned, otherwise it is denied. Currently, only two action buttons can be placed on the approval form, so I am using a checkbox. If three buttons were available, the checkboxes would no longer be necessary.
In the input of this form, you can use the following

This is done using the custom variable that was set earlier. Actually, this part is important, because if you use the value of the trigger form here, the value displayed when returning from the redirection process will be the value of the trigger form.
The output is

This is how the custom variable C_Comment is assigned to the value of the form's return comment.

Deciding whether to send it back or not

This is implemented using an IF statement.

Return Processing Form

Since the application form is used as a trigger, it cannot be used as-is for the return process. Therefore, a form with almost the same screen structure is created.

As a difference, it is possible to display comments from approvers.
Also, as I was creating this form, I thought that the applicant might withdraw the application itself, so I created this form itself using the approval form and displayed two action buttons: Reapply and Discard Application.
The input for this form is

Assign custom variables in this manner.
Also, in the output

Thus C_ModelNo and C_Price are overwritten with the values entered on this form.

Confirmation of Operation

Now let's see how it works. First is the application.

Enter the information and price of the laptop you wish to purchase and submit your application.

Your Manager has received the application, perhaps because 300,000 was too high, and will enter that in the comments and send it back to you.

The application was returned to the applicant. I have no choice but to reapply for a less expensive one than the one I applied for.

The reapplied has been received by my supervisor. However, it is still expensive and he will send it back again.

I am angry with my boss, but I will choose a less expensive one and apply again.

The application has been received by My Manager. The manager now decides to approve the application.

Please test the operation while thinking about how the custom variables will change.
What values are displayed on the approval form, what values are set in the custom variables, what values are displayed on the form for the return process, what values are displayed on the form for the return process, what values are displayed on the form for the return process, what values are displayed on the form for the return process, and what values are displayed on the form for the return process? What values will be displayed on the approval form, what values will be set to custom variables, what values will be displayed on the form for the return process, what values will be displayed on the form for the return process? If you define and set variables with these questions in mind, you will be able to understand them more quickly.For example, the first time the value displayed on the approval form is the value on the trigger form, but the second time, after the return process, it must be the newly set value on the return process form. This has been very difficult to achieve in the past. Thanks to custom variables, this is now very easy to implement.This is a very useful feature and we encourage you to try it.

As you use it more and more, you will find it at .... I would still like to have the ability to just assign to variables. I will request this to development.

1 Comment