on 2016 Jan 07 9:05 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.