Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Personas 3.0 - scripting - identify hidden element

Former Member
0 Kudos

Dear Experts,

I am new to Personas and after looking through the SCN and net, I am not able to find a good solution for my requirement.

We have a requirement for MM01 transaction to move several input fields like "Ind. Std Desc" from tab1 "Basic Data 2" to tab2 "Basic data 1". This element is hidden/not accessible until all the obligatory fields in tab1 are filled. Since the input filed in question is hidden until those are hidden, I have created a dummy duplicte in my Personas Flavour to replace it as read only until the original input filed is shown.

My question is, how to check in scripting weather the element is hidden or not? I have used the code to check if the element exists on the screen while it was not visible, but after using below code, I realized that the element of course does exist on the screen.

Code - even though not visible on the screen, the element is always found:

if(session.idExists("wnd[0]/usr/tabsTABSPR1/tabpSP02/ssubTABFRA1:SAPLMGMM:2004/subSUB2:SAPLMGD1:2002/txtMARA-NORMT")){

// hide the dummy screen elements:

session.findById("wnd[0]/usr/lblPersonas_1470797227903").hide();

session.findById("wnd[0]/usr/txtPersonas_1470797243970").hide();

} else {   

// show the dummy screen elements:

session.findById("wnd[0]/usr/lblPersonas_1470797227903").show();

session.findById("wnd[0]/usr/txtPersonas_1470797243970").show();

}

Did any of you have simlar requirement before? Please advise.

Thank you kindly,

Matevz

  • SAP Managed Tags:
1 ACCEPTED SOLUTION

Former Member
0 Kudos

chk this:

if (obj.visible)      //obj is shown

else  //it is hidden

Br,


Dong Zhu

  • SAP Managed Tags:
4 REPLIES 4

former_member192584
Participant
0 Kudos

Hi Matevz,

     The standard SAP fields do exist in screen as you said, but you can enter the value only if the field is enabled. You can check whether the standard field is enabled or not and proceed further.

if(session.findById("wnd[0]/usr/tabsTABSPR1/tabpSP02/ssubTABFRA1:SAPLMGMM:2004/subSUB2:SAPLMGD1:2002/txtMARA-NORMT").enabled){

// hide the dummy screen elements:

session.findById("wnd[0]/usr/lblPersonas_1470797227903").hide();

session.findById("wnd[0]/usr/txtPersonas_1470797243970").hide();

} else {   

// show the dummy screen elements:

session.findById("wnd[0]/usr/lblPersonas_1470797227903").show();

session.findById("wnd[0]/usr/txtPersonas_1470797243970").show();

}


Hope this works for you.

Regards,

Vigneshkkar.

  • SAP Managed Tags:

0 Kudos

Hi Vigneshkkar,

Thank you for your reply. I tried your suggested code, but it seems that the element is both visible and enabled. I tried two combinations of if statements, starting with one of either:

if(session.findById("wnd[0]/usr/tabsTABSPR1/tabpSP02/ssubTABFRA1:SAPLMGMM:2004/subSUB2:SAPLMGD1:2002/txtMARA-NORMT").enabled)

or

if(session.findById("wnd[0]/usr/tabsTABSPR1/tabpSP02/ssubTABFRA1:SAPLMGMM:2004/subSUB2:SAPLMGD1:2002/txtMARA-NORMT").visible)

The full code would look something like this:

if(session.idExists("wnd[0]/usr/tabsTABSPR1/tabpSP02/ssubTABFRA1:SAPLMGMM:2004/subSUB2:SAPLMGD1:2002/txtMARA-NORMT")){

     if(session.findById("wnd[0]/usr/tabsTABSPR1/tabpSP02/ssubTABFRA1:SAPLMGMM:2004/subSUB2:SAPLMGD1:2002/txtMARA-NORMT").enabled){


          session.findById("wnd[0]/usr/txtPersonas_1470797243970").text = "it exists&enabled";

} else {


          session.findById("wnd[0]/usr/txtPersonas_1470797243970").text = "it exists&disabled";

}

} else {

          session.findById("wnd[0]/usr/txtPersonas_1470797243970").text = "don't exist";

}

As a result I always get "it exists&enabled"; I am making the check in screen 4004, which is the first shown screen after initial transaction screen, where we can enter initial material parameters (number, industry sector and type).

If I open this same flavor in SAP GUI, it seems that this field can be seen as visible and enabled, but this is not the case in Web GUI (images from SAP GUI and image from Web GUI are attached). It could be that the Web GUI processes/displays this transaction differently. Did anyone have this kind of problem before?

Many thanks,

Matevz Babnik

  • SAP Managed Tags:

Former Member
0 Kudos

chk this:

if (obj.visible)      //obj is shown

else  //it is hidden

Br,


Dong Zhu

  • SAP Managed Tags:

0 Kudos

Hi All,

Thank you for your feedback. Your suggestions helped a lot in guiding me to the solution! Checking visibility of the object for some reason did not help, but I found a way round it. Basically, no matter if the sap field is visible/invisible, I set it to the status I want it in and then use scripting with the help of recording to enable, populate and made it visible at appropriate time. At the same time I hide my personas substitute fields. If any system errors occur they can be then handled in the original screen.

Best regards,

Matevz

  • SAP Managed Tags: