cancel
Showing results for 
Search instead for 
Did you mean: 

Updating Big text from ToolBar Script

Former Member
0 Kudos

We are not able to update a field from Subagreement to Contract of type Big Text

Can you please point out where the issue is, i know the code is custom.

Steps we followed

1. Create a extension field of type Big text in Subagreement(SA)- 1003

2. Create a extension field of type Big text in Contract Document(CD) - 2002

3. Create a Tool Bar Script in SA to update the field from SA to CD - code attached

4. Create a SD and save

5. fill some value in the extension of type Big text in SA

6. Execute the toolbar script again

7. change the value in the extension of type Big text in SA

8. Execute the toolbar script again

9. you will get error "target Exception"

Code:

//Purpose of this contract action
if(doc.getExtensionField("ZCLMSCDEXECSCP").get().getTextString(session) != null){

import com.sap.odp.api.common.types.TypeFactory;
act = TypeFactory.createBigText(doc.getExtensionField("ZCLMSCDEXECSCP").get().getTextString(session));

cont_doc.getExtensionField("ZCLMSCDAPPSCPE").get().setText(act.getTextString(session));

}

Error when running the Script to Update the Text Extension Field:

“ Target exception: java.lang.illegalArgumentException: text can not be changed”.

Any help will be appreciated,

Vaibhav.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hello,

BigText attributes are immutable.  Which is fine.  The script you have is actually pretty close.  When you use the TypeFactory to create a new BigText attribute from the String value of the other BigText attribute, you just need to set that new BigText into the target extension field….

//Purpose of this contract action

if(doc.getExtensionField("ZCLMSCDEXECSCP").get().getTextString(session) != null){

import com.sap.odp.api.common.types.TypeFactory;

act = TypeFactory.createBigText(doc.getExtensionField("ZCLMSCDEXECSCP").get().getTextString(session));

// Can't do this...

//cont_doc.getExtensionField("ZCLMSCDAPPSCPE").get().setText(act.getTextString(session));

// Do this ...

cont_doc.getExtensionField("ZCLMSCDAPPSCPE").set(act);

}

Hope that helps.

Thanks

Answers (0)