cancel
Showing results for 
Search instead for 
Did you mean: 

Problem when getting the choice clicked by the user on a confirmation dialo

Former Member
0 Kudos

Hi

I want to prompt a confirmation Dialog, before deleting from a table,

with yes,no,cancel options.

Then I created 3 event handlers

1.EmpRemove-parameter is 'cosid'

code:

public void EmpRemove(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String consid )

{

try

{

int n=stmt.executeUpdate("delete SaConsultantMaster where ConsultantId='"consid"'");

wdThis.showDialog("The Details of the consultant Are removed !!!");

wdThis.EmpReset();

}

catch(Exception e){}

}

2.No

public void No(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{}

3.Cancel

public void Cancel(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{}

in my Action coding:

I wrote.

String Message="Do u want to Remove The Consultant "empid" ??";

IWDControllerInfo controllerInfo = wdControllerAPI.getViewInfo().getViewController();

com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent1=null;

wdThis.EmpRemove(wdEvent1,empid);

IWDConfirmationDialog dialog =wdComponentAPI.getWindowManager().createConfirmationWindow( Message, controllerInfo.findInEventHandlers("EmpRemove"), "Yes");

dialog.addChoice(controllerInfo.findInEventHandlers("No"),"No");

dialog.addChoice(controllerInfo.findInEventHandlers("Cancel"),"Cancel");

dialog.open();

but the problem is

Before clicking the choice, itself the record is getting deleted.

If i click yes/No/Cancel, the action in event handler empremove is executing.

And when passing parameters to eventhandler, what should i give for 'Event' parameter?

can anybody help me..

Thanks in advance.

Smitha

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

remove the statement wdThis.EmpRemove(wdEvent1,empid);

from your Action coding.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Smitha,

in your action coding you call your EventHandler EmpRemove before showing the dialog:

-


wdThis.EmpRemove(wdEvent1,empid);

IWDConfirmationDialog dialog =wdComponentAPI.getWindowManager().createConfirmationWindow( Message, controllerInfo.findInEventHandlers("EmpRemove"), "Yes");

---

So remove the line "wdThis.EmpRemove(wdEvent1,empid);" and let the EventHandler do his work when the user confirms the deletion. Probably you should als check whether and how your ConsultantId is transfered as parameter. Think about removing it from the EventHandler and getting the selection straight out of the table.

HTH

Tina

Former Member
0 Kudos

Hi

I'll try , without passing parameter.

Thanks a lot

Regards

Smitha