cancel
Showing results for 
Search instead for 
Did you mean: 

Set Values in Multi value tuples

Former Member
0 Kudos


Hi All,

I need to set values for tuple fields. How do I do that in webdynpro java?

Please help me on this. Your help is highly appreciated.

Thanks & Regards,

Manoj

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

HI Manoj,

Is this issue resolved?

Former Member
0 Kudos

Hi Arjun,

No, not yet. Please share your knowledge if you come across similar situation

Thanks & regards,

Manoj


Former Member
0 Kudos

can you use this multiTupleValue.addValue(tupleVal);    instead of multiTupleValue.newTupleValue(tupleVal);



Please modify and check if this works out.

Former Member
0 Kudos

Hi Arjun,

As I mentioned above, I tried with 'setValues', 'newTupleValue' and 'addValue' methods. Nothing worked.'

BR,

Manoj

Former Member
0 Kudos

Ok!

if its the same class cast exception, can you check if you are feeding a Tuple value instead of a multiValue.

in the above code I can see that the transactions with the Tuple and the MultiTuples are fine.

Can you also check the step where you set the value to the record?

record.setFieldValue(tableSchema.getFieldId(tupleName), multiTupleValue);    

Former Member
0 Kudos

Hi All,

"Assumed Answered" was a mistake. Please ignore it and share your thoughts on this.

PS: I need to set values for tuples fields on Screen.

Thanks & Regards,

Manoj

former_member191044
Active Contributor
0 Kudos

Hi Manoj,

maybe this can help you --> http://help.sap.com/saphelp_nwmdm71/helpdata/en/f9/ff1d5f39c048eaa6e1eb7012004c32/frameset.htm

[...]

MultiTupleValue phonesTuple = new MultiTupleValue();

// home phone

TupleValue phoneTuple = MdmValueFactory.createTupleValue();

phoneTuple.setFieldValue(numberFieldId, new StringValue("800-888-8888"));

phoneTuple.setFieldValue(descriptionFieldId, new StringValue("Home"));

phonesTuple.newTupleValue(phoneTuple);

// work phone

phoneTuple = MdmValueFactory.createTupleValue();

phoneTuple.setFieldValue(numberFieldId, new StringValue("800-999-9999"));

phoneTuple.setFieldValue(descriptionFieldId, new StringValue("Work"));

phonesTuple.newTupleValue(phoneTuple);

// set phone numbers to record

record.setFieldValue(phonesFieldId, phonesTuple);      

}

[...]

Regards,

Tobias

Former Member
0 Kudos

Hi Tobias,

Thanks for your time. what is 'record' in record.setFieldValue(phonesFieldId, phonesTuple) ?

And what is this method "setMultiValueTupleField()"? Is it a std one? If so, how do I use it?

Sorry for too many question. I am a beginner

Thanks & Regards,

Manoj

former_member191044
Active Contributor
0 Kudos

Hi Manoj,

"record" is the mdm record you are working with.

What do you mean with "std one"? I didn't get that.

I cannot give you whole training here so i would suggest you to read through the documentation of using MDM Component / MDM API in WebDynpro Java

--> http://help.sap.com/saphelp_nwmdm71/helpdata/en/45/76bc4ed69b1956e10000000a11466f/content.htm?frames...

If you have a specific question, i can try to help you ofcourse.

Hope this helps.

Best Regards,

Tobias

Former Member
0 Kudos

Hi Tobias,

Thanks for the help. Really appreciate it. Tutorial you gave worked like a charm.

Thanks & Regards,

Manoj

Former Member
0 Kudos

Hi Tobias/All,

When I use "phonesTuple.newTupleValue(phoneTuple)", only the last tuple gets added into multi-valued tuple.

So I tried with "phonesTuple.addValue(phoneTuple)", it throws below exception

"Cannot cast class com.sap.mdm.internal.valuetypes.TupleValueImpl to class
com.sap.mdm.valuetypes.MultiTupleValue"

Please anyone explain this and how to add multiple tuple values into a tuple.

