cancel
Showing results for 
Search instead for 
Did you mean: 

How to make batch processing in WebDynpro?

former_member185029
Active Contributor
0 Kudos

Hi all,

I am using RFC for connecting my webdynpro to the backend.

I am calling the RFC for saving every single data.

I want to reduce the RFC calls by having something like batch processing.

Can someone guide me, how is it possible using WebDynpro?

Thanks,

Ashutosh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ashuthosh,

What is the structure of your import and Export parameters of your RFC.

There are 2 ways to acheive it.

In the RFC either

1. Use a Table parameter

2. Use a Export Structure

If you use a Table parameter in your RFC then in your webdynpro when you import your adaptive RFC model you would get the Table as a class.

Assume your RFC/BAPI is called "Bapi_RFC_Insert"

write the code

Bapi_RFC_Insert in = new Bapi_RFC_Insert();

wdContext.nodeBAPI_RFC_Insert_InputElement().bind(in);

<TableName> <someName> = new <TableName>

<someName>.setTabValue1();

<someName>.setTabValue2();

in.add<>(<someName>);

This should pass values as a batch.

You can also do this using Export parameters. But a table is much better.

Let me know if you require more information.

regards

ravi

former_member185029
Active Contributor
0 Kudos

Hello Ravi,

I have already tried this option and it only updates / inserts 1st row.

The rest remains un-altered.

Thanks,

Ashutosh

Former Member
0 Kudos

Hi Ashutosh

If you use a table paramter, you can populate the sturcture with multiple records at a time and call the RFC.

Let me know your RFC structure so that i can give you a example.

Kishore

Former Member
0 Kudos

Hi

how are you having the data stored in your front end. If you can give the structure of your RFC then it will be easier to give you a sample code.

ravi

former_member185029
Active Contributor
0 Kudos

Hello,

Yes I am expecting a table structure from front end.

I am looping at the table in the RFC to save each row to the backend, but I am getting only 1st row updated / inserted in the backend.

Thanks,

Ashutosh

Former Member
0 Kudos

Hi Ashutosh

As every body suggested u need to have a Table Structure that accepts multiple records from front end and inserts into back end.

So if u have Table Structure

Then the code can be in following terms

1. Create a Value Node say VnSubmitData with Cardinality 0..n.

2. Store all the records in that alue Node vnSubmitData.

3. For Confirmation check the Size of the Value Node.

4. Then Loop the Value Node vnSubmitData.

5. Inside the Loop create everytime a new Instance of your Structure. For Example your Structure name is structAbc so inside the loop create an Instance like

structAbc structObject = new structAbc();

6. then u can use that object to store the data like

structObject.set<<Ur Values>>(wdContext.nodevnSubmitData().getVnSubmitDataElementAt(i).get<<ValueAttributeName>>();

7.Then Inside the Loop add the Structure to the Model Object say save is ur Model Object then say

save.addIt_<<ImportStructure>>(structObject);

8. Close the For Loop

then u can say save.execute();

Hope this Helps you

With Wishes

Krishna Kanth

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Generally .execute() method will take one record and executes the FM in the backend.

In your case the FM should take a collection as inputparamter so that before calling .execute() method in webdynpro you can pass a group as parameter.

Regards, VIP

Former Member
0 Kudos

Hi Ashutosh

If you can group the data that you are updating SAP,Then use table parameters in the RFC.

Let me know if you require any other help.

Kishore

former_member185029
Active Contributor
0 Kudos

Hello NagaKishor,

Can you please elaborate a little?

Thanks,

Ashutosh