cancel
Showing results for 
Search instead for 
Did you mean: 

Populating MX_Manager from the HCM staging data?

former_member96398
Participant
0 Kudos

Hello,

I've configured IDM 7.2 sp8, VDS and LDAP Connection for HCM, which is successfully pulling in employee data and creating the user in IDM.

The write HCM to Employee to SAP Master has some functions to identify the employee's manager pernr but I'm surprised there isn't a script to ID the manager userid and populate MX_Manager attribute.

Is there a best practice on this or some opinions on the easiest/best way to accomplish this?  Seems like you would just need a task after the write HCM to sap master that looks up the user's manager pernr and subsequently the userid.

Can anyone share a script they have used for this? or some basics on how to build it?

Regards,

Curtis Fincher

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You can use the internal functions to get the value of an object if you have a value.  I can't remember the exact function but you can:

Get the MSKEYValue of the object which has Pernr XXXX

Write it to the manager attribute.

Teros works fine to - I'm not sure about the performance difference between internal functions and uSelect...

Peter

terovirta
Active Contributor
0 Kudos

Peter Wass wrote:

You can use the internal functions to get the value of an object if you have a value. 

uIS_Get?

OutString=uIS_Get(Int iStore, String Attribute, String AttValue[, Boolean ExactMatch]);

https://help.sap.com/saphelp_nwidmic71/en/using_functions/internal_functions/dse_uis_sget.htm

It should work as personnel number (of manager) should be unique. Just replace the SQL bit with the call to internal function and return the MSKEY or NULLATTR based on what the internal function returns.

Answers (1)

Answers (1)

terovirta
Active Contributor
0 Kudos

Hi Curtis,

here's my SQL Server version, with no warranty For Oracle remove the "with (nolock)".

"NULLATTR" is hardcoded SAP IdM value which means "do nothing", if you have a script that must return value and some checks fail in the script or the lookup does not return any value it's always best IMHO to return NULLATTR so nothing gets inserted to the attribute.

function custom_getMskeyByPerNr(Par){
    uErrMsg(1, "custom_getMskeyByPerNr: Par=" + Par);
    if (Par == "") return "NULLATTR";

    var mySQL = "SELECT MSKEY FROM IDMV_VALUE_BASIC WITH (NOLOCK) WHERE IS_ID = %$glb.SAP_MASTER_IDS_ID% AND ATTRNAME = 'MX_FS_PERSONNEL_NUMBER' AND SEARCHVALUE = '" + Par + "'";

   uErrMsg(1, "custom_getMskeyByPerNr: mySQL=" + mySQL);
   var mskey = uSelect(mySQL);
   uErrMsg(1, "custom_getMskeyByPerNr: mskey=" + mskey);
   if (mskey == "") return "NULLATTR";

      

    return mskey;
}

regards, Tero