src-db/database/model/functions/M_INOUT_POST.xml
changeset 29655 e67484476dfd
parent 29654 e6e019dabbbb
child 29706 a8a6d8bd52e5
--- a/src-db/database/model/functions/M_INOUT_POST.xml	Wed Jun 15 16:55:44 2016 +0200
+++ b/src-db/database/model/functions/M_INOUT_POST.xml	Thu Jun 16 11:17:08 2016 +0200
@@ -95,6 +95,8 @@
     v_QtyAux NUMBER;
     v_Count NUMBER:=0;
     v_Line VARCHAR2(10) ;
+    v_OrderDocumentNo C_ORDER.DocumentNo%TYPE;
+    v_OrderLineNo C_ORDERLINE.Line%TYPE;
     v_OrderID_old VARCHAR2(32);
     Cur_MILines RECORD;
     FINISH_PROCESS BOOLEAN:=false;
@@ -126,9 +128,6 @@
     v_RS_Quantity NUMBER;
     v_RS_Releasedqty NUMBER;
 
-    v_orderlineno VARCHAR2(40) ;
-    v_orderDocumentNo VARCHAR2(40) ;
-
   BEGIN
   
     IF(p_PInstance_ID IS NOT NULL) THEN
@@ -356,19 +355,26 @@
         IF (v_Count=0) THEN
           RAISE_APPLICATION_ERROR(-20000, '@NotCorrectOrgDoctypeShipment@') ;
         END IF;
-        SELECT COUNT(*), MAX(M.line),MAX(O.documentno),Max(OL.line)
-        INTO v_Count, v_line,v_orderDocumentNo, v_orderlineno
+        SELECT COUNT(*), MAX(M.line), MAX(O.documentno), Max(OL.line)
+        INTO v_Count, v_line, v_OrderDocumentNo, v_OrderLineNo
         FROM M_InOutLine M
-        left join C_orderLine OL on OL.c_orderline_id=M.c_orderline_id
-        left join C_Order O on OL.C_Order_id=O.C_Order_id
-        join m_product P on P.m_product_id = M.m_product_id
+        JOIN M_Product P
+        ON M.m_product_id = P.m_product_id
+        LEFT JOIN C_OrderLine OL
+        ON M.c_orderline_id = OL.c_orderline_id
+        LEFT JOIN C_Order O
+        ON OL.c_order_id = O.c_order_id
         WHERE P.M_ATTRIBUTESET_ID IS NOT NULL
           AND (P.ATTRSETVALUETYPE IS NULL OR P.ATTRSETVALUETYPE <> 'F')
           AND (SELECT ISONEATTRSETVALREQUIRED FROM M_ATTRIBUTESET WHERE M_ATTRIBUTESET_ID = P.M_ATTRIBUTESET_ID) = 'Y'
           AND COALESCE(M.M_ATTRIBUTESETINSTANCE_ID, '0') = '0'
           AND M.M_INOUT_ID=v_Record_ID;
-        IF v_Count<>0 THEN
-          RAISE_APPLICATION_ERROR(-20000, '@Inline@'||' '||v_line||' '||'@productWithoutAttributeSet@'||': '||'@INS_POREFERENCE@'||' '||v_orderDocumentNo ||' '||'@OrderLine@' ||' ' || v_orderlineno);
+        IF (v_Count <> 0) THEN
+          IF (v_orderDocumentNo IS NULL) THEN
+            RAISE_APPLICATION_ERROR(-20000, '@Inline@'||' '||v_line||' '||'@productWithoutAttributeSet@');
+          ELSE
+            RAISE_APPLICATION_ERROR(-20000, '@Inline@'||' '||v_line||' '||'@productWithoutAttributeSet@'||'. '||'@INS_POREFERENCE@'||' '||v_OrderDocumentNo||' '||'@line@'||' '||v_OrderLineNo);
+          END IF;
         END IF;
         SELECT COUNT(*), MAX(M.line)
         INTO v_Count, v_Line