Skip to Content
author's profile photo Former Member
Former Member

I am trying to add a group of GCL approvers attached to a commodity to a list but it is giving an error.

Hi All,

I am new to Sourcing.

I have a userdefinedbizdoc1 which has a group of approvers attached with it. What I am trying is to add this group to a list but I am unable to do so. It is throwing error "Error executing script: Sourced file: inline evaluation of: ``import java.util.List; import com.sap.eso.api.rfx.RfxDocIBeanIfc; import com . . . '' : null."

Plz help how to get rid of this error.

Here is the code I am using

import java.util.List;

import com.sap.eso.api.rfx.RfxDocIBeanIfc;

import com.sap.odp.api.common.platform.IapiSessionContextIfc;

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

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

import com.sap.odp.api.ibean.ExtensionCollectionIfc;

import com.sap.odp.api.ibean.ExtensionCollectionMemberIfc;

import com.sap.odp.api.ibean.ExtensionFieldIfc;

import com.sap.odp.api.ibean.IBeanHomeLocator;

import com.sap.odp.api.ibean.OrderedSubordinateCollectionIfc;

import com.sap.odp.api.usermgmt.masterdata.GroupIBeanIfc;

List listGcl= null;

OrderedSubordinateCollectionIfc rfxCollaboratorCollection=(OrderedSubordinateCollectionIfc) doc.getCollaborators();

ExtensionCollectionIfc commodityCollection=doc.getExtensionCollection("RR_COMMODITY_COL");//gets commodity collection

if (commodityCollection==null||commodityCollection.size()==0)

{

doc.setDocumentDescription("commodityCollection null");//just to check whther working or not

}

for (int i=0;i<commodityCollection.size();i++)

{

ExtensionCollectionMemberIfc commodityCollMember=(ExtensionCollectionMemberIfc)commodityCollection.get(i);//gets every element

ObjectReferenceIfc commodityFromRfx=(ObjectReferenceIfc)commodityCollMember.get("RR_INTERNAL_CAT");//gets object reference

InternalCatIBeanIfc cmdy=(InternalCatIBeanIfc) IBeanHomeLocator.lookup(session,commodityFromRfx).find(commodityFromRfx);

ExtensionFieldIfc gclExtension=cmdy.getExtensionField("RR_GCL");

if (gclExtension.equals(null))

doc.setDocumentDescription("GCL null");

ObjectReferenceIfc groupGcl=(ObjectReferenceIfc) gclExtension.get();//object reference of GCL

if (!groupGcl.isSet())//if gcl is not referenced

doc.setDocumentDescription("groupGcl null");

GroupIBeanIfc groupHomeBean=(GroupIBeanIfc) IBeanHomeLocator.lookup(session,groupGcl).find(groupGcl);//find gcl

doc.setDocumentDescription("groupHomeBean"+groupHomeBean.getDisplayName());

if(!listGcl.contains(groupHomeBean))

listGcl.add(groupHomeBean);

}

I am getting error in last 2 lines. adding is not working. Don't know why.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 29, 2012 at 08:28 AM

    Hi Kumud,

    The null is because you have not instantiated listGcl yet.

    Declared:

    List listGcl= null;

    Used:

    if(!listGcl.contains(groupHomeBean))

    No instantiation in between.

    Regards,

    Subhasini

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.