cancel
Showing results for 
Search instead for 
Did you mean: 

Sales Order ShipToCode

Former Member
0 Kudos

Good Day

Experts:

Well, I am back on this ol troublesome ShiptToCode issues on my SalesOrder generation. I have verified my code for using the oOrders object is correct as I have a SalesOrder that has the correct Bill-To and Ship-To.

However, that successful one was surrounded by one before and one after that was not correct. It apears that the Bill-To is being put in the Ship-To field. I compared the OCRD and CRD1 records for the success and failure thinking or hoping that there was a "flag" I was missing on the offending ones. But that netted nothing.

So, I know the code works but now I cannot figure if there is a "Setting" I am missing "somewhere" for the offending ones. I tried resetting them to the default and no luck.

Any kind of brainstorming ideas that I can try here would be great.

Thanks,

Ed

I am having a bit of trouble when I generate a SalesOrder. Specifically, "sometimes" the incorrect ShipToAddress is coming up on the order even though I am sending the correct ShipToCode to the SalesOrder object. The address also is coming up blank sometimes or even the BillTo address shows in the ShipTo Address. Now, since it does work correctly with other ShipToCodes, I am really confused as to how to approach any kind of debuggin efforts.

When I enter a SalesOrder manually, the correct ShipTo Address appears when I use the same CardCode that would fail when using my program

So, I ask myself what is different from the manual process compared to what I am passing in my program to the SalesOrder object. I could not find any differences. Is there anyone that may have experienced this odd behavior that has some insight? Ideas for tracking this down would be greatly appreciated.

Edited by: Ed Dobias on Sep 22, 2008 10:24 PM

Edited by: Ed Dobias on Sep 22, 2008 10:25 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Dear Ed Dobias,

There was a bug Ship To Address Mixed Up with Bill To Address and fixed in 2005 A SP01- patch 46 and 2007 A PL 39.

Please refer to SAP Note 1146415 for detailed information, it may related to your issue.

Best Regards

Jane Jing

SAP Business One Forums team

Former Member
0 Kudos

Hello Jane

I am interested in your response. Where do I go to find the notes?

Thanks,

Ed

Nussi
Active Contributor
0 Kudos

Hi Ed,

visit this

[Link|http://service.sap.com/notes]

here you can search notes via text or enter the note nr. at the top:)

lg David

Answers (1)

Answers (1)

Former Member
0 Kudos

Dear Ed Dobias,

Could you put the code used and explain more about the issue?

Best Regards

Jane Jing

SAP Business One Forums team

Former Member
0 Kudos

Thank you for repsonding Jane.

Quick Summary:

I am using the oOrders object to create SalesOrders in a StandAlone application. The issue I am having is the Bill-To address is "at times" getting placed in the Ship-To address field on the Logistics Tab of the SalesOrder.

I am passing the ShipToCode to the Object, so that should initiate both the Ship-To and the Bill-To addresses getting retrieved and not some kind of default that might be occuring behind the scenes sending the Bill-To to the Ship-To address field. I have taken the ShipToCode I am passing to the Object and trimmed both ends of it so I am certain the I have no "Renegade" characters hanging around.

The very troubling part is that I can run my application using a certain CardCode and ShipToCode and it creates the SalesOrder correctly with the ShipTo getting over-written by the BillTo. Then I can take a different CardCode and ShipToCode and get a SalesOrder that has the BillTo as the ShipTo as well as the BillTo.

One would think that might mean that perhaps the ShipToCode I am passing to the object is not valid. I am validating that first before even trying to add to make sure it is valid in CRD1 for AdresType of 'S'.

Here is my Code:

vSlsOrd = oSAPCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)

vSlsOrd.HandWritten = SAPbobsCOM.BoYesNoEnum.tYES

vSlsOrd.Series = -1

vSlsOrd.DocNum = WebSlsOrddr.GetValue(0)

vSlsOrd.CardCode = WebSlsOrddr.GetValue(1)

vSlsOrd.CardName = WebSlsOrddr.GetValue(2)

Dim ShipToCode As String = WebSlsOrddr.GetValue(3)

ShipToCode = ShipToCode.TrimEnd

ShipToCode = ShipToCode.TrimStart

vSlsOrd.ShipToCode = ShipToCode

vSlsOrd.NumAtCard = WebSlsOrddr.GetValue(5)

vSlsOrd.SalesPersonCode = WebSlsOrddr.GetValue(6)

vSlsOrd.DocDueDate = Date.Now

If LineCtr > 0 Then

vSlsOrd.Lines.Add()

End If

vSlsOrd.Lines.ItemCode = WebSlsOrdLinesdr.GetValue(1)

vSlsOrd.Lines.Quantity = WebSlsOrdLinesdr.GetValue(2)

vSlsOrd.Lines.UnitPrice = WebSlsOrdLinesdr.GetValue(3)

RetValRDR1 = vSlsOrd.Add

If RetValRDR1 = 0 Then

'Do some stuff

Else

oSAPCompany.GetLastError(RetValRDR1, sErrMsg)

End If

Thanks,

Ed

Former Member
0 Kudos

Ed,

may be too boring an answer but, have you tried passing hardcoded values for address? and how are you fetching the address code from business partner? is it something like this?


Dim obp As SAPbobsCOM.BusinessPartners
                obp = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners)
                If obp.GetByKey("C00001") = True Then
                    For i = 0 To obp.Addresses.Count - 1
                        obp.Addresses.SetCurrentLine(i)
                        If obp.Addresses.AddressType = SAPbobsCOM.BoAddressType.bo_ShipTo Then
                            ShiptoCode = obp.Addresses.AddressName
                        End If
                    Next
                End If

regards,

Binita

Former Member
0 Kudos

Good Day

Binita...thanks for your response.

I am being supplied the ShipToCode. That is all I am passing to the object. I did not see anywhere to send the street, city, zip etc. I am not sure if I need to pass enything else. The sample for Orders and Invoice was not real clear for me so I runed to the forum.

With just passing the ShipToCode, I did notice something interesting late last night. If the ShipToCode and the BillToCode were the same as the ShipToCode I was passing in, the BillToCode was getting populated in the ShipToCode. However, if the BillToCode was different than the ShipToCode that I was passing, then the ShipToCode and BillToCode would come across to the SalesOrder correclty.

Your message made me think. Perhaps I need to supply the BillToCode even if it is the same as the ShipToCode. I will try populating I think the PayToCode.

Ed

Former Member
0 Kudos

Ed,

I could reproduce that issue and even if you provide the PayTo address, if the code for Shipto and Billto is same , BillTo will overwrite Shipto code. further, if you don't provide anything and the default BP address for both type is same, same thing happens..

seems like a bug.

Former Member
0 Kudos

Hello Binita:

I am trying something I am hoping is NOT the "required" method to solve this. As I mentioned in one of my responses, the BillTo and ShipTo come down correctly when I initiate a SalesOrder with BP X that has the same BillTo and ShipTo CRD1.Address. So, I took a look at the resulting ORDR.Address and ORDR.Address2 values on the new SalesOrder and took note. Now I am trying to reproduce that "look" or block of text being the address in my code so I can apply it to vSlsOrd.Address and vSlsOrd.Address2 with vSlsOrd being my oOrders object.

We'll see if that takes care of it.

Ed