Skip to Content
0
Nov 04, 2016 at 10:02 AM

UDV, Linked UDF

92 Views

Hi Sap Experts

I have the below query for a UDV in sales order which plus through is an item is set only for a specific customer set in a UDF.

When I run it as a UDV in out test system it does not always return the desired results e.g when (t1.U_ITEM_VALUE is not null and t1.U_ITEM_VALUE <> $[$4.0.0]) it only occasionally returns the desired result.

I have linked the reports using the udf fields so I am not sure it is an issue with the database updating.

My Query for the UDV is as per the below where t1.U_ITEM_VALUE is the BP Ref No when an item is set for a specific customer.

Any ideas?

BTW this new sap forum is horrible to use. :-(

SELECT distinct
case
when t1.U_ITEM_VALUE = $[$4.0.0]
then concat(T2.CARDNAME,' ','Only Product')
when (t1.U_ITEM_VALUE is not null and t1.U_ITEM_VALUE <> $[$4.0.0])
then concat('**','Supply Only To',' ',t2.CARDNAME,'**')
end AS 'Supply Only To'

FROM RDR1 T0 INNER JOIN OITM T1 ON T0.ITEMCODE=T1.ITEMCODE LEFT JOIN OCRD T2 ON t1.U_ITEM_VALUE =T2.CARDCODE

WHERE $[$38.1.0] = t1.itemcode

Many Thanks

Chris