cancel
Showing results for 
Search instead for 
Did you mean: 

Invalidate()

Former Member
0 Kudos

Hi,

I have an assignment where I have to pass employee number to the BAPI and get information regarding employee and display at front end.

There is a input field where User enters emp number and press enter. In the onEnter event I wrote code for executing the model and passing emp number as input to the BAPI.

It is working fine for the first time. When User enters another number in the input field and press enter, then the values are not changing. I use the Invalidate() function for refreshing the node. but ! even though I could not get the result.

see the below my code.

public void onActionimplementGO(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionimplementGO(ServerEvent)
       
        
        String emp = wdContext.currentContextElement().getEmpNumber();
        wdContext.currentZhr_Empdata_Get_InputElement().setPernr(emp);
        wdContext.clearSelection();
        wdContext.invalidate();
         
		 wdThis.wdGetPersonalComponentController().executeZhr_Empdata_Get_Input();
		
		 
		 wdComponentAPI.getMessageManager().reportSuccess(wdContext.currentOutputElement().getFname());
		 
		
	    
    //@@end
  }

please help

thanks

Jyothi

Accepted Solutions (1)

Accepted Solutions (1)

former_member192434
Active Contributor
0 Kudos

Hi Jyothi,

It seems that your invalidate () method is not getting called properly.

You need to Invalidate () node before excuting the BAPI, then it will

get refershed after hitting the action button every time.

Regards

Anup

Answers (6)

Answers (6)

0 Kudos

Jyothi,

You need to invalidate your model node's Output node only after the RFC call is executed. I'm afraid that your Model object is getting fresh data every time but is not being populated in your Model node because invalidation is not being done properly. Try replacing your code with this.


public void onActionimplementGO(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionimplementGO(ServerEvent)
       
        
        String emp = wdContext.currentContextElement().getEmpNumber();
        wdContext.currentZhr_Empdata_Get_InputElement().setPernr(emp);
        wdContext.clearSelection();
        wdThis.wdGetPersonalComponentController().executeZhr_Empdata_Get_Input();
       
        wdContext.node{model}_Output.invalidate() 
	
        wdComponentAPI.getMessageManager().reportSuccess(wdContext.currentOutputElement().getFname());
		 
		
	    
    //@@end
  }

Hope this helps.

Vishwas

amolgupta
Active Contributor
0 Kudos

hi,

comment out the invalidate() call.

simply set the context to null values or "".

you are invalidating the context i.e. destryoying the context object.

regards,

-amol

lokesh_kamana
Active Contributor
0 Kudos

Hi,

i think the wrong with ur code is ur invalidating the whole context.

But you have to invalidate the node in which your getting and all the sub nodes in it.

if you could explain me the context structure i could explain yopu the code more in detail .

Thanks & regards,

Lokesh

Former Member
0 Kudos

hi,

go to implementation of executeZhr_Empdata_Get_Input() in the component controller

and compare your code with below one.

observe the underline statement.

IWDMessageManager manager = wdComponentAPI.getMessageManager();

try

{

wdContext.currentZhr_Empdata_Get_InputElement().modelObject().execute();

// nodeOutput is node belongs to this rfc only.

wdContext.nodeOutput().invalidate();

}

catch(WDDynamicRFCExecuteException e)

{

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

}

Regards,

ramesh

Former Member
0 Kudos

Hi Jyothi

After executing the Bapi method then set the value of the input field to NULL or else make it NULL in the init() method of that view controller.

String emp = wdContext.currentContextElement().getEmpNumber();

wdContext.currentZhr_Empdata_Get_InputElement().setPernr(emp);

wdThis.wdGetPersonalComponentController().executeZhr_Empdata_Get_Input();

wdContext.currentZhr_Empdata_Get_InputElement().setPernr(NULL);

Try this if any queries then reply the post.

Thanks & Regards,

Yusuf.

0 Kudos

Hi Jyoti,

After executing RFC [ ie. after .....execute() in executeZhr_Empdata_Get_Input() ], add

wdContext.nodeOutput().invalidate(); (Output is the Output node present in Model node) in executeZhr_Empdata_Get_Input() method.

If it is not working, delete

<Bapi..>_Input input=new <Bapi..>_Input();

wdContext.node<Bapi..>_Input().bind(input);

from init of controller and put it inside executeZhr_Empdata_Get_Input() method

Regards,

Fahad Hamsa