Tuesday 27 February 2018

Oracle Quality Manager Specifications API

DECLARE

    l_gmd_spec_tbl      gmd_specifications%rowtype;
    l_spec_tests_tbl    GMD_SPEC_PUB.spec_tests_tbl;
    x_gmd_spec_tbl      gmd_specifications%rowtype;
    x_spec_tests_tbl    GMD_SPEC_PUB.spec_tests_tbl;
    l_return_status     CHAR(1);
    l_msg_count         NUMBER;
    l_msg_data          VARCHAR2(2000);
    
BEGIN

    fnd_profile.initialize (2820);
    fnd_global.apps_initialize(user_id =>2820,resp_id =>22883 ,resp_appl_id =>552 );
    fnd_msg_pub.initialize;
    gme_common_pvt.g_error_count := 0;
    gme_common_pvt.set_timestamp;
    gme_common_pvt.g_move_to_temp := fnd_api.g_false; 

--    l_gmd_spec_tbl.row_id,
--    l_gmd_spec_tbl.spec_id,
    l_gmd_spec_tbl.spec_name                := 'ZZ';
    l_gmd_spec_tbl.spec_vers                := 1;
    l_gmd_spec_tbl.spec_desc                := 'ZZ';
    l_gmd_spec_tbl.inventory_item_id        := 36467;
    l_gmd_spec_tbl.revision                 :=  NULL;
    l_gmd_spec_tbl.grade_code               :=  NULL;
    l_gmd_spec_tbl.spec_status              := 1000;
    l_gmd_spec_tbl.owner_organization_id    := 453;
    l_gmd_spec_tbl.owner_id                 := 2820;
    l_gmd_spec_tbl.sample_inv_trans_ind     := NULL;
    l_gmd_spec_tbl.delete_mark              := 0;
    l_gmd_spec_tbl.text_code                := NULL;
    l_gmd_spec_tbl.attribute_category       := NULL;
    l_gmd_spec_tbl.attribute1               := NULL;
    l_gmd_spec_tbl.attribute2               := NULL;
    l_gmd_spec_tbl.attribute3               := NULL;
    l_gmd_spec_tbl.attribute4               := NULL;
    l_gmd_spec_tbl.attribute5               := NULL;
    l_gmd_spec_tbl.attribute6               := NULL;
    l_gmd_spec_tbl.attribute7               := NULL;
    l_gmd_spec_tbl.attribute8               := NULL;
    l_gmd_spec_tbl.attribute9               := NULL;
    l_gmd_spec_tbl.attribute10              := NULL;
    l_gmd_spec_tbl.attribute11              := NULL;
    l_gmd_spec_tbl.attribute12              := NULL;
    l_gmd_spec_tbl.attribute13              := NULL;
    l_gmd_spec_tbl.attribute14              := NULL;
    l_gmd_spec_tbl.attribute15              := NULL;
    l_gmd_spec_tbl.attribute16              := NULL;
    l_gmd_spec_tbl.attribute17              := NULL;
    l_gmd_spec_tbl.attribute18              := NULL;
    l_gmd_spec_tbl.attribute19              := NULL;
    l_gmd_spec_tbl.attribute20              := NULL;
    l_gmd_spec_tbl.attribute21              := NULL;
    l_gmd_spec_tbl.attribute22              := NULL;
    l_gmd_spec_tbl.attribute23              := NULL;
    l_gmd_spec_tbl.attribute24              := NULL;
    l_gmd_spec_tbl.attribute25              := NULL;
    l_gmd_spec_tbl.attribute26              := NULL;
    l_gmd_spec_tbl.attribute27              := NULL;
    l_gmd_spec_tbl.attribute28              := NULL;
    l_gmd_spec_tbl.attribute29              := NULL;
    l_gmd_spec_tbl.attribute30              := NULL;
    l_gmd_spec_tbl.creation_date            := SYSDATE;
    l_gmd_spec_tbl.created_by               := 2820;
    l_gmd_spec_tbl.last_updated_by          := 2820;
    l_gmd_spec_tbl.last_update_date         := SYSDATE;
    l_gmd_spec_tbl.last_update_login        := 2820;
    l_gmd_spec_tbl.spec_type                := 'I';
    l_gmd_spec_tbl.overlay_ind              := NULL;
    l_gmd_spec_tbl.base_spec_id             := NULL;


