Credit memo draft adding 7 times automatically
Dear all,
I created draft for credit memo. i converted this draft to credit memo by using DI API. but its adding 7 times automattically (vocationaly).
With regards
Venkatesan .A
Guest replied
Dear
To work around this, you can get the draft, save it as
XML, change the nodenames to adjust them to the new object, delete the
Key for header and lines and get it from XML to save it in the DB. We
have samples at the bottom of Document Object in SDK online help. I
paste the code below, it's about "save a draft document to xml and then
creates a new order based on the xml"
Example
Private Sub cmdDraftToOrder_Click()
Dim pDraft As SAPbobsCOM.Documents
Set pDraft = vCmp.GetBusinessObject(oDrafts)
Dim pOrder As SAPbobsCOM.Documents
vCmp.XmlExportType = xet_ExportImportMode
vCmp.XMLAsString = False
pDraft.GetByKey (3)
pDraft.SaveXML ("c:\drafts.xml")
'Here you should add a code that will change the Object's
'value from 112 (Drafts) to 17 (Orders) and also you should
'remove the DocObjectCode node from the xml. You can use any
'xml parser.
'
'Create a new order
Set pOrder = vCmp.GetBusinessObjectFromXML("c:\drafts.xml", 0)
pOrder.Add
End Sub
Acturally, there is not such method in current DI API that will convert
draft to document straightaway. you may refer to above code for your credit memo to see if it works for you
Hope the above information helps.
best regards,
xiaodan an