cancel
Showing results for 
Search instead for 
Did you mean: 

How can I create an action in RAP with mandatory parameters?

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
341

I got this question today in forum of the German SAP user group.

Since it took me a while to find the answer I am posting the question here and answer it as well.

 

 

 

 

 

 

View Entire Topic
Andre_Fischer
Product and Topic Expert
Product and Topic Expert

An example can be found in the feature showcase app.

The SAP Fiori Elements feature showcase with RAP: ... - SAP Community

You define the action in the behavior definition and use the key word "deep" for the parameter.

action ( features : instance ) overwriteTimezone deep parameter /DMO/FSA_D_OverwriteTimezoneP;

The UI will look like follows:

Andre_Fischer_0-1723216517692.jpeg

Then you need an abstract BDEF that uses the key word mandatory:execute  for the field and with hierarchy and with control

 

abstract;

strict ( 2 );

with hierarchy;

define behavior for /DMO/FSA_D_OverwriteTimezoneP with control
{
field (mandatory:execute) sap_timezone;
}

And you need an abstract entity

@EndUserText.label: 'Oerwrite Timezone parameter'
define root abstract entity /DMO/FSA_D_OverwriteTimezoneP
{
// Search Term #MandatoryParameter
@EndUserText.label: 'Timezone (#MandatoryParameter)'
@Consumption.valueHelpDefinition: [{ entity: { name: 'I_TimeZoneIANACodeMap', element: 'TimeZoneID' },
additionalBinding: [{ usage: #RESULT, localElement: 'iana_timezone', element: 'TimeZoneIANACode' }] }]
sap_timezone : tznzone;

// Search Term #IANATimezoneAParameter
@Semantics.timeZone: true
@EndUserText.label: 'IANA timezone (#IANATimezoneAParameter)'
iana_timezone : tznzone;
}

 

 

 

SachinArtani
Participant
0 Kudos

I got two questions - 
1. Why deep parameter is needed and not a simple parameter?
2. In abstract BDEF, why 'with hierarchy' is used?