Skip to Content
0

UDV, Linked UDF

Nov 04, 2016 at 10:02 AM

27

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
avatar image
Former Member Nov 04, 2016 at 11:36 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Nov 04, 2016 at 10:49 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded