on 08-23-2016 11:15 AM
Hi,
I've been playing around with the script event onF4 for the work center field. The idea is that if user has already filled in plant the onF4 script would open up all the possible work centers for that plant.
I started by copying the plant value and checking the length of the variable, if length is greater than 0 the script would continue to paste the plant value in the plant field in the work center popup where a search for work centers can be done.
But doing this way will result in a endless loop where the script is triggering the F4 on the work center and then start the script all over again. Do anyone know of a better way of accomplishing this?
Best Regards,
Oskar
Hi Oskar,
I am assuming you used the pressF4 function in your script. The pressF4 function of a GuiTextField control executes any onF4 scripts that are assigned. Hence, the endless loop.
One way to solve this issue is to use the setFocus function on the field and then sending an 'F4' key to the main window control. In the following example, I used the transaction CR01 and assigned the script to the onF4 event. It populates the plant field with 0001 in the F4 criteria popup. You may need to change the F4 help settings to 'modal' (fully supported compared to limited support of 'amodal' F4 popups).
session.findById("wnd[0]/usr/ctxtRC68A-ARBPL").setFocus();
session.findById("wnd[0]").sendVKey(4);
session.findById("wnd[1]/usr/tabsG_SELONETABSTRIP/tabpTAB001/ssubSUBSCR_PRESEL:SAPLSDH4:0220/sub:SAPLSDH4:0220/ctxtG_SELFLD_TAB-LOW[1,24]").text = "0001";
Best regards
Kranthi
SAP Screen Personas Team
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Oskar,
as Kranthi has pointed out you must not call the pressF4() method on itself in an onF4 handler script.
I am assuming that you would like to open the F4 help and then pre-populate some values.
For this you have three options:
1) The one outline by Kranthi.
2) You hide the original F4 help field. Create an input field with an onF4 event handler script (which turns it visually into an F4 help field). In the onF4 handler script call the pressF4() method of the hidden original field.
3) Create an onLoad script for the F4 help window. The downside of this option is that you have to ensure that every user in the system uses modal F4 helps, while the switch to modal F4 helps happens automatically for other two options.
Best Regards,
Clemens
SAP Screen Personas Team
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.