Let's follow up this discussion at the Neptune Community

(this forum will be kept in read-only mode)

How to call method of one app in another running in an iframe

I am running a Neptune app X with an iframe. In the iframe I am running another Neptune app Y. From app Y I want to call a method of app X. I could use window.parent.functionName() and it works only when the apps are running standalone. How to achieve the same when running apps in the launchpad? 


I can't make it global using sap.n in app X because app Y doesn't recognize sap.n functions as it is run in an iframe. Any ideas?


Thanks,


Radek


Hi Radek,


From my understanding, as you probably want (for performance reason) to avoid polling regularly the SAP back-end from your App Y to know if data has been updated after the POST request from the 3rd party has been processed, you may explore ABAP Messaging/Push Channels mechanisms if your SAP version and the web browers used allow to do it :


http://scn.sap.com/community/abap/connectivity/blog/2014/04/14/abap-channels-part-3-collaboration-scenario-using-abap-messaging-and-abap-push-channels


Your App Y would need to subscribe with a bit of JavaScript to an AMC channel that you create through the AMC/APC SAP framework, and when the POST request of the 3rd party is processed by SAP, you create a new subscription to the same AMC channel and send a message to the APC framework that will read in its ON_MESSAGE method and send a new message to the waiting App Y that will know that the data newly updated can be fetched online on the SAP server.


Unfortunately, I haven't done yet any AMC/APC implementation. Maybe other Community Members have some experience with it and could confirm that it could fulfill your request.


Best regards.



PEB



Yes this is true and I am aware of it but my case is slightly different. I need an iframe because in the iframe I am showing a 3rd party website. That 3rd party website will send some data using POST which can be captured on the server side. So I make the 3rd party website to open another Neptune app which retrieves the data on the seerver side and renders in the iframe hence I can't use AppCache.Load().


Thanks,


Radek

Thanks for this great interesting topic Radek and PEB !

I agree with both of you.


App Y which is inside the iframe will not see the scope of App X.  PEB's approach is super useful.  If using a Panel, please remember to set its height, otherwise you will not see App Y.


Thanks again, have a nice weekend!

Julian

Hello Radek,


You should use the "Embedded inside another App" capability from the launchpad with a parent container of type Panel (or HBox/VBo)x instead of an iframe for your App Y :


https://template.neptune-software.com/neptune/sdk/explored.html#doc00163EDC99661EE681FB2D0EC66D40DC


Best regards.



PEB

Login or Signup to post a comment