cancel
Showing results for 
Search instead for 
Did you mean: 

Adding Data (Service data type ) to GRPO

Former Member
0 Kudos

Hi to all,

Im doing a data intergration between 2 DB, DR (Source DB) and GRPO (Target) , I could inditify if the transaction were item or service, I dont have any problem if the the transaction is Item doctype , my problem were if im processing a service type , i encounter a error .

Error Message : Error Item no. is missing [PDN1.ItemCode][line:1]

Kindly see my source code for reference

For nLnDtls = 0 To nLnDtls - 1

oDR.Lines.SetCurrentLine(nLnDtls)

If oDR.DocType = BoDocumentTypes.dDocument_Items Then

oGRPO.Lines.ItemCode = oDR.Lines.ItemCode

oGRPO.Lines.ItemDescription = oDR.Lines.ItemDescription

oGRPO.Lines.WarehouseCode = oDR.CardCode

oGRPO.Lines.Quantity = oDR.Lines.Quantity

oGRPO.Lines.UnitPrice = oDR.Lines.UnitPrice

oGRPO.Lines.BatchNumbers.BatchNumber = oDR.Lines.BatchNumbers.BatchNumber

oGRPO.Lines.BatchNumbers.Quantity = oDR.Lines.BatchNumbers.Quantity

oGRPO.Lines.BaseLine = oDR.Lines.LineNum

oGRPO.Lines.Add()

Else

oGRPO.Lines.ItemCode = ""

oGRPO.Lines.ItemDescription = oDR.Lines.ItemDescription

oGRPO.Lines.AccountCode = oDR.Lines.AccountCode

oGRPO.Lines.LineTotal = oDR.Lines.LineTotal

oGRPO.Lines.BaseLine = oDR.Lines.LineNum

End If

Next nLnDtls

Dim oDocNum As String

If oGRPO.Add <> 0 Then

MsgBox("Error " + oCpTrgt.GetLastErrorDescription())

Else

oDocNum = oCpTrgt.GetNewObjectKey()

SndB1Msg(oDocNum, SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes, "New GRPPO")

Insert2OCTP(vDocNum, vDocDate, oDocNum, Now.ToShortDateString, vCardCode, vCardName)

End If

oRecordSetTrgt.MoveNext()

End While

Thank You

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

thanks to all

Former Member
0 Kudos

Dear Loren Flores,

The document has one default line and you need to call oGRPO.Lines.Add from second lines, so change code like:

 

For nLnDtls = 0 To nLnDtls - 1

If nLnDtls > 0 Then

    oGRPO.Lines.Add()

End If

......
......
......
Next nLnDtls

Best Regards

Jane Jing

SAP Business One Forums team

former_member196647
Contributor
0 Kudos

Hello,

Just remove the line where you are setting the item code.

Rahul

Former Member
0 Kudos

Hi Rahul

Thank you for response , I remove the line 'oGRPO.Lines.ItemCode = " " from the source, but it pops another error "Item No. is missing [PDN1.ItemCode][line:1],

I hope you could help/guide to solve this issue

Thanks

Loren