Skip to Content
0

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

Nov 27, 2017 at 12:27 PM

46

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Edy Simon Dec 02, 2017 at 08:50 AM
1

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

Share
10 |10000 characters needed characters left characters exceeded