Skip to Content
avatar image
Former Member

Null Pointer Exception : Help Needed

Hi there,

I am facing a strange NullPointer Exception in one of my objects. The strange part is that the same code is working on Quality and Production but throws up an error on the Development system. The code is as follows:

The method initSoldto() executes the RFC and then calls a method populateSalesArea() :

public void initSoldto( java.lang.String username )
  {
    //@@begin initSoldto()

		IWDMessageManager messageMgr = this.wdComponentAPI.getMessageManager();
		messageMgr.reportSuccess("testUser: " + username );

		Z_Sd_Mdr_Soldto_Input input = new Z_Sd_Mdr_Soldto_Input();
		Zsd_Mdr_Sold_To_Data inputData = new Zsd_Mdr_Sold_To_Data();
		inputData.setRfc_Command("INIT_FORM");
		inputData.setRequester(username);						
		input.setC_Soldto_Data(inputData);

		wdContext.nodeZ_Sd_Mdr_Soldto_Input().bind(input);

		try {

			wdContext
				.currentZ_Sd_Mdr_Soldto_InputElement()
				.modelObject()
				.execute();
			wdContext.nodeSoldToOutput().invalidate();
			wdContext.nodeC_Soldto_Data().invalidate();
		} catch (WDDynamicRFCExecuteException ex) {

			messageMgr.reportSuccess("did not execute: " + ex.getMessage());
		}

		this.populateSalesArea();

    //@@end
  }

The few initial lines of code for the method populateSalesArea() where the exception is getting thrown is as follows:

public void populateSalesArea( )
  {
    //@@begin populateSalesArea()

		IWDMessageManager messageMgr = this.wdComponentAPI.getMessageManager();

		Z_Sd_Mdr_Soldto_Input input = new Z_Sd_Mdr_Soldto_Input();

		input = wdContext.currentZ_Sd_Mdr_Soldto_InputElement().modelObject();

		
    
    
*//This is where the exception is being thrown*
		List dropInitialValues = input.getOutput().getT_Dropdown_Value();
		List dropSalesGroupValues = input.getOutput().getT_Sales_Group_Values();
		List dropSalesDistrictValues =
			input.getOutput().getT_Sales_Distr_Values();

Any help would be greatly appreciated. As discussed the exception is being thrown at the line

List dropInitialValues = input.getOutput().getT_Dropdown_Value();

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 09, 2008 at 11:21 AM

    Hi

    it seems like your RFC doesn't return a value. The result is that the node Output is null and you can't access the attributes in it --> NullPointerException.

    Try to execute your RFC directly in the backend with the same input values to check this.

    Regards,

    Martin

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      Make sure that the following line returns data.

      wdContext.currentZ_Sd_Mdr_Soldto_InputElement().modelObject().execute();

      wdContext.nodeSoldToOutput().invalidate();

      wdContext.nodeC_Soldto_Data().invalidate();

      Regards

      Ayyapparaj

  • avatar image
    Former Member
    Sep 09, 2008 at 11:20 AM

    Hi,

    The Problem is you are not getting data from R/3.

    Why don't you try with direct Output node?

    Try to print the value

    wdContext.nodeOuput().size();

    And check T_Dropdown_Value is null or not.

    If you want more help please give your node structure also.

    regards,

    Siva

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Siva,

      I too guessed the same. But, when I execute the RFC directly in SE 37 with the same parameters, it works fine and returns an output. That is where the confusion is.

      Regards,

      Tahzeeb.

  • avatar image
    Former Member
    Sep 09, 2008 at 11:54 AM

    Hi,

    is it possible, that the invalidate() method clears the return node directly after execute() method? What happens if you comment out the invalidate() calls?

    Regards,

    Martin

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Martin,

      I will try commenting the invalidate() calls. However, the same code works like a charm on the Quality and Production Servers???

  • avatar image
    Former Member
    Sep 09, 2008 at 12:06 PM

    Hi Tahzeeb,

    Can you check the model binding once and also try by commenting the invalidate( ) method calls.

    Regards

    Ramesh.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Guys,

      Thanks for all your inputs. I have resolved the issue. The user that was being used in the JCO destination for model data did not have authorization to execute the function group that contained my RFC. After configuring the destination with another user id, it works fine.

      Regards,

      Tahzeeb.