-- Tests
--    l_spec_tests_tbl(1).row_id;
--    l_spec_tests_tbl(1).spec_id,
    l_spec_tests_tbl(1).test_id                         := 9020;
    l_spec_tests_tbl(1).test_method_id                  := 0;  
    l_spec_tests_tbl(1).seq                             := 10;
    l_spec_tests_tbl(1).test_qty                        := NULL;   
    l_spec_tests_tbl(1).test_qty_uom                    := NULL;
    l_spec_tests_tbl(1).min_value_num                   := 10;
    l_spec_tests_tbl(1).target_value_num                := NULL;
    l_spec_tests_tbl(1).max_value_num                   := 1000;
    l_spec_tests_tbl(1).min_value_char                  := NULL;
    l_spec_tests_tbl(1).target_value_char               := NULL;
    l_spec_tests_tbl(1).max_value_char                  := NULL;
    l_spec_tests_tbl(1).test_replicate                  := 1;
    l_spec_tests_tbl(1).check_result_interval           := NULL;
    l_spec_tests_tbl(1). print_on_coa_ind               := NULL;
    l_spec_tests_tbl(1).use_to_control_step             := NULL;
    l_spec_tests_tbl(1).out_of_spec_action              := NULL;
    l_spec_tests_tbl(1).exp_error_type                  := NULL;
    l_spec_tests_tbl(1).below_spec_min                  := NULL;
    l_spec_tests_tbl(1).above_spec_min                  := NULL;
    l_spec_tests_tbl(1).below_spec_max                  := NULL;
    l_spec_tests_tbl(1).above_spec_max                  := NULL;
    l_spec_tests_tbl(1).below_min_action_code           := NULL;
    l_spec_tests_tbl(1).above_min_action_code           := NULL;
    l_spec_tests_tbl(1).optional_ind                    := NULL;
    l_spec_tests_tbl(1).display_precision               := 0;
    l_spec_tests_tbl(1).report_precision                := 0;
    l_spec_tests_tbl(1).test_priority                   := '5N';
    l_spec_tests_tbl(1).retest_lot_expiry_ind           := NULL;
    l_spec_tests_tbl(1).print_spec_ind                  := NULL;
    l_spec_tests_tbl(1).print_result_ind                := NULL;
    l_spec_tests_tbl(1).below_max_action_code           := NULL;
    l_spec_tests_tbl(1).above_max_action_code           := NULL;
    l_spec_tests_tbl(1).test_display                    := NULL;
    l_spec_tests_tbl(1).text_code                       := NULL;
    l_spec_tests_tbl(1).viability_duration              := 0;
    l_spec_tests_tbl(1).days                            := NULL;
    l_spec_tests_tbl(1).hours                           := NULL;
    l_spec_tests_tbl(1).minutes                         := NULL;
    l_spec_tests_tbl(1).seconds                         := NULL;
    l_spec_tests_tbl(1).attribute_category              := NULL;
    l_spec_tests_tbl(1).attribute1                      := NULL;
    l_spec_tests_tbl(1).attribute2                      := NULL;
    l_spec_tests_tbl(1). attribute3                     := NULL;
    l_spec_tests_tbl(1).attribute4                      := NULL;
    l_spec_tests_tbl(1).attribute5                      := NULL;
    l_spec_tests_tbl(1).attribute6                      := NULL;
    l_spec_tests_tbl(1).attribute7                      := NULL;
    l_spec_tests_tbl(1).attribute8                      := NULL;
    l_spec_tests_tbl(1).attribute9                      := NULL;
    l_spec_tests_tbl(1).attribute10                     := NULL;
    l_spec_tests_tbl(1).attribute11                     := NULL;
    l_spec_tests_tbl(1).attribute12                     := NULL;
    l_spec_tests_tbl(1).attribute13                     := NULL;
    l_spec_tests_tbl(1).attribute14                     := NULL;
    l_spec_tests_tbl(1).attribute15                     := NULL;
    l_spec_tests_tbl(1).attribute16                     := NULL;
    l_spec_tests_tbl(1).attribute17                     := NULL;
    l_spec_tests_tbl(1).attribute18                     := NULL;
    l_spec_tests_tbl(1).attribute19                     := NULL;
    l_spec_tests_tbl(1).attribute20                     := NULL;
    l_spec_tests_tbl(1).attribute21                     := NULL;
    l_spec_tests_tbl(1).attribute22                     := NULL;
    l_spec_tests_tbl(1).attribute23                     := NULL;
    l_spec_tests_tbl(1).attribute24                     := NULL;
    l_spec_tests_tbl(1).attribute25                     := NULL;
    l_spec_tests_tbl(1).attribute26                     := NULL;
    l_spec_tests_tbl(1).attribute27                     := NULL;
    l_spec_tests_tbl(1).attribute28                     := NULL;
    l_spec_tests_tbl(1).attribute29                     := NULL;
    l_spec_tests_tbl(1).attribute30                     := NULL;
    l_spec_tests_tbl(1).creation_date                   := SYSDATE;
    l_spec_tests_tbl(1).created_by                      := 2820;
    l_spec_tests_tbl(1).last_updated_by                 := 2820;
    l_spec_tests_tbl(1).last_update_date                := SYSDATE;
    l_spec_tests_tbl(1).last_update_login               := 2820;
    l_spec_tests_tbl(1).from_base_ind                   := NULL;
    l_spec_tests_tbl(1).exclude_ind                     := NULL;
    l_spec_tests_tbl(1).modified_ind                    := NULL;
    l_spec_tests_tbl(1).calc_uom_conv_ind               := NULL;    
    l_spec_tests_tbl(1).to_qty_uom                      := NULL;   

    apps.GMD_SPEC_PUB.CREATE_SPEC
                                    ( p_api_version          => 2.0
                                    , p_init_msg_list        => apps.FND_API.G_FALSE
                                    , p_commit               => apps.FND_API.G_FALSE
                                    , p_validation_level     => apps.fnd_api.g_valid_level_full 
                                    , p_spec                 => l_gmd_spec_tbl  
                                    , p_spec_tests_tbl       => l_spec_tests_tbl 
                                    , p_user_name            => 'DATA.AFF'
                                    , x_spec                 => x_gmd_spec_tbl
                                    , x_spec_tests_tbl       => x_spec_tests_tbl
                                    , x_return_status        => l_return_status
                                    , x_msg_count            => l_msg_count
                                    , x_msg_data             => l_msg_data
                                    );
                                    
        COMMIT;
        
        dbms_output.put_line(l_return_status||':'||l_msg_data);                                    
END;                                  


Oracle Quality Manager Specifications Table:
gmd_specifications, gmd_spec_tests 

  

Thursday 8 February 2018

Oracle Process Manufacturing OPM APIs

Oracle Process Manufacturing (OPM) Process Operations API
----------------------------------------------------------------------------------------
DECLARE
    
    lx_operation                gmd_operations%ROWTYPE;
    lx_activities               gmd_operations_pub.gmd_oprn_activities_tbl_type;
    lx_resources                gmd_operation_resources_pub.gmd_oprn_resources_tbl_type;
    lx_message_count            varchar2(1000);
    lx_message_list             varchar2(10000);
    lx_return_status            varchar2(1000);
    
    vOprnId                     gmd_operations.oprn_id%TYPE;
    vOprnLineId                 GMD_OPERATION_ACTIVITIES.OPRN_LINE_ID%TYPE;
    l_dummy_cnt     NUMBER  := 0;
    l_data          VARCHAR2(2000);

    j   NUMBER := 1;
BEGIN

    fnd_profile.initialize (1110);
    fnd_global.apps_initialize(user_id=>1110,resp_id =>22882 ,resp_appl_id =>552 );
    fnd_msg_pub.initialize;
    gme_common_pvt.g_error_count := 0;
    gme_common_pvt.set_timestamp;
    gme_common_pvt.g_move_to_temp := fnd_api.g_false;

    SELECT GEM5_OPRN_ID_S.NEXTVAL
    INTO vOprnId
    FROM dual;
    
    SELECT GEM5_OPRNLINE_ID_S.NEXTVAL
    INTO vOprnLineId
    FROM DUAL;


    --lx_operation.row_id                 :=
    lx_operation.oprn_id                :=  vOprnId;
    lx_operation.oprn_no                :=  'ZZZZ';
    lx_operation.oprn_vers              :=  1;
    lx_operation.process_qty_um         :=  NULL;
    lx_operation.process_qty_uom        :=  'KGS';
    lx_operation.minimum_transfer_qty   :=  NULL;
    lx_operation.oprn_class            :=  NULL;
    lx_operation.poc_ctl_class          :=  NULL;
    lx_operation.in_use                 :=  NULL;
    lx_operation.inactive_ind           :=  0;
    lx_operation.delete_mark            :=  NULL;
    lx_operation.text_code              :=  NULL;
    lx_operation.creation_date          :=  SYSDATE;
    lx_operation.created_by             :=  1110;
    lx_operation.last_updated_by        :=  1110;
    lx_operation.last_update_date       :=  SYSDATE;
    lx_operation.last_update_login      :=  -1;
    lx_operation.attribute1             :=  NULL;
    lx_operation.attribute2             :=  NULL;
    lx_operation.attribute3             :=  NULL;
    lx_operation.attribute4             :=  NULL;
    lx_operation.attribute5             :=  NULL;
    lx_operation.attribute6             :=  NULL;
    lx_operation.attribute7             :=  NULL;
    lx_operation.attribute8             :=  NULL;
    lx_operation.attribute9             :=  NULL;
    lx_operation.attribute10            :=  NULL;
    lx_operation.attribute11            :=  NULL;
    lx_operation.attribute12            :=  NULL;
    lx_operation.attribute13            :=  NULL;
    lx_operation.attribute14            :=  NULL;
    lx_operation.attribute15            :=  NULL;
    lx_operation.attribute16            :=  NULL;
    lx_operation.attribute17            :=  NULL;
    lx_operation.attribute18            :=  NULL;
    lx_operation.attribute19            :=  NULL;
    lx_operation.attribute20            :=  NULL;
    lx_operation.attribute21            :=  NULL;
    lx_operation.attribute22            :=  NULL;
    lx_operation.attribute23            :=  NULL;    
    lx_operation.attribute24            :=  NULL;
    lx_operation.attribute25            :=  NULL;
    lx_operation.attribute26            :=  NULL;    
    lx_operation.attribute27            :=  NULL;
    lx_operation.attribute28            :=  NULL;
    lx_operation.attribute29            :=  NULL;
    lx_operation.attribute30            :=  NULL;
    lx_operation.attribute_category     :=  NULL;
    lx_operation.effective_start_date   :=  SYSDATE;
    lx_operation.effective_end_date     :=  NULL;
    lx_operation.operation_status       :=  700;
    lx_operation.owner_organization_id  :=  103;    
    lx_operation.oprn_desc              :=  'ZZZZ';
    lx_operation.oprn_yield             :=  NULL;

    ------------------------------------------------------------
    --Activites
    ------------------------------------------------------------
    lx_activities(1).oprn_line_id       := vOprnLineId;
    lx_activities(1).oprn_id            := vOprnId;   
    lx_activities(1).activity           := 'HEATING MELTING';
    lx_activities(1).offset_interval    := 0;
    lx_activities(1).activity_factor    := 1;
    lx_activities(1).delete_mark        := 0;
    lx_activities(1).text_code          := NULL;
    lx_activities(1).creation_date      := SYSDATE;
    lx_activities(1).created_by         := 1110;
    lx_activities(1).last_updated_by    := 1110;    
    lx_activities(1).last_update_date   := SYSDATE;
    lx_activities(1).last_update_login  := -1;
    lx_activities(1).attribute1         := NULL;
    lx_activities(1).attribute2         := NULL;    
    lx_activities(1).attribute3         := NULL;
    lx_activities(1).attribute4         := NULL;
    lx_activities(1).attribute5         := NULL;
    lx_activities(1).attribute6         := NULL;
    lx_activities(1).attribute7         := NULL;
    lx_activities(1).attribute8         := NULL;
    lx_activities(1).attribute9         := NULL;
    lx_activities(1).attribute10        := NULL;    
    lx_activities(1).attribute11        := NULL;
    lx_activities(1).attribute12        := NULL;
    lx_activities(1).attribute13        := NULL;
    lx_activities(1).attribute14        := NULL;
    lx_activities(1).attribute15        := NULL;
    lx_activities(1).attribute16        := NULL;
    lx_activities(1).attribute17        := NULL;
    lx_activities(1).attribute18        := NULL;
    lx_activities(1).attribute19        := NULL;
    lx_activities(1).attribute20        := NULL;
    lx_activities(1).attribute21        := NULL;
    lx_activities(1).attribute22        := NULL;
    lx_activities(1).attribute23        := NULL;
    lx_activities(1).attribute24        := NULL;
    lx_activities(1).attribute25        := NULL;
    lx_activities(1).attribute26        := NULL;
    lx_activities(1).attribute27        := NULL;
    lx_activities(1).attribute28        := NULL;
    lx_activities(1).attribute29        := NULL;
    lx_activities(1).attribute30        := NULL;
    lx_activities(1).attribute_category := NULL;    
    lx_activities(1).sequence_dependent_ind := 0; -- Valid values 0 (not sequence dependent) or 1 (sequence dependent).
    lx_activities(1).break_ind          := 0;
    lx_activities(1).max_break          := NULL;
    lx_activities(1).material_ind       := NULL;

    ------------------------------------------------------------
    --Activity Resources
    ------------------------------------------------------------
    lx_resources(j).OPRN_LINE_ID   := vOprnLineId;              
    lx_resources(j).RESOURCES      :=  'ACL # 2';       
    lx_resources(j).RESOURCE_USAGE :=  1;
    lx_resources(j).RESOURCE_COUNT :=  1;
    lx_resources(j).RESOURCE_USAGE_UOM     := NULL; 
    lx_resources(j).PROCESS_QTY            := 1;
    lx_resources(j).RESOURCE_PROCESS_UOM   := NULL;
    lx_resources(j).PRIM_RSRC_IND          := 1;
    lx_resources(j).SCALE_TYPE             := 1;
    lx_resources(j).COST_ANALYSIS_CODE     :=  10;              
    lx_resources(j).COST_CMPNTCLS_ID       :=  73;
    lx_resources(j).OFFSET_INTERVAL        := 0;     
    lx_resources(j).MIN_CAPACITY           := NULL;
    lx_resources(j).MAX_CAPACITY           :=  NULL;
    lx_resources(j).RESOURCE_CAPACITY_UOM  :=  NULL;
    lx_resources(j).ATTRIBUTE_CATEGORY     :=  NULL;
    lx_resources(j).ATTRIBUTE1             :=  NULL;
    lx_resources(j).ATTRIBUTE2             :=  NULL;    
    lx_resources(j).ATTRIBUTE3             :=  NULL;
    lx_resources(j).ATTRIBUTE4             :=  NULL;
    lx_resources(j).ATTRIBUTE5             :=  NULL;    
    lx_resources(j).ATTRIBUTE6             :=  NULL;
    lx_resources(j).ATTRIBUTE7             :=  NULL;
    lx_resources(j).ATTRIBUTE8             :=  NULL;
    lx_resources(j).ATTRIBUTE9             :=  NULL;
    lx_resources(j).ATTRIBUTE10            :=  NULL;
    lx_resources(j).ATTRIBUTE11            :=  NULL;
    lx_resources(j).ATTRIBUTE12            :=  NULL;
    lx_resources(j).ATTRIBUTE13            :=  NULL;
    lx_resources(j).ATTRIBUTE14            :=  NULL;
    lx_resources(j).ATTRIBUTE15            :=  NULL;
    lx_resources(j).ATTRIBUTE16            :=  NULL;
    lx_resources(j).ATTRIBUTE17            :=  NULL;
    lx_resources(j).ATTRIBUTE18            :=  NULL;
    lx_resources(j).ATTRIBUTE19            :=  NULL;
    lx_resources(j).ATTRIBUTE20            :=  NULL;
    lx_resources(j).ATTRIBUTE21            :=  NULL;
    lx_resources(j).ATTRIBUTE22            :=  NULL;
    lx_resources(j).ATTRIBUTE23            :=  NULL;
    lx_resources(j).ATTRIBUTE24            :=  NULL;
    lx_resources(j).ATTRIBUTE25            :=  NULL;
    lx_resources(j).ATTRIBUTE26            :=  NULL;
    lx_resources(j).ATTRIBUTE27            :=  NULL;
    lx_resources(j).ATTRIBUTE28            :=  NULL;
    lx_resources(j).ATTRIBUTE29            :=  NULL;
    lx_resources(j).ATTRIBUTE30            :=  NULL;
    lx_resources(j).PROCESS_PARAMETER_1    :=  NULL;
    lx_resources(j).PROCESS_PARAMETER_2    :=  NULL;
    lx_resources(j).PROCESS_PARAMETER_3    :=  NULL;
    lx_resources(j).PROCESS_PARAMETER_4    :=  NULL;
    lx_resources(j).PROCESS_PARAMETER_5    :=  NULL;
    lx_resources(j).ACTIVITY               :=  'HEATING MELTING';

                           
