cancel
Showing results for 
Search instead for 
Did you mean: 

Create Attribute Value using Java API.

Former Member
0 Kudos

Hi,

I have written a java program , to create an attribute and add attributes values to the taxonomy table.

Using the method CreateAttributeCommand -- i am able to do both the creation of attribute and adding of values to the attribute.

Can anyone , please let me know,how to add values to an existing attribute??

Thanks in Advance.

Priya.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello.

I would use the RetrieveAttributeCommand to get the desired attribute. Note that you have to know the attribute Id and table Id for this.

As you mentioned the taxonomy table, I guess you know the table Id already, don't you?

All you need now is the attribute Id(s) of the existing attribute(s) you want to alter. (A for-loop will allow to alter more than one, or are you using a GUI for this? However you can handle more than one at each time, too. Depends on your program)

Using the RetrieveAttributesCommand the retrieval of the attribute Ids should be possible. With the table Id you can get an array with AttributeProperties back. Loop over all of them and pick the desired one(s). With its/their Id(s) you are able to call the ModifyAttributeCommand.

Before using the ModifyAttributeCommand modify the AttributeProperties object as whished. Then use the ModifyAttributeCommand to write it back.

[Link to the current Java API, if you did not had it by now|https://help.sap.com/javadocs/MDM/current/index.html]

A final note to this:

I do not know if the ModifyAttributeCommand will work, as the ModifyUserCommand somehow failed me. I had to delete the user and re-add him to make it work properly. But this occoured only due to the fact that the password could not be modified nor retrieved.

Best regards

Dominik

Former Member
0 Kudos

Hi,

Thanks for the reply.

I have both the taxonomy table id and the attribute id, but i am not able to use the ModifyAttributeCommand to add values to a particular attribute.

Please let me know, if any other method is there to handle this.

Thanks,

Priya.

Former Member
0 Kudos

As I guessed, the ModifyAttributeCommand does not really work.

The only way I could think of would be to delete the attribute and add it again with the chanaged values.

Is there an exception thrown?

Former Member
0 Kudos

Hi,

This is not a good approach right.

If there are 100 values in an attribute, just to add one more extra value, you need to recreate 100 values again.

I think we need to find out some other way to do it.

Thanks,

Priya.

Former Member
0 Kudos

If anyone has another idea, I would like to now it, too.

It could be a bit time consuming during runtime though.

Best regards

Dominik

Former Member
0 Kudos

Hi,

This functionality can be achieved my passing the attribute id in the TextAttributeProperties method, and then passing the same to ModifyAttributeCommand.

This works fine.

Thanks,

Priya.

Answers (0)