Skip to Content

JavaScript Multiple selection for Screen Personas (PRIOK)

Hi, I'm trying to run a script in screen personas 3.0 that Select all Notifications With priority = A, B, C and D. (transaction iw58)

It work With only one, but multiple it do not work.

var idag = new Date();
var fra = new Date();
fra.setDate(fra.getDate()-3);
var dd = idag.getDate();
var mm = idag.getMonth()+1; //January is 0!
var yyyy = idag.getFullYear();

if(dd<10) {
dd='0'+dd;
}

if(mm<10) {
mm='0'+mm;
}


var idagText = dd +'.' + mm +'.'+yyyy;
dd=fra.getDate();
mm = fra.getMonth()+1;
var fraText = dd +'.' + mm +'.'+yyyy;


session.findById("wnd[0]/tbar[0]/okcd").text = "iw58";
session.findById("wnd[0]").sendVKey(0);

session.findById("wnd[0]/usr/chkDY_OFN").selected = true;
session.findById("wnd[0]/usr/chkDY_IAR").selected = true;
session.findById("wnd[0]/usr/ctxtERDAT-LOW").text = fraText;
session.findById("wnd[0]/usr/ctxtERDAT-HIGH").text = idagText;
session.findById("wnd[0]/usr/ctxtERDAT-HIGH").setFocus();
session.findById("wnd[0]").sendVKey(0);

session.findById("wnd[0]/usr/ctxtPRIOK-LOW").text = "A";
session.findById("wnd[0]/usr/ctxtPRIOK-LOW").setFocus();
session.findById("wnd[0]").sendVKey(0);

/*
session.findById("wnd[0]/usr/ctxtPRIOK-LOW").setFocus();
session.findById("wnd[0]/usr/btn%_PRIOK_%_APP_%-VALU_PUSH").press();

session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,0]").setFocus();
session.findById("wnd[0]").sendVKey(0);

session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,1]").text = "B";
session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,1]").setFocus();
session.findById("wnd[0]").sendVKey(0);

session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,2]").text = "C";
session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,2]").setFocus();
session.findById("wnd[0]").sendVKey(0);

session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,3]").text = "D";
session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,3]").setFocus();
session.findById("wnd[0]").sendVKey(0);

session.findById("wnd[1]/usr/tabsTAB_STRIP/tabpSIVA/ssubSCREEN_HEADER:SAPLALDB:3010/tblSAPLALDBSINGLE/ctxtRSCSEL_255-SLOW_I[1,3]").setFocus();
session.findById("wnd[1]/tbar[0]/btn[8]").press();
*/
session.findById("wnd[0]/usr/ctxtIWERK-LOW").text = "0020";
session.findById("wnd[0]/usr/ctxtIWERK-LOW").setFocus();
session.findById("wnd[0]").sendVKey(0);

session.findById("wnd[0]/usr/ctxtIWERK-LOW").setFocus();
session.findById("wnd[0]/tbar[1]/btn[8]").press();

Had to disable a lot of script-line from recording to get it to work.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Feb 14, 2017 at 08:52 AM

    This work:

    session.findById("wnd[0]/usr/ctxtPRIOK-LOW").text = "A";session.findById("wnd[0]/usr/ctxtPRIOK-LOW").setFocus();session.findById("wnd[0]").sendVKey(0);
    session.findById("wnd[0]/usr/ctxtPRIOK-HIGH").text = "D";session.findById("wnd[0]/usr/ctxtPRIOK-HIGH").setFocus();session.findById("wnd[0]").sendVKey(0);

    But what if I would like to use value A, C and D not A, B, C and D?

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 27, 2017 at 11:18 PM

    We were in similar situation for order types.

    We created a variable for order types and created 'if' blocks for each conditions (16 if blocks for 4 order types)

    If (PM01 = true && PM02 = true && PM03 = true && PM04 = true)

    {

    session.findById("wnd[1]/usr…./ctxtRSCSEL_255-SLOW_I[1,0]").text = "PM01";

    session.findById("wnd[1/usr…./ctxtRSCSEL_255-SLOW_I[1,1]").text = "PM02";

    session.findById("wnd[1]/usr…./ctxtRSCSEL_255-SLOW_I[1,2]").text = "PM03" ;

    session.findById("wnd[1]/usr…./ctxtRSCSEL_255-SLOW_I[1,3]").text = "PM04" ;

    ….<code>

    }

    If (PM01 = true && PM02 = true && PM03 = true)

    {

    session.findById("wnd[1]/usr…./ctxtRSCSEL_255-SLOW_I[1,0]").text = "PM01";

    session.findById("wnd[1/usr…./ctxtRSCSEL_255-SLOW_I[1,1]").text = "PM02";

    session.findById("wnd[1]/usr…./ctxtRSCSEL_255-SLOW_I[1,2]").text = "PM03" ;

    ….<code>

    }

    … <you get the idea>

    This worked for us.

    If you find more elegant solution, please post.

    I can always come-up with business requirements that require more selection criteria e.g. combination or order types, priority and user status.

    Thanks,

    Rajen

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 28, 2017 at 09:34 AM

    Hi

    Have you ever tried using arrays in Screen Personas scripts?

    var OTypes = ["PM01", "PM02", "PM03, "PM04"]

    Add comment
    10|10000 characters needed characters exceeded