cancel
Showing results for 
Search instead for 
Did you mean: 

method in custom controller not getting called from view

Former Member
0 Kudos

Hi experts,

I have a very strange problem. My web dynpro application works fine on the development portal. i am in the process of deploying to the production portal there is no issue it deploys perfectly without any problems. However i have noticed that some methods in my custom controlller which are called from the view do not run. there is no error message or anything data just doesnt get picked because the execute function which fills the context are in the custom controller methods.

For some reason the method in the custom controller does not get called even though i'm calling it for the view. I have this problem with two methods. the other methods work without any issue.

Now i overwrote what i have on production at the moment so am stuck and in need for a solution.

I have tried undeplying, restarting and re-deploying to no avail. what could be wrong?

thanks and regards,

dilanke

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Try using messages on every call to see where exactly the issue is.

Former Member
0 Kudos

Thanks for the quick response.

I already tried that. I put in messages before and after the calling of the method and one inside of the method right on top.

The messages before and after the call get printed but the message inside the method doesnt get printed. hence why i assumed that it doesnt go inside the method.

thanks and regards,

dilanke

Former Member
0 Kudos

Are the messages inside are the first thing you execute?

Have you defined the message manager there?

chander_kararia4
Contributor
0 Kudos

Hi Dilanke,

If no issues, could you please provide the snapshot of your code. This is not a strange problem. Its just that you might have mis coded the try catch block. May be your dev server is supporting those features but not the production server.

Have you tested your application with all the test cases (Exception handling) this could be the prominent reason. Just Check & provide code if suits you. Thanks.

Best Regards

Chander Kararia

Former Member
0 Kudos

Deal all

This is the code. basically im calling it from the plug on the detail screen.

This is the method that doesnt get called anymore.

wdThis.wdGetGetPurchaseOrderCustController().getPODetail();

The reportSuccess() works fine.

regards,

Dilanke


  public void onPlugFromListView(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onPlugFromListView(ServerEvent)
	try
	{
	    String po = wdThis.wdGetGetPurchaseOrderCustController().wdGetContext().currentContextElement().getPO_Id();


		wdContext.currentZGETPODETAILS_INPUTElement().setI_Ebeln(po);
		wdThis.wdGetGetPurchaseOrderCustController().getPODetail();
		wdComponentAPI.getMessageManager().reportSuccess(po);

		String fileName = "F://XML_Downloads//" + po + ".xml";
		IWDResource resource = WDResourceFactory.createResource(new FileInputStream(new File(fileName)),fileName,WDWebResourceType.XML,true);
		wdContext.currentContextElement().setXml_Resource(resource);
	
	}
	catch(Exception e)
	{
		e.printStackTrace();	
	}
    
    //@@end
  }

Former Member
0 Kudos

Do you have messages in getPODetail ?

Former Member
0 Kudos

yes i do but it doesnt get printed. the message is right on top as well. can it be because im calling it from the plug? Like i said it works fine on the dev this way though.

Former Member
0 Kudos

In DEV do you see all the messages?

Is the code in the method surrounded by try and catch?

Former Member
0 Kudos

Hi experts,

I still have this issue. only thing now it got worse as now when i deployed to thedev box the dev box also came up with the same issue. I tested it and realized that the custom controller methods do not get called at all even within the controller.

I get the following exception when calling a method in the custom controller.

java.lang.NullPointerException

at com.sap.getpurchaseordercomp.GetPurchaseOrderCust.test(GetPurchaseOrderCust.java:627)

at com.sap.getpurchaseordercomp.GetPurchaseOrderCust.wdDoInit(GetPurchaseOrderCust.java:124)

at com.sap.getpurchaseordercomp.wdp.InternalGetPurchaseOrderCust.wdDoInit(InternalGetPurchaseOrderCust.java:500)

at com.sap.tc.webdynpro.progmodel.generation.DelegatingCustomController.doInit(DelegatingCustomController.java:73)

basically it says cannot find the method. This holds true for both declared methods as well as custom methods. I have no idea why. I have tried undeploying and reploying to no avail. so something is obviously wrong with the custom controller. Thinking of creating another custom controller and moving the code and context to that but that is also alot of work.

any suggestions?

thanks and regards

dilanke

Former Member
0 Kudos

Can you post your code in GetPurchaseOrderCust - Show us the method (test) which has line number 627 in it and wdDoInit.

Former Member
0 Kudos

The code,

wdDoInit -



  public void wdDoInit()
  {
    //@@begin wdDoInit()
    test();
    Zgetpodata_Input Head_Input = new Zgetpodata_Input();
    wdContext.nodeZGETPODATA_INPUT().bind(Head_Input);
    
	Det_Input = new Zgetpodetails_Input();
	wdContext.nodeZGETPODETAILS_INPUT().bind(Det_Input);
    
    //@@end
  }

and the calling function. test(). This is just a test function to see if it gets called.


  public void test()
  {
  	mgr.reportSuccess("success");	
  }  

I didnt post the entire code as it is quite long.

This results in a runtime error. There are no errors when building. it just falls over when running.

regards,

dilanke

Former Member
0 Kudos

Where do you initialize "mgr"?

Former Member
0 Kudos

Hi,

Are you executing any webservice in the method?

Regards,

Gayathri

Former Member
0 Kudos

Brilliant!!!!!.

Aviant You solved my problem. Unbelievable how one line of deleted code can change the whole application. I was clearinig the test messages and looks like i deleted the instantiation of the message manager.

thank you all for taking time to help me out.

Edited by: Dilanke Hettiaratchi on Sep 23, 2009 3:11 PM

Answers (2)

Answers (2)

Former Member
0 Kudos

Use the debugger. Maybe an exception is thrown and not handled correctly by your application.

Armin

susmita_panigrahi
Active Participant
0 Kudos

Hi

it seems that the control is not going inside the method as the message inside the method is not printed.

1.Try the following to test,

In the WdDoInit() method of controller call the method like getData(); and later in the below code define the method.

2. If pont 1 is not working try to define the code inside //@begin others, this line you will get at the end of code

//@@begin others

//@@end

Thanks

Susmita