Closed axelmohnen closed 11 months ago
Hi @axelmohnen, unfortunately i can not test with an on-premise launchpad, but i tested it not for a cloud (SAP Workzone Service) Launchpad. I am sure it works similar for on-premise, so maybe you can adapt it for your use case and create a PR if needed.
First i do the cross navigation with the following code:
const oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");
// generates a hash for the Fiori Launchpad to follow
const hash = (oCrossAppNavigator && oCrossAppNavigator.hrefForExternal({
target: {
semanticObject: "obj",
action: "act"
},
params: {}
})) || "";
// navigates to the new hash
oCrossAppNavigator.toExternal({
target: {
shellHash: hash
}
});
I added two frontend actions:
CROSS_APP_NAV_TO_EXT TYPE string VALUE `CROSS_APP_NAV_TO_EXT`,
CROSS_APP_NAV_TO_PREV_APP TYPE string VALUE `CROSS_APP_NAV_TO_PREV_APP`,
Which are implemented here: https://github.com/abap2UI5/abap2UI5/blob/98cf374f29a38e6ad334414f8ae2bd6bc30a8290/src/z2ui5_cl_fw_http_handler.clas.abap#L252 And here: https://github.com/abap2UI5/abap2UI5/blob/98cf374f29a38e6ad334414f8ae2bd6bc30a8290/src/z2ui5_cl_fw_http_handler.clas.abap#L256
Then i added two demos 127, 128 and customized two apps on the launchpad:
They can call each other and you also have the possibilty to go back:
More funcitonality is now possible, like passing more startparamters etc. Important topic but also some work to implement all functiomalities. So let me know if this is working for you.
Best regards.
@oblomov-dev , This is a great approach! It was working out of the box. Problem: The calling app is rendered in the same window (inplace). This is the normal behavior in the FLP shell. By using the "Back" button your are returning to the caller app. Unfortunately, in case the caller is a ABAPUI5 app and the calling app a SAPUI5, we are loosing the app context while returning.
I extended your source code via PR. With an new optional parameter in ARGS[3] === "EXT", you can call the app in external window (browser tab).
Thanks, Kind regards Axel
yes this is the next step but also possible i think. the context is generated via url params, something like this: system/app/salesorder(1000) calls the app with a specific salesorder for example.
The url params can also be set with abap2UI5 and apps can be implemented by reading the url params first and then show information for a specific salesorder.
@oblomov-dev: If we could pass parameters by returning to the calling application (e.g. CROSS_APP_NAV_TO_PREV_APP) could also solve the following issue: https://github.com/abap2UI5/ext-fiori_launchpad_on_premise/issues/5#issue-1917509700
The problem I see is that we can't push values with the method "backToPreviousApp" from the class sap.ushell.services.CrossApplicationNavigation.
yes going forward we can easily add the possibility to use parameters but backwards....
we have to integrate the ui5 navigation functionality that a history is created, then every app has different history layers and we can go back to the last one. mhh seems that needs some further investigation 🧐
Yes, forwarding startup parameters is no problem with "CROSS_APP_NAV_TO_EXT", but can we receive the startup parameters in a calling ABAP2UI5 app? Do we have to enhance the FLP-extension in order to pass the parameters to the ABAP2UI5 framework similar to the "APP_START" (sap.z2ui5.oBody.APP_START = sap.z2ui5.APP_START;`)?
If we could catch the startup parameters, we could use them to send the context (key values) of the caller application to the calling app. In order to went back to caller app we could use again "CROSS_APP_NAV_TO_EXT" instead of "CROSS_APP_NAV_TO_PREV_APP". With that approach we can easily pass the "context" parameter, catch them and run the caller app with those parameters. OK, the application developer needs to implement that context part itself, but at least we are receiving the context parameters....
(1) passing parameters and sending them to the backend is no problem, we just need to read it from the navigator object and then put it into the request information. in the backend we can create something like: client->get()-t_nav_params
(2) yes this is a good workaround, the only downside is that the browser back function will not work but maybe this is not so important for everyone. yes the developer of the abap2UI5 app has to implement the context, but a frontend UI5 developer has to do the same, so we can not avoid this.
@axelmohnen updated abap2UI5 and the samples again.
You can send start Parameters here: https://github.com/abap2UI5/abap2UI5-samples/blob/71427bdefc8ce2947d226e06d95f4ca1cf2313a4/src/z2ui5_cl_demo_app_128.clas.abap#L69
And set a breakpoint here, to see how to read the parameters: https://github.com/abap2UI5/abap2UI5-samples/blob/71427bdefc8ce2947d226e06d95f4ca1cf2313a4/src/z2ui5_cl_demo_app_127.clas.abap#L22
And update your frontend UI5 app too, needed to make a small adjustment also there.
Hi @oblomov-dev , thanks a lot, great job again! It works out of the box. I just had to fix a small bug in the FLP extension "onInit()" method (please refer to the new PR)
great! did you already send a PR with the onInit fix?
cool, thank you!
the basic functionality is now included: (1) go to next page (2) go back there is potential for a lot more functionality, but i recommend to do this step by step.
so just open a new issue if you have further problems or need more functionality. i will close this one, otherwise it will get too big.
Hi, I have the requirement to trigger an "Intent based Navigation" from an ABAP2UI5 button press event to another SAPUI5 app. The class "sap.ushell.services.CrossApplicationNavigation" is used for the navigation. This works in an SAPUI5 freestyle app, but how can I implement this in the ABAP2UI5 framework?
https://sapui5.hana.ondemand.com/sdk/#/api/sap.ushell.services.CrossApplicationNavigation
Thanks, Axel