Skip to Content

How to block selection of batch number already expired during delivery creation/Inventory Transfer

Hi all,

Help Needed!

How to block selection of batch number already expired during delivery creation/Inventory Transfer/Goods Issue

SAP HANA /SQL below procedure not working...

--#Block if Batch Expired---------
IF :Object_type = '10000044' THEN
Declare temp_var_101 integer;
SELECT
(SELECT cOUNT (t0."AbsEntry" )
FROM OBTN T0
WHERE t0."AbsEntry" = :list_of_cols_val_tab_del
AND DAYS_BETWEEN(t0."ExpDate",CURRENT_DATE)>=0) INTO temp_var_101 FROM DUMMY;
IF :temp_var_101 > 0 THEN
SELECT 1, 'Selected Batch Expire' INTO ERROR, error_message FROM DUMMY;
END IF;
END IF;

Danish

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Nov 15, 2016 at 06:00 AM

    Hi,

    Do you have Quality Management module, if QM is there then we can directly send the expired batch stock to blocked stock.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 16, 2016 at 08:13 AM

    Hi,

    Is this query giving result after executing as a normal query. I guess, some issue regarding date function.

    Regards

    Pradnya

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 06, 2016 at 10:51 AM

    Help needed on this,its not working,

    --#Expired Batch Restriction
    IF LTRIM(RTRIM(:object_type)) = '60' AND (:transaction_type='A') THEN
    DECLARE item nvarchar(20);
    DECLARE batch nvarchar(32);
    DECLARE whs nvarchar(8);
    DECLARE expDate timestamp;
    SELECT OBTN."ItemCode", OBTN."DistNumber", OBTW."WhsCode", OBTN."ExpDate" INTO item, batch, whs, expDate FROM IGE1
    INNER JOIN OBTW ON OBTW."WhsCode" = IGE1."WhsCode" AND IGE1."ItemCode" = OBTW."ItemCode" AND IGE1."DocEntry" = CAST(:list_of_cols_val_tab_del AS integer)
    INNER JOIN OBTN ON OBTW."ItemCode" = OBTN."ItemCode" AND OBTW."WhsCode"=OBTN."DistNumber";
    IF (LTRIM(RTRIM(:item)) <> '' AND LTRIM(RTRIM(:batch)) <> '' AND :expDate < CURRENT_DATE) THEN
    SELECT -1 INTO error FROM DUMMY;
    SELECT 'Error' || :batch || ' for item ' || :item || ' in Whs ' || :whs || ' has expired.choose a diffnt batch' INTO error_message FROM DUMMY;
    END IF;
    END IF;

    Add comment
    10|10000 characters needed characters exceeded