cancel
Showing results for 
Search instead for 
Did you mean: 

Add serial number for Goods Return

Former Member
0 Kudos

Hye expert,

i'm new in developing SAP Data Interface.

How to add serial number in OSRI table?

i need to do this step because the application need to add new entry for good return into the SAP.

Last time when the item is sold, the user still not yet using SAP.

So when there are goods return, my application cannot find the serial number in SAP system.

If do manually in SAP GUI, i have no problem in adding them because a window will shown and i can define new serial to the item.

But how to do it in Data Interface?

here is my code.

'On top here find the serial in OSRI table (Recset3)

' if the serial found in the OSRI

If RecSet3.RecordCount > 0 Then

                                  

                                While Not RecSet3.EoF

                                    RecSet4 = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

                                    RecSet4.DoQuery("SELECT IntrSerial, SysSerial FROM OSRI(nolock) WHERE ItemCode='" & RecSet.Fields.Item("U_DocItem").Value & "' AND IntrSerial='" & RecSet3.Fields.Item("U_DocSerial").Value & "'")

                                    'check for itemcode and intrserial in OSRI

                                    If RecSet4.Fields.Item("IntrSerial").Value <> "" Then

                                        oDoc.Lines.SerialNumbers.SystemSerialNumber = RecSet4.Fields.Item("SysSerial").Value

                                        oDoc.Lines.SerialNumbers.InternalSerialNumber = RecSet3.Fields.Item("U_DocSerial").Value

                                        oDoc.Lines.SerialNumbers.Add()

                                    End If

                                    RecSet3.MoveNext()

                                End While

'if not found in OSRI. here i stuck. i want to force the application to add new entry in goods return, plus add the serial in OSRI. here is my 'attempt to do it but fail.

Else   

                                oDoc.CardCode = "L8A111117153633"

                                oDoc.DocDate = CDate(Now)

                                oDoc.DocDueDate = CDate(Now)

                                oDoc.Lines.ItemCode = "SMC6022"

                                oDoc.Lines.Quantity = 1

                                oDoc.Lines.Price = 777

                              'loop only one time. for testing only.

                                For i As Integer = 1 To 1

                                    oDoc.Lines.SerialNumbers.SetCurrentLine(i - 1)

                                    oDoc.Lines.SerialNumbers.InternalSerialNumber = RecSet3.Fields.Item("U_DocSerial").Value

                                    'oDoc.Lines.SerialNumbers.SystemSerialNumber = 568     'currently 567 is the highest number under SysSerial 'column

                                    oDoc.Lines.SerialNumbers.Add()

                                Next

                              

                                Dim qq As Long

                                Dim aa As Long

                                Dim zz As String

                                qq = oDoc.Add()

                                if qq <> 0 Then

                                   oCompany.GetLastError(aa, zz)

                                  MsgBox(zz)

                                End If

                            End If

The error is 'You should use existing serial/batch numbers for this document type [(----) 29-51]'

i have search the discussion lounge but i cannot found the answer i looking for.

I really hope someone can help me.

Thank You

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member183750
Active Contributor
0 Kudos

Hello Hero

I think this was posted into an incorrect discussion space. As per the Overview of this space, the products and issues covered are:

.NET applications that connect and interact with SAP BusinessObjects Enterprise, SAP BusinessObjects Edge, or SAP Crystal (Reports) Server.

I am not sure what product you are working with and even if I did, more than likely I do not have the rights to move this to the correct discussion space. Perhaps yo can find the correct place by looking here:

http://scn.sap.com/docs/DOC-18971

- Ludek

Former Member
0 Kudos

Sorry for the mistake. i not read the overview last time.

Thanks.