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

MAX funtionality in HANA

$
0
0

HI All

 

I get below output from my HANA model. For the billing item 001710 I get 2 lines. I only want to display the line where the NEW_DEL_DATE is MAX

 

How can I achieve this? I have written a SQL script model

 

 

Billing
  Document
Billing itemBilling DateTO_DATE_EUDATTO_DATE_WADATNEW_DEL_DATECost - Comp
  Code Curr
Net Value -
  Comp Code Curr
GET_DAYSTRAN_TIMEDEL_DATE_CALC
9043128697000010201408018/12/20148/1/20148/12/2014482.160642.88021111
000060201408018/12/20148/1/20148/12/201489.060181.13021111
000080201408018/12/20148/1/20148/12/2014136.000181.33021111
000090201408018/12/20148/1/20148/12/2014435.040725.32021111
000190201408018/12/20148/1/20148/12/2014449.140597.52021111
000210201408018/12/20148/1/20148/12/2014498.680597.52021111
001700201408018/12/20148/1/20148/12/2014699.650651.20021111
001710201408018/12/20148/1/20148/12/2014638.800592.04021111
8/15/20148/6/20148/10/2014638.800592.040299

 

 

 

SELECT"BILL_VBELN","BILL_FKDAT","BILL_KVGR1_1","BILL_FIL_PROFORMA_INV","BILL_KUNRG","BILL_KTGRD_1","BILL_VKORG_VBRK","BILL_INCO1","BILL_INCO2","BILL_PRCTR","BILL_POSNR","ROUTE","BILL_AUPOS","GET_DAYS","BILL_DATE_FY","BILL_DATE_FP","TO_DATE_EUDAT","TO_DATE_WADAT","DEL_DATE_CALC",


"TRAN_TIME","CA_BILL_REP_NETWR_COMP_CURR","CA_BILL_REP_WAVWR_COMP_CURR", MAX("NEW_DEL_DATE") AS"NEW_DEL_DATE"


FROM"_SYS_BIC"."pk-sample.productmanagement/XXXX"


WHERE"BILL_VBELN" = '9043128697'


GROUPBY"BILL_VBELN","BILL_FKDAT","BILL_KVGR1_1","BILL_FIL_PROFORMA_INV","BILL_KUNRG","BILL_KTGRD_1","BILL_VKORG_VBRK","BILL_INCO1","BILL_INCO2","BILL_PRCTR","BILL_POSNR","ROUTE","BILL_AUPOS","GET_DAYS","BILL_DATE_FY","BILL_DATE_FP","TO_DATE_EUDAT","TO_DATE_WADAT","DEL_DATE_CALC","TRAN_TIME","CA_BILL_REP_NETWR_COMP_CURR","CA_BILL_REP_WAVWR_COMP_CURR";

 

;

 

 

The code is correct, but I cannot achieve the desired output. I get below output.

 

 

VBELNBILL_AUPOSPOSNRGET_DAYSTO_DATE_EUDATTO_DATE_WADATDEL_DATE_CALCTRAN_TIMECA_BILL_REP_NETWR_COMP_CURRCA_BILL_REP_WAVWR_COMP_CURRNEW_DEL_DATE
90431286970000102014080128/12/2014 00:00:008/1/2014 00:00:0011.0011642.88482.168/12/2014 00:00:00
0000602014080128/12/2014 00:00:008/1/2014 00:00:0011.0011181.1389.068/12/2014 00:00:00
0000802014080128/12/2014 00:00:008/1/2014 00:00:0011.0011181.33136.008/12/2014 00:00:00
0000902014080128/12/2014 00:00:008/1/2014 00:00:0011.0011725.32435.048/12/2014 00:00:00
0001902014080128/12/2014 00:00:008/1/2014 00:00:0011.0011597.52449.148/12/2014 00:00:00
0002102014080128/12/2014 00:00:008/1/2014 00:00:0011.0011597.52498.688/12/2014 00:00:00
0017002014080128/12/2014 00:00:008/1/2014 00:00:0011.0011651.20699.658/12/2014 00:00:00
0017102014080148/12/2014 00:00:008/1/2014 00:00:0020.00201,184.081,277.608/10/2014 00:00:00

 

 

Please guide. The key figures are getting double, also the NEW_DEL_DATE picked up is wrong..


Viewing all articles
Browse latest Browse all 6412

Trending Articles



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