on 05-29-2006 9:31 AM
I am importing an excel file and then for each row,trying to create purchase order through coding by using document object. I am successful in creating Order Headers but how can i create Lines if the excel sheet is having Same order but different Item codes????
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ashish,
If you want to add more than one line item in the same PO Header , use PO.Lines.Add before the next item.
PO.CardCode="V0001"
PO.Lines.ItemCode="ITEM001"
PO.Lines.Quantity =10
PO.Lines.Add()
PO.Lines.ItemCode ="ITEM0002"
PO.Lines.Quantity =20
'// You can ad many no of line item here using PO.Lines.Add()
IRET =PO.Add()
Regards
BBN
I was trying to import excel file in purchase order by following way:-
I read each row and for each row, call function for creating order. This is my sample code---
(var30 is previous excel value of order no. & var1 is current value)
public sub createorder()
odocs = GOD_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseOrders)
If irow = 2 Then
odocs.CardCode = "200173"
odocs.Lines.ItemCode = var16
odocs.Lines.Add()
Else
If var1 = var30 Then
odocs.CardCode = "200173"
odocs.Lines.ItemCode = "3231015"
odocs.Lines.Add()
Else
lRetCode = odocs.Add()
odocs.CardCode = "200173"
odocs.Lines.ItemCode = var16
odocs.Lines.Add()
End If
End If
lRetCode = odocs.Add()
Dim x As String
GOD_Company.GetNewObjectCode(x)
If lRetCode <> 0 Then
GOD_Company.GetLastError(lErrCode, sErrMsg)
MsgBox(sErrMsg)
Else
MsgBox("Order Created with no " & x & ".")
End If
var30 = var1
This code is giving error as "Item No. is missing(OPOR.ObjType)", But Item no. is not present in Purchase Order. Please check whether Code is proper or i need to make any changes???????/
Hi Ashish,
Every time you call Documents_Lines.Add(), the system creates a new line for you to fill in.
You must set the values for itemcode etc. on each line you create, including the last. Otherwise you will get an error message.
You should call lines.Add() before you are about to add a new line, not after (except for the first line, as the line has already been added for you).
Henry
User | Count |
---|---|
91 | |
9 | |
9 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.