{"id":605,"date":"2011-01-20T11:41:32","date_gmt":"2011-01-20T08:41:32","guid":{"rendered":"https:\/\/enginhafizoglu.com\/?p=605"},"modified":"2011-09-29T10:16:31","modified_gmt":"2011-09-29T07:16:31","slug":"creating-maintenance-routes-with-api-you-can-use-this-api-for-discrete-manufacturing","status":"publish","type":"post","link":"https:\/\/enginhafizoglu.com\/?p=605","title":{"rendered":"Creating Maintenance Routes with BOM_RTG_PUB API (You can use this API for discrete manufacturing)"},"content":{"rendered":"<p>Firstly I create a custom table then I insert the datas from excel sheet.<\/p>\n<p>[sql]CREATE TABLE XXINN_MAINTENANCE_ROUTES(<br \/>\nASSEMBLY_ITEM_NAME         VARCHAR2(240 BYTE),<br \/>\nORGANIZATION_CODE          VARCHAR2(3 BYTE),<br \/>\nLONG_DESCRIPTION           VARCHAR2(4000 BYTE),<br \/>\nOPERATION_DESCRIPTION      VARCHAR2(400 BYTE),<br \/>\nOPERATION_SEQUENCE_NUMBER  NUMBER,<br \/>\nDEPARTMENT_CODE            VARCHAR2(10 BYTE),<br \/>\nRESOURCE_SEQUENCE_NUMBER   NUMBER,<br \/>\nRESOURCE_CODE              VARCHAR2(10 BYTE),<br \/>\nUSAGE_RATE_OR_AMOUNT       NUMBER,<br \/>\nASSIGNED_UNITS             NUMBER,<br \/>\nERROR                      VARCHAR2(2000 BYTE)<br \/>\n)[\/sql]<\/p>\n<p>Then I have written this procedure for creating the maintenance routes. <!--more--><\/p>\n<p>[sql]CREATE OR REPLACE PROCEDURE APPS.XXINN_CREATE_MAINTNCE_ROUTE(ERRBUF  OUT VARCHAR2,<br \/>\nRETCODE OUT NUMBER) IS<br \/>\nP_HEADER_REC       Bom_Rtg_Pub.Rtg_Header_Rec_Type := Bom_Rtg_Pub.G_MISS_RTG_HEADER_REC;<br \/>\nP_OPERATION_REC    Bom_Rtg_Pub.Operation_Tbl_Type := Bom_Rtg_Pub.G_MISS_OPERATION_TBL;<br \/>\nP_RESOURCE_REC     Bom_Rtg_Pub.Op_Resource_Tbl_Type := Bom_Rtg_Pub.G_MISS_OP_RESOURCE_TBL;<br \/>\np_RETURN_STATUS    VARCHAR2(240);<br \/>\np_MSG_COUNT        NUMBER;<br \/>\nl_ret_text         VARCHAR2(32000);<br \/>\np_Message_List     Error_Handler.Error_Tbl_Type;<br \/>\ni                  NUMBER;<br \/>\nj                  NUMBER;<br \/>\nx_rtg_header_rec   Bom_Rtg_Pub.Rtg_Header_Rec_Type;<br \/>\nx_rtg_revision_tbl Bom_Rtg_Pub.Rtg_Revision_Tbl_Type;<br \/>\nx_operation_tbl    Bom_Rtg_Pub.Operation_Tbl_Type;<br \/>\nx_op_resource_tbl  Bom_Rtg_Pub.Op_Resource_Tbl_Type;<br \/>\nx_sub_resource_tbl Bom_Rtg_Pub.Sub_Resource_Tbl_Type;<br \/>\nx_op_network_tbl   Bom_Rtg_Pub.Op_Network_Tbl_Type;<\/p>\n<p>CURSOR C1_ENG IS<br \/>\nSELECT DISTINCT t.assembly_item_name,<br \/>\nt.organization_code<br \/>\nFROM  APPS.XXINN_MAINTENANCE_ROUTES t;<\/p>\n<p>CURSOR C1_OPR(p_ASSEMBLY_ITEM VARCHAR2, p_org_code VARCHAR2) IS<br \/>\nSELECT DISTINCT t.assembly_item_name,<br \/>\nt.organization_code,<br \/>\nt.operation_sequence_number,<br \/>\nt.department_code,<br \/>\nLTRIM (RTRIM(T.LONG_DESCRIPTION)) LONG_DESCRIPTION,<br \/>\ntranslate (LTRIM(RTRIM( t.OPERATION_DESCRIPTION)),&#8217;\u00c7\u011e\u015e\u0130\u00dc\u00d6&#8217;,&#8217;CGSIUO&#8217;) OPERATION_DESCRIPTION<br \/>\nFROM APPS.XXINN_MAINTENANCE_ROUTES t<br \/>\nWHERE t.assembly_item_name = p_ASSEMBLY_ITEM<br \/>\nAND t.organization_code = p_org_code<br \/>\nORDER BY t.operation_sequence_number;<\/p>\n<p>CURSOR C1_RES(p_ASSEMBLY_ITEM VARCHAR2, p_org_code VARCHAR2, p_seq_number NUMBER) IS<br \/>\nSELECT DISTINCT t.assembly_item_name,<br \/>\nt.organization_code,<br \/>\nt.operation_sequence_number,<br \/>\nt.department_code,<br \/>\nt.resource_sequence_number,<br \/>\nt.resource_code,<br \/>\nt.usage_rate_or_amount,<br \/>\nt.ASSIGNED_UNITS<br \/>\nFROM APPS.XXINN_MAINTENANCE_ROUTES t<br \/>\nWHERE t.assembly_item_name = p_ASSEMBLY_ITEM<br \/>\nAND t.organization_code = p_org_code<br \/>\nAND t.operation_sequence_number = p_seq_number<br \/>\nORDER BY t.resource_sequence_number;<\/p>\n<p>BEGIN<br \/>\nFND_GLOBAL.APPS_INITIALIZE(1117, 23118, 426); &#8211;user_id, resp_id, resp_appl_id<br \/>\nFOR C_REC IN C1_ENG LOOP<br \/>\nFND_FILE.PUT_LINE(FND_FILE.OUTPUT, C_REC.ASSEMBLY_ITEM_NAME);<br \/>\nDBMS_OUTPUT.PUT_LINE(C_REC.ASSEMBLY_ITEM_NAME);<\/p>\n<p>P_HEADER_REC                    := Bom_Rtg_Pub.G_MISS_RTG_HEADER_REC;<br \/>\nP_HEADER_REC.ASSEMBLY_ITEM_NAME := C_REC.ASSEMBLY_ITEM_NAME;<br \/>\nP_HEADER_REC.ORGANIZATION_CODE  := C_REC.ORGANIZATION_CODE;<br \/>\nP_HEADER_REC.Eng_Routing_Flag   := 2;<br \/>\nP_HEADER_REC.Transaction_Type   := &#8216;CREATE&#8217;; &#8212;<br \/>\nP_HEADER_REC.Return_Status      := NULL; &#8212;<br \/>\ni                               := 0;<br \/>\nj                               := 0;<br \/>\nP_OPERATION_REC.DELETE;<br \/>\nP_RESOURCE_REC.DELETE;<\/p>\n<p>FOR c_rec2 IN C1_OPR(C_REC.ASSEMBLY_ITEM_NAME, C_REC.ORGANIZATION_CODE) LOOP<br \/>\ni := i + 1;<br \/>\nFND_FILE.PUT_LINE(FND_FILE.OUTPUT,<br \/>\n&#8216;            &#8216; || C_REC2.OPERATION_SEQUENCE_NUMBER || &#8216;-&#8216; ||<br \/>\nC_REC2.DEPARTMENT_CODE);<br \/>\nDBMS_OUTPUT.PUT_LINE(&#8216;            &#8216; ||<br \/>\nC_REC2.OPERATION_SEQUENCE_NUMBER || &#8216;-&#8216; ||<br \/>\nC_REC2.DEPARTMENT_CODE||&#8217;-&#8216;||C_REC2.OPERATION_DESCRIPTION);<br \/>\nP_OPERATION_REC(i).ASSEMBLY_ITEM_NAME := C_REC2.ASSEMBLY_ITEM_NAME;<br \/>\nP_OPERATION_REC(i).ORGANIZATION_CODE := C_REC2.ORGANIZATION_CODE;<br \/>\nP_OPERATION_REC(i).OPERATION_SEQUENCE_NUMBER := C_REC2.OPERATION_SEQUENCE_NUMBER;<br \/>\nP_OPERATION_REC(i).DEPARTMENT_CODE := C_REC2.DEPARTMENT_CODE;<br \/>\nP_OPERATION_REC(i).LONG_DESCRIPTION := C_REC2.LONG_DESCRIPTION; &#8211;Ana tabloda long description diye bir alan a\u00e7<br \/>\nP_OPERATION_REC(i).OPERATION_DESCRIPTION := C_REC2.OPERATION_DESCRIPTION;<br \/>\nP_OPERATION_REC(i).Operation_Type := 1; &#8212;<br \/>\nP_OPERATION_REC(i).Start_Effective_Date := SYSDATE; &#8212;<br \/>\nP_OPERATION_REC(i).Transaction_Type := &#8216;CREATE&#8217;; &#8212;<\/p>\n<p>FOR c_rec3 IN C1_RES(C_REC.ASSEMBLY_ITEM_NAME,<br \/>\nC_REC.ORGANIZATION_CODE,<br \/>\nC_REC2.OPERATION_SEQUENCE_NUMBER) LOOP<br \/>\nj := j + 1;<br \/>\nFND_FILE.PUT_LINE(FND_FILE.OUTPUT,<br \/>\n&#8216;                &#8216; ||<br \/>\nC_REC3.RESOURCE_SEQUENCE_NUMBER || &#8216;-&#8216; ||<br \/>\nC_REC3.RESOURCE_CODE);<br \/>\nDBMS_OUTPUT.PUT_LINE(&#8216;                &#8216; ||<br \/>\nC_REC3.RESOURCE_SEQUENCE_NUMBER || &#8216;-&#8216; ||<br \/>\nC_REC3.RESOURCE_CODE);<br \/>\nP_RESOURCE_REC(j).ASSEMBLY_ITEM_NAME := C_REC3.ASSEMBLY_ITEM_NAME;<br \/>\nP_RESOURCE_REC(j).ORGANIZATION_CODE := C_REC3.ORGANIZATION_CODE;<br \/>\nP_RESOURCE_REC(j).OPERATION_SEQUENCE_NUMBER := C_REC3.OPERATION_SEQUENCE_NUMBER;<br \/>\nP_RESOURCE_REC(j).RESOURCE_SEQUENCE_NUMBER := C_REC3.RESOURCE_SEQUENCE_NUMBER;<br \/>\nP_RESOURCE_REC(j).RESOURCE_CODE := C_REC3.RESOURCE_CODE;<br \/>\nP_RESOURCE_REC(j).USAGE_RATE_OR_AMOUNT := C_REC3.USAGE_RATE_OR_AMOUNT;<br \/>\nP_RESOURCE_REC(j).Operation_Type := 1; &#8212;<br \/>\nP_RESOURCE_REC(j).Op_Start_Effective_Date := SYSDATE; &#8212;<br \/>\nP_RESOURCE_REC(j).Transaction_Type := &#8216;CREATE&#8217;; &#8212;<br \/>\nP_RESOURCE_REC(j).Schedule_Flag := 1;<br \/>\nP_RESOURCE_REC(J).ASSIGNED_UNITS := C_REC3.ASSIGNED_UNITS;<\/p>\n<p>END LOOP; &#8211;res<\/p>\n<p>END LOOP; &#8212; opr<\/p>\n<p>x_rtg_header_rec := Bom_Rtg_Pub.G_MISS_RTG_HEADER_REC;<br \/>\nx_rtg_revision_tbl.delete;<br \/>\nx_operation_tbl.delete;<br \/>\nx_op_resource_tbl.delete;<br \/>\nx_sub_resource_tbl.delete;<br \/>\nx_op_network_tbl.delete;<\/p>\n<p>APPS.BOM_RTG_PUB.PROCESS_RTG(p_init_msg_list    =&gt; TRUE,<br \/>\np_rtg_header_rec   =&gt; P_HEADER_REC,<br \/>\np_operation_tbl    =&gt; P_OPERATION_REC,<br \/>\np_op_resource_tbl  =&gt; P_RESOURCE_REC,<br \/>\nx_rtg_header_rec   =&gt; x_rtg_header_rec,<br \/>\nx_rtg_revision_tbl =&gt; x_rtg_revision_tbl,<br \/>\nx_operation_tbl    =&gt; x_operation_tbl,<br \/>\nx_op_resource_tbl  =&gt; x_op_resource_tbl,<br \/>\nx_sub_resource_tbl =&gt; x_sub_resource_tbl,<br \/>\nx_op_network_tbl   =&gt; x_op_network_tbl,<br \/>\nx_return_status    =&gt; p_RETURN_STATUS,<br \/>\nX_MSG_COUNT        =&gt; p_MSG_COUNT);<\/p>\n<p>IF p_RETURN_STATUS &lt;&gt; &#8216;S&#8217; THEN<br \/>\nerror_handler.Get_Message_List(p_message_list);<br \/>\nFOR i IN 1 .. p_message_list.COUNT LOOP<\/p>\n<p>IF i = 1 THEN<br \/>\nl_ret_text := p_Message_List(i).message_text;<\/p>\n<p>ELSE<br \/>\nl_ret_text := l_ret_text || chr(10) || p_Message_List(i).message_text;<br \/>\nEND IF;<\/p>\n<p>END LOOP;<\/p>\n<p>&#8212; ROLLBACK;<\/p>\n<p>FND_FILE.PUT_LINE(FND_FILE.OUTPUT,<br \/>\nP_HEADER_REC.ASSEMBLY_ITEM_NAME ||<br \/>\n&#8216; ERROR!!!!!!!&#8217; || chr(10) || &#8216;Error:&#8217; ||p_Message_List(i).message_type||&#8217;-&#8216;||p_Message_List(i).message_name||<br \/>\nl_ret_text);<\/p>\n<p>DBMS_OUTPUT.PUT_LINE(P_HEADER_REC.ASSEMBLY_ITEM_NAME ||<br \/>\n&#8216; ERROR!!!!!!!&#8217; || chr(10) || &#8216;Error:&#8217; ||p_Message_List(i).message_type||&#8217;-&#8216;||p_Message_List(i).message_name||<br \/>\nl_ret_text);<\/p>\n<p>UPDATE APPS.XXINN_MAINTENANCE_ROUTES xxinn<br \/>\nSET XXINN.ERROR = l_ret_text<br \/>\nWHERE XXINN.ASSEMBLY_ITEM_NAME = c_rec.assembly_item_name<br \/>\nAND XXINN.ORGANIZATION_CODE = c_rec.organization_code;<\/p>\n<p>ELSE<\/p>\n<p>FND_FILE.PUT_LINE(FND_FILE.OUTPUT,<\/p>\n<p>P_HEADER_REC.ASSEMBLY_ITEM_NAME ||<br \/>\n&#8216; the process is successful..&#8217;);<\/p>\n<p>DBMS_OUTPUT.PUT_LINE(P_HEADER_REC.ASSEMBLY_ITEM_NAME ||<br \/>\n&#8216; the process is successful..&#8217;);<\/p>\n<p>UPDATE APPS.XXINN_MAINTENANCE_ROUTES xxinn<br \/>\nSET XXINN.ERROR = null<br \/>\nWHERE XXINN.ASSEMBLY_ITEM_NAME = c_rec.assembly_item_name<br \/>\nAND XXINN.ORGANIZATION_CODE = c_rec.organization_code;<\/p>\n<p>END IF;<\/p>\n<p>END LOOP;<\/p>\n<p>END<br \/>\n&#8211;\u00a9 EnginH<br \/>\n;<br \/>\n\/[\/sql]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Firstly I create a custom table then I insert the datas from excel sheet. [sql]CREATE TABLE XXINN_MAINTENANCE_ROUTES( ASSEMBLY_ITEM_NAME VARCHAR2(240 BYTE), ORGANIZATION_CODE VARCHAR2(3 BYTE), LONG_DESCRIPTION VARCHAR2(4000 BYTE), OPERATION_DESCRIPTION VARCHAR2(400 BYTE), OPERATION_SEQUENCE_NUMBER NUMBER, DEPARTMENT_CODE VARCHAR2(10 BYTE), RESOURCE_SEQUENCE_NUMBER NUMBER, RESOURCE_CODE VARCHAR2(10 BYTE), USAGE_RATE_OR_AMOUNT NUMBER, ASSIGNED_UNITS NUMBER, ERROR VARCHAR2(2000 BYTE) )[\/sql] Then I have written this procedure for creating [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[108,109,106,107],"class_list":["post-605","post","type-post","status-publish","format-standard","hentry","category-oracle-e-is-yonetim-sistemi","tag-api","tag-bom_rtg_pub","tag-creating-routes","tag-route"],"_links":{"self":[{"href":"https:\/\/enginhafizoglu.com\/index.php?rest_route=\/wp\/v2\/posts\/605","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enginhafizoglu.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enginhafizoglu.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enginhafizoglu.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/enginhafizoglu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=605"}],"version-history":[{"count":6,"href":"https:\/\/enginhafizoglu.com\/index.php?rest_route=\/wp\/v2\/posts\/605\/revisions"}],"predecessor-version":[{"id":606,"href":"https:\/\/enginhafizoglu.com\/index.php?rest_route=\/wp\/v2\/posts\/605\/revisions\/606"}],"wp:attachment":[{"href":"https:\/\/enginhafizoglu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=605"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enginhafizoglu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=605"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enginhafizoglu.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=605"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}