cancel
Showing results for 
Search instead for 
Did you mean: 

Date format

Former Member
0 Kudos

Hi,

I want to add an order via diapi, and the problem is when introducing the docduedate. The date format of my SBO is DD/MM/YYYY, so I've tried entering 30/09/2005 and it doesn't work.

Does anyone know which format do I have to use?

Thanks in advance,

vane

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Vanesa,

1. You can try to add "DateTimePicker" into your window form. And use the value for the DocDueDate.

2. Or you can do query to get the date value and add it to the DocDueDate.

Hope this helps,

Bruce.

AdKerremans
Active Contributor
0 Kudos

Hi Vanessa,

You should use code like below.

doc.docduedate = new date(year, month,day)

Good luck

Ad

Former Member
0 Kudos

Also try converting your date to format yyyyMMdd

Former Member
0 Kudos

Hi Ad,

I've tried what you have told me but it continues giving me error. Perhaps is not the date what is wrong. My code is this:

 
Dim Pedido As SAPbobsCOM.Documents
Dim LineasPedido As SAPbobsCOM.Document_Lines
Pedido = Compañia.GetBusinessObject (SAPbobsCOM.BoObjectTypes.oOrders)
LineasPedido = Pedido.Lines
With Pedido
   .DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Items
   .CardCode = 'a'
   .DocDueDate = New Date(FechaEntrega.Year,  FechaEntrega.Month, FechaEntrega.Day)
   .DiscountPercent = 5
End With
With LineasPedido
    .ItemCode = 'A001'
    .Quantity = 20
    .Price = 75
    .Add()
End With
Dim n As Integer
n = Pedido.Add()
If n <> 0 Then
     log.WriteLine("N: " + n.ToString)
     log.Flush()
End If

FechaEntrega is a date (30/09/2005)

Thanks,

vane

AdKerremans
Active Contributor
0 Kudos

Hi Vane,

Looking at your code, I wonder if format of the docduedate is the problem.

try changing

if n<> 0 then

log.writeline(Compañia.GetLastErrorDescription)

log.flush

endif

Than you see the real errormessage.

Regards,

Ad