cancel
Showing results for 
Search instead for 
Did you mean: 

Change the value of an extension in master agreement via script.

Former Member
0 Kudos

Hello.

I'm trying to change the value of an extension in master agreement via script.

As I was checking, I couldn't find a function that would help you on that matter.

Is there a way to do so?

Example.

I added an extension in MA header, of a value, let's call the value "RFID".

If I want to change that value automatically via script when the MA loads. What function would allow me to set the new value of the RFID field, given it is an extension field?

Thanks in advance!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Oscar,

Suggest you to create a Document Lifecycle Event script on MA.

And have the RFID field set.
doc.getExtensionField(RFID).set("Dummy RFID Value");

Assuming your extension field is of type STRING.
Hope this Helps!

Regards,

Vignesh

Former Member
0 Kudos

Thanks a lot!

It worked like a charm

Former Member
0 Kudos

Hi Vig.

Just another simple question.

I happen to have an extension that it's not String, but text.

Do you know what's the name of the object I have to create in order to assign the value?

The error it throws is the following:

class java.lang.String:null incompatible with interface com.sap.odp.common.db.PersistentTextIfc:sap.com/E-Sourcing-Server@com.sap.engine.boot.loader.ResourceMultiParentClassLoader@77658153@alive‏

So, I Assume I need a PersistentText object to assign it, but it's not found on the namespace. Also, I cannot instantiate a PersistentTextIfc, because it is an interface.

I tried searching in the api with no success.

Thanks in advance!

Former Member
0 Kudos

Hi Oscar,

Try the below code:

import com.sap.eso.api.doccommon.ont.types.BigTextValueIBeanIfc;
import com.sap.odp.api.common.types.TypeFactory;

bigTextObj=TypeFactory.createBigText("Hello world").getTextString(session);
doc.getExtensionField(RFID).set(bigTextObj);

This will solve your problem!!

Regards,

Vignesh

Former Member
0 Kudos

Hi Vig!

Thanks a lot! It did work.

Just a note, I had to do some minimal changes in order for it to work, but the suggested library (TypeFactory) really did the job.

The final code was as follows:

import com.sap.eso.api.doccommon.ont.types.BigTextValueIBeanIfc;

import com.sap.eso.api.doccommon.ont.types.BigText;
import com.sap.odp.api.common.types.TypeFactory;

bigTextObj=TypeFactory.createBigText("Hello world");
doc.getExtensionField(RFID).set(bigTextObj);

Had to remove the getTextString because it was converting the Big Text to a String, therefore still throwing me the exception.

Thank you so much for your help!

Answers (0)