- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Change Unit Cost in PO ROG
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-20-2011 11:42 AM
hi Forum,
I need to write a script to change the unit cost (raplace it with STD Cost) in PO ROG data entry....
I am not familiar with the PO Receipts objects.
Any help will be appreciated...
Regards,
Manuel Roman
Solved! Go to Solution.
Re: Change Unit Cost in PO ROG
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-20-2011 02:03 PM
This will refresh the unit cost when a inventory item from a PO is added to a receipt entry. You can start with this and adjust for your need.
It first checks if the line is new. Then it checks if it comes from PO and if it is an inventory item. Then it gets the item's standard cost and sets unit cost on the line.
itemcode = ""
itemtype = ""
orderLineKey=""
oCIItem = 0
stdcost=0
retVal = 0
if oBusObj.EditState=2 then
retVal = oBusObj.GetValue("OrderLineKey$", orderLineKey)
retVal = oBusObj.GetValue("ItemType$", itemtype)
if itemtype = "1" and orderLineKey <> "" then
oCIItem = oSession.GetObject("CI_ItemCode_svc")
if oCIItem then
Set oCIItem = oScript.AsObject(oCIItem)
retVal = oBusObj.GetValue("ItemCode$", itemcode)
retVal = oCIItem.SetKeyValue("ItemCode", itemcode)
retVal = oCIItem.Find()
if retVal then
retVal = oCIItem.GetValue("StandardUnitCost", stdcost)
retVal = oBusObj.SetValue("UnitCost",stdcost)
end if
end if
end if
end if
Sr. Software Engineer
Sage 100 ERP
Re: Change Unit Cost in PO ROG
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-20-2011 02:23 PM
Just to simply it a little, you can pass the itemcode into the Find() method. No need to do SetKeyValue().
retVal = oCIItem.Find(itemcode)
Sr. Software Engineer
Sage 100 ERP
Re: Change Unit Cost in PO ROG
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-20-2011 02:27 PM
Natasha,
Thaks, i'll give it a try ...
What event should i use for te script?
PO_Receipt Detail; Column pre_validate???
Regards,
Manuel Roman
Re: Change Unit Cost in PO ROG
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-20-2011 02:52 PM
PO_ReceiptDetail; Pre Write
Sr. Software Engineer
Sage 100 ERP
Re: Change Unit Cost in PO ROG
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-20-2011 04:15 PM
Natasha,
You are the best... works perfect.
I'll play around with it but i can see that is working...
Thanks so much
Regards,
Manuel
Re: Change Unit Cost in PO ROG
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-29-2011 06:03 AM
Ye , it is working fine
thanks,


