cancel
Showing results for 
Search instead for 
Did you mean: 

ErrorStack Trace while creating DialogBoxes

Former Member
0 Kudos

Hi all,

I am trying to implement the pdf (Handling Transactions with BAPIs in Web Dynpro)It is giving an error while creating DialgBoxes

The error is

Error stacktrace:

java.lang.NullPointerException

at com.sap.tc.webdynpro.clientserver.window.ConfirmationDialogDelegate.<init>(ConfirmationDialogDelegate.java:58)

at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.createConfirmationWindow(ClientComponent.java:926)

at com.sap.tut.webdynpro.tutorial.FlightBookingView.onActionBookFlight(FlightBookingView.java:169)

at com.sap.tut.webdynpro.tutorial.wdp.InternalFlightBookingView.wdInvokeEventHandler(InternalFlightBookingView.java:280)

at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)

at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleAction(WebDynproMainTask.java:100)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleActionEvent(WebDynproMainTask.java:299)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:635)

The code of BookFligh method is


 public void onActionBookFlight(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionBookFlight(ServerEvent)
	wdContext.currentBapi_Flight_Checkavailibility_InputElement().setAirlineid(wdContext.currentBooking_DataElement().getAirlineid());
	wdContext.currentBapi_Flight_Checkavailibility_InputElement().setConnectionid( wdContext.currentBooking_DataElement().getConnectid());
	wdContext.currentBapi_Flight_Checkavailibility_InputElement().setFlightdate( wdContext.currentBooking_DataElement().getFlightdate());
    wdThis.wdGetFlightBookingCustController().executebapi_CheckAvailibility();
    if(wdContext.currentReturnElement().getType().equals("S"))
    {
		IWDConfirmationDialog dialog;
		String dialogText="The Flight Is available";
		dialog=wdComponentAPI.getWindowManager().createConfirmationWindow(dialogText,
		                 wdControllerAPI.getControllerInfo().findInEventHandlers("Reserve"),"Reserve Flight");
		dialog.addChoice(wdControllerAPI.getControllerInfo().findInEventHandlers("Book"),"Book Flight");
		dialog.addChoice(wdControllerAPI.getControllerInfo().findInEventHandlers("Cancel"),"Cancel Flight");
    	dialog.open();
    }
    else
    {
		wdComponentAPI.getMessageManager().reportSuccess("Type val is"+wdContext.currentReturnElement().getType());
		wdComponentAPI.getMessageManager().reportWarning("The Flight is not booked"+
		                                                 wdContext.currentReturnElement().getMessage());
    }
    
    //@@end
  }

Can anyone tell me where the error is???

Regards

Padma

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Padma,

Just confirm that the name of the event handler is exactly the same(case sesitive);

If it's same then try this option it is actually the same what you wrote down but you can give it a try

wdControllerAPI.getViewInfo().getViewController().findInEventHandlers("Reserve");

Regards,

Murtuza

Former Member
0 Kudos

Hi,

It is giving error at line 169 of Bookingviewjava" menas at


dialog=wdComponentAPI.getWindowManager().createConfirmationWindow(dialogText,

The following code is


                 wdControllerAPI.getViewInfo().getViewController().findInEventHandlers("Reserve"),"Reserve Flight");
		dialog.addChoice(wdControllerAPI.getControllerInfo().findInEventHandlers("Book"),"Book Flight");
		dialog.addChoice(wdControllerAPI.getControllerInfo().findInEventHandlers("Cancel"),"Cancel Flight");
    	dialog.open();
    }
    else
    {
		wdComponentAPI.getMessageManager().reportSuccess("Type val is"+wdContext.currentReturnElement().getType());
		wdComponentAPI.getMessageManager().reportWarning("The Flight is not booked"+
		                                                 wdContext.currentReturnElement().getMessage());
    }
    
    //@@end
  }

Regards
Padma

former_member185029
Active Contributor
0 Kudos

Hi,

You will have to define Event handlers.

Go to Methods tab and create new event handlers named Reserve, Book and Cancel

Ashu

Former Member
0 Kudos

Hi Padma,

I am sure you are providing wrong event handler name.

As i tried providing wrong event handler name and it resulted in the same error.

Goto Methods tab in your WD view and check the name of your EventHandler.

It should be exactly same (case sensitive too).

Regards,

Murtuza

Former Member
0 Kudos

Hi,

I creatd actions for Book,Reserve,Cancel,BookFlight .So the corrosponding eventHandlers also got generated.

I am not getting where the mistake is??

Regards

Padma

Former Member
0 Kudos

Your action and eventhandler will not have the same name

so for Reserve it would be OnActionReserve... and same for others.

Provide these names and you are done.

Regards,

Murtuza

Former Member
0 Kudos

Hi,

I created actions called

<b>Name EventHandler Text</b>

Book onActionBook Book

BookFlight onActionBookFlight BookFlight

Reserve onActionReserve Reserve

Cancel onActionCancel Cancel

i mapped BookFlight to <b>button</b> Book at Event-onAction...

so how the code has to be modified to resolve that error..??

Regards

Padma

Former Member
0 Kudos

Padma,

wdControllerAPI.getViewInfo().getViewController().findInEventHandlers("<b>OnActionReserve</b>"),"Reserve Flight");

dialog.addChoice(wdControllerAPI.getControllerInfo().findInEventHandlers("<b>OnActionBook</b>"),"Book Flight");

dialog.addChoice(wdControllerAPI.getControllerInfo().findInEventHandlers("<b>OnActionCancel</b>"),"Cancel Flight");

dialog.open();

}

else

{

wdComponentAPI.getMessageManager().reportSuccess("Type val is"+wdContext.currentReturnElement().getType());

wdComponentAPI.getMessageManager().reportWarning("The Flight is not booked"+

wdContext.currentReturnElement().getMessage());

}

//@@end

}

Regards,

Murtuza

Answers (1)

Answers (1)

former_member185029
Active Contributor
0 Kudos

Have you created Event handlers Reserve Book and Cancel?

Is that in the same case?

Ashu