0 Replies Latest reply: Apr 17, 2012 7:11 AM by User378604 RSS

    Need example for GME_API_PUB.CREATE_MATERIAL_TXN api

    User378604
      hi,

      Please provide an example for Transaction a line after creating batch>
      I used below code but the transaction did not happen as return status was equal to 'U'

      Please fidn below code..let me know what wrong i am doi or it will be helpful if anyone can provide the example for passing values to api GME_API_PUB.CREATE_MATERIAL_TXN api

      declare
      p_api_version NUMBER DEFAULT 2;
      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) DEFAULT 'BBG';
      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;
      begin

      fnd_global.apps_initialize(user_id =>1229,resp_id =>23326 ,resp_appl_id =>553 );
      /* SELECT material_detail_id
      INTO l_mmti_rec.material_detail_id
      FROM gme_material_details
      WHERE batch_id = 39514--l_batch_hdr.batch_id
      AND line_type = -1
      AND inventory_item_id = 404;*/

      SELECT material_detail_id,a.INVENTORY_ITEM_ID,a.ORGANIZATION_ID
      INTO l_mmti_rec.TRX_SOURCE_LINE_ID,l_mmti_rec.inventory_item_id,l_mmti_rec.organization_id
      FROM gme_material_details a
      WHERE batch_id = 39517--l_batch_hdr.batch_id
      AND line_type = -1
      AND inventory_item_id = 234;--404;

      l_mmti_rec.SUBINVENTORY_CODE:='HUMANPROD';
      l_mmti_rec.locator_id:=52;
      l_mmti_rec.transaction_quantity:=20;

      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 =>NULL
      ,p_generate_lot=> NULL
      ,p_generate_parent_lot =>NULL
      ,x_mmt_rec =>lx_mmt_rec
      ,x_mmln_tbl =>lx_mmln_tbl );

      commit;

      dbms_output.put_line(l_mmti_rec.organization_id||'l_mmti_rec.organization_id');
      dbms_output.put_line(l_mmti_rec.inventory_item_id||'l_mmti_rec.inventory_item_id');
      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 =
      '||length(lx_message_list)||SubStr(lx_message_list,length(lx_message_list)-20,20));
      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);
      --dbms_output.put_line(SubStr('x_batch_header.plant_code ='||x_batch_header_rec.plant_code,1,255));
      --dbms_output.put_line(SubStr('x_batch_header.batch_no ='||x_batch_header_rec.batch_no,1,255));
      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;
      END;
      /


      Output:
      x_message_count =0
      x_message_list =

      x_message_list =
      x_return_status =U
      x_mmt_rec.transaction_header_id=