0 Replies Latest reply: Mar 7, 2013 2:27 AM by 902404 RSS

    Unable to create Header with Oks_Contracts_Pub.Create_Contract_Header API

    902404
      Hello Experts,
      We are on Oracle 11.5.10 and we want to create conversion for Service contracts. We tried to use this API with default values but it's showing some error which is not so clear.

      Error: Contract Header API Return Status : E
      Contract Header API msg -
      OKC_CONTRACTS_REQUIRED_VALUE

      API Code:
      DECLARE
      l_chr_rec_oks OKS_CONTRACTS_PUB.header_rec_type;
      l_chr_rec_oks_contact OKS_CONTRACTS_PUB.contact_tbl;
      l_chr_rec_oks_sales OKS_CONTRACTS_PUB.SalesCredit_tbl;
      l_chr_rec_oks_obj OKS_CONTRACTS_PUB.obj_articles_tbl;
      ---**************Line declaration*********
      l_in_contract_line OKS_CONTRACTS_PUB.line_rec_type;
      l_contact_line OKS_CONTRACTS_PUB.contact_tbl;
      l_contract_scredit_line OKS_CONTRACTS_PUB.SalesCredit_tbl;
      l_contract_supp_line OKS_CONTRACTS_PUB.line_rec_type;
      l_supp_contact_line OKS_CONTRACTS_PUB.contact_tbl;
      l_supp_sale_cr_line OKS_CONTRACTS_PUB.SalesCredit_tbl;
      l_covered_rec OKS_CONTRACTS_PUB.Covered_level_Rec_Type;
      l_pricing_attribue OKS_CONTRACTS_PUB.pricing_attributes_type;
      l_merge_rule VARCHAR2(10);
      l_usage_instantiate VARCHAR2(10);
      l_ib_creation VARCHAR2(10);
      l_billing_sch_type VARCHAR2(10);
      l_StreamLvl_tbl OKS_BILL_SCH.StreamLvl_tbl;
      l_chrid NUMBER;
      l_msg_count NUMBER ;
      l_return_status1 VARCHAR2 ( 1 );
      l_return_status2 VARCHAR2 ( 1 );
      l_return_status3 VARCHAR2 ( 1 );
      x_msg_data1 VARCHAR2 ( 4000 );
      x_msg_data2 VARCHAR2 ( 4000 );
      x_msg_data3 VARCHAR2 ( 4000 );
      l_msg_index_out NUMBER ;
      --l_msg_data1 VARCHAR2 ( 4000 );
      l_contract_number okc_k_headers_b.contract_number%TYPE;
      l_contract_header_id NUMBER;
      l_service_line_id NUMBER;
      l_cp_line_id NUMBER;
      BEGIN
      FND_GLOBAL.APPS_INITIALIZE (44051 , 63793 , 20003 );
      okc_context.set_okc_org_context;
      fnd_client_info.set_org_context(2162;

      SELECT okc_k_headers_s1.nextval INTO l_contract_number FROM dual;
      -- *********************************
      -- Header data
      -- ********************************
      l_chr_rec_oks.contract_number := l_contract_number;
      l_chr_rec_oks.start_date := '07-MAR-2013';
      l_chr_rec_oks.end_date := '07-MAR-2018';
      l_chr_rec_oks.party_id := 156801;
      l_chr_rec_oks.sts_code := 'ACTIVE';
      l_chr_rec_oks.scs_code := 'WARRANTY';
      l_chr_rec_oks.authoring_org_id := 2162;
      l_chr_rec_oks.bill_to_id := 257149;
      l_chr_rec_oks.ship_to_id := 258215;
      l_chr_rec_oks.price_list_id := 199633;
      l_chr_rec_oks.cust_po_number := 'STE-PO';
      l_chr_rec_oks.currency := 'USD';
      l_chr_rec_oks.invoice_rule_type := -2;
      l_chr_rec_oks.payment_term_id := 1080;
      l_chr_rec_oks.Organization_id := 2181;
      l_chr_rec_oks.qcl_id := 1;
      l_chr_rec_oks.chr_group := 50121;-- WARRANTY GROUP
      l_chr_rec_oks.accounting_rule_type:= 1;
      l_chr_rec_oks.PDF_ID := 3;

      Oks_Contracts_Pub.Create_Contract_Header (
      p_K_header_rec => l_chr_rec_oks,
      p_header_contacts_tbl => l_chr_rec_oks_contact,
      p_header_sales_crd_tbl => l_chr_rec_oks_sales,
      p_header_articles_tbl => l_chr_rec_oks_obj,
      x_chrid => l_contract_header_id,
      x_return_status => l_return_status1,
      x_msg_count => l_msg_count,
      x_msg_data => x_msg_data1 );
      COMMIT;

      dbms_output . put_line ('Contract Number ' || l_contract_number);
      dbms_output . put_line ( 'Contract Header ID : ' || l_contract_header_id );
      dbms_output . put_line ( 'Contract Header API Return Status : ' || l_return_status1 );
      -- Check the API return status
      IF ( l_return_status1 <> 'S' ) THEN
      IF ( fnd_msg_pub . count_msg > 0 ) THEN
      FOR i IN 1 .. fnd_msg_pub . count_msg
      LOOP
      fnd_msg_pub . get ( p_msg_index => i , p_data => x_msg_data1 , p_encoded => 'F' , p_msg_index_out => l_msg_index_out );
      END LOOP;
      dbms_output . put_line ( 'Contract Header API msg -

      ' || x_msg_data1 );
      END IF;
      END IF;


      Could you please suggest me if we are missing any setups/patches.

      Thanks/Suresh