cancel
Showing results for 
Search instead for 
Did you mean: 

Model fails to get the new data from R3

Former Member
0 Kudos

Hi All,

I am facing the issue with the new data comming from R3. I have some data in my view, I have to save those records in R3. I am doing the same, but I am failing to get the saved records comming from R3 when I refresh the page or application the new values are displaying.

Here are the steps I have followed to save the records

1) In wdDoInit of controller I am binding the model node

2) in execute method I am executing the "retrieve records bapi" to get the records

3)In view I am displaying those records. I have updated the records. I am calling "save records bapi" to save the records.

4) to refresh the new data again I am executing the "retrieve records bapi" method. But it is diplsaying the old data only.

My question is how to refresh the data comming from R3.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

When creating new RFC_input use WDModelScopeType.TASK_SCOPE in the constructor.

Aviad

Former Member
0 Kudos

I have given the same scope and aslo I tried with all the scopes the data is not refreshing is there any other way to get the new data.

Former Member
0 Kudos

Hi,

Have you invalidated the nodes after recalling the RFC?

Aviad

Former Member
0 Kudos

Hi,

I am invalidating the bapi output node.

Former Member
0 Kudos

Hi,

Try to invalidate <b>all</b> the child nodes of the output as well.

Aviad

Former Member
0 Kudos

Hi,

I have invalidated all the nodes parent and chld nodes, still I am facing the same issue. how to resolve the issue.

Former Member
0 Kudos

can u post the piece of code that u use and causing the problem

Former Member
0 Kudos

Hi,

Here is my code

1) code in wdDoInit

IWDComponent component = wdThis.wdGetAPI().getComponent();

try {

model = (ABC) WDModelFactory.getModelInstance(

ABC.class,

WDModelScopeType.TASK_SCOPE);

} catch (Exception e) {

}

wdContext.nodeSample_Bapi_Input().bind(

(Y_Sample_Bapi_Input) model.createModelObject( Y_Sample_Bapi_Input.class));

2) code in retrieve records method

IWDMessageManager manager = wdComponentAPI.getMessageManager();

try {

wdContext.currentSample_Bapi_InputElement().setI_Uname("user1");

wdContext.currentSample_Bapi_InputElement().modelObject().execute();

wdContext.nodeSample_Bapi_Output().invalidate();

wdContext.nodeSample_Bapi_Output().nodeTab_Data().invalidate();

} catch (WDDynamicRFCExecuteException e) {

manager.reportException(e.getMessage(), false);

}

3) code in save method

Y_Update_Sample_Bapi_Input input = new Y_Update_Sample_Bapi_Input();

wdContext.nodeUpdate_Sample_Input().bind(input);

IWDMessageManager manager = wdComponentAPI.getMessageManager();

try {

input.setI_Uname("user1");

input.setCountry(wdContext.currentSample_Bapi_Inputelement.getCountry());

input.execute();

wdContext.nodeUpdate_International_Output().invalidate();

wdContext.nodeUpdate_International_Output().nodeE_Return().invalidate();

}catch (WDDynamicRFCExecuteException e) {

manager.reportException(e.getMessage(), true);

}

I want to update the country. In my view I am displaying the countries in dropdown list, I can select country from the lsi I will update. When I refresh the page I am retrieve the updated country.

Former Member
0 Kudos

try the following coding:

1. in the other section


Y_Update_Sample_Bapi_Input RFCUpdate = new Y_Update_Sample_Bapi_Input(WDModelScopeType.TASK_SCOPE);

2. in wdDoInit


wdContext.nodeSample_Bapi_Input().bind(RFCUpdate);

3. In retrieve method


IWDMessageManager manager = wdComponentAPI.getMessageManager();
try {
RFCUpdate.setI_Uname("user1");
RFCUpdate.execute();
wdContext.nodeSample_Bapi_Output().invalidate();
wdContext.nodeSample_Bapi_Output().nodeTab_Data().invalidate(); 
} catch (WDDynamicRFCExecuteException e) {
manager.reportException(e.getMessage(), false);
}

4. In the save method


IWDMessageManager manager = wdComponentAPI.getMessageManager();

try {
RFCUpdate.setI_Uname("user1");
RFCUpdate.setCountry(wdContext.currentSample_Bapi_Inputelement.getCountry()); 
RFCUpdate.execute();
wdContext.nodeUpdate_International_Output().invalidate();
wdContext.nodeUpdate_International_Output().nodeE_Return().invalidate();
}catch (WDDynamicRFCExecuteException e) {
manager.reportException(e.getMessage(), true);
}

Former Member
0 Kudos

Thank you very much

Answers (0)