【RCV】接收单号丢失处理

DATAFIX: RCVRCVRC: Receiving Transaction Summary Returns ‘APP-PO-14094: No records meet your search criteria’ for a Received Shipment When Receipt Number is NULL (文档 ID 975312.1)

APPLIES TO:
Oracle Inventory Management - Version 11.5.10 and later
Information in this document applies to any platform.
Form:RCVRCVRC.FMB - View Receiving Transactions
Ident SQL: ident_null_receipt_rsh.sql
Data-Fix SQL: stamp_receipt_num.sql

SYMPTOMS
Find that no data is returned when entering a Shipment Number in the Receiving Transaction Summary form resulting in the following error message being displayed:

APP-PO-14094: No records meet your search criteria

STEPS

  1. Navigate to Receiving
  2. View Receiving Transactions
  3. Enter in Shipment Number and click the Find button
  4. No data is returned for the received Shipment number

CAUSE
One of the conditions is that RCV_SHIPMENT_HEADERS.RECEIPT_NUM cannot be NULL If RECEIPT_NUM is NULL then the View will not return the expected rows and so APP-PO-14094 is returned to the user.

The Receiving Transactions Summary form (RCVRCVRC) uses the View RCV_VRC_HDS_V
This View is defined in the file poxrcv.odf
This view has the following conditions:

SELECT RSH.ROWID, RSH.CREATION_DATE, RSH.CREATED_BY, RSH.LAST_UPDATE_LOGIN,
RSH.LAST_UPDATE_DATE, RSH.LAST_UPDATED_BY, RSH.RECEIPT_NUM, RSH.CREATION_D
ATE RECEIPT_DATE
:
FROM RCV_SHIPMENT_HEADERS RSH,
HZ_CUST_ACCOUNTS HZCA,
HZ_PARTIES HZP,
PO_VENDORS POV,
PO_VENDOR_SITES_ALL POVS,
HR_ALL_ORGANIZATION_UNITS_TL ORG,
HR_LOCATIONS_ALL_TL HRL,
PO_LOOKUP_CODES PLC

WHERE RSH.RECEIPT_NUM IS NOT NULL
AND POV.VENDOR_ID (+) = RSH.VENDOR_ID
AND POVS.VENDOR_SITE_ID (+) = RSH.VENDOR_SITE_ID
AND USERENV('LANG') = ORG.LANGUAGE(+)
AND HZCA.CUST_ACCOUNT_ID(+) = RSH.CUSTOMER_ID
AND HZCA.PARTY_ID = HZP.PARTY_ID(+)
AND HRL.LOCATION_ID (+) = RSH.SHIP_TO_LOCATION_ID
AND HRL.LANGUAGE(+) = USERENV('LANG')
AND ORG.ORGANIZATION_ID (+) = RSH.ORGANIZATION_ID
AND RSH.RECEIPT_SOURCE_CODE = PLC.LOOKUP_CODE
AND PLC.LOOKUP_TYPE = 'SHIPMENT SOURCE TYPE' AND NOT EXISTS(SELECT 1
FROM rcv_shipment_lines rsl,
po_lines_all pol
WHERE rsl.shipment_header_id = rsh.shipment_header_id
AND rsl.po_line_id = pol.po_line_id
AND pol.order_type_lookup_code = 'RATE' AND pol.purchase_basis = 'TEMP LABOR')

The following SQL, ident_null_receipt_rsh.sql, may be used to identify Receipt Headers which do not have a Receipt Number assigned for AUTOMATIC receipt numbering:

SELECT *
FROM rcv_shipment_headers rsh
WHERE receipt_num IS NULL
AND EXISTS (SELECT 1
            FROM rcv_transactions rt
            WHERE rt.shipment_header_id = rsh.shipment_header_id)
AND EXISTS (SELECT 1
            FROM rcv_parameters rp
            WHERE rp.organization_id = rsh.ship_to_org_id
            AND user_defined_receipt_num_code = 'AUTOMATIC');

The following script may be used when MANUAL receipt numbering is used:

