cancel
Showing results for 
Search instead for 
Did you mean: 

get the plant name from the lineitem of a Master Agreement in sourcing 7.0 ?

Former Member
0 Kudos

Hi Experts,

        We are migrating our SAP e-sourcing ver 5.0 to 7.0. In the previous version we have an outbound script for the master agreement.

To get the plant name and price unit of line item we were using the following code

import com.sap.eso.api.contracts.ContractIBeanHomeIfc;

agreementBean = doc.getRootParentIBean();
contractHome=IBeanHomeLocator.lookup(session,ContractIBeanHomeIfc.sHOME_NAME);
// To get the agreemnet id
agreement_id_str = doc.getDocumentId();

lineItemCollection = agreementBean.getLineItems();
collectionsize = lineItemCollection.size();

//getting the line items for a master agreement

for(i=0;i<collectionsize;i++){
list_item_str = "";
collectionbean = lineItemCollection.get(i);

plant_str= collectionbean.getExtensionField("PLANT").get().getDisplayNameId(session);

price_unit_int = collectionbean.getExtensionField("PRICE_UNIT").get().intValue();


}

but when we try the same in 7.0 the following lines give error

plant_str=collectionbean.getExtensionField("PLANT").get().getDisplayNameId(session);

price_unit_int = collectionbean.getExtensionField("PRICE_UNIT").get().intValue();

please suggest how to modify these line to make it running in version 7.0

Regards,

Swastik

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Swastik,

It appears that the two fields in question are Extension Fields, i.e. they are not standard fields.

I would begin by confirming if these fields exist in the Extension Defintion. Please see if these fields were migrated correctly and still have the same name.

Also, if you could mention the error message encountered it would be easier for us.

Thanks

Devesh

Former Member
0 Kudos

Hi,

  These two fields are not extend fields created by the user, as when you open the Reference Guide, you will able to see these two fields. But there is nothing mentioned how to get the values of these fields. I am searching  how to get the value.

Regards,

Swastik

Former Member
0 Kudos

Hi Swastik,

Try this:

collectionbean.getFieldMetadata("PRICE_UNIT").get(collectionbean).intValue();

I am assuming that the "collectionbean" variable holds a LineItemIfc IBean.

Let us know how it goes.

Thanks

Devesh

Former Member
0 Kudos

Hi Devesh,

Its Working.

Thanks,

Swastik

Answers (0)