cancel
Showing results for 
Search instead for 
Did you mean: 

How to add DELETE functionality to an OWL autogenerated by Studio

SAPjedi
Contributor
0 Kudos

I want to allow the delete of a record shown in an OWL that was generated by the Studio.

I don't see a EventHandler for the add, so I don't know how to reverse engineer that.  I do have that gear box that does the add - so it doesn't seem to use an Eventhandler in the OWL.

Appreicate any tips to:

1. Add a delete button on the OWL or even a right mouse menu

2. When the delete button is selected on a row where the cursor is, it prompts a confirm, then delete if approved.

Thanks ahead.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hi Tim,

Please follow the below step..

1. create an Action file say Action-DeleteInstance.abls

write the code

import ABSL;

this.Delete();

2. Go to OWL and add a button

3. Then Goto controler tab select DeleteHandlder under eventhandler

Select  operation BOOperation like in below image.

This below step will select the currente selectd instance in OWL

4. Then select Other operation Message Box, then configure like below image

5. Now Select "DeleteAllHandler", as in above highlighted box

6 select the operation BOAction, bind your absl action

7. select operation List for refresh the DataList.

I hope this will work for you...

Thanks

Suni

SAPjedi
Contributor
0 Kudos

Sunil, Rei,

I am stumped when I configure the toolbar for the OWL for the Delete button.

The provided DELETE button in the RemoveDelete menu always display as disabled.  I have confirmed the properties as Enabled, but it's not working.

If I use other buttons, they display as enabled.  Something about the Delete button is not working.

I suppose if I can't use the Standard buttons, I will have to use a Custom button + action.

Appreciate any tips on this.

Tim.

vinodkumar_kommineni
Active Contributor
0 Kudos

Hi Tim,

Use an application specific button and follow Sunil's post and you should be able to make it work.

Even I had faced this problem of enabling standard buttons and I opened a standard screen and realized even they are using Application Specific Buttons. so push the standard button to left and use custom button

Regards

Vinod

SAPjedi
Contributor
0 Kudos

Vinod,

Yes, I am making better progress with my own app button.

I think when my Handler has Operation "List" and "RemoveRow" as operation - that it disables my Delete button.  WHen I remove this operation, my button is in activated mode.

So I did a modified version of Sunil's post.

1. I didn't do a BOOperation Read - not sure why that's needed.

2. I didn't put anything for the Cancel Handler - if the user says No to delete, I have no handler.

It seems to work now.

BTW, i meant to say I was referring to p95 of the 1311 Studio Guide (not the book).  That example for the DeleteRow is not fully correct.

vinodkumar_kommineni
Active Contributor
0 Kudos

Hi Tim,

Yeah, It makes sense to not give any handler to Cancel as we don't need any action there except the popup to be closed.

Are you adding the button to the row within the OWL ( i e as a new action in a column ) or are you adding it on the top right?

I think there would be difference. When it is on the top you would select the line to delete which makes it enabled. But in case it is in the same line then I expect it to be enabled by default as it is present in all the rows.

I did not try the first method myself to comment much on it. I also don't see a reason why read exist .... To check it is not already deleted before we try to delete ??

Regards

Vinod

Former Member
0 Kudos

Hi Sunil,

Yours is the correct answer for the question! Thanks to you - as this has helped me too!

However,... If I do not select a line item, and then press Delete button, then the first line will be deleted and I do not know how to either:

1) disable the button until a single line has been selected OR

2) add text to the message box to warn the user that "a line hasn't been selected and the first line will be deleted if you press OK"

Any thoughts on this?

Regards

Jay

Former Member
0 Kudos

Hi Sunil,

I tried doing this and it worked. But there is a issue that even if no record or row is selected still the Delete button works. So this should not happen.

so to overcome this issue we have to skip 3rd step from your blog i.e Using of BOOperation as this is not required.

After doing this it works very fine i.e. Delete button is active only when record is selected.

Thanks & Regards

Komal

Former Member
0 Kudos

Hi Jayash,

To overcome your first problem, we have to skip 3rd step from Sunil's blog i.e Using of BOOperation as this is not required.

After doing this it works very fine i.e. Delete button is active only when record is selected.

Thanks & Regards

Komal

Answers (3)

Answers (3)

Jens-Limbach
Advisor
Advisor

Hi Tim,

you are missing a setting, thats why it is greyed out.

Please switch to the DataModel view and select the DataList node in the tree on the left.

Properties tab on the right and change the Lock Behavior property from Automatic to EditOptimistic.

This will make your button be working.

Cheers,
Jens

Jens-Limbach
Advisor
Advisor
0 Kudos

FYI: RemoveRow operation on root node of your OWL will only work when changing this property. Usually we do not delete any Business Object root instances but set them as "obsolete" for example.

Once RemoveRow is on a button on a OWL the above setting is required.

Saurabh_Kabra
Participant
0 Kudos

Thanks Jens!

It worked with the given solution.

Thanks

Saurabh    

SAPjedi
Contributor
0 Kudos

Thanks all for the great tips.  I continued with method from Thomas Schneider's book - details in my earlier post.

However, the Delete button is greyed out.  How I got here - I also added a "Add Row" and put in the EventHandler.  Then I change my mind and deleted that from the Toolbar Config.  And called it a night.

Today in my testing, I noticed the Delete button is always greyed out.  It was working last night...

Has anyone seen this ?

0 Kudos

Hi Tim,

        

        About your question, blew is my suggestion.

1. Add a delete button on the OWL or even a right mouse menu

Chris:   Add delete button on OWL is absolutely okay while right mouse menu is not feasible as far as i know.

2. When the delete button is selected on a row where the cursor is, it prompts a confirm, then delete if approved.

Chris:   You can add one MessageBox in your eventhandler to ask user to confirm then delete.

Thanks.

SAPjedi
Contributor
0 Kudos

I can figure how step 1 - which calls the action / eventhandler.

For step 2 - i'm a bit confused in what to put there.  Can you do a sample screenshot of what that would look like ?

SAPjedi
Contributor
0 Kudos

I think I solved my own question.

On page 95 of the book SAP Cloud App Studio, it shows how to add 2 buttons - Add Row and Delete Row.

But since I already get the Add icon in the left toolbar (with the gearbox icon),  This is auto-generated along with the OWL.

I like to tap into this existing functionality by add a new OWL toolbar button point to the same code that the left toolbar icon is using.

Does anyone know how to do that ?

Former Member
0 Kudos

Tim, all you have to do is add a new button, sub-button, or menu item using the toolbar config properties and then bind this button/menu item to a new event which calls the BOaction.

As a FYI, Cloud for Customer has some strict guidelines on how you layout these buttons/menus so they work on iPad, since the iPad expects a specific order and layout for menus and buttons.

An easy way to know if your UX is compliant with the iPad is to open an existing OWL or standard thing inspector floorplan like the Account and you can see what needs to be done.

Some guidelines are:

1. Only 1 header button on the thing inspector can be rendered on the iPad. So if you need more buttons, you should create a header menu and then put menu items that represent all of the buttons. If you want those buttons on the header on the desktop, you can use ruby script to hide/show content that is not supported on the iPad since iPad cant render Ruby script. Since iPad cant render Ruby script any UI content that is attached to it, will automatically be hidden on the iPad.

2. An OWL (work center or a facet in a thing inspector) must have a "New" link first and then a Menu (like the gear wheel you are talking about) with all of the list actions in the menu

3. An OWL must use the List Modification Pane UX control to add rows to the OWL.