May
22
2014

Rota Oluşturmak İçin Procedure – Create Routing API

Merhaba,

Rota oluşturabilmek için aşağıdaki procedure ü kullanabilirsiniz.

 

———————–

CREATE OR REPLACE PROCEDURE xxinn_process_rtg
AS
-- API input variables
   l_operation_tbl      bom_rtg_pub.operation_tbl_type
                                          := bom_rtg_pub.g_miss_operation_tbl;
   l_rtg_header_rec     bom_rtg_pub.rtg_header_rec_type
                                         := bom_rtg_pub.g_miss_rtg_header_rec;
   l_rtg_revision_tbl   bom_rtg_pub.rtg_revision_tbl_type
                                       := bom_rtg_pub.g_miss_rtg_revision_tbl;
   l_op_resource_tbl    bom_rtg_pub.op_resource_tbl_type
                                        := bom_rtg_pub.g_miss_op_resource_tbl;
   l_sub_resource_tbl   bom_rtg_pub.sub_resource_tbl_type
                                       := bom_rtg_pub.g_miss_sub_resource_tbl;
   l_op_network_tbl     bom_rtg_pub.op_network_tbl_type
                                         := bom_rtg_pub.g_miss_op_network_tbl;
-- API output variables
   x_rtg_header_rec     bom_rtg_pub.rtg_header_rec_type;
                                                     -- routing header record
   x_rtg_revision_tbl   bom_rtg_pub.rtg_revision_tbl_type;
                                                         -- routing revisions
   x_operation_tbl      bom_rtg_pub.operation_tbl_type; -- routing operations
   x_op_resource_tbl    bom_rtg_pub.op_resource_tbl_type;
                                                       -- oepration resources
   x_sub_resource_tbl   bom_rtg_pub.sub_resource_tbl_type;
                                                   -- sub operation resources
   x_op_network_tbl     bom_rtg_pub.op_network_tbl_type;
                                                        -- operation networks
   x_message_list       error_handler.error_tbl_type;
-- Other API variables
   l_return_status      VARCHAR2 (1)                      := NULL;
   l_msg_count          NUMBER                            := 0;
   l_cnt                NUMBER                            := 1;
-- WHO columns
   l_user_id            NUMBER                            := -1;
   l_resp_id            NUMBER                            := -1;
   l_application_id     NUMBER                            := -1;
   l_row_cnt            NUMBER                            := 1;
   l_user_name          VARCHAR2 (30)                     := 'user_name';
                                                   -->kullanıci adi yazilmali
   l_resp_name          VARCHAR2 (30)                 := 'responsibility_key';
                           -->sorumluluğunuzun responsibility_key i yazilmali
BEGIN
-- Get the user_id
   SELECT user_id
     INTO l_user_id
     FROM fnd_user
    WHERE user_name = l_user_name;
 
-- Get the application_id and responsibility_id
   SELECT application_id, responsibility_id
     INTO l_application_id, l_resp_id
     FROM fnd_responsibility
    WHERE responsibility_key = l_resp_name;
 
-- Initialize applications information
   fnd_global.apps_initialize (l_user_id, l_resp_id, l_application_id);
   DBMS_OUTPUT.put_line (   'Initialized applications context: '
                         || l_user_id
                         || ' '
                         || l_resp_id
                         || ' '
                         || l_application_id
                        );
-- Create the routing header
   l_rtg_header_rec.assembly_item_name := 'Assembly_Item_Name';
                                            -->rotasini yapacağiniz kalem kodu
   l_rtg_header_rec.organization_code := 'Organization_Code';
                                     --> hangi organizasyonda rota yapilacaksa
   l_rtg_header_rec.alternate_routing_code := NULL;
-->rotasi yapilacak kalemin daha onceden rotasi yoksa null varsa alternatif adi yazilacak.
   l_rtg_header_rec.completion_subinventory := 'Completion_Subinventory';
                                                              --> depo nun adi
   l_rtg_header_rec.transaction_type := 'CREATE';
   l_rtg_header_rec.completion_location_name := 'Completion_Location_Name';
                                  --> locator li bir depoysa segment birleşimi
-- Create the routing operations
-- operation 1
   l_operation_tbl (l_cnt).assembly_item_name := 'Assembly_Item_Name';
                                            -->rotasini yapacağiniz kalem kodu
   l_operation_tbl (l_cnt).organization_code := 'Organization_Code';
                                      -->hangi organizasyonda rota yapilacaksa
   l_operation_tbl (l_cnt).alternate_routing_code := NULL;
-->rotasi yapilacak kalemin daha onceden rotasi yoksa null varsa alternatif adi yazilacak.
   l_operation_tbl (l_cnt).operation_sequence_number :=
                                                     operation_sequence_number;
                                                   --> operasyon sira numarasi
   l_operation_tbl (l_cnt).operation_type := 1;
   l_operation_tbl (l_cnt).start_effective_date := SYSDATE;
   l_operation_tbl (l_cnt).standard_operation_code :=
                                                     'Standard_Operation_Code';
                                                             -->operasyon kodu
   l_operation_tbl (l_cnt).yield := 1;                      -->operation yield
   l_operation_tbl (l_cnt).transaction_type := 'CREATE';
