sapb1sap-business-one-di-api

SAP B1 How to create approved document from approved draft via SDK


I've tried sample code like this;

SAPbobsCOM.Documents oDocDraft = SAPbobsCOM.Documents)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDrafts);<br>oDocDraft.GetByKey(docEntry);<br>oDocDraft.SaveDraftToDocument();

but this only creates regular document(doesn't have any information about approval status).

Also it does not generate process history on linked tables(ordr,owdd,wdd1) when the draft created via SDK

Is it possible to create approved document via SDK? If so I need an example about how to achieve that(c# code preferably). Any help would be much appreciated.


Solution

  • You should use SaveDraftToDocument method of Document interface. "Converts an approved draft document to a valid document." - this is from sdk documentation.