cancel
Showing results for 
Search instead for 
Did you mean: 

Problem accessing standard collection in contract template document

Former Member
0 Kudos

Hello All,

We have requirement to read the sections and its clauses from the contract document template to validate the upload date via VALIDATE script event. I have written attached code. It returns correct collection size but when I access the records via index it returns null. Please let me know how to retrieve the details correctly to read the sections and its clause from contract document template


collSec = doc.getCollectionMetadata("SECTIONS").get(doc);
if (collSec.size() > 0 ) {
// returns correct number records in the standard collection
for (int i = collSec.size() - 1; i >= 0; --i){
section = collSec.get(i); // it fails. return null value if I refer the collection object with index
throw doc.createApplicationException("SECTIONS",collSec.get(i).toString());
if (hasValue(section)) {
//SECTION = IBeanHomeLocator.lookup(session,com.sap.eso.api.contractgen.SectionIBeanHomeImpl.sHOME_NAME).find(valueSection);
throw doc.createApplicationException("SECTIONS",section.toString()); } } }

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member190023
Contributor
0 Kudos

Hi,

The code returns null because collSec.get(i) is not an actual Section(1803), it is a SectionSub(1804).

In RefGuide you can see that the SECTIONS collection in the template actually contains references to contractgen.SectionSub

Try this code:

section = collSec.get(i).getSectionObjRef();

*it should return an objRef you can pass on to the home class.

Regards,

Bogdan