cancel
Showing results for 
Search instead for 
Did you mean: 

Tuples Using MDM Java Apis....

NarendraChandel
Contributor
0 Kudos

Hi Experts,

I want to expose tuple field over EP using MDM java apis and also want to insert values.

Can you please help me with the code of how to retrieve Tuple values and how to insert its values in MDM repository.

Thanks for your time.

Regards

Narendra

Accepted Solutions (0)

Answers (2)

Answers (2)

NarendraChandel
Contributor
0 Kudos

Hi Manish,

Thanks for your help but i required to retrieve the tuple field values to show them over screen and then if user wants to change some values then he can change and click on modify button to update the new tuple values.

Can you please help me in retrieving the all the tuple value.

Thanks

Regards

Narendra

Former Member
0 Kudos

Hi Narendra,

Please check the code below to read from a tuple field in MDM

Assume the variable rec hold the current record

MdmValue mdmVal = rec.getFieldValue(<Field Id of the tuple field in main table>);

MultiTupleValue tupVal_Cont = (MultiTupleValue) mdmVal;// Type cast if it is a multi valued tuple

// get all the tuple values for the current tuple field

TupleValue tupuntouched[] = tupVal_Cont.getUntouchTupleRecords();

// Iterate through each tuple

for(int t =0; t<tupuntouched.length;t++){

// Get all the field Id's within the tuple

FieldId fldId[] =tupuntouched[iCount].getFields();

// Get the metadata properties of the tuple

TupleDefinitionSchema tupSchema =tupuntouched[iCount].getMetadata();

// Get all the field Codes

String fldCode []=tupSchema.getFieldCodes();

// Iterate through eac field by field within the tuple

for(int fldCnt=0;fldCnt<fldCode.length;fldCnt){

// If condition should repeat for each field within the tuple

if(fldCode[fldCnt].equalsIgnoreCase(<field code within the tuple>)){

MdmValue val =tupuntouched[iCount].getFieldValue(fldId[fldCnt]);

}

}

}

Using the above code you can retrieve all the values from a tuple. The variable val will have the MdmValue and this can be type casted based on the type of the field

Please revert back for any clarifications.

Regards,

Ponraj M

Edited by: Ponraj M on Jul 3, 2009 10:59 AM

Former Member
0 Kudos

MdmValue mdmVal = record.getFieldValue(filedProp.getId());

MultiTupleValue tupVal_cont = (MultiTupleValue)mdmVal; // type casting for multivalue tuple

MdmValue tupleValues[] = tupVal_cont.getValues() ;

for (int t=0 ; t<tupleValues.length ; t++) //tupuntouched.length

{

TupleDefinitionSchema tupSchema = tupleValues[t].getMetadata();

TupleDefinitionProperties tupDef = tupSchema.getTupleDefinition() ;

FieldId[] tupDisplayFields = tupDef.getDisplayFieldIds();

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

{

MdmValue val = tupleValues.getFieldValue(tupDisplayFields) ;

}

}

-


i am trying to solve by above code but my code has error for the highlighted part... would you please guide me to help solve this code or retrive value from the Tuple ....

nitin_mahajan2
Contributor
0 Kudos

Narendra, I have submitted some documents talking about create MDM records and it has code for tuples also.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/master-data-manage...

The name of the document is "SAP NetWeaver MDM 7.1 Java API: First MDM Record"

If you cannot access this link, you can visit my profile and contributions > How to guides. It has the above document.

I am in process of submitting more documents on MDM71 for other features that i have used in my project.

I am working on 71 since December on a Ramp Up mode.

Regards,

Nitin