cancel
Showing results for 
Search instead for 
Did you mean: 

Assigning UnitPrice in lineitem

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Experts ,

Our basic objective is to set unit price for a MA lineitem .The script in MA validation. Methods we are trying -

agr_docline.getFieldMetadata("UNIT_PRICE").set(agr_docline,DualPrice);
  and other one

agr_docline.setUnitPrice(DualPrice) ;

Looks like none of these are working . There is no error but unit price is not assigned.

agr_docline and DualPrice is described  above  in my post

Any Idea will be helpful .

Thanks