Skip to Content
0

onOptionDialogClose not continuing script after being called

Jul 19, 2017 at 11:00 PM

122

avatar image

We are currently on Personas 3.0 SP5. I am using showOptionDialog with the onOptionDialogClose function. The script stops after processing the onOptionDialogClose function even though all parameters have been defined for showOptionDialog.

The script looks for a popup and processes the popup's table control looking for the type of message. Anything other than a type "W" will cause the script to bypass further processing. Here are the code snippets.

var exitloop = false;
var exitscript = false;


// 1st release
session.findById("wnd[0]/usr/subCATS002:SAPLCATS:2200/tblSAPLCATSTC_CATSD/txtCATSD-DAY1[12,2]").setFocus();
session.findById("wnd[0]/usr/subCATS004:SAPLCATS:2400/btnFREE_DATA_BUTTON").press();


// popup
if(session.idExists("wnd[1]")){
	var errortype = " ";
	for (rowindex = 0; rowindex < session.findById("wnd[1]/usr/cntlCC_ERROR_LIST/shellcont/shell").rowCount; rowindex ++){
		errortype = session.findById("wnd[1]/usr/cntlCC_ERROR_LIST/shellcont/shell").getCellValue(rowindex, session.findById("wnd[1]/usr/cntlCC_ERROR_LIST/shellcont/shell").getColumnName(4));
		switch(errortype){
			case "E":
				exitloop = true;
				break;
			case "W":
				exitloop = false;
				break;
			default:
				exitloop = true;
		}
		if (exitloop) {
			break;
		}
	}
	session.findById("wnd[1]").close();
	switch(errortype) {
		case "E":
			session.utils.showOptionDialog("Timesheet Error","At least one error exists with this timesheet.  One-step processing is not possible!",session.constants.MESSAGE_TYPE_ERROR,session.constants.MESSAGE_OPTION_OK,onOptionDialogClose,"1");
			break;
		case "W":
			session.utils.showOptionDialog("Timesheet Warning","At lease one warning exists.  You should check the warnings manually before trying one-step processing.  Have you checked the warnings?",session.constants.MESSAGE_TYPE_INFORMATION,session.constants.MESSAGE_OPTION_YESNO,onOptionDialogClose,"2");
			break;
		default:
			session.utils.showOptionDialog("Timesheet Unknow Error","At least one unknown error exists with this timesheet.  One-step processing is not possible!",
									   		session.constants.MESSAGE_TYPE_ERROR,session.constants.MESSAGE_OPTION_OK,onOptionDialogClose,"9");
	}
}

session.utils.alert("here");  // never shows

if (!exitscript){...further script processing...}

function onOptionDialogClose(dec, id){
	switch(id){
		case "1":
			exitscript = true;
			break;
		case "2":
			if (dec != session.constants.MESSAGE_RESULT_YES) {
				exitscript = true;
			}
			break;
		case "9":
			exitscript = true;
			break;
		default:
			exitscript = true;
	}
}
// end of script

Does the further processing need to be in the onOptionDialogClose function module? If so, I'll put it into a function module because it gets processed if the popup does not exists.

Thanks,

Brian Basch

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Cristiano Hansen
Mar 31 at 03:48 PM
0

Hello Brian,

Check whether this wiki helps.
You should also write messages to the log, so you can see whether there is an error type different than "W" being thrown.

Regards,
Cris

Share
10 |10000 characters needed characters left characters exceeded
Emmanuel Miret Apr 13 at 09:56 AM
0

Hello Brian,

Did you find an answer about your issue?

I have the same behaviour and don't know what to do.

Thanks,

Emmanuel.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

No, I did not. I'm going to close the question.

Thanks.

0