Query to Lookup Ship To in a UDF for the Inventory Transfer
Good Day Experts!
I created a UDF for the Ship To Code in the Inventory Transfer Window. The problem is I do not know how to create a query to be used in the Formatted Search for this UDF wherein it will lookup all the Ship To Codes in the table CRD1 of that particular Customer selected in the Inventory Transfer window. The objective is to choose a Ship to code just like in the sales document.
My next problem would be how to display automatically the whole Ship To Address in another UDF based on the Ship To Code chosen in the UDF Ship To Code.
Your inputs would be highly appreciated.
Sridharan T replied
Sorry, there was a error in the Query,
T0.CardType='S' is wrong and this should be replaced with T0.AdresType='S'
Now use the following corrected query. This should work:
SELECT T0.cardname+CHAR(13)+isnull(T0.Address,'')+CHAR(13)+ cast(T0.Building as varchar(100))+CHAR(13)+isnull(T0.city,'')+CHAR(13) +isnull(T0.zipcode,'') as Address FROM CRD1 T0 WHERE T0.CardCode =$[OWTR.CardCode] and T0.AdresType='S' and T0.Address=$[OWTR.U_SHIPTO]