GMD_OPERATIONS_PUB.insert_operation(
     p_api_version                 =>   1   
    , p_init_msg_list              =>   TRUE    
    , p_commit                     =>   FALSE
    , p_operations                 =>   lx_operation              
    , p_oprn_actv_tbl              =>   lx_activities              
    , x_message_count              =>   lx_message_count
    , x_message_list               =>   lx_message_list 
    , x_return_status              =>   lx_return_status
    , p_oprn_rsrc_tbl              =>   lx_resources   --Added w.r.t. bug 3408799
                          
);                  

    dbms_output.put_line(lx_message_count);
    dbms_output.put_line(lx_message_list);
    dbms_output.put_line(lx_return_status);
                            
    FOR l_loop_cnt IN 1 .. lx_message_count LOOP
    
        FND_MSG_PUB.Get(
            p_msg_index => l_loop_cnt,
            p_data => l_data,
            p_encoded => FND_API.G_FALSE,
            p_msg_index_out => l_dummy_cnt);

        DBMS_OUTPUT.PUT_LINE( l_loop_cnt || ':' || l_data );

    END LOOP; -- msg stack loop

    COMMIT;
    
Exception
    WHEN OTHERS THEN
        DBMS_OUTPUT.PUT_LINE('Exception'||SQLERRM);



END;                          



--Queries to check data
select * from GMD_OPERATIONS
where oprn_id = 261
order by oprn_id desc;

select * from GMD_OPERATION_ACTIVITIES
where oprn_line_id = 341
order by oprn_line_id desc;

select * 
from GMD_OPERATION_RESOURCES
where oprn_line_id = 341;

----------------------------------------------------------------------------------------

Define Process Parameters API in Oracle Process Manufacturing OPM
-------------------------------------------------------------------------------------------------------------
DECLARE

    vRowId VARCHAR2(100);
    
    CURSOR c IS
        SELECT DISTINCT process_parameter,description,min_value,max_value,test_unit
        FROM gg_process_parameters
        WHERE NVL(RESULT,'E') = 'E';
    
