cancel
Showing results for 
Search instead for 
Did you mean: 

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

0 Kudos

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!

Accepted Solutions (1)

Accepted Solutions (1)

cristin_charbonneau
Participant

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;
	}
} 

Answers (1)

Answers (1)

0 Kudos

Thank you so much for sharing ! This worked perfectly.