Skip to Content

How to Create a GRPO against PO in DIAPI in sap B1?

Hi Experts,

I created one Purchase order in sap database. For example That Purchase order number is 506.Now I need to create a GRPO against that Purchase order using DIAPI.

I already written the code but its not working.Here My code Please refer me any code to solve this problem

If s = 0 Then Dim i As Integer = 0 'Dim StrFromware As String = 'txtQltyAvlWhs.Text Dim oPurcahse As SAPbobsCOM.Documents = oCompany.GetBusinessObject(BoObjectTypes.oPurchaseOrders)

Dim oinvgenitems As SAPbobsCOM.Documents = oCompany.GetBusinessObject(BoObjectTypes.oPurchaseDeliveryNotes) oPurcahse.GetByKey(506)

oinvgenitems.DocDate = Today

oinvgenitems.CardCode = oPurcahse.CardCode

oinvgenitems.CardName = oPurcahse.CardName

oinvgenitems.Lines.ItemCode = oPurcahse.Lines.ItemCode oinvgenitems.Lines.ItemDescription = oPurcahse.Lines.ItemDescription oinvgenitems.Lines.BaseEntry = oPurcahse.DocEntry

oinvgenitems.Lines.BaseLine = oPurcahse.Lines.LineNum oinvgenitems.Lines.BatchNumbers.Add() oinvgenitems.Lines.BatchNumbers.SetCurrentLine(0) oinvgenitems.Lines.BatchNumbers.BatchNumber = "Bt1234567" oinvgenitems.Lines.Quantity = 1.0

i = oinvgenitems.Add()

If i = 0 Then

Label1.Text = "Success"

Else

MsgBox("Message:'" & oCompany.GetLastErrorDescription() & "'")

End If

End If

Note:GRPO AGAINST PO -IN DIAPI


Please Help me to solve this Issue

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Dec 02, 2017 at 08:50 AM

    Hi Manikandan

    To copy from the PO,

    oinvgenitems.CardCode = oPurcahse.CardCode
    For i as integer = 0  to oPurcahse.Lines.Count-1
       if i>0 then oinvgenitems.lines.add()
       oPurcahse.Lines.SetCurrentLine(i)
       oinvgenitems.lines.basetype = BoObjectTypes.oPurchaseOrders
       oinvgenitems.lines.baseentry = oPurcahse.DocEntry
       oinvgenitems.lines.baseline = oPurcahse.lines.linenum
    Next 
    
    oinvgenitems.add()

    Regards

    Edy

    Add comment
    10|10000 characters needed characters exceeded