Saturday, July 30, 2016

Update Oracle Service Contract Header Through API

DECLARE
   l_return_status VARCHAR2(1);
   l_msg_count NUMBER;
   l_msg_data VARCHAR2(1000);
   l_contract_rec oks_import_header_pub.Update_rec_type;
   x_Contract_rec oks_import_header_pub.Update_rec_type;
   l_msg_index_out NUMBER;
BEGIN
   FND_GLOBAL.APPS_INITIALIZE
      ( user_id => 1000200
      ,resp_id => 21708
      ,resp_appl_id => 515
      );
     
   okc_context.set_okc_org_context(204,204);
   /*update contract header */
   l_contract_rec.ID := 202111 ;
   l_contract_rec.currency_code :='EUR';
   l_contract_rec.short_description :='Test Update contract Header' ;
   l_contract_rec.pricing_flag := 'R';
   l_contract_rec.conversion_type := 'User';
   l_contract_rec.conversion_rate :=1;
   l_contract_rec.conversion_rate_date:='08-jan-2014';
   l_contract_rec.description := 'Test update contract header API';
  
   OKS_IMPORT_HEADER_PUB.UPDATE_CONTRACT_HEADER
      (
          p_api_version => 1.0,
          p_init_msg_list => OKC_API.G_TRUE,
          x_return_status=>l_return_status,
          x_msg_count=>l_msg_count ,
          x_msg_data=>l_msg_data ,
          p_contract_rec=>l_contract_rec,
          x_Contract_rec =>x_Contract_rec
      );

   Dbms_Output.put_line('l_return_status '||l_return_status);

   IF l_return_status='S'
   THEN
      Dbms_Output.put_line('Contract Header is updated successfully '||x_Contract_rec.contract_number );
      COMMIT;
   END IF;
  
   FOR i IN 1 .. fnd_msg_pub.count_msg
   LOOP
      FND_MSG_PUB.GET
          (p_msg_index => i,
           p_encoded => 'T',
           p_data => l_msg_data,
           p_msg_index_out => l_msg_index_out
          );
         
      FND_MESSAGE.SET_ENCODED (l_msg_data);
      l_msg_data := fnd_message.get;
      dbms_output.put_line(l_msg_data);
   END LOOP;
END;

No comments:

Post a Comment

Best Blogger TipsGet Flower Effect