Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

RFC-BAPI to replace Cognos with BW for JAVA client - URGENT!

Former Member
0 Kudos

Hello Experts,

Not sure how to explain the issue as I am a complete novice in this area. The vendor uses Java application and generates its reports using Cognos as its reporting tool. Now they wanted to call the reports from BW. How to achieve this? How to write RFC's to call the queries from BW side. I am a BW developer, so know to write queries and build reports but how can these reports be called into Java?? Can you guys just give me a small example to follow? Example the vendor was writing some views to pull the fields from the tables and built their reports, so how to go ahead from SAP BW perspective.

Please help me as this is very crucial.

Thanks, any kind of help would be greatly appreciated.

Sree

Message was edited by: Nikki

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Well, first you need to write your RFC enabled function module which will gather up all the required data. I've never worked with BW, but I was under the assumption that it is pretty close to R/3. Meaning that it is written in ABAP and that you can create an RFC enabled function module. In the SAP enterprise portal, we use something called jCo to call the RFC from the java side. This is the java connector. Its really just a bunch of java classes that allow you to get a connection to an SAP system. In your java application, you would want to leverage this existing jCo code to make your connection to BW.

Regards,

Rich Heilman

12 REPLIES 12

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Well, first you need to write your RFC enabled function module which will gather up all the required data. I've never worked with BW, but I was under the assumption that it is pretty close to R/3. Meaning that it is written in ABAP and that you can create an RFC enabled function module. In the SAP enterprise portal, we use something called jCo to call the RFC from the java side. This is the java connector. Its really just a bunch of java classes that allow you to get a connection to an SAP system. In your java application, you would want to leverage this existing jCo code to make your connection to BW.

Regards,

Rich Heilman

0 Kudos

Hello Rich,

Thanks a lot for the imp briefing. From an SAP perspective what are the steps I need to follow to write an RFC enabled function module.

Example: this was the view they created to pull the customer info from an other source into Websphere--->

CREATE OR REPLACE FORCE VIEW XYZ.GETCUSTOMERS

(CUSTOMER_SID, CUSTOMER_NAME, CUSTOMER_NO, BUSINESS)

AS

SELECT

distinct C.Customer_SID CUSTOMER_SID,

C.COUNTRY_NM CUSTOMER_NAME,

LTRIM (C.Customer_No, '0000000') CUSTOMER_NO

FROM

Customer C,

HPD_Cust_Partner HCP

WHERE

C.Customer_No = HCP.Customer_No And

C.Distrib_Chn1_CD = 'AG'

ORDER BY CUSTOMER_NAME;

Every helpful answer would be well rewarded and would be of great help to me. Transaction codes to write the RFC's and simple example with steps plzzz

Nikki

0 Kudos

Yikes.... Interesting code. I can guide you thru creating an RFC enabled function module, but it will do you no good if you can't call it.

Go to transaction code SE80.

In the top left hand corner of SE80 is a list box, pull this down and select function group. Now type in the function group name, start with customer name space Z. Double click the name, system will ask you if you want to create it, say yes. Now you have a function group. You can now create function modules in this function group. Right click on function modules and choose Create. Enter the name of the function module. Use customer name space Z_. Enter description. Now you have function module. Now double click the function module name. On the attributes tab of the function module under processing type, select remote enabled.

Enter your importing exporting parameters and write your source code. That's it.

Regards,

Rich Heilman

0 Kudos

Hello Rich,

Thanks for the steps, do I need the developer key to create the function module? If so I need to ask for one. Are you saying that we won't be successful in calling the RFC from Java? thirdly could you just brief up on the import and export parameters you are talking about. Example: Sales Data

we have these fields from colums -

DOCUMENT_NO VARCHAR2 (10) NOT NULL

DOCUMENT_ITEM_NO VARCHAR2 (6) NOT NULL

CUSTOMER_SID NUMBER NOT NULL

etc

sorry, probably these are very basic questions but it would be great if you don't mind helping me out. I could be a fast learner :).

Nikki

0 Kudos

Yes, you do need a developer key. Are you sure that you have everything that you need on the java side to call this RFC function module? I think that there may be other ways of calling the RFC from java without the jCo, but I'm not sure.

The importing parameters will be what the function module will use to get the data, the export parmaters will be what you want in return. Most likly in this case it will be a table and you can pass that in your exporting parameters or in your tables paramters. So you need to ask yourself, 1) what does this function module need to get me the correct data. 2) what data do I want in return.

For example. I need to write a function module which will retrieve purchase order data. An importing parameter will be the purchase order number. An exporting parameter will likely be a table type of the line item structure.

Regards,

Rich Heilman

0 Kudos

Hello Rich,

Thanks a lot for all the help. I didn't get the developer key yet but meanwhile would just like to know how to define the parameters since mine is from a BW side. Ex: on the java application there is a field called Invoice date and on BW it is 0BILL_DATE. Can you just send me one sample of import,export and source code example.

Nikki

0 Kudos

Here is sample function module, the first part shows the interface.

In the paramters can be typed as anything in the dictionary.



*"----------------------------------------------------------------------
*"Lokale Schnittstelle:
*"       IMPORTING
*"             INPUT
*"       EXPORTING
*"             OUTPUT
*"----------------------------------------------------------------------

  CALL 'CONVERSION_EXIT_ALPHA_INPUT'  ID 'INPUT'  FIELD INPUT
                                      ID 'OUTPUT' FIELD OUTPUT.

ENDFUNCTION.


Regards,

Rich Heilman

0 Kudos

Hello Rich,

Thanks again. So once the input and output parameters are defined and the source code written, nothing is done on SAP side but on the java side a program is written to connect it to the SAP . I read in one of the forums :

"nothing has to be done on SAP side to use JCo to connect to SAP. In Netweaver developer studio-create a java project and give the package name, name for class, host name, system #, client, logon name, password, language which then takes to a screen where one can select BAPI or function module to be used. "

Is that right? Do I need to define the destination of the RFC server i.e. in SM59 or nothing is done other than creating a function module with attributes, parameters and source code defined??

Please let me know your valuable thoughts.

Thanks,

Nikki

0 Kudos

Once you have your RFC function module working, nothing else needs to be done on the ABAP side. On the java side, there are a few ways to call this RFC. You can "hand write" the connection which I would not recommend, I think that in NWDS, there is a wizard which will walk you thru it, not sure though, or in webdynpro project, you create a model for the RFC call.

Regards,

Rich Heilman

0 Kudos

Hello Rich,

I am a BW person so wanted to do whatever I can from SAP side, so when you are saying ABAP side I am assuming that it is from the SAP side. Coming to the netweaver developer studio is that a java application or somewhere linked to SAP. I mean as a BW person heard this a lot but not sure where I could see the screen, I mean is it a separate add-on.

Let me know.

Thanks

Nikki

0 Kudos

Really, its all SAP, so I didn't want to say that "its all done on the SAP side" In SAP, there are two worlds. ABAP and JAVA. ABAP development happens in SE80 on an R/3 system and I'm assuming on a BW system as well. NWDS is an appliation which runs on your local machine. It is based on the open source Elipse developed by IBM. SAP has taken it and added a bunch of stuff and turned it into the Netweaver Development Studio. This is where you develop your java based applications. It can be download from the service marketplace.

Regards,

Rich Heilman

0 Kudos

Rich,

Thanks a ton for all the help. Would like to take more help once I get the developer key and start working on the source code.

Nikki