cancel
Showing results for 
Search instead for 
Did you mean: 

Refresh table with values from SAP RFC

Former Member
0 Kudos

Hello everyone,

I'm having problems trying to refresh a table with values that come from a SAP Remote function.

On my Init i do something like this:

wdContext.currentZ_Function_InputElement().setParam(param);

wdThis.wdGetFunctionController().executeZ_Function_Input();

Result: node wdcontext.nodeOutput().size() with elements = 5 (example)

The function controller is a simple "template->aplly->service controller->SAP model"

During initialization everything works fine.

But then, i process 2 of the lines outputed to the table (using another SAP function), and call this same function again.

I know that those 2 lines will not appear (i tried the sap function in R3 to verify) and that should be the right result.

Instead, the nodeOutput still returns exactly the same 5 elements. If i reinitialize the application, the calling of the SAP function returns the right result (3 elements). So, the problem must be some "invalidation" that i must do before calling the function again.

Can anyone help? (i hope i explained this right...)

Thank in advance,

Nuno Santos

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182372
Active Contributor
0 Kudos

Hi Nuno,

Call wdcontext.nodeOutput().invalidate() just after execute().

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Hi Maksim,

I allready tried doing that, but the problem persists. After calling the function for the second time, it returns the same elements as if none of them has been processed before.

Also, when i create a custom controller using the "apply->service controller", Netweaver automatically puts the invalidate method after the execute. Nevertheless, i tried "double invalidating", by doing the same in the code of my view, when i call the controler. Still the problem persists.

Any ideas? Thank you all.

Former Member
0 Kudos

We are facing the exact same problem. I know my RFC is getting called because if I close the browser and come back in, my updates are there.

Former Member
0 Kudos

Hi everyone,

Solved the problem on my own. In fact, it is not a web dynpro problem. What happens is that the rfc function executed in SAP R/3 needs some time to commit work on it's database. So, all i had to do was add a Thread.sleep(2000) for 2 seconds, and now everything works perfectly. I hope this helps your problem too, Karla.

Greetings to all of you,

Nuno Santos

Former Member
0 Kudos

Hi Nuno!

I guess you can be my hero today, if this works! I'm having the exact same problem and looking for a solution for quite a while.

But where and how do you exactly put that thread.sleep()? Can you give me some details on that? I would really appreciate!

Thanks,

Christian

Former Member
0 Kudos

Hi Christian,

I placed the Thread.sleep() just after executing the RFC function. In the sap function i have a subrc variable that returns 0 if ok, or other numbers if not ok. If 0 is returned, then proceed to the sleep. Nothing as simple as that.

Greetings,

Nuno Santos

Former Member
0 Kudos

Thanks for your reply Nuno,

I tried it the same way you wrote, but it unfortunatelly doesn't work for my case. It's actually the same you do, but the other way arround. I have a table and want to insert some lines. When I press "save" and go back to the table they wont show up. I have to refresh the Webdynpro for them to show up. The slepp() command didnt change anything to that.

How did you exactly call the Bapi the second time? Just calling the doInit() once more? Or anything different?

Thanks,

Christian

Former Member
0 Kudos

We solved the problem as well, but the sleep() did not work for us. The problem was much more complex. We were trying to create/update a record and then display a summary with the updated results. Our problem was that we had 1 model tied to the BAPI for create/update and a separate model tied to the BAPI to pull our summary. We were doing a buffer refresh after our create/update, but the buffer refresh was only occurring on our inputs. What we did was redefine our model to contain both the BAPI for create/update and the BAPI to pull our summary info. Once we did this, it fixed our problem because the buffer refresh occurred for everything within that model.

Joseph_BERTHE
Active Contributor
0 Kudos

Hi,

Could you explain me how to refresh the buffer of the model, cause I've the same problem.

Regards