Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8705

Updating Multi Valued fields of qualified level

$
0
0

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


Viewing all articles
Browse latest Browse all 8705

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>