1 Reply Latest reply: May 31, 2013 1:44 AM by L S P.. RSS

    Sample API code to update quote

    899231
      Hi,

      i want to update quote using API, can any one have sample code to do that.

      ASO_QUOTE_PUB.Update_Quote

      Thanks!
        • 1. Re: Sample API code to update quote
          L S P..
          Hi, Use the below code for Quote update process.

          set serveroutput on size 80000
          set pages 500

          DECLARE
          l_control_rec ASO_QUOTE_PUB.Control_Rec_Type;
          l_qte_header_rec ASO_QUOTE_PUB.Qte_Header_Rec_Type;
          l_qte_line_tbl ASO_QUOTE_PUB.Qte_Line_Tbl_Type;
          l_qte_line_rec ASO_QUOTE_PUB.Qte_Line_rec_Type;
          l_qte_line_dtl_tbl ASO_QUOTE_PUB.Qte_Line_Dtl_Tbl_Type;
          l_hd_Price_Attr_Tbl ASO_QUOTE_PUB.Price_Attributes_Tbl_Type;
          l_hd_payment_tbl ASO_QUOTE_PUB.Payment_Tbl_Type;
          l_hd_shipment_tbl ASO_QUOTE_PUB.Shipment_Tbl_Type;
          l_hd_freight_charge_tbl ASO_QUOTE_PUB.Freight_Charge_Tbl_Type;
          l_hd_tax_detail_tbl ASO_QUOTE_PUB.Tax_Detail_Tbl_Type;
          l_Line_Attr_Ext_Tbl ASO_QUOTE_PUB.Line_Attribs_Ext_Tbl_Type;
          l_line_rltship_tbl ASO_QUOTE_PUB.Line_Rltship_Tbl_Type;
          l_Price_Adjustment_Tbl ASO_QUOTE_PUB.Price_Adj_Tbl_Type;
          l_Price_Adj_Attr_Tbl ASO_QUOTE_PUB.Price_Adj_Attr_Tbl_Type;
          l_price_adj_rltship_tbl ASO_QUOTE_PUB.Price_Adj_Rltship_Tbl_Type;
          l_ln_Price_Attr_Tbl ASO_QUOTE_PUB.Price_Attributes_Tbl_Type;
          l_ln_payment_tbl ASO_QUOTE_PUB.Payment_Tbl_Type;
          l_ln_shipment_tbl ASO_QUOTE_PUB.Shipment_Tbl_Type;
          l_ln_freight_charge_tbl ASO_QUOTE_PUB.Freight_Charge_Tbl_Type;
          l_ln_tax_detail_tbl ASO_QUOTE_PUB.Tax_Detail_Tbl_Type;
          l_hd_Sales_Credit_Tbl ASO_QUOTE_PUB.Sales_Credit_Tbl_Type:= ASO_QUOTE_PUB.G_MISS_Sales_Credit_Tbl;
          l_ln_Sales_Credit_Tbl ASO_QUOTE_PUB.Sales_Credit_Tbl_Type:= ASO_QUOTE_PUB.G_MISS_Sales_Credit_Tbl;
          lx_qte_header_rec ASO_QUOTE_PUB.Qte_Header_Rec_Type;
          lx_qte_line_tbl ASO_QUOTE_PUB.Qte_Line_Tbl_Type;
          lx_qte_line_dtl_tbl ASO_QUOTE_PUB.Qte_Line_Dtl_Tbl_Type;
          lx_hd_Price_Attr_Tbl ASO_QUOTE_PUB.Price_Attributes_Tbl_Type;
          lx_hd_payment_tbl ASO_QUOTE_PUB.Payment_Tbl_Type;
          lx_hd_shipment_tbl ASO_QUOTE_PUB.Shipment_Tbl_Type;
          lx_hd_freight_charge_tbl ASO_QUOTE_PUB.Freight_Charge_Tbl_Type;
          lx_hd_tax_detail_tbl ASO_QUOTE_PUB.Tax_Detail_Tbl_Type;
          lX_hd_Attr_Ext_Tbl ASO_QUOTE_PUB.Line_Attribs_Ext_Tbl_Type;
          lx_Line_Attr_Ext_Tbl ASO_QUOTE_PUB.Line_Attribs_Ext_Tbl_Type;
          lx_line_rltship_tbl ASO_QUOTE_PUB.Line_Rltship_Tbl_Type;
          lx_Price_Adjustment_Tbl ASO_QUOTE_PUB.Price_Adj_Tbl_Type;
          lx_Price_Adj_Attr_Tbl ASO_QUOTE_PUB.Price_Adj_Attr_Tbl_Type;
          lx_price_adj_rltship_tbl ASO_QUOTE_PUB.Price_Adj_Rltship_Tbl_Type;
          lx_hd_Sales_Credit_Tbl ASO_QUOTE_PUB.Sales_Credit_Tbl_Type;
          lx_Quote_Party_Tbl ASO_QUOTE_PUB.Quote_Party_Tbl_Type;
          lX_Ln_Sales_Credit_Tbl ASO_QUOTE_PUB.Sales_Credit_Tbl_Type;
          lX_Ln_Quote_Party_Tbl ASO_QUOTE_PUB.Quote_Party_Tbl_Type;

          lx_ln_Price_Attr_Tbl ASO_QUOTE_PUB.Price_Attributes_Tbl_Type;
          lx_ln_payment_tbl ASO_QUOTE_PUB.Payment_Tbl_Type;
          lx_ln_shipment_tbl ASO_QUOTE_PUB.Shipment_Tbl_Type;
          lx_ln_freight_charge_tbl ASO_QUOTE_PUB.Freight_Charge_Tbl_Type;
          lx_ln_tax_detail_tbl ASO_QUOTE_PUB.Tax_Detail_Tbl_Type;
          lX_return_status VARCHAR2(1);
          lx_msg_count NUMBER;
          lx_msg_data VARCHAR2(2000);
          l_payment_rec ASO_QUOTE_PUB.Payment_Rec_Type;
          l_shipment_rec ASO_QUOTE_PUB.Shipment_Rec_Type;
          l_tax_detail_rec ASO_QUOTE_PUB.Tax_Detail_Rec_Type;

          quote NUMBER;
          qte_lin
          NUMBER;
          my_message VARCHAR2(2000);

          CURSOR c_quote(c_qte_header_id
          NUMBER) IS
          SELECT last_update_date FROM ASO_QUOTE_HEADERS_ALL
          WHERE
          quote_header_id = c_qte_header_id;

          lc_last_update_date
          date;

          CURSOR c_quoteLine(c_qte_line_id NUMBER) IS
          SELECT
          last_update_date FROM ASO_QUOTE_Lines_ALL
          WHERE quote_line_id =
          c_qte_line_id;

          BEGIN

          -- Get the Last Updated Date

          OPEN
          c_quote(l_qte_header_rec.quote_header_id);
          FETCH c_quote INTO
          lc_last_update_date;
          CLOSE c_quote;

          -- Quote Header Id

          quote := 5864;

          -- Quote Header Rec

          l_qte_header_rec.quote_header_id := quote;
          l_qte_header_rec.last_update_date := lc_last_update_date;
          l_control_rec.last_update_date := lc_last_update_date;

          -- Quote Line
          Rec

          l_qte_line_rec.inventory_item_id := 123;
          l_qte_line_rec.organization_id := 204;
          l_qte_line_rec.quantity := 6;
          l_qte_line_rec.uom_code := 'Ea';
          l_qte_line_rec.line_category_code := 'ORDER';
          l_qte_line_rec.OPERATION_CODE := 'CREATE';
          l_qte_line_rec.quote_header_id := quote;
          l_qte_line_rec.last_update_date := lc_last_update_date;

          l_Qte_Line_Tbl(1) := l_qte_line_rec;

          ASO_QUOTE_PUB.Update_Quote(p_api_version_number => 1.0,
          p_init_msg_list => FND_API.G_TRUE,
          p_commit =>
          FND_API.G_TRUE,
          p_control_rec => l_control_rec,
          p_qte_header_rec => l_qte_header_rec,
          P_Qte_Line_Tbl => l_Qte_Line_Tbl,
          P_Qte_Line_dtl_Tbl => l_Qte_Line_dtl_Tbl,
          p_hd_tax_detail_tbl => l_hd_tax_detail_tbl,
          P_ln_Payment_Tbl => l_ln_Payment_Tbl,
          P_hd_Sales_Credit_Tbl => l_hd_Sales_Credit_Tbl,
          P_ln_Sales_Credit_Tbl => l_ln_Sales_Credit_Tbl,
          P_ln_Shipment_Tbl => l_ln_shipment_tbl,
          x_Qte_Header_Rec => lx_qte_header_rec,
          X_Qte_Line_Tbl => lx_Qte_Line_Tbl,
          X_Qte_Line_Dtl_Tbl => lx_Qte_Line_Dtl_Tbl,
          X_hd_Price_Attributes_Tbl => lx_hd_Price_Attr_Tbl,
          X_hd_Payment_Tbl => lx_hd_Payment_Tbl,
          X_hd_Shipment_Tbl => lx_hd_Shipment_Tbl,
          X_hd_Freight_Charge_Tbl => lx_hd_Freight_Charge_Tbl,
          X_hd_Tax_Detail_Tbl => lx_hd_Tax_Detail_Tbl,
          X_hd_Attr_Ext_Tbl => lX_hd_Attr_Ext_Tbl,
          X_hd_Sales_Credit_Tbl => lx_hd_Sales_Credit_Tbl,
          X_hd_Quote_Party_Tbl => lx_Quote_Party_Tbl,
          x_Line_Attr_Ext_Tbl => lx_Line_Attr_Ext_Tbl,
          X_line_rltship_tbl => lx_line_rltship_tbl,
          X_Price_Adjustment_Tbl => lx_Price_Adjustment_Tbl,
          X_Price_Adj_Attr_Tbl => lx_Price_Adj_Attr_Tbl,

          X_Price_Adj_Rltship_Tbl => lx_Price_Adj_Rltship_Tbl,
          X_ln_Price_Attributes_Tbl => lx_ln_Price_Attr_Tbl,
          X_ln_Payment_Tbl => lx_ln_Payment_Tbl,
          X_ln_Shipment_Tbl => lx_ln_Shipment_Tbl,
          X_ln_Freight_Charge_Tbl => lx_ln_Freight_Charge_Tbl,
          X_ln_Tax_Detail_Tbl => lx_ln_Tax_Detail_Tbl,
          X_Ln_Sales_Credit_Tbl => lX_Ln_Sales_Credit_Tbl,
          X_Ln_Quote_Party_Tbl => lX_Ln_Quote_Party_Tbl,
          X_Return_Status => lx_Return_Status,
          X_Msg_Count => lx_Msg_Count,
          X_Msg_Data => lx_Msg_Data);

          fnd_msg_pub.count_and_get( p_encoded => 'F', p_count => lx_msg_count, p_data => lx_msg_data);
          dbms_output.put_line('no. of FND messages :'||lx_msg_count);
          for k in 1 .. lx_msg_count
          loop
          lx_msg_data := fnd_msg_pub.get(p_msg_index => k,p_encoded => 'F');
          dbms_output.put_line('Error msg: '||substr(lx_msg_data,1,240));
          end
          loop;

          dbms_output.put_line(lx_return_status);
          dbms_output.put_line(to_char(lx_msg_count));
          dbms_output.put_line(lx_msg_data);

          dbms_output.put_line('qte_header_id:
          '||to_char(lx_qte_header_rec
          .quote_header_id));
          dbms_output.put_line('end');

          END;
          /