BEGIN
    
    FOR i IN c LOOP

        APPS.gmp_process_parameters_pkg.INSERT_ROW (
          X_ROWID        => vRowId,
          X_PARAMETER_ID =>  GMP_PROCESS_PARAMETER_S.NEXTVAL,
          X_ATTRIBUTE21 =>  NULL,
          X_ATTRIBUTE22 =>  NULL,
          X_ATTRIBUTE23 =>  NULL,
          X_ATTRIBUTE24 =>  NULL,
          X_ATTRIBUTE25 =>  NULL,
          X_ATTRIBUTE26 =>  NULL,
          X_ATTRIBUTE27 =>  NULL,
          X_ATTRIBUTE28 =>  NULL,
          X_ATTRIBUTE29 =>  NULL,
          X_ATTRIBUTE30 =>  NULL,
          X_ATTRIBUTE_CATEGORY =>  NULL,
          X_ATTRIBUTE1 =>  NULL,
          X_ATTRIBUTE2 =>  NULL,
          X_ATTRIBUTE3 =>  NULL,
          X_ATTRIBUTE4 =>  NULL,
          X_ATTRIBUTE5 =>  NULL,
          X_ATTRIBUTE6 =>  NULL,
          X_ATTRIBUTE7 =>  NULL,
          X_ATTRIBUTE8 =>  NULL,
          X_ATTRIBUTE9 =>  NULL,
          X_ATTRIBUTE10 =>  NULL,
          X_ATTRIBUTE11 =>  NULL,
          X_ATTRIBUTE12 =>  NULL,
          X_ATTRIBUTE13 =>  NULL,
          X_ATTRIBUTE14 =>  NULL,
          
          X_MAXIMUM_VALUE =>  i.max_value,
          X_DELETE_MARK   =>  0,
          X_TEXT_CODE     =>  NULL,
          X_ATTRIBUTE15     =>  NULL,
          X_ATTRIBUTE16     =>  NULL,
          X_ATTRIBUTE17     =>  NULL,
          X_ATTRIBUTE18     =>  NULL,
          X_ATTRIBUTE19     =>  NULL,
          X_ATTRIBUTE20     =>  NULL,
          X_PARAMETER_TYPE  =>  2, --For Numeric 1 For Text
          X_MINIMUM_VALUE   =>  i.min_value,
          X_PARAMETER_NAME  =>   i.process_parameter,
          X_UNITS           => i.TEST_UNIT,
          X_PARAMETER_DESCRIPTION   => i.description,
          X_CREATION_DATE           => SYSDATE,
          X_CREATED_BY              => 1110,
          X_LAST_UPDATE_DATE        => SYSDATE,
          X_LAST_UPDATED_BY         => 1110,
          X_LAST_UPDATE_LOGIN       => 1110);
    
        IF vRowId IS NOT NULL THEN
            UPDATE gg_process_parameters
            SET result = 'S'
            WHERE process_parameter = i.process_parameter;
            
            COMMIT;
        ELSE
            UPDATE gg_process_parameters
            SET result = 'E'
            WHERE process_parameter = i.process_parameter;
            
            COMMIT;
            
        END IF;
    
    
    END LOOP;  
  
  

END;

Check results from gmp_process_parameters table.

Material Transaction API
--------------------------------------------
CREATE OR REPLACE PROCEDURE gg_TRANSACT_MATERIAL_P(errbuf OUT VARCHAR2,retcode OUT VARCHAR2)
IS
--DECLARE
    CURSOR c IS
        select character1 org_code,
               character2 transaction_date,
               character3 batch_no,
               character4 transaction_type,
               character5 sub_inventory, 
               character6 lot_number,
               character7,
               character8,
               character9,
               character10,
               character11 primary_quantity,
               character12 primary_uom,
               character13 secondary_quantity,
               character14 secondary_uom,
               locator_id,
               qa.item_id inventory_item_id,
               qa.occurrence
        from qa_results qa ,ggl.cust_gme_transact_material_log cg
        where qa.occurrence = cg.occurrence(+)
        AND cg.occurrence IS NULL
        AND plan_id = 5115 ;


    p_api_version               NUMBER  DEFAULT 2.0;
    p_validation_level          NUMBER  DEFAULT GME_COMMON_PVT.G_MAX_ERRORS;
    p_init_msg_list             BOOLEAN DEFAULT FALSE;
    P_batch_type                NUMBER DEFAULT 0;
    p_orgn_code                 VARCHAR2(4) ;
    lx_message_count            varchar2(1000);
    lx_message_list             varchar2(10000);
    lx_return_status            varchar2(1000);
    l_mmti_rec                  mtl_transactions_interface%ROWTYPE;
    l_mmli_tbl                  gme_common_pvt.mtl_trans_lots_inter_tbl;
    lx_mmt_rec                  mtl_material_transactions%ROWTYPE;
    lx_mmln_tbl                 gme_common_pvt.mtl_trans_lots_num_tbl;
    g_debug_point               VARCHAR2 (100);
    g_debug                     VARCHAR2 (5)     := fnd_profile.VALUE ('AFLOG_LEVEL');
    l_transaction_interface_id  NUMBER := NULL;
    l_user_id                   NUMBER:= 1110;
    x_return_status             VARCHAR2 (2000);
    vBatchId                    NUMBER;
    vTransactionTypeId          NUMBER;
    vStatus                     VARCHAR2(2000);
    vItemCode                   VARCHAR2(30);
    vLinesProcessed             NUMBER := 0;

