Skip to Content
Technical Articles
Author's profile photo Mohammed Aymen

Flexible Workflow: Custom Flexible Scenario – Part 4

In the previous blog posts Part 1 & 2, I created a custom flexible workflow scenario and configured it. In part 3, I showcased the possibility of multi-level approvals.

In this blog post, I will focus on creating a custom value help for start conditions in flexible workflow.

 

Adding the links to previous blog posts for a recap:

Part 1, Part 2, Part 3.

SAP already has standard value helps for fields like Company Code, Profit Center, Cost Center, Material Group etc. What if we need a new field based on our requirements ?

For example, in my requirement I need a start condition for RE-FX Contract Type. This can be achieved by created a custom value help for the required field using CDS Views.

Solution

Find out the master table for your field. In my case it is TIV26.

Next up, create a custom CDS value help.

Go to File->New. In the pop-up, select ABAP->Core Data Services->Data Definition

@AbapCatalog.sqlViewName: 'ZV_CNTRTYPE_WFVH'
@AbapCatalog.preserveKey: true
@AbapCatalog.compiler.compareFilter: true
@ObjectModel.usageType.dataClass: #CUSTOMIZING
@ObjectModel.usageType.serviceQuality: #A
@ObjectModel.usageType.sizeCategory: #M
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ObjectModel.dataCategory:#VALUE_HELP
@EndUserText.label: 'Contract type Value Help'
define view ZC_CntrType_WFVH 
as select from tiv26 
    association [1] to tiv2f as _RecnText on $projection.RecnType = _RecnText.smvart and 
        _RecnText.spras = $session.system_language
{
key smvart as RecnType,
  _RecnText.xmbez
 
  
} where newcntype = 'X'

 

In the above code, I am reading contract type from table TIV26 & contract type text from TIV2F. I need the two fields to be displayed in search help. I am aliasing the field contract type as ‘RecnType’.

 

Next, I need another CDS view to map the value help created in above CDS into the start condition field in Workflow.

@AbapCatalog.sqlViewName: 'ZV_CTYPE_VHMAP'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Contract type Value Help Mapping'
define view ZC_CntrType_VHMAP 
as select from swf_flex_ifs_vh 

  association [0..1] to ZC_CntrType_WFVH as _RecnType on $projection.RecnType = _RecnType.RecnType
{
key '' as dummy,
  @Consumption.valueHelp: '_RecnType'
  cast( '' as smvart ) as RecnType,
  
  _RecnType
  
}

In the  above code, we are reading the value help from the first CDS created, and mapping it into field RecnType.

 

Now, go to /IWFND/MAINT_SERVICE in your gateway system. In add service, add the 2nd CDS. In our case it is ‘ZC_CNTRTYPE_VHMAP_CDS’ .

Once service is added, go to the gateway client. In the entitysets, you will see the name the entities available. We will be using ‘ZC_CntrType_VHMAP’ for our value help. That is the mapping which we did earlier. The other entity gives the list of contract types which is used to map to this entity.

Entity Set for CDS View

 

Now for the part of assigning this value help to our field in the workflow.

Go to SWDD_Scenario. Enter you workflow number.

In the flexible block, go to Value Helps Tab. In the field for which you need the value help, enter the details.

Value%20Help%20Assignment

 

Value Help Assignment

 

Service path: /sap/opu/odata/sap/ZC_CNTRTYPE_VHMAP_CDS

Entity: ZC_CntrType_VHMAP

Property: ZC_CntrType_VHMAP

 

Once this is set, go to the conditions tab. Select on the field & click on parameter button. The green indicator button for the help field will be set.

Next, open the Workflow scenario in your Fiori launchpad, go to Add.

In Start condiitons, select your field, and you will be able to see the F4 help assigned to your field input.

F4%20Help

F4 Help

 

Conclusion

This completes my 4 part blog post series on custom workflow scenario development. It has been a great learning experience. I hope my blog post series helps you design custom scenarios based on your requirements.

 

Thank you. 🙂

 

 

Assigned tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Ashish Saxena
      Ashish Saxena

      Hi Mohammed,

      Great documentation. Question - We would like to trigger an email from a flexible workflow on approval or rejection. Something like this is available in 1809 and 1909 etc. However 1709 does not seem to have it. We also want to do CC using a rule.

      Any thoughts how this can be done using Manage Email template app. We can also do using email task like in standard workflow, but we don't want to do that.

      Author's profile photo SHIVA KRISHNA
      SHIVA KRISHNA

      Hello Mohammed,

      Thanks for the document, I have requirements for the escalations.

      If Agent hasn't approved or rejected the work item for a couple of days, the work item needs to get auto approval and should trigger to the next level approver. Here, the Agent determination is happening through the BADI.

      In the Fiori App, the deadline monitoring has only 2 options. So there is nothing like auto-approval.

      Do you have any idea, How the auto-approval process will work?

      Author's profile photo Mohammed Aymen
      Mohammed Aymen
      Blog Post Author

      As of now we only have the option of setting the step as overdue in deadline monitoring.

      Author's profile photo Prakash Varun
      Prakash Varun

      Hi Aymem,

       

      We have similar requirement for Custom Value Help for People Picker, we have followed the same and maintain our custom service and entity in SWDD_SCENARIO, but we are still getting the standard Value help for User field in Manage PO Work Flow App.

       

      Do you have any recommendation.

       

      Thanks in Advance.

       

      Author's profile photo Mohammed Aymen
      Mohammed Aymen
      Blog Post Author

      Make sure you have added your custom service in the people picker field in Value helps tab.