Skip to Content
Author's profile photo Othmane NGABI

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 operationwhich 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

This is the Creation.view.xml

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!!!

 

Assigned tags

      11 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Moya Watson
      Moya Watson

      That's cool, Othmane! Thanks for walking us through your debug process!

      Author's profile photo Othmane NGABI
      Othmane NGABI
      Blog Post Author

      Thanks Moya.

      Happy to see that you enjoyed.

      Author's profile photo Lotfi GAALOUL
      Lotfi GAALOUL

      A very clear explanation

      well done

      Author's profile photo Othmane NGABI
      Othmane NGABI
      Blog Post Author

      Thanks Lotfi for your support.

      Author's profile photo Former Member
      Former Member

      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

      Author's profile photo Othmane NGABI
      Othmane NGABI
      Blog Post Author

      Hi,

      Try with this

      jQuery.sap.registerModulePath("sap.hcm.lib.common", "/sap/bc/ui5_ui5/sap/hcm_common/sap/hcm/lib/common/");
      
      and re-deploy your app on your On-Premise system and check it again.
      
      
      regards,

      Othmane

       

      Author's profile photo Former Member
      Former Member

      I had run the application on WebIDE. When I deployed, it worked. Thanks a lot.

       

      Regards,

       

      Mina

      Author's profile photo shalu jha
      shalu jha

      I tried this, but it is not working. Could you please suggest any other solution

      Author's profile photo Piotr Żak
      Piotr Żak

      Hello

      I have problem too with extend Fiori standard apps My Leave Request and People Profile

      My Component.js file

      jQuery.sap.declare("hcm.fab.myleaverequest.HCMFAB_LEAV_MANExtension.Component");
      jQuery.sap.registerModulePath("sap.hcm.lib.common", "/sap/bc/ui5_ui5/sap/hcm_common/sap/hcm/lib/common/");
      // use the load function for getting the optimized preload file if present
      sap.ui.component.load({
      	name: "hcm.fab.myleaverequest",
      	// Use the below URL to run the extended application when SAP-delivered application is deployed on SAPUI5 ABAP Repository
      	url: "/sap/bc/ui5_ui5/sap/HCMFAB_LEAV_MAN"
      		// we use a URL relative to our own component
      		// extension application is deployed with customer namespace
      });
      
      this.hcm.fab.myleaverequest.Component.extend("hcm.fab.myleaverequest.HCMFAB_LEAV_MANExtension.Component", {
      	metadata: {
      		manifest: "json"
      	}
      });

       

      Regards

      Piotr

      Author's profile photo shalu jha
      shalu jha

      Hi Piotr,

       

      Did you find any solution for this, i am facing same problem.

      Author's profile photo Pedro Lopes
      Pedro Lopes

      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