cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP Function call + strange behaviour

Former Member
0 Kudos

Hello Friends,

I am facing strange behaviour as follows:

I have three input fields with f4 help. I have set EVS in wdinit method of view. ( call RFC function to retrieve the table which i display as f4 help ). so far is okey,

Then some other businss logic implemented which will add more contents in table, thus I again call the RFC to retrieve the new records, ( and in debug mode I can see that the backend gave back the new records ) but when I read the output node, its empty...

any idea what I am doing wrong ?

its more or less same coading which i once call in wdinit, and later in one plugin method .....

Regards,

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

if it helps, i can past the coading here....

Regards,

Former Member
0 Kudos

Hi Shah,

Its better if u can paste the code.Apart from that what's the plugin method??

regards

Sumit

Former Member
0 Kudos

Okey, I am pasting my code:

public void wdDoInit() {

IWDAttributeInfo attribute_var = wdContext.getNodeInfo().getAttribute("varname");

ISimpleTypeModifiable fileName_var = attribute_var.getModifiableSimpleType();

IWDMessageManager msgMgr = this.wdThis.wdGetAPI().getComponent().getMessageManager();

Zport_Get_Tables_Input input = new Zport_Get_Tables_Input();

wdContext.nodeInput().bind(input);

Zport_Get_Variant_Input variant_input = new Zport_Get_Variant_Input();

wdContext.nodeZport_Get_Variant_Input().bind(variant_input);

variant_input.setClient(WDClientUser.getCurrentUser().getSAPUser().getJobTitle()); variant_input.setPuser(WDClientUser.getCurrentUser().getSAPUser().getUniqueName().toUpperCase());

try {

wdContext.nodeZport_Get_Variant_Input().currentZport_Get_Variant_InputElement().modelObject().execute();

} catch (Exception e) {

msgMgr.reportWarning("Files not available.");

}

fileName_var.setFieldLabel("varname");

IModifiableSimpleValueSet valueSet2 = fileName_var.getSVServices().getModifiableSimpleValueSet();

msgMgr.reportSuccess("SIZE-before" + wdContext.nodeVartab().size());

for (int i = 0; i < wdContext.nodeVartab().size(); i++)

{

valueSet2.put(wdContext.nodeVartab().getVartabElementAt(i).getVarname(), wdContext.nodeVartab().getVartabElementAt(i).getVarname());

}

valueSet2.sort(true, true , true);

Till here works fine, and my wdContext.nodeVartab() is filled with the table I retrieved from back end system.

Then control goes to other view, and some changes happens in the backend table, from other view I come back in this view agian, and in plugin method then I do the same code again, and after excuting the bapi, my nodeVatrab is still empty...

But before It works fine, and in plugin method I did something like this

wdContext.nodeVartab().clearSelection() ( the intention behind was to refresh the node and as I did not find any method refresh or clear, I just tried this method )

But to my surprise in wdDoinit method after executing the bapi the node if filled, but when I try now in plugin method or in some other method it empty...

I gave another try, and i.e. from plugin method I again called wdDoinit method, in debug mode I can see the control goes to this method, but again the node was empty. ( only first time when wdDoInit method executes the node is going to be filled )

PLS HLEP !!!!!

Regards,

Former Member
0 Kudos

Hi Shah H,

Do one thing, while you return back to the first view write your code to execute the BAPI in the wdDoModifyView and instead of clearing the node invalidate the node.

Regards,

Murtuza

former_member182294
Active Contributor
0 Kudos

Shah,

You should call the wdInit() method programatically.

- Move your code to a method and call that method from wdIniti() and onPlug so that always you are using same code. The other thing I found in your code is, you should invalidate the nodes then only new data is refreshed.

Add the following after executing the BAPI:

try

{

wdContext.nodeZport_Get_Variant_Input().currentZport_Get_Variant_InputElement().modelObject().execute();

<b>wdContext.nodeVartab().invalidate();</b>

}

Regards

Abhilash

catch (Exception e) {

msgMgr.reportWarning("Files not available.");

}

Former Member
0 Kudos

okey, atleast one things works for me now,

from plugin method I called again wdDoInit method ( i know its not good way ) but I did for test purpose and this time the node is filled,

Okey, I will try to invalidate the node and see if it works for me ?

By the way what is the reason behind this that we have to invalidate the code ?

Regards,

Former Member
0 Kudos

No unfortunatelly, even after invalidating the node, it did not get refreshed and did not show me the new values ..... Any idea what I am doing wronge ?

Regards,

Former Member
0 Kudos

Right now from my plugin method I am calling wdDoInit () method again, and then it takes the newly added values into the output node, I know this is not the right approach, and what I do not understand is why in my plugin method it did not takes the new values ( pls note these values I am assigning to the f4 help to my input field )

Any suggestions for me ?

Regards,

former_member182294
Active Contributor
0 Kudos

What is your output node? What code you have written in your plug in method.

If your wdInit() code works, then move it to some new method and call the same method from wdInit() and plug in method.

Regards

Abhilash

Former Member
0 Kudos

Hello,

This is my output node wdContext.nodeVartab()......

dont know why not it get refreshed in plug in method, in wdDoinit it also did not work as I expected, but atleast after executing, it retrieve the new added contents..

Regards,