Skip to main content

I want to create a filter of an ELSE inside my condition.

 

The   ELSE 'Área Não Aderente'. Below script. I want to bring only the data from this ELSE, which would be the opposite of my condition below.

 

 

CASE WHEN

 

    ("EKKO"."BSART" LIKE 'Y%' OR "EKKO"."BSART" LIKE 'PE' OR ("EKKO"."BSART" LIKE 'Z%' AND "EKKO"."BSART" NOT IN ('ZCG','ZPM', 'ZCAT')))

    AND

    ("EKKO"."EKGRP" LIKE 'I%' OR "EKKO"."EKGRP" IN_LIKE ('%1I','%2I','%3I','%4I','%5I','%6I','%7I','%8I','%9I') OR "EKKO"."EKGRP" LIKE 'A%' OR "EKKO"."EKGRP" LIKE '01A')

     

  THEN -- Pedido por Área

 

    CASE WHEN

   

    PU_COUNT("EKKO", "EKPO"."MATNR", "EKPO"."MATNR" IN_LIKE ('%3001009%', '%3000926%', '%3000927%'))>0 -- Cadastro de Material

    OR

    (PU_COUNT("EKKO", "EKPO"."MATKL", "EKPO"."MATKL" IN ('GI001710A'))>0 -- Grupo de Mercadoria

      AND

    "EKKO"."EKGRP" IN ('I09')) -- Grupo de Comprador

    OR

    "EKKO"."EKGRP" IN ('I38', 'I13','I12') -- Grupo de Comprador

    OR

    "EKKO"."Z_BSGRU" IN ('INT')

    AND

    "PO_LFB1"."FDGRV" IN ('FPREL') -- Contratos Intercompany

    THEN 'Área Aderente'

    ELSE 'Área Não Aderente'

    END

 

  ELSE 'Supply'

 

Thanks.

The second 'Case When' statement is a part of the first one or is it a separate condition?

so basically :

 

1st case when-

then-- Pedido por Área

 

If the second 'Case When' statement is a part of the first one it should be written after 'Then'

If it's not a part of it,

Don't write Case when again, only 'When' should work.

 

CASE WHEN

 

  ("EKKO"."BSART" LIKE 'Y%' OR "EKKO"."BSART" LIKE 'PE' OR ("EKKO"."BSART" LIKE 'Z%' AND "EKKO"."BSART" NOT IN ('ZCG','ZPM', 'ZCAT')))

  AND

  ("EKKO"."EKGRP" LIKE 'I%' OR "EKKO"."EKGRP" IN_LIKE ('%1I','%2I','%3I','%4I','%5I','%6I','%7I','%8I','%9I') OR "EKKO"."EKGRP" LIKE 'A%' OR "EKKO"."EKGRP" LIKE '01A')

   

 THEN -- Pedido por Área

 

  WHEN

  

  PU_COUNT("EKKO", "EKPO"."MATNR", "EKPO"."MATNR" IN_LIKE ('%3001009%', '%3000926%', '%3000927%'))>0 -- Cadastro de Material.........continued

 

Let me know if I am getting anything wrong.

 

Thanks


The second 'Case When' statement is a part of the first one or is it a separate condition?

so basically :

 

1st case when-

then-- Pedido por Área

 

If the second 'Case When' statement is a part of the first one it should be written after 'Then'

If it's not a part of it,

Don't write Case when again, only 'When' should work.

 

CASE WHEN

 

  ("EKKO"."BSART" LIKE 'Y%' OR "EKKO"."BSART" LIKE 'PE' OR ("EKKO"."BSART" LIKE 'Z%' AND "EKKO"."BSART" NOT IN ('ZCG','ZPM', 'ZCAT')))

  AND

  ("EKKO"."EKGRP" LIKE 'I%' OR "EKKO"."EKGRP" IN_LIKE ('%1I','%2I','%3I','%4I','%5I','%6I','%7I','%8I','%9I') OR "EKKO"."EKGRP" LIKE 'A%' OR "EKKO"."EKGRP" LIKE '01A')

   

 THEN -- Pedido por Área

 

  WHEN

  

  PU_COUNT("EKKO", "EKPO"."MATNR", "EKPO"."MATNR" IN_LIKE ('%3001009%', '%3000926%', '%3000927%'))>0 -- Cadastro de Material.........continued

 

Let me know if I am getting anything wrong.

 

Thanks

Hi Dyvian, yes, the second is part of the first. I understand your placement.Thanks, i made the adjustment in WHEN

 

What I need is to create a filter, which brings me the condition  ELSE 'Área Não Aderente'.


Hi,

 

You can try this

FILTER DOMAIN

-- Your Entire Case when statement --

IN ( 'Área Não Aderente' )

 


Kailash, thank you very much.


Reply