Friday, 7 August 2015

ware house locator change

ware house locator change 

declare
X_RETURN_STATUS     varchar2(1000);
X_MSG_COUNT         number;
X_MSG_DATA          VARCHAR2(1000);
CURSOR a1 IS
SELECT MSI.SEGMENT1
  ||'.'
  ||MSI.SEGMENT2 STYLE,
  MSI.INVENTORY_ITEM_ID,
  MIL.SEGMENT1
  ||'.'
  ||MIL.SEGMENT2
  ||'.'
  ||MIL.SEGMENT3
  ||'.'
  ||MIL.SEGMENT4
  ||'.'
  ||MIL.SEGMENT5 LOC,
  SUBSTR(MOH.SUBINVENTORY_CODE, 1,20) SUBINVENTORY_CODE,
  MOH.LOCATOR_ID,
  msi.primary_uom_code,
  SUM(MOH.PRIMARY_TRANSACTION_QUANTITY) PRIMARY_TRANSACTION_QUANTITY,
  SUM(MOH.TRANSACTION_QUANTITY) TRANSACTION_QUANTITY
FROM MTL_ONHAND_QUANTITIES_DETAIL MOH,
  MTL_SYSTEM_ITEMS MSI,
  MTL_ITEM_LOCATIONS MIL
WHERE MOH.SUBINVENTORY_CODE  ='WAREHOUSE' and MIL.SEGMENT1='WAREHOUSE'
AND MSI.INVENTORY_ITEM_ID    =MOH.INVENTORY_ITEM_ID
AND msi.segmENT1='abc' and msi.SEGMENT2='xx'
AND MOH.ORGANIZATION_ID      =MSI.ORGANIZATION_ID
AND MSI.ORGANIZATION_ID      =40
AND MIL.INVENTORY_LOCATION_ID=MOH.LOCATOR_ID
AND MIL.SUBINVENTORY_CODE    =MOH.SUBINVENTORY_CODE
AND MOH.ORGANIZATION_ID      =MIL.ORGANIZATION_ID
AND MIL.ENABLED_FLAG         ='Y'
GROUP BY MSI.SEGMENT1,
  MSI.SEGMENT2,
  MSI.INVENTORY_ITEM_ID,
  MIL.SEGMENT1
  ||'.'
  ||MIL.SEGMENT2
  ||'.'
  ||MIL.SEGMENT3
  ||'.'
  ||MIL.SEGMENT4
  ||'.'
  ||MIL.SEGMENT5,
  MOH.SUBINVENTORY_CODE,
  MOH.LOCATOR_ID,
  msi.primary_uom_code
ORDER BY 1,2;

BEGIN
  FOR S IN a1 LOOP
    BEGIN
      SUBINVENTORY_TRANSFER(S.INVENTORY_ITEM_ID, 4, S.SUBINVENTORY_CODE, S.LOC, NULL,'PC', S.PRIMARY_TRANSACTION_QUANTITY,'Subinventory Transfer',
                S.SUBINVENTORY_CODE,'PK.G.2.3.WH', X_RETURN_STATUS, X_MSG_COUNT, X_MSG_DATA,NULL);
    END;
  end LOOP;
end;

--commit;

No comments:

Post a Comment