cancel
Showing results for 
Search instead for 
Did you mean: 

Updating Multi Valued fields of qualified level

Former Member
0 Kudos

Hi,

I am trying to insert the Multi Value Fields at Qualified level.

Error com.sap.mdm.internal.protocol.manual.ServerException: The requested record was not found

---------------------------------------------------------------

Here is details.

Main Table : Material Master 

Qualified  Lookup : Location Data

Qualified field      :  Inspection Type (Type Qualified Flat : Multi-Valued)

---------------------------------------------------------------------------------

Sample Java Code

//Connect to MDM

...

CreateRepositorySessionCommand repositorySessionCommand = new CreateRepositorySessionCommand(connections);

                        repositorySessionCommand.setRepositoryIdentifier(reposId);

                        repositorySessionCommand.execute();

                        repositorySession = repositorySessionCommand.getRepositorySession();

                        AuthenticateRepositorySessionCommand authenticatedRepositorySession = new AuthenticateRepositorySessionCommand(connections);

                        authenticatedRepositorySession.setSession(repositorySession);

                        authenticatedRepositorySession.setUserName(userName);

                        authenticatedRepositorySession.setUserPassword(userPassword);

                        authenticatedRepositorySession.execute();

                        GetRepositorySchemaCommand repositroySchemaCommand = new GetRepositorySchemaCommand(connections);

                        repositroySchemaCommand.setSession(repositorySession);

                        repositroySchemaCommand.execute();

                        schema = repositroySchemaCommand.getRepositorySchema();

.

.

.

.

//Search For Material

FieldSearchDimension fsdMaintableType = new FieldSearchDimension(schema.getFieldId(tableName, fieldName));

                TextSearchConstraint tscTypeRoot =new TextSearchConstraint(materialNumber, TextSearchConstraint.EQUALS);

                Search seSearchMainRoot = new Search(schema.getTableId(tableName));

                seSearchMainRoot.addSearchItem(fsdMaintableType, tscTypeRoot);

                ResultDefinition rdMain = new ResultDefinition(schema.getTableId(tableName));

                rdMain.addSelectField(schema.getFieldId(tableName, fieldName));

                rdMain.setLoadAttributes(true);

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

                {

                        rdMain.addSelectField(schema.getField(tableName, fields_names[j]).getId());        

                }

               

                rdMain.setIsLoadTupleValues(true);

                rdMain.setLoadAttributes(true);

                RetrieveLimitedRecordsCommand recordsCommand =new RetrieveLimitedRecordsCommand(mdmconn.getConnections());

                recordsCommand.setSession(mdmconn.getSessionId());

                recordsCommand.setSearch(seSearchMainRoot);

                recordsCommand.setResultDefinition(rdMain);

                try

                {

                        recordsCommand.execute();

                }

                catch (Exception e1)

                {

                        e1.printStackTrace();

                }

.

.

.

.

//Start Updating Material

                        FieldProperties qField = schema.getField(tableName,"Location_Data");

                        QualifiedLookupValue qall = (QualifiedLookupValue)sourceProduct.getFieldValue(qField.getId());

int index = qall.createQualifiedLink(plant2.getId());

.

.

.

/*Error for following update*/

MdmValue multiValue  = new MultiValue();

// Represents the Multivalued lookup field

MdmValue lookupValue = new NullValue();// Represents each lookupvalue in multivalued

for (int i = 0; i < recs.length; i++)

{

Record record = (Record) recs[i];

lookupValue = new LookupValue(record.getId());// recid --> Recordid of thelookup value

((MultiValue)multiValue).addValue(lookupValue);

}

qall.setQualifierFieldValue(index, schema.getFieldId("Location_Data", "R3_Inspection_Type"), multiValue);

/*Error for following update*/

ModifyRecordCommand modRec = new ModifyRecordCommand (mdmconn.getConnections());

                modRec.setSession(mdmconn.getSessionId());

                modRec.setRecord(mdmrecord);

                modRec.setModifyAnyway(true);

                try

                {

                        modRec.execute();

                        return true;

                }

                catch (Exception e)

                {

                        e.printStackTrace();

                }

Error : while Modify record

com.sap.mdm.internal.protocol.manual.ServerException: The requested record was not found .



Thanks in Advance,


Regards,

Sunil Patil

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Since u are using java APIs to update mult-valued field in MDM, following link may be helpful.

http://scn.sap.com/docs/DOC-29061

But if you are flexible try to use ABAP APIs instead.

http://scn.sap.com/docs/DOC-14805

Regards,