Thanks & Regards,

Manoj

Former Member
0 Kudos

Hi,

Here is what I am doing:

  MultiTupleValue mtvTelephone = new MultiTupleValue();

   TupleValue tvTelephone = MdmValueFactory.createTupleValue();

   TupleValue tvTelephone2 = MdmValueFactory.createTupleValue();

FieldProperties[] mtFieldPropertiesForTelephone = schema.getTupleMemberFields("Telephone_Numbers");

   TupleDefinitionProperties tdTelephone = schema.getTupleDefinition("Telephone_Numbers");

   TupleDefinitionSchema tdsTelephone = schema.getTupleDefinitionSchema(tdTelephone.getId()) ;

tvTelephone.setFieldValue(tdsTelephone.getFieldId("Number_Types"), numberTypeValue);

    tvTelephone.setFieldValue(tdsTelephone.getFieldId("Number"),new StringValue(wdThis.nullCheck(wdThis.wdGetGetDnBDetailsFromMDMCustController().wdGetContext().nodeResponse_1().nodeDUNS_Data().currentDUNS_DataElement().getTelephoneNumber())));

    mtvTelephone.newTupleValue(tvTelephone);

tvTelephone2.setFieldValue(tdsTelephone.getFieldId("Number_Types"), numberTypeValue);

    tvTelephone2.setFieldValue(tdsTelephone.getFieldId("Number"),new StringValue(wdThis.nullCheck(wdThis.wdGetGetDnBDetailsFromMDMCustController().wdGetContext().nodeResponse_1().nodeDUNS_Data().currentDUNS_DataElement().getFaxNumber())));

   mtvTelephone.newTupleValue(tvTelephone2);

wdThis.wdGetCreateBPItemDetailInterface().setFieldValue("Telephone_Numbers",mtvTelephone);

But only the last tuple value is added onto the "Telephone Numbers" multivalued tuple.

Anything wrong in what I am doing, please let me know about it.

Thanks & Regards,

Manoj


former_member191044
Active Contributor
0 Kudos

Hi Manoj,

this looks quite correct to me. I can't test it right now because i have no mdm components here. You could try the "addValue" method instead of "newTupleValue" and see if that works (despite that "newTupleValue" is recommended).

Regards,

Tobias

Former Member
0 Kudos

Hi Tobias,

I've tried that too. But no use. Same result. I don't know what is that I am doing wrong.

Regards,

Manoj

former_member191044
Active Contributor
0 Kudos

Your code looks correct. Maybe there is a bug in SAPs MDM API. In this case you will need check for notes for the version your server is on or report a bug.

Have you tryed to set the values in a Array and use the "addValues" method. Don't think that it will change anything because that method should call "addValue" internal but this is SAP... you never know .

Regards,

Tobias

Former Member
0 Kudos

Hi Tobias,

Is there any such method called 'addValues'?. As you said I tried to set the values in array and used 'setValues' method. But same result.

You asked to check for notes for my server version, how do I do that?

Thanks & Regards,

Manoj

former_member191044
Active Contributor
0 Kudos

Hi Manoj,

you are right, it is "setValues". But as expected it does not work .

You can try search here https://websmp109.sap-ag.de/support under "Help & Support" if you can find any hints for mdm api / multituple / etc... In the note itself you can see for what version it applies so you can check if you are affected.

Best Regards,

Tobias

Former Member
0 Kudos

Hi Tobias,

As you suggested, I searched and found a note(1468379) with similar issue. The issue is fixed in  7.1 SP04 Patch13, but currently we are using 7.1 SP12.

Do you still think this could be a bug? A bug in WD framework component?

Please share your thoughts. Thank you very much for your time.

regards,

Manoj


former_member191044
Active Contributor
0 Kudos


Hi Manoj,

then this issue should be fixed in your version. I think you have no other choice than to open a product error via support portal. At least i have no other idea what could help you, sorry.

Please don't forget to mark answers as helpful if they were useful for you.

Best Regards & good luck,

Tobias