cancel
Showing results for 
Search instead for 
Did you mean: 

Case of 'Enter' and Status Bar messages

Former Member
0 Kudos

Hi all experts around!

I have two questions:

1) How to override in Screen Personas 3.0 SP02 behavior of Enter key? In general it goes to subsequent screen, but as I have custom mandatory fields on the first screen, I want to to display warning message if those have not been filled.

2) How to handle Status Bar messages in the script if the situation is like this: from the SMEN screen user has to ability to check if tax number for vendor already exists and show some basic info of that vendor. So script button goes to FK03 enters tax number in the search field, but in some cases (when vendor is not yet confirmed) a StatusBar message appears and then there is a need to press Enter one more time. We tried to do it with if statement indicating if there is some text in the StatusBar, then Enter is pressed one more time, but it seems that it is not working that way. Script presses Enter double times in both cases (either there is StatusBar message or not) , so if vendor is already confirmed, then script pushes transaction code already to the next screen (from there it cannot take the necessary information) therefore it stops and doesn't bring back info on SMEN screen.

3) and in general with if statements in Personas - is it meant to be like that if I specify in the statement that some field should be hidden depending one one value entered, then it remains hidden even after different value is entered?

Thanks for answers, they are as always appreciated

Diana

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

3) show/hide keeps the effect when you set it. To change, you must use .show()/.hide() to do the change.  Eg, simple toggle:

if xxx.visble===true {xxx.hide();} Also the other way.

Br,

Dong

Former Member
0 Kudos

for your 2):

status message bar is special. You cannot direct do .text.

Try this:

var sMsg=session.findById("win[0]/sbar").text;

var oMsg=JSON.parse(sMsg);

var myMsgValueFromBar=oMsg.STAT;

It works with me. Hope this helps you.

Dong

tamas_hoznek
Product and Topic Expert
Product and Topic Expert
0 Kudos

For #1, you could look into this KB article to see some examples of using OnBeforeRefresh for validation: Implementing custom validations - SAP Imagineering - SCN Wiki

This would let you do the validation for most keystrokes but allow certain ones like Exit, Cancel, F4 to be still processed even if the required field is empty.

Former Member
0 Kudos

Tamas, I tried exactly what said in the KB article - after pressing Enter, system continues to next screen even if the"mandatory" field is empty!

clemens_gantert
Active Participant
0 Kudos

Hello Diana,

It sounds like the onBeforeRefresh script you wrote triggers a communication with the backend that makes the backend move to a different screen. This ok and normal, but unfortunately not obvious.

Change your script to check what screen you are on before it returns and if the screen has changed have the script press the back button (or whatever you have to do to go back to your desired screen). You can use session.info.screenNumber/transaction/program to determine "where" you are. When you are sure that your script has navigated back end it with "return true;".

Regards,

Clemens

Former Member
0 Kudos

Adding "back" action to the script doesn't change things. it still doesn't issue the error message in Status bar, like mentioned in Implementing custom validations - SAP Imagineering - SCN Wiki

"In any other case (like pressing ENTER or another navigation button such as Sales, Item Overview etc.), the content of the Sales Organization field is checked and if it is empty, an error message is displayed, exactly how the standard required field check is done."


Diana

Former Member
0 Kudos

Fr your 3)

Perhasps try this workround: use script to set a flag true/false depending on the fields validation on first screen. In the next screen onLoad, validate that flag. If false, go back to the previous screen. I am not sure if there will be a short "flash" on UI.

Br,

Dong

0 Kudos

1, Use onBeforeRefresh

   When you return true from your onBeforerefsresh script, it stops the stops the rountrip.

So check your field and retun true if its blank

2. Thats not expected. Is your script right? can you post your part of scripts?

3. well if you hide something, it will remain hideen even if you enter some data through script.

   It depends so much on your flavor design.....what you want to show initially and hide later....

Former Member
0 Kudos

Thanks, Sushant!

1. Doesn't sees to work that way, Enter still proceeds to next screen 😕

2.

session.findById("wnd[1]/tbar[0]/btn[0]").press(); //press search

if (session.findById("wnd[0]/sbar").text=="") {

  session.findById("wnd[1]/tbar[0]/btn[0]").press(); //additional pop-up confirmed

  session.findById("wnd[0]").sendVKey(0); //enter to continue to next screen

  if (session.findById("wnd[0]/sbar").messageNumber=224) {

  session.findById("wnd[0]").sendVKey(0); //enter to continue to next screen if vendor is not confirmed

  };

} else if (session.findById("wnd[0]/sbar").text="I: No values for this selection") { // actions if no such vendor found after hitting search button

3. So you mean that if entering value in the same field the hidden objects will not appear back automatically, I should include them in script with .show() property?

Thanks, Diana