Technical Articles
F4 Help in Custom Pre-Conditions for Flexible Workflow / Manage Workflow for Purchase Requisition
Introduction:
Starting from S4 Hana 1909, you can add custom pre-conditions to the Manage Workflow App for Purchasing. Like Purchase Requisition. (https://blogs.sap.com/2019/12/03/sap-s-4hana-cloud-flexible-workflow-with-new-custom-pre-condition-for-purchase-requisition/)
A common requirement in such cases would be to add an F4 help for the new field. Found a few blogs that explain how to put the preconditions but none explain how to attach an F4 help to it.
So here is a solution for all such needs.
Requirement
- Add a new precondition to the Purchase Requisition Manage Workflow App in S4HANA 1909 (Follow the blog in the Introduction Section to add this )
- Add an F4 help to the new precondition
Solution:
- You have a parameter CT_PARAMETERS(refer blog in the introduction) to insert the condition.
- This method parameter has 3 fields for F4 help addition,
- service_path – the service path of your OData Service
- entity – the Value Help entity of your OData Service
- property – the field/property in your OData Service for your field value.
- In my case, I had a requirement of adding value help for Inspection Type from table QMAT.
- I found standard CDS views I_InspectionLotType and I_InspectionLotTypeText that helped in creating a value help CDS view. To make life easier did a bit more debugging and found out SAP’s given CDS view for the Standard Value Helps (S_MMPURWorkflowVH) and created mine similar to it.
- Code excerpts below for the CDS
- Composite View to create the Value help for Inspection Lot and Text – ZI_InspectionLotType
- Value Help exposed view/Published View- ZC_InspectionlotVH
@AbapCatalog.sqlViewName: 'ZINSCOMPTY'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Composite View for Inspection Lot'
@Search.searchable: true
@VDM.viewType: #COMPOSITE
@ObjectModel.representativeKey: 'InspectionLotType'
@ObjectModel.usageType.serviceQuality: #A
@ObjectModel.usageType.sizeCategory: #S
@ObjectModel.usageType.dataClass: #MASTER
define view ZI_InspectionLotType as select from I_InspectionLotType as InspectionType
association to I_InspectionLotTypeText as _Instext
on _Instext.InspectionLotType = $projection.InspectionLotType //and _text.Language = 'E'
{
@Search.defaultSearchElement: true
key InspectionLotType as InspectionLotType,
@Semantics.text
@EndUserText.label: 'Inspection Lot Text'
_Instext.InspectionLotTypeText as InspectionLotTypeText
} where _Instext.Language = 'E';
@AbapCatalog.sqlViewName: 'ZCINSPLOTVH'
@AbapCatalog.preserveKey: true
@EndUserText.label: 'Inspection Lot VH'
@AbapCatalog.compiler.compareFilter: true
@ObjectModel.usageType.dataClass: #CUSTOMIZING
@ObjectModel.usageType.serviceQuality: #A
@ObjectModel.usageType.sizeCategory: #M
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ObjectModel.dataCategory:#VALUE_HELP
@OData.publish: true
@ObjectModel.createEnabled: true
define view ZC_InspectionlotVH
as select from tsproc_wf_vh as Document
association [0..1] to ZI_InspectionLotType as _InspectionType on _InspectionType.InspectionLotType = $projection.InspectionLotType //and _text.Language = 'E'
{
key '' as MMPURWorkflow,
@Consumption.valueHelp: '_InspectionType'
cast( '' as qpart ) as InspectionLotType,
//expose assoc
_InspectionType
}
- Now after the CDS is created, Publish the Odata and register the service.
- Now in the CFL app, we will pass the 3 fields that we discussed earlier as below. (code attached).
ct_parameter = VALUE #(
( id = 1 name = 'Inspection' xsd_type = if_swf_flex_ifs_condition_def=>cs_xstype-string mandatory = abap_false
service_path = '/sap/opu/odata/sap/ZC_INSPECTIONLOTVH_CDS/' entity = 'ZC_InspectionlotVH' property = 'InspectionLotType'
)
).
- That’s it, the F4 help will now come up on the Manage workflow App new precondition field (Screenshot Below)
Interesting blog Abhilash. Keep exploring new areas and post the same.
Very helpful blog Abhilash ?
Hi Abhilash,
Thanks for the blog. Can this actually be done in S/4HANA Cloud Essentials?
Hi Andrew,
I have tried this in a S4 HANA 1909 STE Cloud Extended environment.
Don’t have a cloud essential setup to check this. It would be great if someone shares the experience of doing it in the cloud essential version. The CDS can be created in Cloud essentials and the badi used is a cloud badi so theoretically it should work.
Regards,
Abhilash
Nice blog Abhilash, well explained .
Hi Abhilash,
I tried to add F4 functionality from custom table, but could not able to get it. Could you please provide me some steps using custom table.
Thanks Bala
H Balakoti,
Sure give me a few days I'll give an example to you.
Regards,
Abhilash
Hi Abhilash,
Thank you for the reply...i'm able to achieve the F4 functionality now. I was registering the service locally instead of gateway system. After registering the service in HUB system, it was working ...thank you for the detailed documentation.
Thanks
Balu