cancel
Showing results for 
Search instead for 
Did you mean: 

Service Master Implementation

Former Member
0 Kudos
89

Hi Experts,

We are in Sourcing 10.0

We are implementing Service Master , from configurations side we have done the changes.

Now we have to write the script for -  to change the item type from Material to Service in the case where a service master is added.

I have tried the code but it's not working:

ma_line_items = doc.getLineItems();

iter = ma_line_items.iterator();

while(iter.hasNext())

{

     line_item = iter.next();

    mat_obj = line_item.getMaterialObjRef();

    matHome= IBeanHomeLocator.lookup(session, mat_obj).find(mat_obj);

          if(matHome.getExtensionField("Z_Is_Service").get())

       {

name=matHome.getDisplayName();

//line_item.setLineItemTypeEnum(LineItemTypeEnumType SERVICE);

              line_item.setLineItemTypeEnum(new LineItemTypeEnumType(2));

}}

Can anyone help me on this

Any leads would be of great help!!

I am getting the the below error

Regards,

Geetika

Accepted Solutions (1)

Accepted Solutions (1)

kushagra_agrawal
Active Participant
0 Kudos

HI Geetika,

Add the highlighted lines in your code :

import com.sap.eso.api.doccommon.lineitem.LineItemTypeEnumType;

ma_line_items = doc.getLineItems();

iter = ma_line_items.iterator();

  lineTypeEnum = new LineItemTypeEnumType(LineItemTypeEnumType.SERVICE);

while(iter.hasNext())

{

     line_item = iter.next();

    mat_obj = line_item.getMaterialObjRef();

    matHome= IBeanHomeLocator.lookup(session, mat_obj).find(mat_obj);

          if(matHome.getExtensionField("Z_Is_Service").get())

       {

name=matHome.getDisplayName();

line_item.setLineItemTypeEnum(lineTypeEnum);

}}

Hope it helps!

Best,

Kushagra A

Former Member
0 Kudos

Hi Kushagra,

Many thanks for your input,

I have tried the code in the toolbar script ,done logging then in the nwa  value is showing  as "SERVICE". But on UI it's not reflecting,

Also when i am running the code on validate event system throwing an error pasted above.

"You can only select the following item types for materials in the selected document type:Material"

Can you please help us on this!!

Any leads would be of great help!!

Regards,

Geetika

Answers (0)