Skip to Content
0
Former Member
Jul 15, 2014 at 02:14 PM

Get Data from unposted Document

28 Views

Hi Everybody,

I need to create a validation for an Invoice Document. The validatio must run, before the document is added.

Means, I need to get the document total, compare it to some conditions and then allow/block the adding of the document.

My Problem is now to get the relevant information.

If I try to get the value from UID like this

TextEdit.GetFromUID(pVal.Form, "29").Value.ToString(); 

than the system returns the value to me including the currency sign, like "100.00 EUR". But I don't want to have the currency signs in there. And I can not use substring, because the currency can be different from time to time and it can also be on the right or left side of the value.

My next thought was, to get the information directly from the document object like this:

SAPbobsCOM.Documents oInv = (SAPbobsCOM.Documents) oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices); 
 oInv.GetByKey(xy); // DocEntry needed  
 oInv.DocNum.ToString();

This will work perfectly if I had a DocEntry which that I can use to connect to the object.

For documents already posted to the database this is no problem, because I can get the DocEntry via Database Selcet.

But how I can connect to an UNPOSTED Document where I have no Doc Entry?

Did anybody have a solution for me?

Or did anyone maybe have an other solution for me, how to get the data?

Best Regards,

Sebastian