/* -- 2.operasyon eklenecekse asagidaki kod acilir. 3. vedaha fazlası icin asagidaki kod coklanir.
l_cnt := l_cnt + 1;
l_operation_tbl(l_cnt).Assembly_Item_Name :=
'RS_BOM_ASSY1';
l_operation_tbl(l_cnt).Organization_Code := 'M1';
l_operation_tbl(l_cnt).Alternate_Routing_Code := NULL;
l_operation_tbl(l_cnt).Operation_Sequence_Number := '20';
l_operation_tbl(l_cnt).Operation_Type := 1;
l_operation_tbl(l_cnt).Start_Effective_Date := SYSDATE; --
to_date('16-JUL-2010 19:30:39','DD-MON-YY HH24:MI:SS'); -- should match timestamp for UPDATE
l_operation_tbl(l_cnt).Standard_Operation_Code := 'SFPK';
l_operation_tbl(l_cnt).Yield := 1.0;
l_operation_tbl(l_cnt).Transaction_Type := 'CREATE' ;*/
 
   -- initialize error stack for logging errors
   error_handler.initialize;
-- call API to create / update routing DBMS_OUTPUT.PUT_LINE('=======================================================');
   DBMS_OUTPUT.put_line ('Calling Bom_Rtg_Pub.Process_Rtg API');
   bom_rtg_pub.process_rtg (
-- p_bo_identifier => 'RTG'
-- ,p_api_version_number => 1.0,
                            p_init_msg_list         => TRUE,
                            p_rtg_header_rec        => l_rtg_header_rec,
                            p_rtg_revision_tbl      => l_rtg_revision_tbl,
                            p_operation_tbl         => l_operation_tbl,
                            p_op_resource_tbl       => l_op_resource_tbl,
                            p_sub_resource_tbl      => l_sub_resource_tbl,
                            p_op_network_tbl        => l_op_network_tbl,
                            x_rtg_header_rec        => x_rtg_header_rec,
                            x_rtg_revision_tbl      => x_rtg_revision_tbl,
                            x_operation_tbl         => x_operation_tbl,
                            x_op_resource_tbl       => x_op_resource_tbl,
                            x_sub_resource_tbl      => x_sub_resource_tbl,
                            x_op_network_tbl        => x_op_network_tbl,
                            x_return_status         => l_return_status,
                            x_msg_count             => l_msg_count,
                            p_debug                 => 'N',
                            p_output_dir            => '/usr/tmp/'
-- ,p_debug_filename => 'rtg_bo_debug.log'
                           );
   DBMS_OUTPUT.put_line
                    ('=======================================================');
   DBMS_OUTPUT.put_line ('Return Status: ' || l_return_status);
 
   IF (l_return_status <> fnd_api.g_ret_sts_success)
   THEN
      DBMS_OUTPUT.put_line ('x_msg_count:' || l_msg_count);
      error_handler.get_message_list (x_message_list => x_message_list);
      DBMS_OUTPUT.put_line ('Error Message Count :' || x_message_list.COUNT);
 
      FOR i IN 1 .. x_message_list.COUNT
      LOOP
         DBMS_OUTPUT.put_line (   TO_CHAR (i)
                               || ':'
                               || x_message_list (i).entity_index
                               || ':'
                               || x_message_list (i).table_name
                              );
         DBMS_OUTPUT.put_line (   TO_CHAR (i)
                               || ':'
                               || x_message_list (i).MESSAGE_TEXT
                              );
      END LOOP;
   END IF;
 
   DBMS_OUTPUT.put_line
                    ('=======================================================');
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Exception Occured :');
      DBMS_OUTPUT.put_line (SQLCODE || ':' || SQLERRM);
      DBMS_OUTPUT.put_line
                   ('=======================================================');
-- RAISE;
END;

 

———————–

BEGIN XXINN_PROCESS_RTG (); END ;

———————–

 

Ref:  https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=455821396451586&id=1244125.1&_afrWindowMode=0&_adf.ctrl-state=33wo35z7e_4

 

Mert Ağbaba

1986 İstanbul doğumlu. Okan Üniversitesi Endüstri Mühendisliği
(%50 Burslu) bölümünde lisans eğitimini tamamladı. Blog yöneticisi
ve aynı zamanda yazardır. Sırasıyla Tetaş Group, Innova Bilişim
Çözümleri ve Renault MAİS A.Ş.(Devam) de Oracle EBS Fonksiyonel
Danışman olarak profesyonel kariyerine devam etmektedir.
Mail: mrtgbb@gmail.com
Mert Ağbaba


Yorum yapın

*