- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
In PO entry need to verify that Vendor is the Primary vendor in Inventory Master
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-12-2012 07:20 AM
Hi Forum,
I need to create a Script to verify that the Vendor entered in PO Entry is the Primary Vendor in Inventory Master.
What Objects should i be using to get this done?
Any help/advise will greatly appreciated.
Regards,
Manuel Roman
Solved! Go to Solution.
Re: In PO entry need to verify that Vendor is the Primary vendor in Inventory Master
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-12-2012 07:31 AM
Hi Manuel,
I would probably put a Pre-Validate script on the item code table, using the childhandle to the existing CI_Item_svc object. Retrieving the PrimaryAPDivisionNo & PrimaryVendorNo from the CI_Item table for the current Item. You'll also, want to retrieve the current APDivisionNo and VendorNo from the Purchase order header.
Keep in mind some potential conflicts:
1) What do you want to do if the Div + Vendor combo does not exist in Item Maintenance?
2) You may want to make this Script conditional to only be done from the data entry program itself. Use oSession.Updating<>0 condition, so that potential updates to the PO lines does not inadvertently run this script.
Hope this helps
Elliott
Re: In PO entry need to verify that Vendor is the Primary vendor in Inventory Master
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-12-2012 08:55 AM - last edited on 01-12-2012 02:56 PM
Manuel ,
Elliots replay sounds a little confusing to me so I may just be re-wording it...
I would put a Pre-Validate script on the ItemCode$ column in PO_PurchaseOrderDetail. I would check oBusObj.EditState. If it is equal to 2, a new record, then I'd get a handle to the existing child collection for CI_ItemCode_svc and pull the Primary Division and Vendor. I always do a find on those child objects because I want to make sure they are pointed to the correct record. Compare the values from CI_Item to those on the PO Header and either display a message or just fail it. You wouldn't want to display a message in certain cases, V/I in particular.
Hope this helps,
Jonathan
Re: In PO entry need to verify that Vendor is the Primary vendor in Inventory Master
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-12-2012 09:13 AM
Hi Elliott,
Thanks, i'll give it try and let you know the outcome.
Regards,
Manuel Roman
Re: In PO entry need to verify that Vendor is the Primary vendor in Inventory Master
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-12-2012 09:21 AM
Thanks Jonathan...
is it CI_Item_SVC or CI_ItemCode_SVC ?
Regards,
Manuel Roman
Re: In PO entry need to verify that Vendor is the Primary vendor in Inventory Master
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-12-2012 09:46 AM
Jonathan is correct it's CI_ItemCode_svc, sorry about that.
Re: In PO entry need to verify that Vendor is the Primary vendor in Inventory Master
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-12-2012 10:02 AM
Hi Elliott,
Jonathan had the same CI_Item_SVC as you....
Not a problem, it's just that CI_Item_SVC didn't sound familiar (not that i am familiarwith all Objects)...
Regards,
Manuel Roman
Re: In PO entry need to verify that Vendor is the Primary vendor in Inventory Master
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-12-2012 03:01 PM
I corrected my post. Hopefully you can figure it out....
Thanks,
Jonathan
Re: In PO entry need to verify that Vendor is the Primary vendor in Inventory Master
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-23-2012 10:03 AM
Hi,
I am trying to test the script with no luck.
Is there a way that i can troublshoot?...
Well, first here the script so you can take alook at it end tell me what i am doing worng?
ItemCode = ""
itemtype = ""
LineKey=""
oCIItem = 0
CIVendorNo = ""
POVendorNo = ""
retVal = 0
if oBusObj.EditState=2 then
if Not(IsObject(oItemSvc)) then
oItemSvc = oBusObj.GetChildHandle("ItemCode")
if oItemSvc <> 0 then
Set oItemSvc = oBusObj.AsObject(oItemSvc)
msgbox "Yes"
end if
end If
retval = oItemSvc.GetValue("LineKey$", LineKey)
retVal = oItemSvc.GetValue("ItemType$", itemtype)
retVal = oItemSvc.GetValue("ItemCode$", ItemCode)
if itemtype = "1" and LineKey <> "" then
oCIItem = oSession.GetObject("CI_ItemCode_svc")
if oCIItem then
Set oCIItem = oScript.AsObject(oCIItem)
retVal = oBusObj.GetValue("VendorNo$", POVendorNo)
retVal = oCIItem.SetKeyValue("ItemCode", ItemCode)
retVal = oCIItem.Find()
if retVal then
retVal = CIItem.GetValue("PrimaryVendorNo$", CIVendorNo)
if CIVendorNo<>POVendorNo then
msgbox "P/O vendor not the Primary Vendor Code"
end if
end if
end if
end if
Any suggestions?
Regards,
Manuel Roman
Re: In PO entry need to verify that Vendor is the Primary vendor in Inventory Master
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-23-2012 10:13 AM
ItemCode = ""
itemtype = ""
LineKey=""
oCIItem = 0
CIVendorNo = ""
POVendorNo = ""
retVal = 0
if oBusObj.EditState=2 then
retval = oBusObj.GetValue("LineKey$", LineKey)
retVal = oBusObj.GetValue("ItemType$", itemtype)
retVal = oBusObj.GetValue("ItemCode$", ItemCode)
if itemtype = "1" and LineKey <> "" then
oCIItem = oSession.GetObject("CI_ItemCode_svc")
if oCIItem then
Set oCIItem = oScript.AsObject(oCIItem)
retVal = oHeaderObj.GetValue("VendorNo$", POVendorNo)
retVal = oCIItem.SetKeyValue("ItemCode", ItemCode)
retVal = oCIItem.Find()
if retVal then
retVal = oCIItem.GetValue("PrimaryVendorNo$", CIVendorNo)
if CIVendorNo<>POVendorNo then
msgbox "P/O vendor not the Primary Vendor Code"
end if
end if
end if
end if
end if


