使用标准API Inv_Item_Grp 更新物料属性,可以修改大部分字段,包括物料编码、物料描述等属性。

不可修改字段:PRIMARY_UNIT_OF_MEASURE, TRACKING_QUANTITY_IND, ONT_PRICING_QTY_SOURCE, SECONDARY_UOM_CODE, SECONDARY_DEFAULT_IND, DUAL_UOM_DEVIATION_HIGH, DUAL_UOM_DEVIATION_LOW 和 ENGINEERING_ITEM_FLAG.


脚本如下:

DECLARE
    l_Item_Rec      Inv_Item_Grp.Item_Rec_Type;
    x_Item_Rec      Inv_Item_Grp.Item_Rec_Type;
    x_Error_Tbl     Inv_Item_Grp.Error_Tbl_Type;
    x_Return_Status VARCHAR2(1);
BEGIN

    Fnd_Global.Apps_Initialize(User_Id      => 0,
                               Resp_Id      => 20634,
                               Resp_Appl_Id => 401);

    --Item
    l_Item_Rec.Inventory_Item_Id := 3374628;
    l_Item_Rec.Organization_Id   := 176;

    --可修改:
    l_Item_Rec.Segment1 := 'CCITSpeed001-1';

    --不可修改字段:PRIMARY_UNIT_OF_MEASURE, TRACKING_QUANTITY_IND, ONT_PRICING_QTY_SOURCE, SECONDARY_UOM_CODE, SECONDARY_DEFAULT_IND, DUAL_UOM_DEVIATION_HIGH, DUAL_UOM_DEVIATION_LOW 和 ENGINEERING_ITEM_FLAG

    --API
    Inv_Item_Grp.Update_Item(p_Commit        => Fnd_Api.g_False,
                             p_Item_Rec      => l_Item_Rec,
                             x_Item_Rec      => x_Item_Rec,
                             x_Return_Status => x_Return_Status,
                             x_Error_Tbl     => x_Error_Tbl);

    Dbms_Output.Put_Line('x_Return_Status:' || x_Return_Status);

    --Result
    IF x_Return_Status <> Fnd_Api.g_Ret_Sts_Success THEN
    
        -- ROLLBACK;
        FOR i IN 1 .. x_Error_Tbl.Count LOOP
            Dbms_Output.Put_Line('Transaction ID   :' || x_Error_Tbl(i)
                                 .Transaction_Id);
            Dbms_Output.Put_Line('Unique ID           :' || x_Error_Tbl(i)
                                 .Unique_Id);
            Dbms_Output.Put_Line('Message Name  :' || x_Error_Tbl(i)
                                 .Message_Name);
            Dbms_Output.Put_Line('Message Text:     :' || x_Error_Tbl(i)
                                 .Message_Text);
            Dbms_Output.Put_Line('Table Name        :' || x_Error_Tbl(i)
                                 .Table_Name);
            Dbms_Output.Put_Line('Column Name   :' || x_Error_Tbl(i)
                                 .Column_Name);
            Dbms_Output.Put_Line('Organization ID :' || x_Error_Tbl(i)
                                 .Organization_Id);
        END LOOP;
    
        IF (x_Return_Status = Fnd_Api.g_Ret_Sts_Unexp_Error) THEN
            RAISE Fnd_Api.g_Exc_Unexpected_Error;
        ELSIF (x_Return_Status = Fnd_Api.g_Ret_Sts_Error) THEN
            RAISE Fnd_Api.g_Exc_Error;
        END IF;
    
    ELSE
        -- COMMIT;
        Dbms_Output.Put_Line('ok:' || x_Item_Rec.Item_Number);
    END IF;

END;


已测试。