Hello Experts ,
We are on SAP Sourcing 10 . We have a scenario for master agreement where each lineitems have multiple supplier entered attributes (price type) . We need to create extra lineitems (on the same MA ) from the existing lineitems with each supplier entered attributes becomes the unit price for new lineitems .The event will be on MA save .
To achieve that , we have created a MA validation script . However , we are able to create new lineitems but not able to assign the supplier entered attributes to new lineitem unit price . When we run the script , the new line items are created with blank unit price . Can you please guide if I am mistaking anywhere ?
In the included screenshot , last two lineitems are created from the 1st one . The supplier entered attributes for 1st lineitem ( 33 and 33 USD ) should become unit price for 2nd and 3rd line item .
Code :
SupplierAttribute = doc.getLineItems().get(0).getVendorSpecGroup().get(0).getItemSpecs().size();
for(int j=0; j < SupplierAttribute ; j++)
{
DualPrice = TypeFactory.createDualPrice(doc.getCurrency(), doc.getLineItems().get(i).getVendorSpecGroup().get(0).getItemSpecs().get(j).getValue().getPrimaryPrice().getPrice());
agr_docline = doc.getLineItems().create();
agr_docline.getFieldMetadata("MATERIAL").set(agr_docline, doc.getLineItems().get(i).getFieldMetadata("MATERIAL").get(doc.getLineItems().get(i)));
agr_docline.getFieldMetadata("UNIT_PRICE").set(agr_docline, DualPrice);
agr_docline.getFieldMetadata("QUANTITY").set(agr_docline, Quantity);
agr_docline.getFieldMetadata("PLANT").set(agr_docline, null);
doc.getLineItems().add(agr_docline);
}
Thanks
Sudipta