cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 application calling RFC directly

Former Member
0 Kudos

Is there a way for an SAPUI5 application to consume an RFC directly? if not perhaps a SOAP web service? 

Accepted Solutions (1)

Accepted Solutions (1)

cesar_at_sap
Advisor
Advisor
0 Kudos

Hi Kelly,

I posted this today in order to explain the code Gavin is referring to:

http://scn.sap.com/community/abap/connectivity/blog/2013/03/05/json-adapter-for-abap-function-module...

That could be what you're looking for.

Cheers,

      César.

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Guys,

I want to pass some parameters to WSDL service from SAPUI5 interface. Can somebody tell me how to do this. Thanks and best regards.

Fahad

Former Member
0 Kudos

Much easier way is to use the standard SICF service /sap/bc/soap/rfc . It 'wraps' function modules, and converts the parameters to and from SOAP. Fairly easy to use jQuery to extract the results too.

Not well documented!

It's not perfect, but it's standard, needs no additional code, and works.

Jon

Former Member
0 Kudos

It's not quite as easy as you think, but it's possible.

https://cw.sdn.sap.com/cw/groups/json-adapter-for-abap-function-modules

You should convert your RFC to a REST-based web service. Then use AJAX to call it. You will need to consider security and SSO though.

Former Member
0 Kudos

Hi,

SAPUI5 is in its core a HTML5+ Javascript framework.

So if you want to consume an RFC, you need to have a javascript framework which allows this.

I do not believe such a framework exist.

If your SAPUI5 application is running on a Java based web application server (such as SAP NW Java AS or ), then it is possible to use the JCO java library to perform the connection on the server side. Then you could include the data through a JSP as @Abilash gamp suggest, or you could expose a REST API for sapui5 to easily consume (with JSONModel).

It is possible to call webservices from Javascript but it is not a common practice.

See this stackoverflow thread for more information http://stackoverflow.com/questions/124269/simplest-soap-example-using-javascript

After executing the webservice from javascript, you should create a JSONModel or an XMLModel with the contents of the response.

Regards

Dagfinn

0 Kudos

Hi Dagfinn,

What would it be the best way to get information from sap ecc and show it with sapui5 ? For ex; i want to show an sap report to multiple touchpad users ?

Thanks in advance,

Yasin,

koehntopp
Product and Topic Expert
Product and Topic Expert
0 Kudos

Intranet or Internet scenario...?

Frank.

0 Kudos

Hi Frank,

Thanks for your response,

Intranet for now, i do not know if there is any future plan for internet,

Regards,

Yasin

koehntopp
Product and Topic Expert
Product and Topic Expert
0 Kudos

Well, in that case there is no security issue (or only a minor one) by exposing ERP data through web services to mobile devices.

However, I would still consider such an implementation a 'hack' - Mobile is going to be a huge force in the coming years, so my advice would be to think about a long term mobile strategy for the company/customer and _then_ decide on the technology.

hofmann
Active Contributor
0 Kudos

Even with Intranet use case, exposing a BAPI as a WS so that a HTML5 app can consume it, ... no, I don't think that's a good idea. I would use the portal to expose the BAPI in [whateveryouwant], adding security and role based access to the mix.

Keeps licensing issues down to a minimum, you can get HTML5 apps (online / phonegap'ed) and watch from the sideline which mobile technology from SAP will survive will be considered enterprise ready

SandipAgarwalla
Active Contributor
0 Kudos

Yasin

I came across this article today..webrfc

http://scn.sap.com/community/netweaver-as/blog/2012/08/07/webrfc--simply-calling-an-rfc-from-javascr...

but Not sure if this is relevant today and what are the risks with it..you may want to check it out.

Sandip

0 Kudos

Thanks Sandip,

Regards,

Yasin

former_member182294
Active Contributor
0 Kudos

Hi Kelly,

You can use JSP with SAPUI5 library to call a Web Service or RFC i.e., traditional way.

Thanks

Abhilash

Former Member
0 Kudos

There is a standard SOAP wrapper for RFC function modules. It is service /sap/bc/soap/rfc, and the main parameter is services, which names the function to call.

You need to activate it transaction SICF, and call it with a SOAP call (i.e. not just with a URL). It's good for simple calls - some things (like commits) get a little more complex (there is a parameter session_mode to tell SAP whether to start a new session).

Former Member
0 Kudos

Hi

I am using the following code to call the jsp page:

                                                $.ajax({

                                                      url : "test.jsp",

                                                      data : "{'name':'abc','age':'20'}",

                                                      contentType : "application/json",

                                                      type : "POST",

                                                      success : function(json) {

                                                      alert("Hi, there is no problem!");

                                                      },

                                                      error : function(xhr, status) {

                                                      alert("Sorry, there was a problem!");

                                                      },

                                                      complete : function(xhr,status) {

                                                      alert("The request is complete!");

                                                      }

                                                    })

I am getting the following error :

500 (Unable to compile class for JSP  Generated servlet error: org.apache.jasper.runtime.HttpJspBase cannot be resolved to a type  Generated servlet error: org.apache.jasper.runtime.JspSourceDependent cannot be resolved to a type  Generated servlet error: The method getPageContext(Servlet, ServletRequest, ServletResponse, String, boolean, int, boolean) in the type JspFactory is not applicable for the arguments (test_jsp, HttpServletRequest, HttpServletResponse, null, boolean, int, boolean))

Please help. I am using NWDS (NetWeaverDevelopmentStudio) and running on localhost.

Thanks

Preety