cancel
Showing results for 
Search instead for 
Did you mean: 

Reading Images from Images Table using MDM Java API

Former Member
0 Kudos

I tried to read pictures from the images table which i previously imported using the MDM Java API: However retrieving the images results in the following exception:

java.lang.IllegalArgumentException: Illegal value type '4' for specified field type 'Interner Baum'. Original exception: 'Unsupported field type '105'.'

at com.sap.mdm.internal.valuetypes.ValueConverter.createValueForField(ValueConverter.java:331)

at com.sap.mdm.internal.data.RecordLoader.getFieldData(RecordLoader.java:169)

at com.sap.mdm.internal.data.RecordImpl.loadData(RecordImpl.java:597)

at com.sap.mdm.internal.data.RecordImpl.(RecordsLoader.java:40)

at com.sap.mdm.internal.data.RecordResultSetHelper.convertFrom(RecordResultSetHelper.java:26)

at com.sap.mdm.data.commands.RetrieveRecordsByValueCommand.execute(RetrieveRecordsByValueCommand.java:126)

what´s wrong? The import doesn´t show any errors and i can view the records with the MDM Data Manager wihout any problems.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

It seems you are using RetrieveRecordsByValueCommand for retrieving Image from MDM server;

But in order to retrieve Image record, you have to use one of the following commands based on where you stored the image;

- com.sap.mdm.blobs.commands.RetrieveBlobCommand

- com.sap.mdm.blobs.commands.RetrieveImageVariantsCommand.

RetrieveBlobCommand will be used to retrive Image from Images table, where as RetrieveImageVariantsCommand will be used to retrive Image from Image variants table;

Image is also a blob type, so you can deal with it by using one of the two above mentioned commands.

Secondly,RetrieveRecordsByIdCommand would be useful for you in this senario.

why dont you try in the following way.

I guess you are getting MDMValue from Main table and check it whether it is of type Image, if it is so, use the following approach

if(!(images.toString()).equals("[Null]")) {

if(!(images instanceof NullValue)) {

Image []imags = null;

MultiValue imageValue = (MultiValue)images;

MdmValue imageValues[] = imageValue.getValues();

LookupValue imgValue[] = new LookupValue[imageValues.length];

imags = new Image[imgValue.length];

for(int j = 0 ;j<imageValues.length;j++) {

imgValue[j]=(LookupValue) imageValues[j]; imags[j] = this.getImageXX(imgValue[j].getLookupId());

}

category.setImages(imags);

}*/

in getImageXX(RecordId id) method, you have to execute RetrieveRecordsByIdCommand; I hope this would be best approach in yr case;

And regarding RetrieveRecordsByValueCommand, it is used to retrieve records by field values. and the supported fields to match on are:

Fixed Width Text

Normalized Text

Auto ID

Integer

Regards

Raj