SELECT *
FROM   rcv_shipment_headers rsh
WHERE  receipt_num IS NULL
AND    EXISTS (SELECT 1
              FROM   rcv_transactions rt
              WHERE  rt.shipment_header_id = rsh.shipment_header_id)
AND    EXISTS (SELECT 1
              FROM   rcv_parameters rp
              WHERE  rp.organization_id = rsh.ship_to_org_id
              AND    user_defined_receipt_num_code = 'MANUAL');

SOLUTION

  1. If the SQL for AUTOMATIC receipt numbering returns rows, then download the generic script stamp_receipt_num.sql
    This script will update RCV_SHIPMENT_HEADERS.RECEIPT_NUM with the next available receipt number.

  2. If the SQL for MANUAL receipt numbering returns rows, then use the following to insert a unique receipt number of your choice:

UPDATE rcv_shipment_headers
SET    receipt_num = &receipt_number
WHERE  shipment_header_id = &shipment_header_id;

脚本stamp_receipt_num.sql代码:

CREATE TABLE rsh_missing_rpt_temp AS
 SELECT *
 FROM   rcv_shipment_headers rsh
 WHERE  receipt_num IS NULL
 AND    EXISTS (SELECT 1 
                FROM   rcv_transactions rt
                WHERE  rt.shipment_header_id = rsh.shipment_header_id)
 AND    EXISTS (SELECT 1
                FROM   rcv_parameters rp
                WHERE  rp.organization_id = rsh.ship_to_org_id 
                AND    user_defined_receipt_num_code = 'AUTOMATIC');

SET SERVEROUTPUT ON;

DECLARE
 
 CURSOR cur_null_receipt_num IS
 SELECT shipment_header_id, ship_to_org_id
 FROM   rcv_shipment_headers rsh
 WHERE  receipt_num IS NULL
 AND    EXISTS (SELECT 1 
                FROM   rcv_transactions rt
                WHERE  rt.shipment_header_id = rsh.shipment_header_id)
 AND    EXISTS (SELECT 1
                FROM   rcv_parameters rp
                WHERE  rp.organization_id = rsh.ship_to_org_id 
                AND    rp.user_defined_receipt_num_code = 'AUTOMATIC');

x_unique       NUMBER;
x_receipt_num  NUMBER;
x_count        NUMBER;
x_progress     NUMBER := 10;

BEGIN  
    FOR c_rec IN cur_null_receipt_num LOOP
        --
	x_progress := 20;
        SELECT next_receipt_num + 1
        INTO   x_receipt_num
        FROM   rcv_parameters
        WHERE  organization_id = c_rec.ship_to_org_id;

	x_progress := 30;
	x_unique := 0;
        --
        LOOP 
           x_progress := 40;
	   EXIT WHEN x_unique = 1;
    
           x_progress := 50;
           SELECT COUNT(1)
           INTO   x_count
           FROM   rcv_shipment_headers
           WHERE  receipt_num = to_char(x_receipt_num)
           AND    ship_to_org_id = c_rec.ship_to_org_id;

           x_progress := 60;
           IF (x_count = 0) THEN
               x_unique := 1;
           ELSE
               x_receipt_num := x_receipt_num + 1;
           END IF;	   
        END LOOP;
        --
        x_progress := 70;
        UPDATE rcv_shipment_headers
        SET    receipt_num = x_receipt_num
        WHERE  shipment_header_id = c_rec.shipment_header_id;

        x_progress := 80;
        UPDATE rcv_parameters
        SET    next_receipt_num = x_receipt_num
        WHERE  organization_id = c_rec.ship_to_org_id;
        --        
        x_progress := 90;
        dbms_output.put_line (' Updated shipment header: '|| c_rec.shipment_header_id || ' with receipt# ' || x_receipt_num);
        --
    END LOOP;
    --
    x_progress := 100;
    dbms_output.put_line ('Pls verify the data. COMMIT to save changes or ROLLBACK to revert the changes.');
    --
EXCEPTION
  WHEN OTHERS THEN
       dbms_output.put_line  ('Exception raised :  '|| sqlerrm);
       dbms_output.put_line  ('x_progress       :  '|| x_progress);
       rollback;
END;
/

おすすめ

転載: blog.csdn.net/qingshimoon4/article/details/112987347