cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Screen Personas 3.0 Hiding screen elements via OnLoad screen event

jan_rehfeld
Explorer
0 Kudos

I would like to hide (or show) some screen elements depending on the order type via a script. The script should be triggered when a user starts transaction VA02 (after entering the order number and pressing ‘Enter’. Therfore I created a script and attached it to the screen event ‘OnLoad’. While I can read field values during ‘OnLoad’ it seems to be impossible to hide fields. Does anybody know how to achieve this?

Thanks in advance

Jan

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member192584
Participant
0 Kudos

Hi Jan,

I think screen refresh might be the problem try adding the below code inside if condition at the last.

sap.personas.scripting.executeScriptInternal({src:''});  
jan_rehfeld
Explorer
0 Kudos

Hi Andrew,

thank you very much for your answer. Unfortunately this does not work in our system. The script reacts only after the user has started to work within the screen (for example clicking on a button or pressing ‘Enter’). This is not very useful. The screen elements should be hidden when the transaction has been started. Does your system react differently?

(Within the OnLoad event I can read values and show them within a message box but I cannot fill in values to text elements or hiding elements.)

Jan
Former Member
0 Kudos

This (nonsensical) script works for me in VA02. It looks at the order number, and if it is "102" it hides the gross amount field!

var order = session.findById("wnd[0]/usr/subSUBSCREEN_HEADER:SAPMV45A:4021/ctxtVBAK-VBELN").text;
if(order == "102") {
    session.findById("wnd[0]/usr/subSUBSCREEN_HEADER:SAPMV45A:4021/txtVBAK-NETWR").hide();
}

Set this as the "onLoad" event handler on the second screen of VA02 and it should do what you want. It certainly works for me.

Perhaps if you post more details of what you've done, including your script, we might be able to help more?

Former Member
0 Kudos

I use this functionality in work orders. The below code should help you, assign it to onLoad. (not in the code is defining variable orderType, make sure to do this)

if (orderType === 'Z400'){

session.utils.log (orderType)

session.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:*/ssubSUB_LEVEL:SAPLCOIH:*/tabsTS_1100/tabpIHKZ/ssubSUB_AUFTRAG:SAPLCOIH:1120/boxPersonas_146964646030946/lblPersonas_146964660474297").hide() ;
session.findById("wnd[0]/usr/subSUB_ALL:SAPLCOIH:*/ssubSUB_LEVEL:SAPLCOIH:*/tabsTS_1100/tabpIHKZ/ssubSUB_AUFTRAG:SAPLCOIH:1120/boxPersonas_146964646030946/txtPersonas_146964662395271").hide() ;
}

Thanks,

Andrew McGrath