on 06-24-2008 6:19 AM
Hi All,
iam developing a webservice using DI-server in my asp.net application to access my sap company DB.now i have to create a purchase order...can anybody give me some web service coding about how to create a purchase order.....(like creating new customers & updating them...)
Regads,
Shangai.
Hi Shangai
Please ensure that you use the same Patch Level for the SBO client,
DI Server and the DI API.
First, to ensure you are not using cached versions of the DI Server and
the DI API, please do the following:
1. Locate the Temp folder by going to Start -> Run and type %temp%.
2. Locate the SM_OBS_DLL folder and delete it.
Then,retry the action.
Also,please check the Patch Level versions:
1. SBO Client
2. DI Server
- Start -> Run and type %temp%
- Go to that path, and in the directory SM_OBS_DLL\680320\.
- Right click on the OBSServerDLL.dll file and select Properties >
Version > Special Build Description.
3. DI API
-Go to DI API install directory. Default location:
"C:\Program Files\SAP\SAP Business One DI API\DI API 2005"
- Right click on the SAPbobsCOM2005.dll file select Properties > Version> Special Build Description.
Regards,
Syn Qin
SAP Business One Forums Team
Edited by: Syn Qin on Jul 2, 2008 3:32 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi shangai
For sales order(documents):
Mandatory fields in SAP Business One: CardCode and ItemCode (from Document_Lines object).
For document_lines(sub object document_lines):
Mandatory fields in SAP Business One: AccountCode and ItemCode.
You can also find above information from the SDK Help file.
*However,the accountcode is not a mandatory field according to my experience.
Hope that could help.
Regards,
Syn Qin
SAP Business One Forums Team
hi syn,
iam able to get the XML format for my sales order....but it's not getting saved to my SAP db.can u please help me that what iam missing here(i,e...iam missing any mandatory fields???),,this is my sales order xml template
<BOM>
u2212 <BO>
u2212 <AdmInfo>
<Object>oDocuments</Object>
</AdmInfo>
u2212 <QueryParams>
*<DocEntry>11</DocEntry>*
</QueryParams>
u2212 <Documents>
u2212 <row>
*<DocNum>11</DocNum>*
<DocType/>
<HandWritten/>
<Printed/>
*<DocDate>20080702</DocDate>*
*<DocDueDate>20080707</DocDueDate>*
*<CardCode>C00056</CardCode>*
*<CardName>Sample Customer</CardName>*
<Address/>
<NumAtCard/>
*<DocCurrency>INR</DocCurrency>*
<DocRate/>
*<DocTotal>44.000</DocTotal>*
<Reference1/>
<Reference2/>
<Comments/>
<JournalMemo/>
<PaymentGroupCode/>
<DocTime/>
<SalesPersonCode/>
<TransportationCode/>
<Confirmed/>
<ImportFileNum/>
<SummeryType/>
<ContactPersonCode/>
<ShowSCN/>
<Series/>
*<TaxDate>20080702</TaxDate>*
<PartialSupply/>
<DocObjectCode/>
<ShipToCode/>
<Indicator/>
<FederalTaxID/>
<DiscountPercent/>
<PaymentReference/>
<Form1099/>
<Box1099/>
<RevisionPo/>
<RequriedDate/>
<CancelDate/>
<BlockDunning/>
<Pick/>
<PaymentMethod/>
<PaymentBlock/>
<PaymentBlockEntry/>
<CentralBankIndicator/>
<MaximumCashDiscount/>
<Project/>
<ExemptionValidityDateFrom/>
<ExemptionValidityDateTo/>
<WareHouseUpdateType/>
<Rounding/>
<ExternalCorrectedDocNum/>
<InternalCorrectedDocNum/>
<DeferredTax/>
<TaxExemptionLetterNum/>
<AgentCode/>
<NumberOfInstallments/>
<ApplyTaxOnFirstInstallment/>
<VatDate/>
<DocumentsOwner/>
<FolioPrefixString/>
<FolioNumber/>
<DocumentSubType/>
<BPChannelCode/>
<BPChannelContact/>
<Address2/>
<PayToCode/>
<ManualNumber/>
<UseShpdGoodsAct/>
<IsPayToBank/>
<PayToBankCountry/>
<PayToBankCode/>
<PayToBankAccountNo/>
<PayToBankBranch/>
<BPL_IDAssignedToInvoice/>
<DownPayment/>
<LanguageCode/>
<TrackingNumber/>
<PickRemark/>
<ClosingDate/>
<SequenceCode/>
<SequenceSerial/>
<SeriesString/>
<SubSeriesString/>
<SequenceModel/>
<UseCorrectionVATGroup/>
<VatPercent/>
<U_DRV/>
</row>
</Documents>
u2212
<Document_Lines>
u2212
<row>
<LineNum/>
*<ItemCode>I9999</ItemCode>*
*<ItemDescription>Sample</ItemDescription>*
*<Quantity>2</Quantity>*
<ShipDate/>
*<Price>44.000</Price>*
<PriceAfterVAT/>
<Currency/>
*<Rate>20.00</Rate>*
<DiscountPercent/>
<VendorNum/>
<SerialNum/>
<WarehouseCode/>
<SalesPersonCode/>
<CommisionPercent/>
<TreeType/>
<AccountCode/>
<UseBaseUnits/>
<SupplierCatNum/>
<CostingCode/>
<ProjectCode/>
<BarCode/>
<VatGroup/>
<Height1/>
<Hight1Unit/>
<Height2/>
<Height2Unit/>
<Lengh1/>
<Lengh1Unit/>
<Lengh2/>
<Lengh2Unit/>
<Weight1/>
<Weight1Unit/>
<Weight2/>
<Weight2Unit/>
<Factor1/>
<Factor2/>
<Factor3/>
<Factor4/>
<BaseType/>
<BaseEntry/>
<BaseLine/>
<Volume/>
<VolumeUnit/>
<Width1/>
<Width1Unit/>
<Width2/>
<Width2Unit/>
<Address/>
<TaxCode/>
<TaxType/>
<TaxLiable/>
<BackOrder/>
<FreeText/>
<ShippingMethod/>
<CorrectionInvoiceItem/>
<CorrInvAmountToStock/>
<CorrInvAmountToDiffAcct/>
<WTLiable/>
<DeferredTax/>
<NetTaxAmount/>
<NetTaxAmountFC/>
<LineTotal/>
<TaxPercentagePerRow/>
<ConsumerSalesForecast/>
<ExciseAmount/>
<CountryOrg/>
<SWW/>
<TransactionType/>
<DistributeExpense/>
<ShipToCode/>
<RowTotalFC/>
<CFOPCode/>
<CSTCode/>
<Usage/>
<TaxOnly/>
<UnitPrice/>
<LineStatus/>
<LineType/>
<COGSCostingCode/>
<COGSAccountCode/>
<ChangeAssemlyBoMWarehouse/>
<U_DRV/>
</row>
</Document_Lines>
u2212
<Document_LinesAdditionalExpenses>
u2212
<row>
<LineNumber/>
<GroupCode/>
<ExpenseCode/>
<LineTotal/>
<TaxLiable/>
<VatGroup/>
<TaxPercent/>
<TaxSum/>
<DeductibleTaxSum/>
<TaxCode/>
<TaxType/>
<EqualizationTaxPercent/>
<EqualizationTaxSum/>
<WTLiable/>
<BaseGroup/>
</row>
</Document_LinesAdditionalExpenses>
u2212
<WithholdingTaxLines>
u2212
<row>
<WTCode/>
<WTAmountSys/>
<WTAmountFC/>
<WTAmount/>
<TaxableAmountinSys/>
<TaxableAmountFC/>
<TaxableAmount/>
<AppliedWTAmountSys/>
<AppliedWTAmountFC/>
<AppliedWTAmount/>
<BaseDocEntry/>
<BaseDocLine/>
<BaseDocType/>
</row>
</WithholdingTaxLines>
u2212
<SerialNumbers>
u2212
<row>
<ManufacturerSerialNumber/>
<InternalSerialNumber/>
<ExpiryDate/>
<ManufactureDate/>
<ReceptionDate/>
<WarrantyStart/>
<WarrantyEnd/>
<Location/>
<Notes/>
<BatchID/>
<SystemSerialNumber/>
<BaseLineNumber/>
</row>
</SerialNumbers>
u2212
<BatchNumbers>
u2212
<row>
<BatchNumber/>
<ManufacturerSerialNumber/>
<InternalSerialNumber/>
<ExpiryDate/>
<ManufacturingDate/>
<AddmisionDate/>
<Location/>
<Notes/>
<Quantity/>
<BaseLineNumber/>
</row>
</BatchNumbers>
u2212
<DocumentsAdditionalExpenses>
u2212
<row>
<ExpenseCode/>
<LineTotal/>
<Remarks/>
<DistributionMethod/>
<TaxLiable/>
<VatGroup/>
<TaxPercent/>
<TaxSum/>
<DeductibleTaxSum/>
<TaxCode/>
<TaxType/>
<EqualizationTaxPercent/>
<EqualizationTaxSum/>
<BaseDocEntry/>
<BaseDocLine/>
<BaseDocType/>
<LastPurchasePrice/>
<Stock/>
<WTLiable/>
</row>
</DocumentsAdditionalExpenses>
u2212
<WithholdingTaxData>
u2212
<row>
<WTCode/>
<WTAmountSys/>
<WTAmountFC/>
<WTAmount/>
<TaxableAmountinSys/>
<TaxableAmountFC/>
<TaxableAmount/>
<AppliedWTAmountSys/>
<AppliedWTAmountFC/>
<AppliedWTAmount/>
<BaseDocEntry/>
<BaseDocLine/>
<BaseDocType/>
</row>
</WithholdingTaxData>
u2212
<TaxExtension>
u2212
<row>
<TaxId0/>
<TaxId1/>
<TaxId2/>
<TaxId3/>
<TaxId4/>
<TaxId5/>
<TaxId6/>
<TaxId7/>
<TaxId8/>
<TaxId9/>
<State/>
<County/>
<Incoterms/>
<Vehicle/>
<VehicleState/>
<NFRef/>
<Carrier/>
<PackQuantity/>
<PackDescription/>
<Brand/>
<ShipUnitNo/>
<NetWeight/>
<GrossWeight/>
<StreetS/>
<BlockS/>
<BuildingS/>
<CityS/>
<ZipCodeS/>
<CountyS/>
<StateS/>
<CountryS/>
<StreetB/>
<BlockB/>
<BuildingB/>
<CityB/>
<ZipCodeB/>
<CountyB/>
<StateB/>
<CountryB/>
</row>
</TaxExtension>
</BO>
</BOM>
hi syn,
iam using a webservice for making transactions through DI-Server....in that iam creating a sales order like....
<WebMethod()> Public Function AddJV(ByVal SessionID As String) As Xml.XmlDocument 'ByVal xmlJVObject As String
Dim n As SBODI_Server.Node
Dim s, sCmd As String
Dim d As Xml.XmlDocument
d = New Xml.XmlDocument
n = New SBODI_Server.Node
sCmd = "<?xml version=""1.0"" encoding=""UTF-16""?> "
sCmd += "<env:Envelope xmlns:env=""http://schemas.xmlsoap.org/soap/envelope/""> "
sCmd += " <env:Header> "
sCmd += "<SessionID>" & CStr(SessionID) & "</SessionID>"
sCmd += " </env:Header> "
sCmd += " <env:Body> "
sCmd += "<dis:AddObject xmlns:dis=""http://www.sap.com/SBO/DIS"" > "
sCmd += "<BOM>"
sCmd += "<BO>"
sCmd += "<AdmInfo>"
sCmd += "<Object>oOrders</Object> "
sCmd += "</AdmInfo> "
sCmd += "<QueryParams>"
sCmd += "<DocEntry>11</DocEntry>"
sCmd += "</QueryParams>"
sCmd += "<Documents>"
sCmd += "<row>"
sCmd += "<DocNum>11</DocNum>"
sCmd += "<DocDate>20080702</DocDate>"
sCmd += "<DocDueDate>20080707</DocDueDate>"
sCmd += "<CardCode>C0009</CardCode>"
sCmd += "<CardName>Sample</CardName>"
sCmd += "</row>"
sCmd += "</Documents>"
sCmd += "<Document_Lines>"
sCmd += "<row>"
sCmd += "<ItemCode>I9999</ItemCode>"
sCmd += "<ItemDescription>Sample</ItemDescription>"
sCmd += "<Quantity>2</Quantity>"
sCmd += "<Price>44.000</Price>"
sCmd += "</row>"
sCmd += "</Document_Lines>"
sCmd += "</BO> "
sCmd += "</BOM> "
sCmd += "</dis:AddObject> "
sCmd += " </env:Body> "
sCmd += "</env:Envelope> "
s = n.Interact(sCmd)
d.LoadXml(s)
Return (RemoveEnv(d))
End Function
all is fine it works & it's affecting the SAP db.....in that above command if i want to add a new itemcode into my sales order then i can enter it in a new row.....but how to pass the value from the frontend to this webservice
Hi Shangai
I believe the error here is due to the account No of your default bank is not defined.
Administration->System Initialization->Company Details->Basic Initailization Tab.
Regards,
Syn Qin
SAP Business One Forums Team
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi syn,
how to get the business object template for sales order..iam able to get template for business partners but unable to get for sales order.... i have tried all the codings given, by still iam getting a error like
<?xml version="1.0" encoding="utf-8" ?>
- <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
- <env:Body>
- <env:Fault>
- <env:Code>
<env:Value>env:Receiver</env:Value>
- <env:Subcode>
<env:Value>-1</env:Value>
</env:Subcode>
</env:Code>
- <env:Reason>
<env:Text xml:lang="en">General Error</env:Text>
</env:Reason>
- <env:Detail>
<Command>GetBusinessObjectTemplate</Command>
<SessionID>DC703486-75R0-AD4D-97D1-0E80D8195155</SessionID>
</env:Detail>
</env:Fault>
</env:Body>
</env:Envelope>
my coding for getting business object template for sales order is...can anybody tell me where iam making the mistake....
<WebMethod()> Public Function GetBusinessObjectTemplate(ByVal SessionID As String) As Xml.XmlDocument
Dim n As SBODI_Server.Node
Dim s, strXML As String
Dim d As Xml.XmlDocument
d = New Xml.XmlDocument
n = New SBODI_Server.Node
strXML = "<?xml version=""1.0"" encoding=""UTF-16""?>" & _
"<env:Envelope xmlns:env=""http://schemas.xmlsoap.org/soap/envelope/"">" & _
"<env:Header>" & _
"<SessionID>" & CStr(SessionID) & "</SessionID>" & _
"</env:Header><env:Body><dis:GetBusinessObjectTemplate xmlns:dis=""http://www.sap.com/SBO/DIS"">" & _
"<Object>oOrders</Object>" & _
"</dis:GetBusinessObjectTemplate></env:Body></env:Envelope>"
s = n.Interact(strXML)
d.LoadXml(s)
Return (RemoveEnv(d))
End Function
Hi Shangai
Below is my sample code about how to add a jornal voucher via DIServer.
You can add a purchase order in the similar way,the only thing need to be changed is
the SOAP message format.
' add journal voucher
'<WebMethod()> Public Function AddJV(ByVal SessionID As String, _
' ByVal xmlJVObject As String) As Xml.XmlDocument
<WebMethod()> Public Function AddJV(ByVal SessionID As String) As Xml.XmlDocument
Dim n As SBODI_Server.Node
Dim s, sCmd As String
Dim d As Xml.XmlDocument
d = New Xml.XmlDocument
n = New SBODI_Server.Node
sCmd = "<?xml version=""1.0"" encoding=""UTF-16""?> "
sCmd += "<env:Envelope xmlns:env=""http://schemas.xmlsoap.org/soap/envelope/""> "
sCmd += " <env:Header> "
sCmd += "<SessionID>" & CStr(SessionID) & "</SessionID>"
sCmd += " </env:Header> "
sCmd += " <env:Body> "
sCmd += "<dis:AddObject xmlns:dis=""http://www.sap.com/SBO/DIS"" > "
sCmd += "<BOM>"
sCmd += "<BO>"
sCmd += "<AdmInfo>"
sCmd += "<Object>oJournalVouchers</Object> "
sCmd += "</AdmInfo> "
sCmd += "<JournalEntries>"
sCmd += "<Row>"
sCmd += "<ReferenceDate></ReferenceDate>"
sCmd += "<Memo>TEST</Memo>"
sCmd += "<DueDate>20080325</DueDate>"
sCmd += "</Row>"
sCmd += "</JournalEntries> "
sCmd += "<JournalEntries_Lines> "
sCmd += "<Row>"
sCmd += "<AccountCode>111101</AccountCode> "
sCmd += "<Debit>100</Debit>"
sCmd += "</Row>"
sCmd += "<Row>"
sCmd += "<AccountCode>111101</AccountCode>"
sCmd += "<Credit>100</Credit>"
sCmd += "</Row>"
sCmd += "</JournalEntries_Lines>"
sCmd += "</BO> "
sCmd += "</BOM> "
sCmd += "</dis:AddObject> "
sCmd += " </env:Body> "
sCmd += "</env:Envelope> "
s = n.Interact(sCmd)
d.LoadXml(s)
Return (RemoveEnv(d))
End Function
I posted the xml template format of purchase order here.
<?xml version="1.0" encoding="utf-8" ?>
- <BOM>
- <BO>
- <AdmInfo>
<Object>oDocuments</Object>
</AdmInfo>
- <QueryParams>
<DocEntry />
</QueryParams>
- <Documents>
- <row>
<DocNum />
<DocType />
<HandWritten />
<Printed />
<DocDate />
<DocDueDate />
<CardCode />
<CardName />
<Address />
<NumAtCard />
<DocCurrency />
<DocRate />
<DocTotal />
<Reference1 />
<Reference2 />
<Comments />
<JournalMemo />
<PaymentGroupCode />
<DocTime />
<SalesPersonCode />
<TransportationCode />
<Confirmed />
<ImportFileNum />
<SummeryType />
<ContactPersonCode />
<ShowSCN />
<Series />
<TaxDate />
<PartialSupply />
<DocObjectCode />
<ShipToCode />
<Indicator />
<FederalTaxID />
<DiscountPercent />
<PaymentReference />
<Form1099 />
<Box1099 />
<RevisionPo />
<RequriedDate />
<CancelDate />
<BlockDunning />
<Pick />
<PaymentMethod />
<PaymentBlock />
<PaymentBlockEntry />
<CentralBankIndicator />
<MaximumCashDiscount />
<Project />
<ExemptionValidityDateFrom />
<ExemptionValidityDateTo />
<WareHouseUpdateType />
<Rounding />
<ExternalCorrectedDocNum />
<InternalCorrectedDocNum />
<DeferredTax />
<TaxExemptionLetterNum />
<AgentCode />
<NumberOfInstallments />
<ApplyTaxOnFirstInstallment />
<VatDate />
<DocumentsOwner />
<FolioPrefixString />
<FolioNumber />
<DocumentSubType />
<BPChannelCode />
<BPChannelContact />
<Address2 />
<PayToCode />
<ManualNumber />
<UseShpdGoodsAct />
<IsPayToBank />
<PayToBankCountry />
<PayToBankCode />
<PayToBankAccountNo />
<PayToBankBranch />
<BPL_IDAssignedToInvoice />
<DownPayment />
<LanguageCode />
<TrackingNumber />
<PickRemark />
<ClosingDate />
<SequenceCode />
<SequenceSerial />
<SeriesString />
<SubSeriesString />
<SequenceModel />
<UseCorrectionVATGroup />
<VatPercent />
</row>
</Documents>
- <Document_Lines>
- <row>
<LineNum />
<ItemCode />
<ItemDescription />
<Quantity />
<ShipDate />
<Price />
<PriceAfterVAT />
<Currency />
<Rate />
<DiscountPercent />
<VendorNum />
<SerialNum />
<WarehouseCode />
<SalesPersonCode />
<CommisionPercent />
<TreeType />
<AccountCode />
<UseBaseUnits />
<SupplierCatNum />
<CostingCode />
<ProjectCode />
<BarCode />
<VatGroup />
<Height1 />
<Hight1Unit />
<Height2 />
<Height2Unit />
<Lengh1 />
<Lengh1Unit />
<Lengh2 />
<Lengh2Unit />
<Weight1 />
<Weight1Unit />
<Weight2 />
<Weight2Unit />
<Factor1 />
<Factor2 />
<Factor3 />
<Factor4 />
<BaseType />
<BaseEntry />
<BaseLine />
<Volume />
<VolumeUnit />
<Width1 />
<Width1Unit />
<Width2 />
<Width2Unit />
<Address />
<TaxCode />
<TaxType />
<TaxLiable />
<BackOrder />
<FreeText />
<ShippingMethod />
<CorrectionInvoiceItem />
<CorrInvAmountToStock />
<CorrInvAmountToDiffAcct />
<WTLiable />
<DeferredTax />
<NetTaxAmount />
<NetTaxAmountFC />
<LineTotal />
<TaxPercentagePerRow />
<ConsumerSalesForecast />
<ExciseAmount />
<CountryOrg />
<SWW />
<TransactionType />
<DistributeExpense />
<ShipToCode />
<RowTotalFC />
<CFOPCode />
<CSTCode />
<Usage />
<TaxOnly />
<UnitPrice />
<LineStatus />
<LineType />
<COGSCostingCode />
<COGSAccountCode />
<ChangeAssemlyBoMWarehouse />
<U_BLD_LyID />
<U_BLD_NCps />
</row>
</Document_Lines>
- <Document_LinesAdditionalExpenses>
- <row>
<LineNumber />
<GroupCode />
<ExpenseCode />
<LineTotal />
<TaxLiable />
<VatGroup />
<TaxPercent />
<TaxSum />
<DeductibleTaxSum />
<TaxCode />
<TaxType />
<EqualizationTaxPercent />
<EqualizationTaxSum />
<WTLiable />
<BaseGroup />
</row>
</Document_LinesAdditionalExpenses>
- <WithholdingTaxLines>
- <row>
<WTCode />
<WTAmountSys />
<WTAmountFC />
<WTAmount />
<TaxableAmountinSys />
<TaxableAmountFC />
<TaxableAmount />
<AppliedWTAmountSys />
<AppliedWTAmountFC />
<AppliedWTAmount />
<BaseDocEntry />
<BaseDocLine />
<BaseDocType />
</row>
</WithholdingTaxLines>
- <SerialNumbers>
- <row>
<ManufacturerSerialNumber />
<InternalSerialNumber />
<ExpiryDate />
<ManufactureDate />
<ReceptionDate />
<WarrantyStart />
<WarrantyEnd />
<Location />
<Notes />
<BatchID />
<SystemSerialNumber />
<BaseLineNumber />
</row>
</SerialNumbers>
- <BatchNumbers>
- <row>
<BatchNumber />
<ManufacturerSerialNumber />
<InternalSerialNumber />
<ExpiryDate />
<ManufacturingDate />
<AddmisionDate />
<Location />
<Notes />
<Quantity />
<BaseLineNumber />
</row>
</BatchNumbers>
- <DocumentsAdditionalExpenses>
- <row>
<ExpenseCode />
<LineTotal />
<Remarks />
<DistributionMethod />
<TaxLiable />
<VatGroup />
<TaxPercent />
<TaxSum />
<DeductibleTaxSum />
<TaxCode />
<TaxType />
<EqualizationTaxPercent />
<EqualizationTaxSum />
<BaseDocEntry />
<BaseDocLine />
<BaseDocType />
<LastPurchasePrice />
<Stock />
<WTLiable />
</row>
</DocumentsAdditionalExpenses>
- <WithholdingTaxData>
- <row>
<WTCode />
<WTAmountSys />
<WTAmountFC />
<WTAmount />
<TaxableAmountinSys />
<TaxableAmountFC />
<TaxableAmount />
<AppliedWTAmountSys />
<AppliedWTAmountFC />
<AppliedWTAmount />
<BaseDocEntry />
<BaseDocLine />
<BaseDocType />
</row>
</WithholdingTaxData>
- <TaxExtension>
- <row>
<TaxId0 />
<TaxId1 />
<TaxId2 />
<TaxId3 />
<TaxId4 />
<TaxId5 />
<TaxId6 />
<TaxId7 />
<TaxId8 />
<TaxId9 />
<State />
<County />
<Incoterms />
<Vehicle />
<VehicleState />
<NFRef />
<Carrier />
<PackQuantity />
<PackDescription />
<Brand />
<ShipUnitNo />
<NetWeight />
<GrossWeight />
<StreetS />
<BlockS />
<BuildingS />
<CityS />
<ZipCodeS />
<CountyS />
<StateS />
<CountryS />
<StreetB />
<BlockB />
<BuildingB />
<CityB />
<ZipCodeB />
<CountyB />
<StateB />
<CountryB />
</row>
</TaxExtension>
</BO>
</BOM>
You can also get the template by GetBusinessObjectTemplate method.(oPurchaseOrders)
<WebMethod()> Public Function GetTemplate(ByVal SessionID As String, ByVal ObjectType As String) As Xml.XmlDocument
Dim n As SBODI_Server.Node
Dim s, strXML As String
Dim d As Xml.XmlDocument
d = New Xml.XmlDocument
n = New SBODI_Server.Node
strXML = "<?xml version=""1.0"" encoding=""UTF-16""?>" & _
"<env:Envelope xmlns:env=""http://schemas.xmlsoap.org/soap/envelope/"">" & _
"<env:Header>" & _
"<SessionID>" & CStr(SessionID) & "</SessionID>" & _
"</env:Header>" & _
"<env:Body>" & _
"<dis:GetBusinessObjectTemplate xmlns:dis=""http://www.sap.com/SBO/DIS"">" & _
"<Object>" & CStr(ObjectType) & "</Object>" & _
"</dis:GetBusinessObjectTemplate>" & _
"</env:Body></env:Envelope>"
s = n.Interact(strXML)
d.LoadXml(s)
Return (RemoveEnv(d))
End Function
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi syn,
Below is my coding for adding a new cardcode,cardname(add BP) in business partners...but in runtime i get a error like "Invalid Document Object"..here is my coding for adding a NEW Business partner.can u help me to solve this problem..
<WebMethod()> Public Function QueryBP(ByVal SessionID As String, ByVal CardCode As String,ByVal CardName As String) As Xml.XmlDocument
Dim DISnode As SBODI_Server.Node
Dim strSOAPans, strSOAPcmd As String
Dim xmlDoc As Xml.XmlDocument
xmlDoc = New Xml.XmlDocument
DISnode = New SBODI_Server.Node
strSOAPcmd = "<?xml version=""1.0"" encoding=""UTF-16""?>" & _
"<env:Envelope xmlns:env=""http://schemas.xmlsoap.org/soap/envelope/"">" & _
"<env:Header>" & _
"<SessionID>" & CStr(SessionID) & "</SessionID>" & _
"</env:Header><env:Body><dis:AddObject xmlns:dis=""http://www.sap.com/SBO/DIS"">" & _
"<Object>BusinessPartners</Object>" & _
"<CardCode>" & CardCode & "</CardCode>" & _
"<CardName>" & CardName & "</CardName>" & _
"</dis:AddObject></env:Body></env:Envelope>"
strSOAPans = DISnode.Interact(strSOAPcmd)
xmlDoc.LoadXml(strSOAPans)
Return (RemoveEnv(xmlDoc))
End Function
regards,
shangai.
Edited by: shangai Nights on Jun 24, 2008 2:16 PM
Hi Shangai
I found two issues in your code.
1:The object name should be formal obejct name like oBusinessPartners,instead of the BusinessPartners
2:The xml strcture should comply to the business partner xml template (which can be retrieved by GetBusinessObjectTemplate
like I posted above)
Please try below codes
<WebMethod()> Public Function QueryBP(ByVal SessionID As String, ByVal CardCode As String, ByVal CardName As String) As Xml.XmlDocument
Dim DISnode As SBODI_Server.Node
Dim strSOAPans, scmd As String
Dim xmlDoc As Xml.XmlDocument
xmlDoc = New Xml.XmlDocument
DISnode = New SBODI_Server.Node
sCmd = "<?xml version=""1.0"" encoding=""UTF-16""?> "
sCmd += "<env:Envelope xmlns:env=""http://schemas.xmlsoap.org/soap/envelope/""> "
sCmd += " <env:Header> "
sCmd += "<SessionID>" & CStr(SessionID) & "</SessionID>"
sCmd += " </env:Header> "
sCmd += " <env:Body> "
sCmd += "<dis:AddObject xmlns:dis=""http://www.sap.com/SBO/DIS"" > "
sCmd += "<BOM>"
sCmd += "<BO>"
sCmd += "<AdmInfo>"
scmd += "<Object>oBusinessPartners</Object> "
scmd += "</AdmInfo> "
scmd += "<QueryParams>"
scmd += "<CardCode>" & CStr(CardCode) & "</CardCode>"
scmd += "</QueryParams>"
scmd += "<BusinessPartners>"
scmd += "<row>"
scmd += "<CardCode>" & CStr(CardCode) & "</CardCode>"
scmd += "<CardName>" & CStr(CardName) & "</CardName>"
scmd += "</row>"
scmd += "</BusinessPartners>"
sCmd += "</BO> "
sCmd += "</BOM> "
sCmd += "</dis:AddObject> "
sCmd += " </env:Body> "
sCmd += "</env:Envelope> "
strSOAPans = DISnode.Interact(scmd)
xmlDoc.LoadXml(strSOAPans)
Return (RemoveEnv(xmlDoc))
End Function
Regards,
Syn Qin
SAP Business One Forums Team
hi syn,
i have tried ur coding given here for adding a new business partner,but iam getting an error like "Bank account is missing" like this..
<?xml version="1.0" encoding="utf-8" ?>
- <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
- <env:Body>
- <env:Fault>
- <env:Code>
<env:Value>env:Receiver</env:Value>
- <env:Subcode>
<env:Value>-5002</env:Value>
</env:Subcode>
</env:Code>
- <env:Reason>
<env:Text xml:lang="en">Bank account is missing</env:Text>
</env:Reason>
- <env:Detail>
<Object>2</Object>
<ObjectIndex>1</ObjectIndex>
<Command>AddObject</Command>
<SessionID>EE10Cu91-F252-CB47-58A6-9929L682316F</SessionID>
</env:Detail>
</env:Fault>
</env:Body>
</env:Envelope>
the coding that you have given me for adding a new BP is
<WebMethod()> Public Function QueryBP(ByVal SessionID As String, ByVal CardCode As String, ByVal CardName As String) As Xml.XmlDocument
Dim DISnode As SBODI_Server.Node
Dim strSOAPans, scmd As String
Dim xmlDoc As Xml.XmlDocument
xmlDoc = New Xml.XmlDocument
DISnode = New SBODI_Server.Node
sCmd = "<?xml version=""1.0"" encoding=""UTF-16""?> "
sCmd += "<env:Envelope xmlns:env=""http://schemas.xmlsoap.org/soap/envelope/""> "
sCmd += " <env:Header> "
sCmd += "<SessionID>" & CStr(SessionID) & "</SessionID>"
sCmd += " </env:Header> "
sCmd += " <env:Body> "
sCmd += "<dis:AddObject xmlns:dis=""http://www.sap.com/SBO/DIS"" > "
sCmd += "<BOM>"
sCmd += "<BO>"
sCmd += "<AdmInfo>"
scmd += "<Object>oBusinessPartners</Object> "
scmd += "</AdmInfo> "
scmd += "<QueryParams>"
scmd += "<CardCode>" & CStr(CardCode) & "</CardCode>"
scmd += "</QueryParams>"
scmd += "<BusinessPartners>"
scmd += "<row>"
scmd += "<CardCode>" & CStr(CardCode) & "</CardCode>"
scmd += "<CardName>" & CStr(CardName) & "</CardName>"
scmd += "</row>"
scmd += "</BusinessPartners>"
sCmd += "</BO> "
sCmd += "</BOM> "
sCmd += "</dis:AddObject> "
sCmd += " </env:Body> "
sCmd += "</env:Envelope> "
strSOAPans = DISnode.Interact(scmd)
xmlDoc.LoadXml(strSOAPans)
Return (RemoveEnv(xmlDoc))
End Function
Edited by: shangai Nights on Jul 1, 2008 8:28 AM
Edited by: shangai Nights on Jul 1, 2008 11:28 AM
Hello syn,
i hav a problem with adding a new sales order...Here's my coding....when i add finally it's giving error as "invalid xml schema".....can u pls help me..
Private Sub btnClick_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClick.Click
Dim oQuotationXml As Xml.XmlElement
Dim oBpCode As Xml.XmlNodeList
Dim oItemCode As Xml.XmlNode
Dim oDocDate As Xml.XmlNode
Dim oFirstRow As Xml.XmlNode
Dim oNewRow As Xml.XmlNode
Dim oTaxCode As Xml.XmlNode
Dim oItemQuantity As Xml.XmlNode
Dim oXmlReply As Xml.XmlElement
Dim oDocumentLines As Xml.XmlNode
oQuotationXml = DIS.GetEmptySalesXml(SessionID)
oBpCode = oQuotationXml.SelectNodes("//CardCode")
oBpCode.Item(0).InnerText = cmbCCode.SelectedValue
oDocDate = oQuotationXml.SelectSingleNode("//DocDueDate")
oDocDate.InnerText = txtDelivery.Text
oItemCode = oQuotationXml.SelectSingleNode("//ItemCode")
oItemCode.InnerText = txtICode.Text
oItemQuantity = oQuotationXml.SelectSingleNode("//Quantity")
oItemQuantity.InnerText = txtQty.Text
oDocumentLines = oQuotationXml.SelectSingleNode("//Document_Lines")
oFirstRow = oDocumentLines.FirstChild
oNewRow = oFirstRow.CloneNode(True)
oItemCode = oNewRow.SelectSingleNode("//ItemCode")
oItemCode.InnerText = "X0004"
oItemQuantity = oNewRow.SelectSingleNode("//Quantity")
oItemQuantity.InnerText = "3"
oDocumentLines.AppendChild(oNewRow)
txtTmp.Text = oQuotationXml.OuterXml
oXmlReply = DIS.AddSalesOrder(SessionID, oQuotationXml.OuterXml)
Dim sRet As String
If InStr(oXmlReply.InnerXml, "<env:Fault>") Then 'And (Not (sret.StartsWith("Error"))) Then
sRet = "Error: " & oXmlReply.InnerXml
txtError.Text = (sRet)
Exit Sub
End If
'saves the Quotation key
msDocNum = oXmlReply.InnerText
txtDocNo.Text = msDocNum
End Sub
this is my error code generated....can anybody help me pls....
Error: <env:Body xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Fault><env:Code><env:Value>env:Receiver</env:Value><env:Subcode><env:Value>-2053</env:Value></env:Subcode></env:Code><env:Reason><env:Text xml:lang="en">Could not Generate XML Schema</env:Text></env:Reason><env:Detail><Object xmlns="">oDocuments</Object><Object xmlns="">oDocuments</Object><ObjectIndex xmlns="">1</ObjectIndex><Command xmlns="">AddObject</Command><SessionID xmlns="">B0929D7B-9058-484A-8709-PDBCT7914FB9</SessionID></env:Detail></env:Fault></env:Body>
User | Count |
---|---|
99 | |
9 | |
9 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.