Skip to Content
0

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

Jan 18 at 06:28 PM

70

avatar image

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!

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Cristin Charbonneau Jan 18 at 08:51 PM
2

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

Share
10 |10000 characters needed characters left characters exceeded
Raquel Silva Jan 19 at 02:13 PM
0

Thank you so much for sharing ! This worked perfectly.

Share
10 |10000 characters needed characters left characters exceeded