Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Update SpecialPrice using DI API - XML


I want to update my SpecialPrices using the DI API, and exporting the object in a XML file.

This is my process:

1) When I click on add button, I retrieve the CardCode and the ItemCode (getbykey)

2) I save the object like XML (specialPrice.SaveXML(pathXml)

3) I retrieve the object with (.getasxml) and replace the old value with the new value (.replace(oldvalue,newvalue)

4) I write the new xml

5) I set new obejct with GetBusinessObjectFromXML(path,0) and then I call .update() but I catch an error (invalid xml file)

What can I do??

Where is the error??



Former Member
Former Member replied

Marco, did you tried it without replacing the values? Try to update it with the same xml you got.

I think that thje problem is in

xmlmodel = xmlmodel.Replace(specialPriceFrom.DiscountPercent, "1")

Im persuaded, that with this replacing youll repalce other things too (names of nodes, ...).

The replacement should be somethink like

xmlmodel = xmlmodel.Replace("<node name>" & specialPriceFrom.DiscountPercent, "<nodename>1")

Try it and let me know.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question