Fiori My Leave Request standard issue
Recently I worked with the standard Fiori app HCMFAB_LEAV_MAN. All technical details related to the application are described in the following link My Leave Request (Version 3/Fiori 2.0).
And i faced a strange problem that not occure when using the standard version but happen if we extend the Fiori app.
Let’s Start
I extend the controller Creating.controller.js by copying it.,
So i create a new one, CreationCustom.controller.js and i activate the whole source code and tried to create a leaving request without changing any thing on the source code.
When i click Save button i receive this error message Default changeset implementation allows only one operation. which is raised by the standard implementation of the CHANGESET_BEGIN method of my DPC_EXT Class.
What’s Happening ?
I’m sending multiple POST operations on the same change set which is not possible, because when we use Batch request we must process one by one operation.
Of course the first solution that come to my mind is to redefine the standard method and check my it_operation_info content to resolve the problem.
But i decided to go to the caller ( Fiori side ) and check the problem in the source
I searched for the operation called when the save action is triggered
And i analysed the source of the onSendRequest Method on controller.js
In the Method submitLeaveRequest we prepar the batch request and submit changes.
Until now i didn’t find the problem but by reading the v view content in debug i see that im sending two Leave Requests as changed entities so it confirm why on ABAP i have the error. Good.
With this information i undertsand that the problem is coming from the Select Component.
When the first item is added to the view Model ?
After some debug i understand that on onInit Method they add a default value for the first item of the Select Coponent ( Dropdown list ).
And here come my modification of the onAbsenceTypeChange Method. I added resetChanges() when the user select a Request Type from the drpdown list to remove the last View Model and add the new one to be sure that i will send only one Request when i submit my changes
Great!!! with this change i avoid the ABAP exception but when i tried to send directly the first item without changing my Dropdown list Request Type my error is still occured. I thougth to add a blank entry as first line to force the user to make a choice but unfortunately this option is not available with a Select component.
So i take few minutes and i find that it will be more easy to trigger the onAbsenceTypeChange even for the by default selected item. And i find a way by adding line below to _onCreateRouteMatched Method.
With this last change all the scenario is working. Hope my solution can help some one working with this app or facing the same issue. Enjoy!!!
That's cool, Othmane! Thanks for walking us through your debug process!
Thanks Moya.
Happy to see that you enjoyed.
A very clear explanation
well done
Thanks Lotfi for your support.
Hello Sir,
I am trying to extend My Leave Request Application but when I run it I get this error:
I added this codes in Component.js file:
But it still doesn't work.
Do you have any suggestion?
Thanks in advance,
Mina
Hi,
Try with this
Othmane
I had run the application on WebIDE. When I deployed, it worked. Thanks a lot.
Regards,
Mina
I tried this, but it is not working. Could you please suggest any other solution
Hello
I have problem too with extend Fiori standard apps My Leave Request and People Profile
My Component.js file
Regards
Piotr
Hi Piotr,
Did you find any solution for this, i am facing same problem.
Hi,
I hope you've already solved the issue.
Looks like the common library is missing.
If you're still using the SAP Web IDE you can right-click in the project: Project > Add Reference to Library > choose your Repository/System > choose your library.
(depending on the app version you're extending it might be the: hcm.fab.lib.common - UI Reuse lib HCM)
Best regards