cancel
Showing results for 
Search instead for 
Did you mean: 

How to set values to VLV through java code

Former Member
0 Kudos

Hi Experts,

Thanks for your time in advance,

Could you please let me know, if anyone worked on setting VLV values through java code. This VLV is a custom extension field. We have another vlv , which is field of custom Collection. so these values we are would like to set through Java code. This java code is in custom jar.

Thanks and Regards,

N.Venkateswararao.

Accepted Solutions (0)

Answers (1)

Answers (1)

isaac_ariza_cruz
Participant
0 Kudos

Hello,

Here you have an example to set vlv in one extension field:

import com.sap.odp.api.doccommon.masterdata.ValueListValueIBeanHomeIfc;

import com.sap.odp.api.doccommon.masterdata.ValueListValueIBeanIfc;

.....

//Retrieve Value Type "XXXXX":

valueTypeHome = IBeanHomeLocator.lookup(session,"com.sap.odp.api.doccommon.masterdata.ValueListTypeIBeanHomeImpl");

valueTypeBean = valueTypeHome.findByExternalId("<EXTERNAL_ID_OF_VALUE_TYPE>");

valueBean = valueTypeBean.getCollnValueListValue().get(i); // i = position of value list value (from 0 to N)

//Set value in corresponding field

doc.getExtensionField("<EXTENSION_FIELD>").set(valueBean.getLocalizedObjectReference());

Hopes this help you.

Best regards,

Isaac