Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Using Case Statement in HANA SQL SELECT(CALCULATION VIEW)

$
0
0

Hi I am trying to check the usage of case statement in SELECT.

 

Example:

 

The partner fucntion table -> VBPA we have data as below for sales order '12345'

 

VBPA-VBELN = '12345'

VBPA-POSNR = '000000'

VBPA-PARVW = 'NA'

VBPA-KUNNR  =  '  '

VBPA-PARNR  =   '  '

VBPA-LIFNR    =  'NA0115'

 

 

When i am extracting the data from VBPA i am using below statement but the result does not return anything.

I am expecting the result -> NA0115

 

  it_temp1 has the sales order data -> Example sales order '12345'

 

it_temp2= SELECT  distinct a.*,

                 case  when d.kunnr is not null   then d.kunnr

                            when d.lifnr     is not null   then d.lifnr

                            when d.parnr  is not null   then d.parnr    else ' '

                end as national_account

                FROM: it_temp1 as a

                INNER JOIN VBPA as b

                ON  a.mandt = b.mandt and

                      a.vbeln    = b.vbeln  and

                      b.parvw = 'NA' and b.posnr = '000000';

 

 

 

 

 

 

'


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>