Skip to Content

Input the parameter value from a user parameter ID into a field with Personas scripting?

For whatever reason user parameters do not seem to work in the IW transactions. In IW37N I would like the main work center to be what the parameter value for the Parameter ID VAP in the user is. Is there a way that I can retreive this value with personas scripting?

The main work center is to represent a shift or crew. When a user/mechanic logs in they should be able to automatically see what work is assigned to their shift based on what parameter is assigned to their user account in SAP.

Any help is much appreciated!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jan 18 at 08:51 PM

    Hi Raquel.

    We retrieve user parameters using the following script (in this case we are retrieving the parameter "SWK Maintenance Plant").

    I hope this helps,

    Cristin

    //Get User ID
    var userid = session.info.user;
    var rfc = session.createRFC("BAPI_USER_GET_DETAIL");
    rfc.setParameter("USERNAME", userid);
    rfc.requestResults (JSON.stringify(["RETURN", "PARAMETER"]));            
    rfc.send();
    
    var pid = JSON.parse(rfc.getResult("PARAMETER"));
    
    for(var i=0; i<pid.length; i++){
      	
    	if ((pid[i].PARID)=="SWK"){
    		var userplant = pid[i].PARVA;
    	
    break;
    	}
    } 
    
    
    Add comment
    10|10000 characters needed characters exceeded

  • Jan 19 at 02:13 PM

    Thank you so much for sharing ! This worked perfectly.

    Add comment
    10|10000 characters needed characters exceeded