Skip to Content
avatar image
Former Member

SP for Block Close of Production Order

Hi Experts I have SAP Business one 9.2 Hana

I write the following SP to block Production order to close if Issue for production and Receipt from Production is not done.

IF ( :transaction_type = 'U') AND (:object_type= '202') THEN /*Block Prod O if Receipt and Issue not Done Error = 3006*/ SELECT count(*) INTO cnt FROM OWOR T0 Inner Join WOR1 T1 on T1."DocEntry" = T0."DocEntry" Inner Join IGN1 T2 on T0."DocNum" = T2."BaseRef" Inner Join OIGN T3 on T2."DocEntry" = T3."DocEntry" Inner Join IGE1 T4 on T4."BaseRef" = T0."DocNum" WHERE T0."DocEntry" = :list_of_cols_val_tab_del AND T4."Quantity" = 0 AND T2."Quantity" = 0 and T0."Status" = 'L'; IF :cnt>0 THEN error := 3006; error_message := 'Cannot Close Untill Issue and Receipt Not Done'; END IF; END IF;

but its not working kindly guide me where am i missing in this SP


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Feb 08, 2017 at 07:17 AM


    Use below logic to block closing production order in HANA,

    IF (@object_type = '202' AND @transaction_type= 'U')


    if exists (

    SELECT T0.[DocNum]

    FROM OWOR T0 INNER JOIN WOR1 T1 ON T0.[DocEntry] = T1.[DocEntry] WHERE T0.[CmpltQty] =0 and T1.[PlannedQty] > T1.[IssuedQty] and T0.[Status] = 'L' and T0.DocEntry = @list_of_cols_val_tab_del)


    set @error =1

    set @error_message = 'Production Order can not be Closed,until issue and receipt done'



    Add comment
    10|10000 characters needed characters exceeded