cancel
Showing results for 
Search instead for 
Did you mean: 

UDV, Linked UDF

chris_fawcett
Participant
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

chris_fawcett
Participant
0 Kudos

Thanks Nayrayani

I have found the solution. It was an issue with the tables which were linked. As I needed to filter by all items OITM left Join to RDR1 was correct.

Answers (1)

Answers (1)

narayanis
Active Contributor
0 Kudos

Hi,

Instead of comparing with NULL, assign a default value and then try.

Also try listing the values of that field in the existing rows. Especially when it gives you the incorrect result.

There is a possibility that user has interacted with that field erroneously and NULL is getting replaced by empty spaces.

Regards

Narayani