- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Populate an Alias Item UDF in sales orer entry
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-29-2011 10:42 AM
Hi Forum,
I have aUDF in the Alias Item Maintenance and and another one in Sales Order entry.
What i need to do is, populate the S/O entry UDF when the Item entered has an Alias...
Any sample out there that i can look at?
Regards,
Manuel Roman
Solved! Go to Solution.
Re: Populate an Alias Item UDF in sales orer entry
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-29-2011 12:36 PM - last edited on 12-29-2011 12:36 PM
Manuel,
I don't have sample code but this is what I would try:
In ItemCode;PostValidate, instantiate the IM_AliasItem_Svc object.
Pass ItemCode into SetBrowseFilter method.
Then use MoveFirst and MoveNext to find the right alias item record and get the alias item UDF.
If record found, set the Sales Order Detail UDF.
Sr. Software Engineer
Sage 100 ERP
Re: Populate an Alias Item UDF in sales orer entry
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-29-2011 03:15 PM
Thanks Natasha i'll give it a try..
Regards,
Manuel Roman
Re: Populate an Alias Item UDF in sales orer entry
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-02-2012 12:07 PM
Hi Natasha,
I've tried the following and i am getting an error message when entring the line is S/O entry.
This is the coded that i am using...
retVal = oBusObj.GetValue("AliasItemNo$",UDFAlias)
retVal = oBusObj.GetValue("ItemCode$",Itemcode)
if UDFAlias <> "" then
' Update UDF Alias Field
Set oIMAliasObj = oSession.AsObject(oSession.GetObject("IM_ALIAS_ITE
Set oSODtlObj = oSession.AsObject(oSOHdrObj.Lines)
retVal = oIMAliasObj.SetKey(Itemcode)
FoundLine = 0
retVal = oIMAliasObj.SetBrowseFilter(ItemCode)
retVal = oIMAliasObj.MoveFirst()
Do Until CBool(oIMAliasObj.EOF) or FoundLine=1
retVal = oIMAliasObj.GetValue("AliasItemNo$",AliasItemCode)
retVal = oIMAliasObj.GetValue("UDF_ALIAS_DESCRIPTION_2$",IM
if AliasItemCode = UDFAlias then
FoundLine = 1
end if
if FoundLine <> 1 then
retVal = oIMAliasObj.MoveNext()
end if
Loop
If FoundLine then
retVal = oSODtlObj.SetValue("UDF_ALIAS_DESCRIPTION_2$","Tes
end if
end if
REgards,
Manuel Roman
Re: Populate an Alias Item UDF in sales orer entry
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-03-2012 07:16 AM
Hi Forum,
This is the code that i am using:
retVal = oBusObj.GetValue("AliasItemNo$",UDFAlias)
retVal = oBusObj.GetValue("ItemCode$",Itemcode)
if UDFAlias <> "" then
' Update UDF Alias Field
Set oIMAliasObj = oSession.AsObject(oSession.GetObject("IM_ALIAS_ITE
Set oSOHdrObj = oSession.AsObject(oSession.GetObject("SO_SalesOrde
Set oSODtlObj = oSession.AsObject(oSOHdrObj.Lines)
retVal = oIMAliasObj.SetKey(Itemcode)
FoundLine = 0
retVal = oIMAliasObj.SetBrowseFilter(ItemCode)
retVal = oIMAliasObj.MoveFirst()
Do Until CBool(oIMAliasObj.EOF) or FoundLine=1
retVal = oIMAliasObj.GetValue("AliasItemNo$",AliasItemCode)
retVal = oIMAliasObj.GetValue("UDF_ALIAS_DESCRIPTION_2$",IM
if AliasItemCode = UDFAlias then
FoundLine = 1
end if
if FoundLine <> 1 then
retVal = oIMAliasObj.MoveNext()
end if
Loop
If FoundLine then
retVal = oSODtlObj.SetValue("UDF_ALIAS_DESCRIPTION_2$",IMAl
end if
end if
The Error that i am getting is:
err=26 pgm=Sy_Service_pvc line=1395
Regards,
Manuel Roman
Re: Populate an Alias Item UDF in sales orer entry
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-03-2012 07:56 AM
Hi Manuel,
Just at first glance, there are a couple of things I noticed in your script.
1) You cannot use the SetKey() method with a _svc (Service object), you can try using Find() instead. Although, it looks like you really don't need this line in your script.
2) Make sure you declare your variables, because depending on what your ItemCode or Alias is VB might mistake it for a numeric. So your variables like UDFAlias, ItemCode, AliasItemCode, IMAliasDesc, should be declared as strings before they are used. (This is most likely the cause of your error)
3) Also, I don't think you need to have a separate object reference to the SalesOrderDetail object as if you are using this in the Post-Validate of the Item Code oBusObj should be the same object.
Hope this helps
Elliott
Re: Populate an Alias Item UDF in sales orer entry
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-03-2012 08:21 AM
Thanks Elliott,
i changed the script to the following:
UDFAlias = ""
Itemcode = ""
AliasItemCode = ""
IMAliasDesc = ""
retVal = oBusObj.GetValue("AliasItemNo$",UDFAlias)
retVal = oBusObj.GetValue("ItemCode$",Itemcode)
if UDFAlias <> "" then
' Update UDF Alias Field
Set oIMAliasObj = oSession.AsObject(oSession.GetObject("IM_ALIAS_ITE
FoundLine = 0
retVal = oIMAliasObj.SetBrowseFilter(ItemCode)
retVal = oIMAliasObj.MoveFirst()
Do Until CBool(oIMAliasObj.EOF) or FoundLine=1
retVal = oIMAliasObj.GetValue("AliasItemNo$",AliasItemCode)
retVal = oIMAliasObj.GetValue("UDF_ALIAS_DESCRIPTION_2$",IM
if AliasItemCode = UDFAlias then
FoundLine = 1
end if
if FoundLine <> 1 then
retVal = oIMAliasObj.MoveNext()
end if
Loop
If FoundLine then
retVal = oBusObj.SetValue("UDF_ALIAS_DESCRIPTION_2$",IMAlia
end if
end if
And now i am getting an error 88
Type Mismatch : o.Seesion.AsObject(err/ret=2/0)
Regards,
Manuel Roman
Re: Populate an Alias Item UDF in sales orer entry
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-03-2012 08:33 AM
Manuel,
Sorry, I think I missed this before. I believe the name of the service object you are trying to use should be IM_AliasItem_svc NOT IM_Alias_Item_svc.
Re: Populate an Alias Item UDF in sales orer entry
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-03-2012 08:36 AM
Just adding that the use of oScript.DebugPrint can be very useful when debugging these scripts. Putting a few of these in your script can let you know values of variables within your script.
rVal = oScript.DebugPrint("ItemCode = " & ItemCode)
Or just to know where you are in the script, so if an error comes up you know if you gotten to a certain point.
rVal = oScript.DebugPrint("After SetBrowseFilter()")
Something like that.
Re: Populate an Alias Item UDF in sales orer entry
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-03-2012 08:43 AM
Thanks Elliott,
This worked. I went back to see the name of the _svc and i didn't catch it.
Thanks for the prompt response.
Regards,
Manuel Roman