BEGIN

    fnd_profile.initialize (l_user_id);
    fnd_global.apps_initialize(user_id =>1110,resp_id =>23326 ,resp_appl_id =>553 );
    x_return_status := fnd_api.g_ret_sts_success;
    fnd_msg_pub.initialize;
    gme_common_pvt.g_error_count := 0;
    gme_common_pvt.set_timestamp;
    gme_common_pvt.g_move_to_temp := fnd_api.g_false;


    SELECT mtl_material_transactions_s.NEXTVAL
    INTO l_transaction_interface_id
    FROM DUAL;
     
    
    FOR i in c LOOP
            
    
            vLinesProcessed := vLinesProcessed + 1;
            SELECT h.batch_id,material_detail_id,a.INVENTORY_ITEM_ID,a.ORGANIZATION_ID
            INTO vBatchId, l_mmti_rec.TRX_SOURCE_LINE_ID,l_mmti_rec.inventory_item_id,l_mmti_rec.organization_id
            FROM gme_batch_header h,gme_material_details a
            WHERE  h.batch_id = a.batch_id
            AND batch_no = i.batch_no--l_batch_hdr.batch_no
            AND line_type IN (1,2)
            AND inventory_item_id = i.inventory_item_id; 
            
            BEGIN
                select transaction_type_id
                INTO vTransactionTypeId 
                from mtl_transaction_types
                where transaction_type_name =i.transaction_type;
            
            Exception
                WHEN NO_DATA_FOUND THEN
                    vStatus := 'Invalid/No Transaction Type';    

            END;
            
            
            l_mmti_rec.transaction_interface_id         := l_transaction_interface_id;
            l_mmti_rec.transaction_header_id            := l_transaction_interface_id;
            l_mmti_rec.transaction_source_id            := l_transaction_interface_id;
            l_mmti_rec.subinventory_code                :=i.sub_inventory;
            l_mmti_rec.locator_id                       :=i.locator_id;
            l_mmti_rec.inventory_item_id                :=i.inventory_item_id;
            --l_mmti_rec.organization_id                  :=i.organization_id;
            p_orgn_code                                 := i.org_code;
            l_mmti_rec.source_header_id                 :=vBatchId;
            l_mmti_rec.transaction_source_id            :=vBatchId; -- Batch_id
            --l_mmti_rec.trx_source_line_id             :=1656; -- material_detail_id
            l_mmti_rec.transaction_quantity             :=i.primary_quantity;
            l_mmti_rec.transaction_uom                  := i.primary_uom;
            l_mmti_rec.primary_quantity                 :=i.primary_quantity;
            l_mmti_rec.secondary_uom_code               := i.secondary_uom;
            l_mmti_rec.secondary_transaction_quantity   :=i.secondary_quantity;
            l_mmti_rec.source_code                      :='OPM';
            l_mmti_rec.TRANSACTION_SOURCE_TYPE_ID       :=5;
            l_mmti_rec.wip_entity_type                  :=9;
            l_mmti_rec.TRANSACTION_ACTION_ID            := gme_common_pvt.g_prod_comp_txn_action;   --1;
            l_mmti_rec.TRANSACTION_TYPE_ID              := vTransactionTypeId;   --gme_common_pvt.g_prod_completion;--44;

            l_mmti_rec.TRANSACTION_DATE                 := SYSDATE; --i.transaction_date;
            l_mmti_rec.LAST_UPDATE_DATE                 := SYSDATE;
            l_mmti_rec.LAST_UPDATED_BY                  :=1110;
            l_mmti_rec.CREATION_DATE                    := SYSDATE;
            l_mmti_rec.CREATED_BY                       :=1110;
            l_mmti_rec.LAST_UPDATE_LOGIN                :=-1;
            g_debug_point                               := 'PA_1090';
          
          ---------------------------------------Lot Details
           l_mmli_tbl(1).last_update_date       := gme_common_pvt.g_timestamp       ;
           l_mmli_tbl(1).last_updated_by        := gme_common_pvt.g_user_ident      ;
           l_mmli_tbl(1).creation_date          := gme_common_pvt.g_timestamp        ;
           l_mmli_tbl(1).created_by             := gme_common_pvt.g_user_ident       ;
           l_mmli_tbl(1).lot_number             := i.lot_number;
           l_mmli_tbl(1).transaction_quantity   := i.primary_quantity;
          ---------------------------------------------------
          

            gme_api_pub.create_material_txn (
                p_api_version => 2.0
                ,p_validation_level =>gme_common_pvt.g_max_errors
                ,p_init_msg_list => fnd_api.g_false
                ,p_commit => fnd_api.g_false
                ,x_message_count =>lx_message_count
                ,x_message_list => lx_message_list
                ,x_return_status => lx_return_status
                ,p_org_code =>p_orgn_code
                ,p_mmti_rec =>l_mmti_rec
                ,p_mmli_tbl =>l_mmli_tbl
                ,p_batch_no =>NULL
                ,p_line_no =>NULL
                ,p_line_type =>NULL
                ,p_create_lot => fnd_api.g_true--NULL
                ,p_generate_lot=> NULL
                ,p_generate_parent_lot =>NULL
                ,x_mmt_rec =>lx_mmt_rec
                ,x_mmln_tbl =>lx_mmln_tbl );
                
            COMMIT;

            gme_debug.display_messages(lx_message_count);

            dbms_output.put_line('x_message_count ='||TO_CHAR(lx_message_count));
            dbms_output.put_line('x_message_list ='||SubStr(lx_message_list,1,120));
            dbms_output.put_line('x_message_list ='||lx_message_list);
            dbms_output.put_line('x_return_status ='||lx_return_status);
            dbms_output.put_line('x_mmt_rec.transaction_header_id= '||lx_mmt_rec.transaction_id);
            
            IF lx_message_count >=1 THEN
                FOR I IN 1..lx_message_count
               
                 LOOP
                    dbms_output.put_line(I||'. '||SUBSTR(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ),1, 255));
                    fnd_file.put_line(fnd_file.log,I||'. '||SUBSTR(FND_MSG_PUB.Get(p_encoded => FND_API.G_FALSE ),1, 255));
                 END LOOP;
            END IF;
            
            select concatenated_segments
            INTO vItemCode
            FROM mtl_system_items_kfv msi
            WHERE inventory_item_id = i.inventory_item_id
            AND organization_id = 101;   
            
            IF (lx_message_count = 0) THEN
                
                vStatus := 'Success';
                INSERT INTO ggl.cust_gme_transact_material_log(occurrence,status,entry_date,user_id)
                VALUES(i.occurrence,vStatus,SYSDATE,1110);
                
                COMMIT;
                
                apps.fnd_file.put_line(apps.fnd_file.output,'Success: Batch#'||i.batch_no||':'||i.transaction_type||':'||vItemCode||':'||i.primary_quantity);
                dbms_output.put_line('Success: Batch#'||i.batch_no||':'||i.transaction_type||':'||vItemCode||':'||i.primary_quantity);
            ELSE
                
                apps.fnd_file.put_line(apps.fnd_file.output,'Error: Batch#'||i.batch_no||':'||i.transaction_type||':'||vItemCode||':'||i.primary_quantity||':'||vStatus||':'||lx_message_list);
                dbms_output.put_line('Error: Batch#'||i.batch_no||':'||i.transaction_type||'-'||vItemCode||'-'||i.primary_quantity||':'||vStatus||':'||lx_message_list);
            
            END IF;
    
    END LOOP;
    
        apps.fnd_file.put_line(apps.fnd_file.output,'Total Record Processed:'||vLinesProcessed);
        dbms_output.put_line('Total Record Processed:'||vLinesProcessed);
