3 weeks ago
Version: SAP Business One 10.0 SP 2411 for HANA
I am trying to set the ShippingMethod in order lines to the default value -1 with an update via DI-API. Unfortunately without success so far. The value -1 is not recognized. Instead, the value 15 is entered, which is contained in the OSHP table.
The update process does not produce an error. Since I also adjust the delivery date in the same step, which works, the question has arisen for me whether the value -1 cannot be set or whether it is a problem in the DI-API.
The same behavior exists via the service layer. However, I can update a NULL via the service layer, which is not possible via the DI-API.
Who has ideas or solutions?
Code:
I run a query to determine all order lines that should be updated
--------------
while (!oRecordset.EoF)
{
SAPbobsCOM.Documents oOrders = (SAPbobsCOM.Documents)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders);
int documentEntry = (int)oRecordset.Fields.Item("DocEntry").Value;
int documentLine = (int)oRecordset.Fields.Item("VisOrder").Value;
oOrders.Lines.SetCurrentLine(documentLine);
oOrders.Lines.ShipDate = DateTime.Now.AddDays(addDaysToCurrentDateForNewShipDate).Date;
oOrders.Lines.ShippingMethod = -1;
oOrders.Update()
}
--------------
Request clarification before answering.
Hi Swen_Koegler,
According to SAP Note 2623612:
If you use ShippingMethod = -1 in the DI program, it will take the Shipping Type from Item Master Data of the line. This is by-design behavior.
If you want to set Shipping Type as empty, you should use the following:
oSO.Lines.ShippingMethod = -2;
Hope it helps!
Kind regards,
ANKIT CHAUHAN
SAP Business One Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ANKIT_CHAUHAN,
unbelievable, but it works. It's a good thing that SAP doesn't write it in the DI-API documentation. Otherwise there would be no need for this forum. 🙂
Thanks a lot. Problem solved.
User | Count |
---|---|
102 | |
15 | |
9 | |
7 | |
5 | |
4 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.