Skip to Content

UDV, Linked UDF

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Nov 04, 2016 at 11:36 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 04, 2016 at 10:49 AM

    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

    Add comment
    10|10000 characters needed characters exceeded