‎2007 Sep 17 5:50 PM
Does anyone know if it is possible to create a count on multiple fields. I am trying to create an SQL statement that will indicate the number of Delivery Items in a Shipment.
The Delivery and Delivery-item need to be counted for each shipment. I was hoping to use something like the following but I can not get it passed the syntax checker:
select OI_SHNUM
count( distinct OI_DOCNR OI_ITEM )
from /BIC/AZOITRO0200
into table i_dlvCount_data
group by OI_SHNUM.
or
select OI_SHNUM
count( distinct OI_DOCNR )
count( distinct OI_ITEM )
from /BIC/AZOITRO0200
into table i_dlvCount_data
group by OI_SHNUM.
Any ideas appreciated. For the time being I will concatenate these in the preceeding BW data target.
‎2007 Sep 18 9:03 PM
This should work:
DATA: BEGIN OF i_dlvcount OCCURS 0,
oi_shnum TYPE /bic/azoitro0200-oi_shnum,
oi_docnr TYPE i,
oi_item TYPE i,
END OF i_dlvcount.
SELECT oi_shnum
COUNT( DISTINCT oi_docnr )
COUNT( DISTINCT oi_item )
FROM /bic/azoitro0200
INTO TABLE i_dlvcount_data.
Rob