diff --git a/RESTAPI/Functions/SFP_GET_SCRAP_SUMMARY.sql b/RESTAPI/Functions/SFP_GET_SCRAP_SUMMARY.sql
index 8863eba..cee3500 100644
--- a/RESTAPI/Functions/SFP_GET_SCRAP_SUMMARY.sql
+++ b/RESTAPI/Functions/SFP_GET_SCRAP_SUMMARY.sql
@@ -1 +1,280 @@
-âÅã@×ÁãÈ@\ÓÉÂÓ@^@
%
%ÃÙÅÁãÅ@ÖÙ@ÙÅ×ÓÁÃÅ@ÆäÕÃãÉÖÕ@ÙÅâãÁ×ÉKâÆ×mÇÅãmâÃÙÁ×mâäÔÔÁÙè@M@
%ÉÕm×ÁÙÔ@ÃÓÖÂMòñô÷ôøóöô÷]@]@
%ÙÅãäÙÕâ@ÃÓÖÂMòñô÷ôøóöô÷]@@@
%ÓÁÕÇäÁÇÅ@âØÓ@
%â×ÅÃÉÆÉÃ@ÙÅâãÁ×ÉKâÆ×mÇÅãmâÃÙÁ×mâäÔÔÁÙè@
%ÕÖã@ÄÅãÅÙÔÉÕÉâãÉÃ@
%ÔÖÄÉÆÉÅâ@âØÓ@ÄÁãÁ@
%ÃÁÓÓÅÄ@ÖÕ@ÕäÓÓ@ÉÕ×äã@
%âÅã@Ö×ãÉÖÕ@@ÁÓæÂÓÒ@~@\ÁÓÓÙÅÁÄ@k@
%ÁÓæÃ×èÄãÁ@~@\Ö×ãÉÔÉéÅ@k@
%ÃÖÔÔÉã@~@\ÕÖÕÅ@k@
%ÄÅÃÙÅâäÓã@~@Móñk@óñk@ðð]@k@
%ÄèÕÄÆãÃÖÓ@~@\ÕÖ@k@
%ÄèÕäâÙ×ÙÆ@~@\äâÅÙ@k@
%âÙãâÅØ@~@\ÈÅç@@@
%ÂÅÇÉÕ@
%ÄÅÃÓÁÙÅ@ÅÕå@åÁÙÃÈÁÙ@M@òð@]@ÄÅÆÁäÓã@}}@^@
%ÄÅÃÓÁÙÅ@åm×ÅÙÉÖÄ@ÃÈÁÙ@M@ñ@]@ÄÅÆÁäÓã@}Ä}@^@
%ÄÅÃÓÁÙÅ@åm×ÓÁÕã@åÁÙÃÈÁÙ@M@ñõ@]@ÄÅÆÁäÓã@}}@^@
%ÄÅÃÓÁÙÅ@åmÄÅ×ã@åÁÙÃÈÁÙ@M@ñõ@]@ÄÅÆÁäÓã@}}@^@
%ÄÅÃÓÁÙÅ@åmæÃ@åÁÙÃÈÁÙ@M@õ@]@ÄÅÆÁäÓã@}}@^@
%ÄÅÃÓÁÙÅ@åmâÉãÅ@åÁÙÃÈÁÙ@M@ó@]@ÄÅÆÁäÓã@}}@^@
%ÄÅÃÓÁÙÅ@ÓÓ@åÁÙÃÈÁÙ@M@ñðòô@]@ÄÅÆÁäÓã@}}@^@
%ÄÅÃÓÁÙÅ@åmÉÕm×ÁÙÔ@ÃÓÖÂ@M@ò@Ç@]@ÄÅÆÁäÓã@}}@^@
%``@Å™™–™@ˆ�•„“‰•‡@¥�™‰�‚“…¢@
%ÄÅÃÓÁÙÅ@åmâØÓâãÁãÅ@ÃÈÁÙ@M@õ@]@ÄÅÆÁäÓã@}ððððð}@^@
%ÄÅÃÓÁÙÅ@åmâØÓÃÖÄÅ@ÉÕãÅÇÅÙ@ÄÅÆÁäÓã@ð@^@
%ÄÅÃÓÁÙÅ@åmÅÙÙÔâÇ@åÁÙÃÈÁÙ@M@õðð@]@ÄÅÆÁäÓã@}}@^@
%ÄÅÃÓÁÙÅ@åmÈãã×mâãÁãäâ@ÉÕãÅÇÅÙ@ÄÅÆÁäÓã@òðð@^@
%ÄÅÃÓÁÙÅ@åmÈÁâmÅÙÙÖÙ@ÉÕãÅÇÅÙ@ÄÅÆÁäÓã@ð@^@
%``@Ã–•£‰•¤…@ˆ�•„“…™¢@†–™@…™™–™@ƒ�—£¤™…@
%ÄÅÃÓÁÙÅ@ÃÖÕãÉÕäÅ@ÈÁÕÄÓÅÙ@ÆÖÙ@âØÓâãÁãÅ@}òòðð÷}@@``@É•¥�“‰„@„�£…£‰”…@
%ÂÅÇÉÕ@
%âÅã@åmâØÓâãÁãÅ@~@}òòðð÷}@^@
%ÇÅã@ÄÉÁÇÕÖâãÉÃâ@ÃÖÕÄÉãÉÖÕ@ñ@åmÅÙÙÔâÇ@~@ÔÅââÁÇÅmãÅçã@^@
%âÅã@åmÈãã×mâãÁãäâ@~@ôðð@^@
%âÅã@åmÈÁâmÅÙÙÖÙ@~@ñ@^@
%ÅÕÄ@^@
%ÄÅÃÓÁÙÅ@ÃÖÕãÉÕäÅ@ÈÁÕÄÓÅÙ@ÆÖÙ@âØÓâãÁãÅ@}òòððó}@@``@Õ¤”…™‰ƒ@–¤£@–†@™�•‡…@
%ÂÅÇÉÕ@
%âÅã@åmâØÓâãÁãÅ@~@}òòððó}@^@
%ÇÅã@ÄÉÁÇÕÖâãÉÃâ@ÃÖÕÄÉãÉÖÕ@ñ@åmÅÙÙÔâÇ@~@ÔÅââÁÇÅmãÅçã@^@
%âÅã@åmÈãã×mâãÁãäâ@~@ôðð@^@
%âÅã@åmÈÁâmÅÙÙÖÙ@~@ñ@^@
%ÅÕÄ@^@
%ÄÅÃÓÁÙÅ@ÃÖÕãÉÕäÅ@ÈÁÕÄÓÅÙ@ÆÖÙ@âØÓâãÁãÅ@}ðòððð}@@``@Õ–@„�£�@†–¤•„@
%ÂÅÇÉÕ@
%âÅã@åmâØÓâãÁãÅ@~@}ðòððð}@^@
%âÅã@åmÅÙÙÔâÇ@~@}Õ–@„�£�@†–¤•„@†–™@£ˆ…@¢—…ƒ‰†‰…„@ƒ™‰£…™‰�}@^@
%âÅã@åmÈãã×mâãÁãäâ@~@ôðô@^@
%âÅã@åmÈÁâmÅÙÙÖÙ@~@ñ@^@
%ÅÕÄ@^@
%ÄÅÃÓÁÙÅ@ÃÖÕãÉÕäÅ@ÈÁÕÄÓÅÙ@ÆÖÙ@âØÓâãÁãÅ@}ôòõðñ}@@``@Õ–£@�¤£ˆ–™‰©…„@
%ÂÅÇÉÕ@
%âÅã@åmâØÓâãÁãÅ@~@}ôòõðñ}@^@
%ÇÅã@ÄÉÁÇÕÖâãÉÃâ@ÃÖÕÄÉãÉÖÕ@ñ@åmÅÙÙÔâÇ@~@ÔÅââÁÇÅmãÅçã@^@
%âÅã@åmÈãã×mâãÁãäâ@~@ôðó@^@
%âÅã@åmÈÁâmÅÙÙÖÙ@~@ñ@^@
%ÅÕÄ@^@
%ÄÅÃÓÁÙÅ@ÃÖÕãÉÕäÅ@ÈÁÕÄÓÅÙ@ÆÖÙ@âØÓâãÁãÅ@}ôò÷ðô}@@``@Ö‚‘…ƒ£@•–£@†–¤•„@
%ÂÅÇÉÕ@
%âÅã@åmâØÓâãÁãÅ@~@}ôò÷ðô}@^@
%ÇÅã@ÄÉÁÇÕÖâãÉÃâ@ÃÖÕÄÉãÉÖÕ@ñ@åmÅÙÙÔâÇ@~@ÔÅââÁÇÅmãÅçã@^@
%âÅã@åmÈãã×mâãÁãäâ@~@ôðô@^@
%âÅã@åmÈÁâmÅÙÙÖÙ@~@ñ@^@
%ÅÕÄ@^@
%ÄÅÃÓÁÙÅ@ÃÖÕãÉÕäÅ@ÈÁÕÄÓÅÙ@ÆÖÙ@âØÓÅçÃÅ×ãÉÖÕ@
%ÂÅÇÉÕ@
%ÇÅã@ÄÉÁÇÕÖâãÉÃâ@ÃÖÕÄÉãÉÖÕ@ñ@
%åmâØÓâãÁãÅ@~@ÙÅãäÙÕÅÄmâØÓâãÁãÅ@k@
%åmâØÓÃÖÄÅ@~@ÄÂòmÙÅãäÙÕÅÄmâØÓÃÖÄÅ@k@åmÅÙÙÔâÇ@~@ÔÅââÁÇÅmãÅçã@^@
%âÅã@åmÈãã×mâãÁãäâ@~@õðð@^@
%âÅã@åmÈÁâmÅÙÙÖÙ@~@ñ@^@
%ÅÕÄ@^@
%``@×�™¢…@‰•—¤£@—�™�”…£…™¢@
%âÅã@åm×ÅÙÉÖÄ@~@ÃÖÁÓÅâÃÅ@M@ä××ÅÙ@M@ÑâÖÕmåÁÓäÅ@M@ÉÕm×ÁÙÔ@k@}[K—…™‰–„}@]@]@k@}Ä}@]^@
%âÅã@åm×ÓÁÕã@~@ÃÖÁÓÅâÃÅ@M@ÑâÖÕmåÁÓäÅ@M@ÉÕm×ÁÙÔ@k@}[K—“�•£}@]@k@}}@]@^@
%âÅã@åmÄÅ×ã@~@ÃÖÁÓÅâÃÅ@M@ÑâÖÕmåÁÓäÅ@M@ÉÕm×ÁÙÔ@k@}[K„…—�™£”…•£}@]@k@}}@]@^@
%âÅã@åmæÃ@~@ÃÖÁÓÅâÃÅ@M
\ No newline at end of file
+SET PATH *LIBL ; 
+
+CREATE OR REPLACE FUNCTION RESTAPI.SFP_GET_SCRAP_SUMMARY ( 
+	IN_PARM CLOB(2147483647) ) 
+	RETURNS CLOB(2147483647)   
+	LANGUAGE SQL 
+	SPECIFIC RESTAPI.SFP_GET_SCRAP_SUMMARY 
+	NOT DETERMINISTIC 
+	MODIFIES SQL DATA 
+	CALLED ON NULL INPUT 
+	SET OPTION  ALWBLK = *ALLREAD , 
+	ALWCPYDTA = *OPTIMIZE , 
+	COMMIT = *NONE , 
+	DECRESULT = (31, 31, 00) , 
+	DYNDFTCOL = *NO , 
+	DYNUSRPRF = *USER , 
+	SRTSEQ = *HEX   
+	BEGIN 
+DECLARE ENV VARCHAR ( 20 ) DEFAULT '' ; 
+DECLARE V_PERIOD CHAR ( 1 ) DEFAULT 'D' ; 
+DECLARE V_PLANT VARCHAR ( 15 ) DEFAULT '' ; 
+DECLARE V_DEPT VARCHAR ( 15 ) DEFAULT '' ; 
+DECLARE V_WC VARCHAR ( 5 ) DEFAULT '' ; 
+DECLARE V_SITE VARCHAR ( 3 ) DEFAULT '' ; 
+DECLARE LL VARCHAR ( 1024 ) DEFAULT '' ; 
+DECLARE V_IN_PARM CLOB ( 2 G ) DEFAULT '' ; 
+-- Error handling variables 
+DECLARE V_SQLSTATE CHAR ( 5 ) DEFAULT '00000' ; 
+DECLARE V_SQLCODE INTEGER DEFAULT 0 ; 
+DECLARE V_ERRMSG VARCHAR ( 500 ) DEFAULT '' ; 
+DECLARE V_HTTP_STATUS INTEGER DEFAULT 200 ; 
+DECLARE V_HAS_ERROR INTEGER DEFAULT 0 ; 
+-- Continue handlers for error capture 
+DECLARE CONTINUE HANDLER FOR SQLSTATE '22007'  -- Invalid datetime 
+BEGIN 
+SET V_SQLSTATE = '22007' ; 
+GET DIAGNOSTICS CONDITION 1 V_ERRMSG = MESSAGE_TEXT ; 
+SET V_HTTP_STATUS = 400 ; 
+SET V_HAS_ERROR = 1 ; 
+END ; 
+DECLARE CONTINUE HANDLER FOR SQLSTATE '22003'  -- Numeric out of range 
+BEGIN 
+SET V_SQLSTATE = '22003' ; 
+GET DIAGNOSTICS CONDITION 1 V_ERRMSG = MESSAGE_TEXT ; 
+SET V_HTTP_STATUS = 400 ; 
+SET V_HAS_ERROR = 1 ; 
+END ; 
+DECLARE CONTINUE HANDLER FOR SQLSTATE '02000'  -- No data found 
+BEGIN 
+SET V_SQLSTATE = '02000' ; 
+SET V_ERRMSG = 'No data found for the specified criteria' ; 
+SET V_HTTP_STATUS = 404 ; 
+SET V_HAS_ERROR = 1 ; 
+END ; 
+DECLARE CONTINUE HANDLER FOR SQLSTATE '42501'  -- Not authorized 
+BEGIN 
+SET V_SQLSTATE = '42501' ; 
+GET DIAGNOSTICS CONDITION 1 V_ERRMSG = MESSAGE_TEXT ; 
+SET V_HTTP_STATUS = 403 ; 
+SET V_HAS_ERROR = 1 ; 
+END ; 
+DECLARE CONTINUE HANDLER FOR SQLSTATE '42704'  -- Object not found 
+BEGIN 
+SET V_SQLSTATE = '42704' ; 
+GET DIAGNOSTICS CONDITION 1 V_ERRMSG = MESSAGE_TEXT ; 
+SET V_HTTP_STATUS = 404 ; 
+SET V_HAS_ERROR = 1 ; 
+END ; 
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION 
+BEGIN 
+GET DIAGNOSTICS CONDITION 1 
+V_SQLSTATE = RETURNED_SQLSTATE , 
+V_SQLCODE = DB2_RETURNED_SQLCODE , V_ERRMSG = MESSAGE_TEXT ; 
+SET V_HTTP_STATUS = 500 ; 
+SET V_HAS_ERROR = 1 ; 
+END ; 
+-- Parse input parameters 
+SET V_PERIOD = COALESCE ( UPPER ( JSON_VALUE ( IN_PARM , '$.period' ) ) , 'D' ); 
+SET V_PLANT = COALESCE ( JSON_VALUE ( IN_PARM , '$.plant' ) , '' ) ; 
+SET V_DEPT = COALESCE ( JSON_VALUE ( IN_PARM , '$.department' ) , '' ) ; 
+SET V_WC = COALESCE ( JSON_VALUE ( IN_PARM , '$.workcenter' ) , '' ) ; 
+SET V_SITE = COALESCE ( JSON_VALUE ( IN_PARM , '$.site' ) , '' ) ; 
+-- Extract env handling all input formats (object, array, string) 
+SET V_IN_PARM = IN_PARM ; 
+WHILE CISTOOLS . JSON_TYPE ( V_IN_PARM ) IN ( 'object' , 'array' , 'string' ) 
+DO 
+SET V_IN_PARM = 
+CASE CISTOOLS . JSON_TYPE ( V_IN_PARM ) 
+WHEN 'object' THEN JSON_VALUE ( V_IN_PARM , '$.env' ) 
+WHEN 'array' THEN JSON_VALUE ( V_IN_PARM , '$[0]' ) 
+WHEN 'string' THEN REPLACE ( V_IN_PARM , '"' , '' ) 
+ELSE TRIM ( V_IN_PARM ) 
+END ; 
+END WHILE ; 
+SET ENV = V_IN_PARM ; 
+SET LL = CISTOOLS . SET_LIBRARY_LIST ( ENV ) ; 
+-- Validate environment was set 
+IF ENV = '' 
+OR ENV IS NULL THEN 
+RETURN 
+JSON_OBJECT ( 
+'error' : JSON_OBJECT ( 
+'http_status' : 400 , 'sqlstate' : '22001' , 
+'message' : 'Environment parameter is required' 
+) 
+) ; 
+END IF ; 
+-- Check for errors from library list setup 
+IF V_HAS_ERROR = 1 THEN 
+RETURN 
+JSON_OBJECT ( 
+'error' : JSON_OBJECT ( 
+'http_status' : V_HTTP_STATUS , 'sqlstate' : V_SQLSTATE , 
+'message' : V_ERRMSG 
+) 
+) ; 
+END IF ; 
+RETURN 
+WITH BOUNDS AS ( 
+SELECT CURRENT_DATE AS FOR_DATE , 2 AS WEEK_START_DOW , 
+ZONED ( CURRENT_DATE ) AS YYYYMMDD_FOR , 
+ZONED ( 
+LAST_DAY ( ADD_MONTHS ( CURRENT_DATE , - 1 ) ) + 1 DAY ) 
+AS YYYYMMDD_MONTH_FROM , 
+ZONED ( LAST_DAY ( CURRENT_DATE ) ) 
+AS YYYYMMDD_MONTH_THRU , 
+DAYOFWEEK ( CURRENT_DATE ) AS DOW_FOR 
+FROM SYSIBM . SYSDUMMY1 
+) , 
+WEEK_CALC AS ( 
+SELECT B . * , 
+MOD ( B . DOW_FOR - B . WEEK_START_DOW + 7 , 7 ) 
+AS DELTA_DAYS 
+FROM BOUNDS B 
+) , 
+DATE_RANGE AS ( 
+SELECT 
+CASE 
+V_PERIOD 
+WHEN 'M' THEN ( YYYYMMDD_MONTH_FROM - 19000000 ) 
+WHEN 
+'W' 
+THEN 
+( ( YEAR ( FOR_DATE - DELTA_DAYS DAYS ) * 10000 
++ 
+MONTH ( FOR_DATE - DELTA_DAYS DAYS ) * 100 
++ DAY ( FOR_DATE - DELTA_DAYS DAYS ) ) - 
+19000000 ) 
+ELSE ( YYYYMMDD_FOR - 19000000 ) 
+END AS FROM_CY , 
+CASE V_PERIOD 
+WHEN 'M' THEN ( YYYYMMDD_MONTH_THRU - 19000000 ) 
+ELSE ( YYYYMMDD_FOR - 19000000 ) 
+END AS THRU_CY 
+FROM WEEK_CALC 
+) , 
+-- Group by workcenter and site from host file 
+SCRAP_BY_WC AS ( 
+SELECT TRIM ( P . KIWKCTR ) AS WKCTR , TRIM ( P . KISTID ) AS STID , 
+TRIM ( P . KIGRP1 ) AS PLANT , TRIM ( P . KIGRP2 ) AS DEPT , 
+SUM ( P . KIRCVD ) AS GOOD_QTY , 
+SUM ( P . KISCRP ) AS SCRAP_QTY , 
+SUM ( P . KIEXPT ) AS TARGET_QTY 
+FROM SFCPERI P , DATE_RANGE R 
+WHERE P . KIDATE BETWEEN R . FROM_CY AND R . THRU_CY 
+AND TRIM ( P . KIGRP1 ) = COALESCE ( 
+NULLIF ( V_PLANT , '' ) , TRIM ( P . KIGRP1 ) ) 
+AND TRIM ( P . KIGRP2 ) = COALESCE ( 
+NULLIF ( V_DEPT , '' ) , TRIM ( P . KIGRP2 ) ) 
+AND TRIM ( P . KIWKCTR ) = COALESCE ( 
+NULLIF ( V_WC , '' ) , TRIM ( P . KIWKCTR ) ) 
+AND TRIM ( P . KISTID ) = COALESCE ( 
+NULLIF ( V_SITE , '' ) , TRIM ( P . KISTID ) ) 
+GROUP BY P . KIWKCTR , P . KISTID , P . KIGRP1 , P . KIGRP2 
+) , 
+WC_CALCS AS ( 
+SELECT WKCTR , STID , PLANT , DEPT , 
+DEC ( GOOD_QTY , 31 , 2 ) AS GOOD_PARTS , 
+DEC ( SCRAP_QTY , 31 , 2 ) AS SCRAP_PARTS , 
+DEC ( GOOD_QTY + SCRAP_QTY , 31 , 2 ) AS TOTAL_PARTS , 
+DEC ( TARGET_QTY , 31 , 2 ) AS TARGET_PARTS , 
+CASE 
+WHEN 
+( GOOD_QTY + SCRAP_QTY ) > 0 
+THEN 
+INT ( 
+( DECFLOAT ( SCRAP_QTY ) / 
+DECFLOAT ( GOOD_QTY + SCRAP_QTY ) * 100 ) 
++ 0.5 ) 
+ELSE 0 
+END AS SCRAP_RATE_PCT , 
+CASE 
+WHEN 
+( GOOD_QTY + SCRAP_QTY ) > 0 
+THEN 
+INT ( 
+( DECFLOAT ( GOOD_QTY ) / 
+DECFLOAT ( GOOD_QTY + SCRAP_QTY ) * 100 ) 
++ 0.5 ) 
+ELSE 0 
+END AS QUALITY_PCT 
+FROM SCRAP_BY_WC 
+) , 
+JSON_WORKCENTERS AS ( 
+SELECT 
+JSON_OBJECT ( 
+'workcenter' : CAST ( WKCTR AS VARCHAR ( 5 ) CCSID 37 ) , 
+'site' : CAST ( STID AS VARCHAR ( 3 ) CCSID 37 ) , 
+'plant' : CAST ( PLANT AS VARCHAR ( 15 ) CCSID 37 ) , 
+'department' : CAST ( DEPT AS VARCHAR ( 15 ) CCSID 37 ) , 
+'goodParts' : COALESCE ( GOOD_PARTS , 0 ) , 
+'scrapParts' : COALESCE ( SCRAP_PARTS , 0 ) , 
+'totalParts' : COALESCE ( TOTAL_PARTS , 0 ) , 
+'targetParts' : COALESCE ( TARGET_PARTS , 0 ) , 
+'scrapRatePercentage' : COALESCE ( 
+SCRAP_RATE_PCT , 0 ) , 
+'qualityPercentage' : COALESCE ( QUALITY_PCT , 0 ) 
+) AS WC_OBJ 
+FROM WC_CALCS 
+ORDER BY WKCTR , STID ) , 
+-- Calculate totals across all workcenters 
+TOTALS AS ( 
+SELECT SUM ( GOOD_PARTS ) AS TOTAL_GOOD , 
+SUM ( SCRAP_PARTS ) AS TOTAL_SCRAP , 
+SUM ( TOTAL_PARTS ) AS TOTAL_ALL , 
+SUM ( TARGET_PARTS ) AS TOTAL_TARGET , 
+CASE 
+WHEN 
+SUM ( TOTAL_PARTS ) > 0 
+THEN 
+INT ( 
+( DECFLOAT ( SUM ( SCRAP_PARTS ) ) / 
+DECFLOAT ( SUM ( TOTAL_PARTS ) ) * 100 ) + 
+0.5 ) 
+ELSE 0 
+END AS OVERALL_SCRAP_RATE , 
+CASE 
+WHEN 
+SUM ( TOTAL_PARTS ) > 0 
+THEN 
+INT ( 
+( DECFLOAT ( SUM ( GOOD_PARTS ) ) / 
+DECFLOAT ( SUM ( TOTAL_PARTS ) ) * 100 ) + 
+0.5 ) 
+ELSE 0 
+END AS OVERALL_QUALITY 
+FROM WC_CALCS 
+) SELECT JSON_OBJECT ( 
+'workcenters' : ( SELECT JSON_ARRAYAGG ( 
+WC_OBJ FORMAT JSON 
+) 
+FROM JSON_WORKCENTERS ) FORMAT JSON , 'totals' : ( 
+SELECT JSON_OBJECT ( 
+'goodParts' : COALESCE ( TOTAL_GOOD , 0 ) , 
+'scrapParts' : COALESCE ( TOTAL_SCRAP , 0 ) , 
+'totalParts' : COALESCE ( TOTAL_ALL , 0 ) , 
+'targetParts' : COALESCE ( TOTAL_TARGET , 0 ) , 
+'scrapRatePercentage' : COALESCE ( 
+OVERALL_SCRAP_RATE , 0 ) , 
+'qualityPercentage' : COALESCE ( OVERALL_QUALITY , 0 ) 
+) 
+FROM TOTALS ) , 'period' : V_PERIOD , 'periodLabel' : 
+CASE V_PERIOD 
+WHEN 'M' THEN 'Monthly' 
+WHEN 'W' THEN 'Weekly' 
+ELSE 'Daily' 
+END , 'generatedAt' : TO_CHAR ( 
+CURRENT_TIMESTAMP , 'YYYY-MM-DD HH24:MI:SS' ) 
+) 
+FROM SYSIBM . SYSDUMMY1 ; 
+END  ; 
+
+GRANT ALTER , EXECUTE   
+ON SPECIFIC FUNCTION RESTAPI.SFP_GET_SCRAP_SUMMARY 
+TO AMAPICS WITH GRANT OPTION ; 
+
+GRANT EXECUTE   
+ON SPECIFIC FUNCTION RESTAPI.SFP_GET_SCRAP_SUMMARY 
+TO PUBLIC ; 
+
