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: 
prajnaparmita
Employee
Employee
While working on a customer project we realized creating value help using smart field will save a lot of our time. How you can understand while going through this blog.Also, I can see many blogs have already been written on creating Value helps using smart field. But the difference here is that I needed to pass filters as parameter and hide them so that users cannot modify.

This last requirement of hiding the parameters itself took a lot of my time. So for the benefits of others decided to write this blog.

BUSINESS SCENARIO:

There was one form containing the fields similar to below screen.



On click of Sales Office one F4 value help has to  open and the values are to be filtered based on Division selected as in below screen shot.



 

SOLUTION

This can be achieved by adding smart field in the view xml file  and using annotations on the oData model metadata.

XML FILE:

<smartForm:GroupElement label="{i18n>SalesOffice}">

                                                            <smartField:SmartField value="{ZSalesOff}" >

                                                            </smartField:SmartField>

                                             </smartForm:GroupElement>

 

For smart field to be editable base entity set must be updatable true.

LOCAL ANNOTATIONS:



 

OR in the code editor,



 

Till this point the steps are like that explained in Samples. Here Record Type: Common.ValueListParameterIn determines the filtering data set which is Division for our example.

This results in a value help like below screen shot,



 

Issue here is that user can modify the resultant set.



 

To avoid this and hide the filter use the below annotation on the property of entity.



 



 

I hope this will help other users to solve this quickly.
10 Comments
EkanshCapgemini
Active Contributor
Hi,

I had a similar requirement and your blog was really helpful. Thanks for sharing the information.

I would recommend to rename the blog title to something like 'Hidden Filters with SmartField Value Help' so that it's easier to find.

 

BR, Ekansh
prajnaparmita
Employee
Employee
0 Kudos
Thank you for your suggestion. Modified the title as well as added few more tags.

Best Regards

Prajna

 
0 Kudos
You can achieve through annotations in CDS views.
  @Consumption.valueHelpDefinition: [{ entity: 
{name: '/DMO/I_Connection_VH' , element: 'connection_id' },
additionalBinding
: [{ localElement: 'CarrierID', element: 'carrier_id' }]
}]

You can find more details here - https://help.sap.com/viewer/cc0c305d2fab47bd808adcad3ca7ee9d/1809BW.001/en-US/3051302c457e4c0f9a9c2c...

prajnaparmita
Employee
Employee
Hello Sunil ,

This blog is not focused on defining Value Help.This is more about passing filter and then hiding it.

Best Regards

Prajna
Ragavie
Participant

Thanks so much for the valuable information.

I had similar to this requirement to hide the fields. It will help us to resolve it

0 Kudos
prajnaparmita , Is there any way to keep the filter bar visible all the time, By-default filter bar is hidden when we open the F4 Help, but in our use-case we want this to be visible all the time?
prajnaparmita
Employee
Employee
0 Kudos
Hello Shekar,

I am not aware of any way to achieve this.
0 Kudos
Hi Prajna, Thanks for the reply. I got this issue resolved using Visual Editor.
0 Kudos
HI  prajnaparmita ,

 

Where to define division's value 10
janani_10
Explorer
0 Kudos
Hi prajnaparmita ,

I have a similar requirement. In smartform, I am having 2 smartfields with F4 help. On selecting purchasae org field, the vendor fields's valuehelp should get filtered based on selected Purchase Org. But when i try the same in my local annotation file, it's not getting filtered. I tried this from CDS annotation as well, which is also working. When trying through CDS annotation, the generated annotations for valuehelp is not containg the ValueListParameterIn property. Any inputs will help.

Attaching the code below.

Sample cds code:
@Consumption.valueHelpDefinition: [
{ entity: { name: 'C_RegionVH', element: 'Region' }},
{additionalBinding: [{ element: 'Country', localElement: 'Country' }]}
]

 


 

 

Thanks in Advance,


Janani