cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid date (valid to) in quotation DI API

Former Member
0 Kudos

Good day experts, I have a code that creates a quotation in SAP B1 through the DI API, but I ran into a problem when I wanted to assign it an expiration date (Valid to / DocDueDate), because it does not accept it in any format.

Looking at the XML of a document created in the client, I see that the date is in the following format:

<DocDueDate>20180410</DocDueDate>

I have tried to assign it both by a date field, and manually:

DateTime fechaPrueba = DateTime.Parse("20180523");
DateTime fechaPrueba = new DateTime(2018, 05, 23, 6, 30, 0);
Cotizacion.DocDueDate = Convert.ToDateTime( txtFecha.Text.ToString(), System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat);
Cotizacion.DocDueDate = DateTime.Now.AddMonths(1);
DateTime fechaPrueba = DateTime.ParseExact("20180511", "yyyyMMdd", CultureInfo.InvariantCulture);

But in no way I get the personalized date to appear, in some cases only one day is added to the due date, that is, those that I created today appear due tomorrow. In other cases, it sends me a message indicating that the date string has an incorrect format.

Has anyone had a similar problem? I checked the SDK help and only mentioned that the data type is date, but I did not find examples.

Thank you in advance for any example, comment or guidance you may give me. Best regards.

Accepted Solutions (0)

Answers (0)