cancel
Showing results for 
Search instead for 
Did you mean: 

duplicate Batch number Block in Goods receipt and Receipt from Production

former_member252592
Participant
0 Kudos

Hi, Experts

following is my SP to block Duplicate Batch number in Goods receipt and Receipt from production

/* Duplicate Batch Number Block Error = 900001*/ IF (:transaction_type = 'A' OR :transaction_type = 'U') AND (:object_type= '59') then SELECT COUNT(*) INTO CNT FROM IGN1 T1 INNER JOIN OIGN T2 ON T1."DocEntry" = T2."DocEntry" INNER JOIN OIBT T0 ON T0."BaseEntry" = T2."DocEntry" WHERE T0."BaseType" = 59 AND T1."DocEntry" = :list_of_cols_val_tab_del AND (T1."ItemCode" Like 'DNC-FG%%') AND T0."BatchNum" in (SELECT T0."BatchNum" FROM IGN1 T1 INNER JOIN OIGN T2 ON T1."DocEntry" = T2."DocEntry" INNER JOIN OIBT T0 ON T0."BaseEntry" = T2."DocEntry" WHERE T0."BaseType" = 59 AND (T1."ItemCode" Like 'DNC-FG%%')); IF :CNT>0 THEN error := 900001; error_message := 'Batch Number is Already Exist'; CNT := 0 ; END IF ; END IF;

but its not working can anyone guide me what am i missing my SAP Business one version is 9.2 PL06 HANA

Regards

Jamil Siddiqui

Accepted Solutions (1)

Accepted Solutions (1)

former_member252592
Participant
0 Kudos

Issue resolved by following SP

/* Duplicate Batch Number Block Error = 900001*/

IF (:transaction_type = 'A'OR :transaction_type = 'U') AND (:object_type= '59') then

SELECTCOUNT(*) INTO CNT

FROM IGN1 T1

INNERJOIN IBT1 T0 ON T1."DocEntry" = T0."BaseEntry"and T0."BaseType" = '59'

where T1."DocEntry" = :list_of_cols_val_tab_del and

T1."ItemCode"Like'DNC-FG%%'

AND T0."BatchNum"in (SelectIfnull(T0."BatchNum",'') from IBT1 T0

INNERJOIN IGN1 T1 ON T1."DocEntry" = T0."BaseEntry"and T0."BaseType" = '59'where

T1."ItemCode"Like'DNC-FG%%'and T1."DocEntry" <> :list_of_cols_val_tab_del );

IF :CNT>0 THEN

error := 900001;

error_message := 'Duplicate Batch Number Exist Check Batch No Again';

CNT:= 0;

ENDIF;

ENDIF;

Regards

Jamil

Answers (1)

Answers (1)

MD1
Active Contributor
0 Kudos

IF :object_type = '59' AND :transaction_type ='A' THEN
Declare temp_var_0 integer;
SELECT Count (*) INTO temp_var_0
FROM IBT1 B1,
IBT1 B2
WHERE b1."BatchNum" IN (IFNULL(b2."BatchNum" , '')) AND B1."BaseEntry" = :list_of_cols_val_tab_del AND
b1."ItemCode" = B2."ItemCode" AND b2."BaseEntry" <> :list_of_cols_val_tab_del AND b2."BaseType"=59 AND
b1."BaseType"=59 AND b2."BsDocType" not in (202) AND b1."BsDocType" not in (202) and b2."WhsCode" not in ('01') AND b1."WhsCode" not in ('01');
IF :temp_var_0 >0 THEN
error := 108;
error_message := 'Duplicate Batch no not allwd';
END IF;
END IF;