Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8533

Re: SAP IDM Create user policies

$
0
0

Hi Miguel,

 

Here is the script i am using.

 

// Main function: zsap_core_generate_mskeyvalue

/*

*----------------------------------------------------------------------------------------------------------------------------

* Parameter(s) Cat.        : String

* Parameter(s)               : FirstName|LastName|NRIC|MSKEY from the Z_USER_REQUEST Entry Type

* Return value Cat.         : String 

* Return value                : MSKEYVALUE of MX_PERSON

*----------------------------------------------------------------------------------------------------------------------------

* Dependencies : // to scripts, attributes, inbuild functions, context vars, tables/views,

* system/job/repository/global constants/variables

* - inbuild function : uGetIDStore

* - inbuild function : uSelect

* - view : idmv_entry_simple_all

*- NRIC is the unique identity of the user

*--------------------------------------------------------------------------------------------------------------------------*/

 

function zsap_core_generate_mskeyvalue(Par){

//Example calling DSE internal function

//uStop("Terminated by user");

 

  //string looks like this FirstName|LastName|NRIC|MSKEY

  var inputParameter = Par.split("|");

  var displayName = inputParameter[1]+ inputParameter[0];

  var nric = inputParameter[2];

  var mskey = inputParameter[3];

  var subName = ""; //To store first five characters of the MSKEYVALUE

  var nameLength = displayName.length;

  var checkmskeyvalue = ""; //To store the MSKEYVALUE

  var count = 0; //To generate the free number in the MSKEYVALUE

  var IdentityStore = uGetIDStore();

  var tempCount = 0; //Counter used in loop

  var tempDisplayName = ""; //variable to hold display name

 

 

uInfo("Executing zsap_core_generate_mskeyvalue");

 

uInfo("displayName:" + displayName + "nric :" + nric + "mskey:" +mskey);

 

//skip space from displayName

 

for (tempCount = 0;tempCount<nameLength;tempCount++)

{

if (displayName[tempCount] != " " )

tempDisplayName          = tempDisplayName + displayName[tempCount];

}

 

displayName = tempDisplayName;

 

// Append additional 0 if the length of name is less than 5 characters

  for (; nameLength < 5;)

{

displayName = displayName.concact("0");

nameLength = displayName.length;

}

 

subName = displayName.substring(0,5);

 

 

//for loop to find next available number if the a user with same name and nric number already exists.

for (count = 0;count<=36; count++)

{

 

if(count <10)

{

checkmskeyvalue = uSelect("select mcMSKEY from idmv_entry_simple_all WITH(NOLOCK) where mcMSKEYVALUE = '" + subName+count+nric +"'");

 

if (checkmskeyvalue =="" || checkmskeyvalue=="NULL")

{

checkmskeyvalue = subName+count+nric;

break;

}

}

else {

 

checkmskeyvalue = uSelect("select mcMSKEY from idmv_entry_simple_all WITH(NOLOCK) where mcMSKEYVALUE = '" + subName+String.fromCharCode(count+55)+nric +"'");

 

if (checkmskeyvalue =="" || checkmskeyvalue=="NULL")

{

checkmskeyvalue = subName+String.fromCharCode(count+55)+nric;

break;

}

 

}

 

}

 

uInfo("checkmskeyvalue:" + checkmskeyvalue );

 

 

var retValue = uIS_SetValue(mskey, IdentityStore, "Z_USERREQ_USERID", checkmskeyvalue.toUpperCase());

 

uInfo("retValue:" + retValue );

 

return checkmskeyvalue.toUpperCase();

}


Viewing all articles
Browse latest Browse all 8533

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>