END;
/

Upload/Insert Oracle OPM Generic Resource
----------------------------------------------------------------------------------
DECLARE
    lx_cr_rsrc_mst  cr_rsrc_mst%ROWTYPE;
    lx_message_count            varchar2(1000);
    lx_message_list             varchar2(10000);
    lx_return_status            varchar2(1000);

BEGIN
    fnd_profile.initialize (1110);
    fnd_global.apps_initialize(user_id =>1110,resp_id =>22882 ,resp_appl_id =>552 );
    fnd_msg_pub.initialize;
    gme_common_pvt.g_error_count := 0;
    gme_common_pvt.set_timestamp;
    gme_common_pvt.g_move_to_temp := fnd_api.g_false;

    --lx_cr_rsrc_mst.row_id := ;
    lx_cr_rsrc_mst.resource_class := NULL;
    lx_cr_rsrc_mst.creation_date := SYSDATE;
    lx_cr_rsrc_mst.created_by :=1110;
    lx_cr_rsrc_mst.last_update_date := SYSDATE;
    lx_cr_rsrc_mst.last_updated_by := 1110;
    lx_cr_rsrc_mst.trans_cnt := 0;
    lx_cr_rsrc_mst.delete_mark := 0;
    lx_cr_rsrc_mst.text_code := NULL;
    lx_cr_rsrc_mst.last_update_login := -1;
    lx_cr_rsrc_mst.min_capacity := 36000;
    lx_cr_rsrc_mst.max_capacity := 1152000;
    lx_cr_rsrc_mst.capacity_constraint := 0;
    lx_cr_rsrc_mst.capacity_uom:= NULL;
    lx_cr_rsrc_mst.resources := 'ZZ';
    lx_cr_rsrc_mst.std_usage_um := NULL;
    lx_cr_rsrc_mst.cost_cmpntcls_id := 73;
    lx_cr_rsrc_mst.capacity_tolerance := NULL;
    lx_cr_rsrc_mst.utilization := NULL;
    lx_cr_rsrc_mst.efficiency := NULL;
    lx_cr_rsrc_mst.resource_desc := 'Test Resource';
    lx_cr_rsrc_mst.std_usage_uom := 'HRS';
    lx_cr_rsrc_mst.capacity_um := 'PCS';
    lx_cr_rsrc_mst.outside_process_ind := 0;
    

    GMP_RESOURCES_PUB.insert_resources
      ( p_api_version       =>  1
      , p_init_msg_list     =>  TRUE
      , p_commit            =>  FALSE
      , p_resources         =>  lx_cr_rsrc_mst   
      , x_message_count     =>  lx_message_count     
      , x_message_list      =>  lx_message_count     
      , x_return_status     =>  lx_return_status
      );
  
      COMMIT;
    
    dbms_output.put_line(lx_message_count);
    dbms_output.put_line(lx_message_list);
    dbms_output.put_line(lx_return_status);


END;

Upload/insert Oracle OPM Plant Resource
--------------------------------------------------------------------------
DECLARE
    lx_rsrc_dtl cr_rsrc_dtl%ROWTYPE;
    lx_rsrc_instances_tbl      GMP_RESOURCE_DTL_PUB.resource_instances_tbl;
    lx_message_count            varchar2(1000);
    lx_message_list             varchar2(10000);
    lx_return_status            varchar2(1000);
    

