cancel
Showing results for 
Search instead for 
Did you mean: 

How to read table of records from RFC

Former Member
0 Kudos

Hi,

My requirement is to read multiple records(800) from RFC 1 and pass the same records to RFC 2 as input(AbstractList).

Please suggest how to achieve this ??

Thanks,

vijay.

Accepted Solutions (0)

Answers (2)

Answers (2)

p330068
Active Contributor
0 Kudos

This message was moderated.

former_member182598
Active Contributor
0 Kudos

Why do you want to make two RFC calls? One to read parameters and another to pass parameters

Write a wrapper RFC which calls RFC1 to get your 800 records and passes them to the second RFC and returns the final result to WebDYnpro. This will increase the performance of your application manifold.

Thanks

Prashant

Former Member
0 Kudos

Hi prashant,

your answer is very generic, can you be a bit specific..........

can you share with few lines of code as an example.

Thanks

vijay

former_member182598
Active Contributor
0 Kudos

Hi Vijay,

The answer can only be as specific as the question is.!! Without knowing what your RFC does and what is it's signature how can someone write a code for you.

By the way what code you want..? I trust that you can write a ZRFC in which you can call 2 function modules.

What I want to highlight is calling 2 RFC from Web DYnpro is not a good idea. You better combine the functionality in one z RFC and call that from the Web Dynpro side.

If you are fcaing problems with calling a RFC which returns a table. you can import the example project TutWD_FlightList which is available in C:\Program Files\SAP\IDE\IDE70\eclipse\examples, the path may vary depending on the installation drive and NWDS version.

Thanks

Prashant

Former Member
0 Kudos

Hi,

I'll share the code for RFC 1 & RFC 2

Code for RFC 1

Zbapi_event_name input= new Zbapi_event_name();

input.setUser("name");

wdContext.nodeZbapi_event_name().bind(input);

// we use the normal execute statement over here

wdContext.nodeZbapi_event_name.nodeOutput().nodeResult_Objec1(); // returns all table records

code for RFC 2

Zbapi_event_data data= new Zbapi_event_data();

data.setUser("ss");

data.addPerners(Object); // we have a method accepts argument as Object

data.setPerners(Abstractlist); // we have a method which accepts the argument as Abstractlist

// we are stuck at this step , how to transform the data from RFC 1 to RFC 2

wdContext.nodeZbapi_event_data().bind(data);

// we use the normal execute statement over here

Please suggest.......

Thanks

vijay

former_member182598
Active Contributor
0 Kudos

Hi Vijay,

It's difficult to suggest anything without looking at the dictionary classes that are getting generated.

If you are comfortable and have it in local project you may send the project to the address mentioned in my business card.

I should be able to suggest you the snippet.

Thanks

Prashant

Former Member
0 Kudos

Hi Vijay,

If I have understood your problem correctly, you are being to retrive the data from rfc1 but not being able to send it to rfc 2.

If thats correct, i will suggest a small modification in the sample code you provided.

Zbapi_event_data data= new Zbapi_event_data();

data.setUser("ss");

loop at the records obatined from rfc1

{

data.addPerners(Object); // we have a method accepts argument as Object

//here u add the relevant part from the records to the perners object

}

wdContext.nodeZbapi_event_data().bind(data);

//execute rfc 2

Try this and let me know if you face any more problems.

Regards,

Sattam

Former Member
0 Kudos

Hi Vijay,

To create the AbstractList, you need to use:

com.sap.aii.proxy.framework.core.AbstractList

Create the list and then retrieve the values from the RFC1. you will be able to retrieve the values like this:

wdContext.nodeZbapi_event_name.nodeOutput().get{whatever the abstract list name is that is coming from the RFC}

To set the input to RFC2:

Create a list and then create the object of the type that needs to go into the list and set your values. You can then add it to the abstract list and set the abstract list to the main RFC input. This should solve it.

Thanks & Regards,

Vaishnavi