P.O. Integration

I took the anytime "class" for BOI. I have all of the examples and the Objects reference. The thing is... I cannot find any examples for P.O. integration. I am trying to use BOI to Create P.O.'s. can anyone provide me a example?

 

We are using MAS 90 4.4 SU 5.

 

Thanks in Advance.

Parents
  • The example script does have the basics of what you need to create a PO.  I was not specifically referring to creating them from Sales Orders.  It will have the logic to get the next po number, adding lines to the PO, setting the necessary values, etc.  These parts are what you would need.

     

    if NOT(IsObject(oPurchObj)) then
    	' get handle to purchase order object to create new PO
    	Set oPurchObj = oSession.AsObject(oSession.GetObject("PO_PurchaseOrder_bus")) 
    end if
    
    retVal = oSS_Script.GetStorageVar("po_Num" & poVend, poNum)
    			
    if poNum = "" then
    	retVal = oPurchObj.GetNextPurchaseOrderNo(poNum)
    end if
    
    retVal = oPurchObj.SetKey(poNum)
    
    if retVal = 2 then
    	retVal = oPurchObj.SetValue("APDivisionNo$", mid(poVend, 1, 2))
    	retVal = oPurchObj.SetValue("VendorNo$", mid(poVend, 3))
    	retVal = oPurchObj.SetValue("TaxSchedule$", "NONTAX")
    end if
    
    'store off this PO number for this vendor (e.g. po_Num01AIRWAY) for future PO's in this session
    retVal = oSS_Script.SetStorageVar("po_Num" & poVend, poNum) 
    
    if NOT(isObject(oPOLines)) then
    	Set oPOLines = oPurchObj.AsObject(oPurchObj.Lines)
    end if
    
    retVal = oPOLines.AddLine() ' set up a new line for this PO
    
    retVal = oLines.GetValue("ItemCode$", itm)
    retVal = oLines.GetValue("QuantityOrdered", qty)
    retVal = oBusObj.GetValue("SalesOrderNo$", soNum)
    retVal = oBusObj.GetValue("BillToName$", custName)
    
    retVal = oPOLines.SetValue("ItemCode$", itm)
    retVal = oPOLines.SetValue("QuantityOrdered", qty)
    retVal = oPOLines.SetValue("WarehouseCode$", "ZZZ") ' non-stock warehouse
    retVal = oPOLines.SetValue("CommentText$", "Customer: " & custName & "  SalesOrder: " & soNum)
    retVal = oPOLines.Write()
    
    retVal = oPurchObj.Write()

     This would have to be reworked though to be in the BOI syntax instead:

     

    oPOLines.Write() would become oPOLines.nWrite()

     

    And you text file would have to be read to provide the values for the fields.

Reply
  • The example script does have the basics of what you need to create a PO.  I was not specifically referring to creating them from Sales Orders.  It will have the logic to get the next po number, adding lines to the PO, setting the necessary values, etc.  These parts are what you would need.

     

    if NOT(IsObject(oPurchObj)) then
    	' get handle to purchase order object to create new PO
    	Set oPurchObj = oSession.AsObject(oSession.GetObject("PO_PurchaseOrder_bus")) 
    end if
    
    retVal = oSS_Script.GetStorageVar("po_Num" & poVend, poNum)
    			
    if poNum = "" then
    	retVal = oPurchObj.GetNextPurchaseOrderNo(poNum)
    end if
    
    retVal = oPurchObj.SetKey(poNum)
    
    if retVal = 2 then
    	retVal = oPurchObj.SetValue("APDivisionNo$", mid(poVend, 1, 2))
    	retVal = oPurchObj.SetValue("VendorNo$", mid(poVend, 3))
    	retVal = oPurchObj.SetValue("TaxSchedule$", "NONTAX")
    end if
    
    'store off this PO number for this vendor (e.g. po_Num01AIRWAY) for future PO's in this session
    retVal = oSS_Script.SetStorageVar("po_Num" & poVend, poNum) 
    
    if NOT(isObject(oPOLines)) then
    	Set oPOLines = oPurchObj.AsObject(oPurchObj.Lines)
    end if
    
    retVal = oPOLines.AddLine() ' set up a new line for this PO
    
    retVal = oLines.GetValue("ItemCode$", itm)
    retVal = oLines.GetValue("QuantityOrdered", qty)
    retVal = oBusObj.GetValue("SalesOrderNo$", soNum)
    retVal = oBusObj.GetValue("BillToName$", custName)
    
    retVal = oPOLines.SetValue("ItemCode$", itm)
    retVal = oPOLines.SetValue("QuantityOrdered", qty)
    retVal = oPOLines.SetValue("WarehouseCode$", "ZZZ") ' non-stock warehouse
    retVal = oPOLines.SetValue("CommentText$", "Customer: " & custName & "  SalesOrder: " & soNum)
    retVal = oPOLines.Write()
    
    retVal = oPurchObj.Write()

     This would have to be reworked though to be in the BOI syntax instead:

     

    oPOLines.Write() would become oPOLines.nWrite()

     

    And you text file would have to be read to provide the values for the fields.

Children
No Data