Hello,
the following stored Procedure calls a second one and I get for each product some parts where included. Now, I group this at all, but some products uses the same parts and I would group it in this function, without calling with another one which groups it. It is possible? create or alter procedure P_GETTEILEMATPULPS ( PSJAHR integer, PSKW integer) returns ( MATNR varchar(16), ANZ double precision, EINHEIT integer) AS declare variable teil varchar(16); declare variable menge double precision; BEGIN for select teilenr, sum(stck_je_tag) from tplan_kw_pos where ltjahr = :psjahr and ltkw = :pskw and abgearbeitet = 0 group by teilenr into :teil, :menge do begin if(menge is null) then menge = 0; for select materialnr, sum(anzahlm) as anzahlm, einheit from P_GETTEILEMATps_pul(:teil, :menge) group by materialnr, einheit into :matnr, :anz, :einheit do suspend; end END Thank you. Best regards Olaf