cancel
Showing results for 
Search instead for 
Did you mean: 

How to check if SAPbobsCOM.Documents object represents draft?

0 Kudos
1,208

Hi folks,

I get the draft invoice in this way:

SAPbobsCOM.Documents oDoc = Company.GetBusinessObject( SAPbobsCOM.BoObjectTypes.oDrafts );
oDoc.GetByKey( docEntry );

Now, I want to check if object oDoc represetns draft or regular document.

After method GetByKey() property DocObjectCodeEx (and DocObjectCode too) return value 13 (and oInvoice).

m_felicella
Participant
View Entire Topic
vitor_vieira
Explorer
0 Kudos

Hi Prsemyslaw,

By instantiating the object with "Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDrafts)" you are guaranteeing it is a draft. But keep in mind that drafts for all document types are stored under the same table and thus accessible through the same object. That is why DocObjectyCode is returning 13 - because that record is a A/R Invoice draft.

I recommend checking SDK help file, see the sample code for the Document object. See:

- Create Draft Document with Down Payment - Create Order from a Draft Document

Hope this helps,

VV

0 Kudos

Hi Vieira, thx for your post. All You wrote is ok but, only if You are "creator" of document object.
In my case I did not created those objects, they have been exposed by external library.
I have array of SAPbobsCOM.Documents without konowledge how this object was created: like draft and then loaded by GetByKey() or like "normal" document.
Now I need to separated drafts from others documents because business logic depends from this fact.
So thats my queston is how to _check_ if the object SAPbobsCOM.Documents represents draft document or not.