Saturday, July 30, 2016

Create Oracle Service Contract Header From Template Through API

DECLARE
l_return_status VARCHAR2(1);
l_msg_count NUMBER;
l_msg_data VARCHAR2(1000);
l_contract_id NUMBER;
l_template_rec oks_import_header_pub.templ_rec_type;

BEGIN
   begin
      FND_GLOBAL.APPS_INITIALIZE
      ( user_id => 1318
       ,resp_id => 21708
       ,resp_appl_id => 515
      );
     
      OKC_CONTEXT.SET_OKC_ORG_CONTEXT(204,204);
   END;
  
   l_template_rec.template_name := 'XXAASC_TEMP' ;
   l_template_rec.template_modifier :=NULL;
   l_template_rec.start_date := '01-jan-2015';
   l_template_rec.end_date := '31-dec-2015';
  
   OKS_IMPORT_HEADER_PUB.CREATE_CONTRACT_FROM_TEMPLATE
          (
          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_template_rec => l_template_rec ,
          x_Contract_id => l_contract_id
          ) ;
   Dbms_Output.put_line('l_contract_id '||l_contract_id);
  
   IF l_return_status='S'
   THEN
      Dbms_Output.put_line(' Template created from contract ' );
      COMMIT;
   END IF;
  
   IF l_return_status<>'S'
   THEN
      FOR i IN 1..l_msg_count
      LOOP
          l_msg_data := FND_MSG_PUB.Get(i, p_encoded => FND_API.G_FALSE);
          Dbms_Output.put_line(l_msg_data);
      END LOOP;
   END IF;

END;

No comments:

Post a Comment

Best Blogger TipsGet Flower Effect