cancel
Showing results for 
Search instead for 
Did you mean: 

Flavor Switching - SAP Screen Personas 3.0 SP5

erin_mogg
Participant
0 Kudos
961

We'd like to display different data in transaction VA02 based on Sales Order Type.

We've created two flavors to control this. We've then written the following script (inserted to "Screen Events - onLoad) to switch the flavor based on order type. This script is based on the example here.

//Navigate to Sales Order Header - Sales Tab
session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\\01/ssubSUBSCREEN_BODY:SAPMV45A:4400/subSUBSCREEN_TC:SAPMV45A:4900/tblSAPMV45ATCTRL_U_ERF_AUFTRAG/ctxtRV45A-MABNR[1,1]").setFocus();
session.findById("wnd[0]/mbar/menu[2]/menu[1]/menu[0]").select();

//Set Variable for Order Type
var Order=session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP*/tabpT\\01/ssubSUBSCREEN_BODY:SAPMV45A:4301/ctxtVBAK-AUART").text;

//Switch flavor if order type is = ZFOC
if (Order =="ZFOC");
{session.utils.changeFlavor("00505686770A1ED78DA1150E838D9420");}

//return to "Change Order XXXXXXX: Overview" Screen
session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP*/tabpT\\01/ssubSUBSCREEN_BODY:SAPMV45A:4301/ctxtVBAK-AUDAT").setFocus();
session.findById("wnd[0]/tbar[0]/btn[3]").press();


However, regardless of the Order Type, the flavor is being switched - any suggestions?

View Entire Topic
Tamas_Hoznek
Product and Topic Expert
Product and Topic Expert

Remove the semicolon right after the closing parenthesis of the IF condition... so

if (Order=="ZFOC") {
  session.utils.changeFlavor("00505686770A1ED78DA1150E838D9420");
}
erin_mogg
Participant
0 Kudos

Thanks, Tamas! There was no error shown in the script, so I was at a loss. When I updated the code as per your suggestion the issue was resolved.

Tamas_Hoznek
Product and Topic Expert
Product and Topic Expert

There is no error, but with the semicolon you effectively closed the IF statement, so the flavor switching was always executed.