cancel
Showing results for 
Search instead for 
Did you mean: 

Need Information to retrieve the custom UME field using UME API

susmita_panigrahi
Active Participant
0 Kudos

Hi All,

We are using SAP Portal EP 7.02 SP12 portal. Our basis team added the custom ME field with name Date in the Customized tab inside User Admin role.

 

So when we search a user id in user admin role. Then we can see the Date ield with an input field inside customized tab. We can provide the date and save this information manually from user admin role.

Requirement is how can we read the custom UME attributeDate for a User using UME API and how can we set the custom field value to current date using UME API for a user in WDJ code?

Thanks & Regards,

Susmita

Accepted Solutions (0)

Answers (3)

Answers (3)

govardan_raj
Contributor
0 Kudos

In order to access ume api you have to add an com.security.api.sda in the used Dcs  i.e

DC MetaData - >Used Dcs -> right click and select Add Used Dc.. and then expand sap.com_Sap-JEE_1 and select com.security.api.sda .

Regards

Govardan Raj

susmita_panigrahi
Active Participant
0 Kudos

Hi Govardan Raj ,

We have checked the path for the NWA you have suggested. The Name space is not mentioned for the custom field created by basis team.

We will check with basis team and after getting name space name we can use the code as suggested by you, We will inform the test results after deploying code.

Thanks & Regards,

Susmita

govardan_raj
Contributor
0 Kudos

Hi sushmitha ,

sure  you can update the test results.

 

Regards

Govardan Raj

govardan_raj
Contributor
0 Kudos

hi Susmitha,

for updating the custom attribute value use the below code

//******************************Update****************************??

IUserFactory userFact = UMFactory.getUserFactory();


IUserAccountFactory accFact = UMFactory.getUserAccountFactory();

IUser myuser=userFact.getUserByLogonID(uid);

IUserMaint usermaint=userFact.getMutableUser(myuser.getUniqueID());

String customvaluetype[] = new String[1]; 

customvaluetype[0]= "xxxx"; xxx is the string value of custom attribute you wanted assign.

usermaint.setAttribute("com.sap.security.core.usermanagement","customval",customvaluetype);


usermaint.commit();

here customval is unique id that you can give for your custom attribute and now this is useful for retreiving the same/

//******************************Update****************************??

// Retreiving


String[] customvaluetype =null;
IUserFactory userFactory=UMFactory.getUserFactory();
IUser userInfo=userFactory.getUserByLogonID(uid); // where uid is login id
customvaluetype =userInfo.getAttribute("com.sap.security.core.usermanagement","customval");

--> now the value from customvaluetype will have the value "xxxx" that was updated above.

hope this code helps .

Regards

Govardan Raj

susmita_panigrahi
Active Participant
0 Kudos

Hi Govardan Raj,

Can you please let me know whether the Name Space name we need to use always as "com.sap.security.core.usermanagement" ?

How we can get to know the Name Space name and the attribute name used for the custom field ""Date" ?

Thanks & Regards,

Susmita

govardan_raj
Contributor
0 Kudos

hi susmita,

yes the name space name is always "com.sap.security.core.usermanagement"and attribute name for custom feild ***Date is the name which you are giving while updating.

In your case are you updating the feild through code or some one else is updating that.. ?

in that case ask them what is the name they have given for that.

Regards

Govardan Raj

susmita_panigrahi
Active Participant
0 Kudos

Hi

The Custom field is created by basis team .They have followed the approach mentioned in the below link.

http://help.sap.com/saphelp_nwce10/helpdata/en/44/0316d50bbe025ce10000000a1553f7/content.htm?framese...

We need to update and also read this custom field using UME API code.

Thanks & Regards,

Susmita

govardan_raj
Contributor
0 Kudos

hi susmita,

The above code that i have mentioned works, you can try that code, and try to create your own customer feild instead of date some other like department etc..for testing purpose.. and assign a value for that particular TestLoginID (userxxx), and later go to useradmin tab i.e log in as administrator to ep portal and navigate to user administration , search for the userxxx for whom u added this dept and open the customized information tab you can find the department attribute (customised one ) which you have added.

Regards

Govardan

govardan_raj
Contributor
0 Kudos

hi susmita ,

you can login to nwa of your server, go to system administration-->administration-->identitymanagement--> click configuration-->select UserAdmin UI Tab.

here you can find

Custom attributes of the user profile

so find the name space your basis team as given and custom feild name that they have given

Like in my case

Administrator-Managed Custom Attributes

com.sap.security.core.usermanagement:Authentication ;Certificate SerialKey;typeofuser

here first one is name space and after that certificate serial key and typeofuser are the custom attribute values that i have created and from webdynpro code im accessing and updating same using above webdynpro code . so I guess it should work for you too.

Regards

Govardan Raj

Former Member
0 Kudos

See the respective chapter of the application help.