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

Here i would describe how to hide the defaultset option (show dropdown option) of the OWL UI/Query dynamically using ABSL resue library code.

additionally also will describe how to pass value to Query parameter dynamically using ABSL reuse library.

Created Business Object:

and generated UIs including OWL.

OWL sample data:

Here there is a defaultset dropdown option "All Vehicles" , this displays all the vehicles data.

1) How to pass value to query parameter dynamically using ABSL reuse library:

example: scenario is to have a defaultset option called "Current year Mfg" to display the vehicles which displays vehicles with ManufacturedYear from current year only.

a. Created resuse library to get current year:

b. Added query parameter ManufacturedYear in the OWL:

c.Created anothter defaultset "Current year Mfg" with query parameter "ManufacturedYear" mapped to the reuse library we created in step a:

when we preview we will see the new defaultset option "Current year Mfg" with data filtered on ManufacturedYear for the current year:

so now we have two defaultset options in the Show dropdown of the OWL query:

"All Vehicles" to display all the vehicles
and

"Current year Mfg" to display vehicles from the current year

2) How to hide a defaultset option dynamically using ABSL reuse library:

example: scenario is to display the defaultset option "All vehicles" for only my user (User = ABC) and hide it for all other users

a.Created reuse library "GetLoggedInUser" to return current logged in user:

b.Created a datamodel element to map to the reuse library:

c.Created field transformation to map the datamodel element to the reuse library:

d. Created "Calcuated Rule" for the visibleField property for the defaultset "All Vehicles" :

e.Calculated Rule script to display defaultset option "All Vehicles" only for current user:

f.In the "DefaultSet Mapping" to include both the defaultsets and also change the "Default DefaultSet" to "CurrentYearMfg"

Result:

With this change only user "ABC" can see the defaultset option "All Vehicles" all other users won't see it.

with user "ABC" logged in, user can see both the defaultset options:

and all other users will see only one defaultset option "Current year Mfg":

Some of the learnings from this content are:
ABSL Reuse library,

Using reuse library in UI,

UI Script,

Dynamically controlling visibility from UI,

Query Defaultset,
Field transformation,

Get current user,

Get current year

etc.

Thanks, Pradeep.

11 Comments