BEGIN

    fnd_profile.initialize (1110);
    fnd_global.apps_initialize(user_id =>1110,resp_id =>22882 ,resp_appl_id =>552 );
    fnd_msg_pub.initialize;
    gme_common_pvt.g_error_count := 0;
    gme_common_pvt.set_timestamp;
    gme_common_pvt.g_move_to_temp := fnd_api.g_false;

    /*
    lx_rsrc_instances_tbl.RESOURCE_ID            
    lx_rsrc_instances_tbl.INSTANCE_ID                
    lx_rsrc_instances_tbl.INSTANCE_NUMBER            
        lx_rsrc_instances_tbl.VENDOR_ID                  
        lx_rsrc_instances_tbl.MODEL_NUMBER               
        lx_rsrc_instances_tbl.SERIAL_NUMBER              
        lx_rsrc_instances_tbl.TRACKING_NUMBER            
        lx_rsrc_instances_tbl.EFF_START_DATE             
        lx_rsrc_instances_tbl.EFF_END_DATE               
        lx_rsrc_instances_tbl.LAST_MAINTENANCE_DATE      
        lx_rsrc_instances_tbl.MAINTENANCE_INTERVAL       
        lx_rsrc_instances_tbl.INACTIVE_IND               
        lx_rsrc_instances_tbl.CALIBRATION_FREQUENCY      
        lx_rsrc_instances_tbl.CALIBRATION_PERIOD         
        lx_rsrc_instances_tbl.CALIBRATION_ITEM_ID        
        lx_rsrc_instances_tbl.LAST_CALIBRATION_DATE      
        lx_rsrc_instances_tbl.NEXT_CALIBRATION_DATE      
        lx_rsrc_instances_tbl.LAST_CERTIFICATION_DATE    
        lx_rsrc_instances_tbl.CERTIFIED_BY               
        lx_rsrc_instances_tbl.CREATION_DATE              
        lx_rsrc_instances_tbl.CREATED_BY                 
        lx_rsrc_instances_tbl.LAST_UPDATE_DATE           
        lx_rsrc_instances_tbl.LAST_UPDATED_BY            
        lx_rsrc_instances_tbl.LAST_UPDATE_LOGIN  
    */        
    -------------------------------------------------

    lx_rsrc_dtl.orgn_code := NULL;
    lx_rsrc_dtl.resources := 'ACL # 3';
    lx_rsrc_dtl.group_resource := 'ACL # 3';
    lx_rsrc_dtl.assigned_qty := 1;
    lx_rsrc_dtl.daily_avail_use := NULL;
    lx_rsrc_dtl.usage_um := NULL;
    lx_rsrc_dtl.nominal_cost := 1;
    lx_rsrc_dtl.inactive_ind := 0;
    lx_rsrc_dtl.creation_date := SYSDATE;
    lx_rsrc_dtl.created_by := 1110;
    lx_rsrc_dtl.last_update_date := SYSDATE;
    lx_rsrc_dtl.last_updated_by := 1110;
    lx_rsrc_dtl.last_update_login := -1;
    lx_rsrc_dtl.trans_cnt := 0;
    lx_rsrc_dtl.delete_mark := 0;
    lx_rsrc_dtl.text_code := NULL;
    lx_rsrc_dtl.ideal_capacity :=  37000;
    lx_rsrc_dtl.min_capacity := 36000;
    lx_rsrc_dtl.max_capacity :=  115200.0000;
    lx_rsrc_dtl.capacity_uom := NULL;
    lx_rsrc_dtl.resource_id := 1004;
    lx_rsrc_dtl.capacity_constraint := 0;
    lx_rsrc_dtl.capacity_tolerance := NULL;
    lx_rsrc_dtl.schedule_ind := 1;
    lx_rsrc_dtl.utilization:= NULL;
    lx_rsrc_dtl.efficiency:= NULL;
    lx_rsrc_dtl.planning_exception_set:= NULL;
    lx_rsrc_dtl.idle_time_tolerence:= NULL;
    lx_rsrc_dtl.sds_window:= NULL;
    lx_rsrc_dtl.organization_id := 103;
    lx_rsrc_dtl.usage_uom := 'HRS';
    lx_rsrc_dtl.capacity_um := 'PCS';
    lx_rsrc_dtl.calendar_code := NULL;
    lx_rsrc_dtl.batchable_flag := 0;
    lx_rsrc_dtl.batch_window:= NULL;
    lx_rsrc_dtl.batch_window_uom:= NULL;
    lx_rsrc_dtl.cost_source:= NULL;
    lx_rsrc_dtl.purchase_item_id  := NULL;  
    
    
    
    GMP_RESOURCE_DTL_PUB.insert_resource_dtl(
            p_api_version            =>   1
          , p_init_msg_list          =>   TRUE
          , p_commit                 =>   FALSE
          , p_resources              =>   lx_rsrc_dtl
          , p_rsrc_instances         =>   lx_rsrc_instances_tbl
          , x_message_count          =>   lx_message_count          
          , x_message_list           =>   lx_message_list           
          , x_return_status          =>   lx_return_status       
    );
    
    COMMIT;
    
    dbms_output.put_line(lx_message_count);
    dbms_output.put_line(lx_message_list);
    dbms_output.put_line(lx_return_status);
    

END;




Oracle OPM Routing API
--------------------------------------------------------------------------

-- Insert Oracle OPM Routing
gmd_routings_pub.insert_routing
                          (p_api_version                => 1.0,
                           p_init_msg_list              => l_init_msg_list,
                           p_commit                     => l_commit,
                           p_routings                   => l_routings,
                           p_routings_step_tbl          => l_routings_step_tbl,
                           p_routings_step_dep_tbl      => l_routings_step_dep_tbl,
                           x_message_count              => l_count,
                           x_return_status              => l_return_status,
                           x_message_list               => l_data
                          );


-- Upload Oracle OPM Routing
gmd_routings_pub.update_routing
  ( p_api_version     =>    1
  , p_init_msg_list   =>    TRUE
  , p_commit          =>    FALSE
  , p_routing_id      =>    1895
  , p_routing_no   =>    '41200.45002.01.03.M-1.1-A.0000'
  , p_routing_vers   =>    1
  , p_update_table   => l_tbl_type
  , x_message_count   =>    l_msg_count
  , x_message_list   =>    l_msg_list
  , x_return_status   =>    l_return_status 

  );


--Modify Oracle OPM Routing Status
Gmd_status_pub.modify_status ( p_api_version        => 1
                                    , p_init_msg_list      => TRUE
                                    , p_entity_name        =>'ROUTING'
                                    , p_entity_id          => i.routing_id
                                    , p_entity_no          => NULL
                                    , p_entity_version     => NULL
                                    , p_to_status          => 700 
                                    , p_ignore_flag        => FALSE
                                    , x_message_count      => l_msg_count
                                    , x_message_list       => l_msg_data

                                    , x_return_status      => l_return_status);






TAGS: gmp_process_parameters, gmp_process_parameters_pkg, GMP_RESOURCE_DTL_PUB, GMP_RESOURCES_PUB, GMD_OPERATIONS, GMD_OPERATION_ACTIVITIES, GMD_OPERATION_RESOURCES, GMD_OPERATIONS_PUB.insert_operation