cancel
Showing results forΒ 
Search instead forΒ 
Did you mean:Β 

RAP - Fiori Elements: Disable Create Button App, but not RAP functionality

florian_halder
Participant
0 Kudos

Hi Experts,

we have a RAP/Fiori Elements List Report app with a create button. We have two mandatory fields on create, which leads to a pop up on create. This is/was fine for testing. Now the customer want that new objects are only created from a SAP GUI transaction.

Therefore we created as service method which calls the intent with create:

DATA(lt_parameter) = VALUE tihttpnvp( ( name = 'SalesOrder'

value = if_sales_order )

( name = 'SalesOrderItem'

value = if_sales_order_item ) ).

cl_lsapi_manager=>navigate_to_intent( Object = 'CUSTOMER_APP'

Action = 'create'

parameters = lt_parameter

navigation_mode = if_lsapi=>gc_s_navigation_mode-inplace ).

This works as expected. A new browser tab is opened and the pop up is pre-filled. When the pop up is confirmed, the Object Page is displayed in create mode.

The requirement is now to disable/hide the create button in the app, at least on the productive system. It would be good to have the button on the test environment further on. And/Or to skip the pop up, when the create is called with the service function, because then it's always pre-filled.

All my attempts to remove/disable the button (which is auto generated by the RAP framework/behavior), resulted in the function being unavailable in the backend as well.

andre.fischer maybe you have any idea on that. πŸ™‚

Thanks for your help,

Regards Florian

Accepted Solutions (0)

Answers (2)

Answers (2)

JessieCheah
Product and Topic Expert
Product and Topic Expert

Hi Florian,

have you tried the annotation @UI.createHidden: true to see if it fulfills your requirement?

Regards,

Jessie

florian_halder
Participant
0 Kudos

Hi Jessie,

thanks for your response. Is this annotation from SAP CAP? I couldn't find it on the customers S/4 On Premise system.

Regards,

Florian

JessieCheah
Product and Topic Expert
Product and Topic Expert

Hi Florian,

it is actually a CDS annotation for RAP but it is only available from release 2211. Since your customer has a S/4 on premise system it wouldn't be available yet. However I found this under the UI5 documentation https://sapui5.hana.ondemand.com/sdk/#/topic/cbf16c599f2d4b8796e3702f7d4aae6c.html under Additional Features in SAP Fiori Elements for OData V4/Enabling Custom Actions Defined via Annotations or search for 'CreateHidden'. You could add it via local annotation file, example:

<Annotations Target="SAP__self.SalesOrderItems>

<Annotation Term="SAP__UI.CreateHidden" Path="_SalesOrder/Delivered">

</Annotations>

Regards,

Jessie

florian_halder
Participant
0 Kudos

Hi Jessie,

we did a lot of try and error, and searched the documentation, but we only get it work partly. If I get it correctly your annotation is for the create action with a child/parent relation (for example on a table on the object page). We want to hide the button on the list report of the app.

So we tried with:

Apart from the fact, that there are missing " in the documentation, it also does not work. BAS marks "SAP_self.createWith<ourEntity>Type" as an error.

We found the following:

Continue on the next answer because answers a limited to 2 attachments.....

florian_halder
Participant
0 Kudos

...continue.

with the following the button is hidden:

Our requirement is to hide the button only on the productive system so in theory we need a binding to a attribute

But currently I have no idea how this should work for the create button because I think backend properties are alway assigned to a record of the entity and not for the whole app. At least I don't know how to provide an attribute for the app in the backend.

Or is there any way to achieve this customer request?

Thanks and regards Florian

JessieCheah
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Florian,

you are correct, the example I gave was for the create of child instances with an attribute of parent defined in path. You also do not need to set the 'Core.OperationAvailable' annotation as you define create; in BDEF instead.

What you need is probably Singleton, as below:

RAP does not support Singleton, so you probably need to define it locally in BAS? Unfortunately I cannot help you in that area, as it is out of my area of expertise.

Regards,

Jessie

florian_halder
Participant

Hi Jessie,

thanks again for your answer. Yes this is exactly what we found (see my screenshot above πŸ™‚ ). I just recognized that I forget to mention some steps between our "solution" and the documentation. We had a look into the meta data file of the odata service and we saw that there is already a container element for our entity. We used this one to set the button to hidden. But as I wrote it does not meet the customer's requirement to do it depended on the environment.

Maybe there is someone out there, who have an additional idea for this.

Thanks and regards, Florian

EricXie
Advisor
Advisor
0 Kudos

With feature control you can determine the enablement of action with you own ABAP logic, maybe this could meet your requirement.

Kostiantyn_K
Explorer
0 Kudos

Feature control works only once you push button "Create" fill required fields and then press "continue" button, after that get_global_features method is ran. It is not possible to use that method to manage of button Create.

I think solution with attribute should be suitable.