Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Can i create SalesOrder using SalesQuotation

Hi all,

I want to create SalesOrder with reference using the SalesQuotation. How can i achieve this.

I am using JAVA to develop this. I am using DI API to achieve this. I am creating SalesOrder directly by giving the items and their quantities and succeded. But when i want to give the SalesQuotation number Reference while creating salesOrder it is giving error.

-5002Item no. is missing [ORDR.ObjType]

com.sap.smb.sbo.wrapper.com.ComFailException: Invoke of: DoQuery

Source: SAPbobsCOM.Recordset.6.7

Description: 1). [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'FOR'.

2). [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared.

at com.sap.smb.sbo.wrapper.com.Dispatch.invokev(Native Method)

at com.sap.smb.sbo.wrapper.com.Dispatch.invokev(Unknown Source)

at com.sap.smb.sbo.wrapper.com.Dispatch.callN(Unknown Source)

at com.sap.smb.sbo.wrapper.com.Dispatch.call(Unknown Source)

at com.sap.smb.sbo.api.Recordset.doQuery(Unknown Source)

at SalesOrderCreate.main(SalesOrderCreate.java:133)

Can any body give me a sample code that how can we create salesOrder using SalesQuotation.

regards,

JAYA

replied

Hi

I've never tried doing it in java. But i here is an example of how it is done in VB.Net, im sure it will help you connect the dots. This example makes a invoice based on a sales order

Dim oInvoice As SAPbobsCOM.Documents

oInvoice = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)

oInvoice.CardCode = BPCode.Text

oInvoice.DocDueDate = Now

oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders

'OrderStr is sales order DocEntry,not Docnum

oInvoice.Lines.BaseEntry = CInt(OrderStr)

oInvoice.Lines.BaseLine = 0

oInvoice.Lines.Add()

oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders

oInvoice.Lines.BaseEntry = CInt(OrderStr)

oInvoice.Lines.BaseLine = 1

lRetCode = oInvoice.Add

oCompany.GetLastError(lErrCode, sErrMsg)

If lRetCode <> 0 Then

MessageBox.Show("Not Added" & lErrCode & " " & sErrMsg)

ElseIf lRetCode = 0 Then

'oCompany.GetNewObjectCode(OrderStr)

MsgBox("Added Invoice")

End If

please not, OrderStr is sales order DocEntry,not Docnum

Hope this helps

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question