Friday, October 4, 2013

API to Check the Available credit On a Sales Order.


 --Mainline Function that will read an Order Header and Determine if should be checked, Consumes available Credit and applies a credit hold if Appropriate

DECLARE
   l_header_id                                       NUMBER;
   l_calling_action                                  VARCHAR2 (200);
   l_msg_index                                       NUMBER;
   l_error_message                                   VARCHAR2 (2000);
   x_msg_count                                       NUMBER;
   x_msg_data                                        VARCHAR2 (200);
   x_result_out                                      VARCHAR2 (200);
   x_return_status                                   VARCHAR2 (200);
BEGIN
   l_header_id                                              := 885421;
   l_calling_action                                         := 'BOOKING';
   x_msg_count                                              := NULL;
   x_msg_data                                               := NULL;
   x_result_out                                             := NULL;
   x_return_status                                          := NULL;
   apps.oe_credit_pub.check_available_credit (p_header_id                   => l_header_id
                                            , p_calling_action              => l_calling_action
                                            , p_msg_count                   => x_msg_count
                                            , p_msg_data                    => x_msg_data
                                            , p_result_out                  => x_result_out
                                            , p_return_status               => x_return_status
                                             );

   IF x_return_status <> fnd_api.g_ret_sts_success
   THEN
      FOR i IN 1 .. x_msg_count
      LOOP
         apps.fnd_msg_pub.get (p_msg_index                   => i
                             , p_encoded                     => fnd_api.g_false
                             , p_data                        => x_msg_data
                             , p_msg_index_out               => l_msg_index
                              );

         IF l_error_message IS NULL
         THEN
            l_error_message                                          := SUBSTR (x_msg_data, 1, 250);
         ELSE
            l_error_message                                          :=
                                                                      l_error_message || ' /' || SUBSTR (x_msg_data, 1, 250);
         END IF;
      END LOOP;

      DBMS_OUTPUT.put_line ('*****************************************');
      DBMS_OUTPUT.put_line ('API Error : ' || l_error_message);
      DBMS_OUTPUT.put_line ('*****************************************');
      ROLLBACK;
   ELSE
      DBMS_OUTPUT.put_line ('*****************************************');
      DBMS_OUTPUT.put_line ('Resul Out For Header Id : ' || l_header_id || '---' || x_result_out);
      DBMS_OUTPUT.put_line ('*****************************************');
      COMMIT;
   END IF;
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Error is ' || SQLCODE || '---' || SQLERRM);
END;

API to release the Hold on Order

DECLARE
   l_order_tbl                                       oe_holds_pvt.order_tbl_type;
   x_return_status                                   VARCHAR2 (30);
   x_msg_data                                        VARCHAR2 (256);
   x_msg_count                                       NUMBER;
   l_msg_index_out                                   NUMBER;
   l_error_message                                   VARCHAR2 (2000);
BEGIN
   fnd_global.apps_initialize (1318, 21623, 660);   -- pass in user_id, responsibility_id, and application_id
   oe_debug_pub.initialize;
   oe_debug_pub.setdebuglevel (5);
   oe_msg_pub.initialize;
   l_order_tbl (1).header_id                                := '<order header id>';
   oe_debug_pub.ADD ('Just before calling OE_Holds_PUB.Apply_Holds:');
   oe_holds_pub.release_holds (p_api_version                 => 1.0
                             , p_order_tbl                   => l_order_tbl
                             , p_hold_id                     => '<hold id>'
                             , p_release_reason_code         => '<Hold Release reason Code>'
                             , p_release_comment             => '<Hold release Addiotnal Commnent if any>'
                             , x_return_status               => x_return_status
                             , x_msg_count                   => x_msg_count
                             , x_msg_data                    => x_msg_data
                              );
   oe_debug_pub.ADD ('Just after calling OE_Holds_PUB.Apply_Holds:');

   IF x_return_status <> fnd_api.g_ret_sts_success
   THEN
      FOR i IN 1 .. x_msg_count
      LOOP
         apps.fnd_msg_pub.get (p_msg_index                   => i
                             , p_encoded                     => fnd_api.g_false
                             , p_data                        => x_msg_data
                             , p_msg_index_out               => l_msg_index_out
                              );

         IF l_error_message IS NULL
         THEN
            l_error_message                                          := SUBSTR (x_msg_data, 1, 250);
         ELSE
            l_error_message                                          :=
                                                                      l_error_message || ' /' || SUBSTR (x_msg_data, 1, 250);
         END IF;
      END LOOP;

      DBMS_OUTPUT.put_line ('*****************************************');
      DBMS_OUTPUT.put_line ('API Error : ' || l_error_message);
      DBMS_OUTPUT.put_line ('*****************************************');
      ROLLBACK;
   ELSE
      DBMS_OUTPUT.put_line ('*****************************************');
      DBMS_OUTPUT.put_line ('Hold Released Successfully ');
      DBMS_OUTPUT.put_line ('*****************************************');
      COMMIT;
   END IF;

   oe_debug_pub.debug_off;
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Error is ' || SQLCODE || '---' || SQLERRM);
END;

API to Apply the Hold on Order


This script can be used on Version 12.0 and later

DECLARE
   l_file                VARCHAR2 (100);
   l_data                VARCHAR2 (2000);
   l_hold_source_rec     oe_holds_pvt.hold_source_rec_type;
   l_org                 NUMBER := 204;
   l_file_val            VARCHAR2 (100);
   l_error_message       VARCHAR2 (2000);
   l_msg_index_out       NUMBER (10);
   x_return_status       VARCHAR2 (2000);
   x_msg_count           NUMBER;
   x_msg_data            VARCHAR2 (2000);
   x_debug_file          VARCHAR2 (100);
BEGIN
-- Source the Environment variables
   fnd_global.apps_initialize (
                          user_id  => '<user_id>'
                        , resp_id   => '<resp_id>'
                        , resp_appl_id => '<resp_appl_id>'
                        , security_group_id => '<security_group_id>'
                              );
   DBMS_OUTPUT.ENABLE (1000000);
   oe_debug_pub.initialize;
   oe_debug_pub.setdebuglevel (5);
   oe_debug_pub.debug_on;
   l_file_val   := oe_debug_pub.set_debug_mode ('FILE');
   DBMS_OUTPUT.put_line ('.');
   DBMS_OUTPUT.put_line (' Log File Name and Location :- ' ||                 oe_debug_pub.g_dir || '/' || oe_debug_pub.g_file);
   DBMS_OUTPUT.put_line ('.');
   mo_global.set_policy_context ('S', l_org);
   l_hold_source_rec   := oe_holds_pvt.g_miss_hold_source_rec;
   l_hold_source_rec.hold_id := '<hold_id>';
   l_hold_source_rec.hold_entity_code := 'O';   -- order level hold
   l_hold_source_rec.hold_entity_id:= '<header_id of the order>';
   l_hold_source_rec.header_id := '<header_id of the order>';
   x_return_status   := NULL;
   x_msg_data        := NULL;
   x_msg_count        := NULL;
   oe_debug_pub.ADD ('Just Before calling OE_Holds_PUB.Apply_Holds:');
   oe_holds_pub.apply_holds (p_api_version  => 1.0
                           , p_init_msg_list=> fnd_api.g_true
                           , p_commit=> fnd_api.g_true
                           , p_hold_source_rec => l_hold_source_rec
                           , x_return_status => x_return_status
                           , x_msg_count => x_msg_count
                           , x_msg_data  => x_msg_data
                            );
   oe_debug_pub.ADD ('Just After calling OE_Holds_PUB.Apply_Holds:');

   IF x_return_status <> fnd_api.g_ret_sts_success
   THEN
      FOR i IN 1 .. x_msg_count
      LOOP
         apps.fnd_msg_pub.get (p_msg_index  => i
                             , p_encoded   => fnd_api.g_false
                             , p_data      => x_msg_data
                             , p_msg_index_out => l_msg_index_out
                              );

         IF l_error_message IS NULL
         THEN
            l_error_message  := SUBSTR (x_msg_data, 1, 250);
         ELSE
            l_error_message :=                                                   l_error_message || ' /' || SUBSTR (x_msg_data, 1, 250);
         END IF;
      END LOOP;
      DBMS_OUTPUT.put_line ('API Error : ' || l_error_message);
      ROLLBACK;
   ELSE
      DBMS_OUTPUT.put_line ('Hold Applied Successfully ');
      COMMIT;
   END IF;
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Error is ' || SQLCODE || '---' || SQLERRM);
END;

API to Apply the Hold on Order


This script can be used on Version 12.0 and later

DECLARE
   l_file                VARCHAR2 (100);
   l_data                VARCHAR2 (2000);
   l_hold_source_rec     oe_holds_pvt.hold_source_rec_type;
   l_org                 NUMBER := 204;
   l_file_val            VARCHAR2 (100);
   l_error_message       VARCHAR2 (2000);
   l_msg_index_out       NUMBER (10);
   x_return_status       VARCHAR2 (2000);
   x_msg_count           NUMBER;
   x_msg_data            VARCHAR2 (2000);
   x_debug_file          VARCHAR2 (100);
BEGIN
-- Source the Environment variables
   fnd_global.apps_initialize (
                          user_id  => '<user_id>'
                        , resp_id   => '<resp_id>'
                        , resp_appl_id => '<resp_appl_id>'
                        , security_group_id => '<security_group_id>'
                              );
   DBMS_OUTPUT.ENABLE (1000000);
   oe_debug_pub.initialize;
   oe_debug_pub.setdebuglevel (5);
   oe_debug_pub.debug_on;
   l_file_val   := oe_debug_pub.set_debug_mode ('FILE');
   DBMS_OUTPUT.put_line ('.');
   DBMS_OUTPUT.put_line (' Log File Name and Location :- ' ||                 oe_debug_pub.g_dir || '/' || oe_debug_pub.g_file);
   DBMS_OUTPUT.put_line ('.');
   mo_global.set_policy_context ('S', l_org);
   l_hold_source_rec   := oe_holds_pvt.g_miss_hold_source_rec;
   l_hold_source_rec.hold_id := '<hold_id>';
   l_hold_source_rec.hold_entity_code := 'O';   -- order level hold
   l_hold_source_rec.hold_entity_id:= '<header_id of the order>';
   l_hold_source_rec.header_id := '<header_id of the order>';
   x_return_status   := NULL;
   x_msg_data        := NULL;
   x_msg_count        := NULL;
   oe_debug_pub.ADD ('Just Before calling OE_Holds_PUB.Apply_Holds:');
   oe_holds_pub.apply_holds (p_api_version  => 1.0
                           , p_init_msg_list=> fnd_api.g_true
                           , p_commit=> fnd_api.g_true
                           , p_hold_source_rec => l_hold_source_rec
                           , x_return_status => x_return_status
                           , x_msg_count => x_msg_count
                           , x_msg_data  => x_msg_data
                            );
   oe_debug_pub.ADD ('Just After calling OE_Holds_PUB.Apply_Holds:');

   IF x_return_status <> fnd_api.g_ret_sts_success
   THEN
      FOR i IN 1 .. x_msg_count
      LOOP
         apps.fnd_msg_pub.get (p_msg_index  => i
                             , p_encoded   => fnd_api.g_false
                             , p_data      => x_msg_data
                             , p_msg_index_out => l_msg_index_out
                              );

         IF l_error_message IS NULL
         THEN
            l_error_message  := SUBSTR (x_msg_data, 1, 250);
         ELSE
            l_error_message :=                                                   l_error_message || ' /' || SUBSTR (x_msg_data, 1, 250);
         END IF;
      END LOOP;
      DBMS_OUTPUT.put_line ('API Error : ' || l_error_message);
      ROLLBACK;
   ELSE
      DBMS_OUTPUT.put_line ('Hold Applied Successfully ');
      COMMIT;
   END IF;
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('Error is ' || SQLCODE || '---' || SQLERRM);
END;

API to Delete Price List Lines from Price List

DECLARE
   gpr_return_status                                 VARCHAR2 (1) := NULL;
   gpr_msg_count                                     NUMBER := 0;
   gpr_msg_data                                      VARCHAR2 (2000);
   gpr_price_list_rec                                qp_price_list_pub.price_list_rec_type;
   gpr_price_list_val_rec                            qp_price_list_pub.price_list_val_rec_type;
   gpr_price_list_line_tbl                           qp_price_list_pub.price_list_line_tbl_type;
   gpr_price_list_line_val_tbl                       qp_price_list_pub.price_list_line_val_tbl_type;
   gpr_qualifiers_tbl                                qp_qualifier_rules_pub.qualifiers_tbl_type;
   gpr_qualifiers_val_tbl                            qp_qualifier_rules_pub.qualifiers_val_tbl_type;
   gpr_pricing_attr_tbl                              qp_price_list_pub.pricing_attr_tbl_type;
   gpr_pricing_attr_val_tbl                          qp_price_list_pub.pricing_attr_val_tbl_type;
   ppr_price_list_rec                                qp_price_list_pub.price_list_rec_type;
   ppr_price_list_val_rec                            qp_price_list_pub.price_list_val_rec_type;
   ppr_price_list_line_tbl                           qp_price_list_pub.price_list_line_tbl_type;
   ppr_price_list_line_val_tbl                       qp_price_list_pub.price_list_line_val_tbl_type;
   ppr_qualifiers_tbl                                qp_qualifier_rules_pub.qualifiers_tbl_type;
   ppr_qualifiers_val_tbl                            qp_qualifier_rules_pub.qualifiers_val_tbl_type;
   ppr_pricing_attr_tbl                              qp_price_list_pub.pricing_attr_tbl_type;
   ppr_pricing_attr_val_tbl                          qp_price_list_pub.pricing_attr_val_tbl_type;
   k                                                 NUMBER := 1;
   j                                                 NUMBER := 1;
BEGIN
   oe_debug_pub.initialize;
   oe_debug_pub.setdebuglevel (5);
   oe_msg_pub.initialize;
   DBMS_OUTPUT.put_line ('Debug File = ' || oe_debug_pub.g_dir || '/' || oe_debug_pub.g_file);
--dbms_output.put_line('after get price list ');
   /* setup the list_header rec for update */
   gpr_price_list_rec.list_header_id                        := '<price_list_header_id>';
   gpr_price_list_rec.NAME                                  := '<price_list_name>';
   gpr_price_list_rec.list_type_code                        := 'PRL';
   gpr_price_list_rec.description                           := '<price_list_description>';
   gpr_price_list_rec.operation                             := qp_globals.g_opr_update;
-- delete the price list line rec
   gpr_price_list_line_tbl (k).list_header_id               := '<price_list_header_id>';
   gpr_price_list_line_tbl (k).list_line_id                 := '<price_list_line_id>';
   gpr_price_list_line_tbl (k).list_line_type_code          := 'PLL';
   gpr_price_list_line_tbl (k).operation                    := qp_globals.g_opr_delete;
--dbms_output.put_line('before process price list ');
   qp_price_list_pub.process_price_list (p_api_version_number          => 1
                                       , p_init_msg_list               => fnd_api.g_false
                                       , p_return_values               => fnd_api.g_false
                                       , p_commit                      => fnd_api.g_false
                                       , x_return_status               => gpr_return_status
                                       , x_msg_count                   => gpr_msg_count
                                       , x_msg_data                    => gpr_msg_data
                                       , p_price_list_rec              => gpr_price_list_rec
                                       , p_price_list_line_tbl         => gpr_price_list_line_tbl
                                       , p_pricing_attr_tbl            => gpr_pricing_attr_tbl
                                       , x_price_list_rec              => ppr_price_list_rec
                                       , x_price_list_val_rec          => ppr_price_list_val_rec
                                       , x_price_list_line_tbl         => ppr_price_list_line_tbl
                                       , x_price_list_line_val_tbl     => ppr_price_list_line_val_tbl
                                       , x_qualifiers_tbl              => ppr_qualifiers_tbl
                                       , x_qualifiers_val_tbl          => ppr_qualifiers_val_tbl
                                       , x_pricing_attr_tbl            => ppr_pricing_attr_tbl
                                       , x_pricing_attr_val_tbl        => ppr_pricing_attr_val_tbl
                                        );
   IF ppr_price_list_line_tbl.COUNT > 0
   THEN
      FOR k IN 1 .. ppr_price_list_line_tbl.COUNT
      LOOP
         DBMS_OUTPUT.put_line ('Record = ' || k || 'Return Status = ' || ppr_price_list_line_tbl (k).return_status);
      END LOOP;
   END IF;
   IF gpr_return_status <> fnd_api.g_ret_sts_success
   THEN
      RAISE fnd_api.g_exc_unexpected_error;
   END IF;
   DBMS_OUTPUT.put_line ('after process price list ');
   FOR k IN 1 .. gpr_msg_count
   LOOP
      gpr_msg_data                                             := oe_msg_pub.get (p_msg_index => k, p_encoded => 'F');
      DBMS_OUTPUT.put_line ('err msg ' || k || ' is: ' || gpr_msg_data);
      NULL;
   END LOOP;
EXCEPTION
   WHEN fnd_api.g_exc_error
   THEN
      gpr_return_status                                        := fnd_api.g_ret_sts_error;
-- Get message count and data
      DBMS_OUTPUT.put_line ('err msg 1 is : ' || gpr_msg_data);
   WHEN fnd_api.g_exc_unexpected_error
   THEN
      gpr_return_status                                        := fnd_api.g_ret_sts_unexp_error;
      DBMS_OUTPUT.put_line (' msg count 2 is : ' || gpr_msg_count);
      FOR k IN 1 .. gpr_msg_count
      LOOP
         gpr_msg_data                                             := oe_msg_pub.get (p_msg_index => k, p_encoded => 'F');
         -- Get message count and data
         DBMS_OUTPUT.put_line ('err msg ' || k || ' is: ' || gpr_msg_data);
         NULL;
      END LOOP;
   WHEN OTHERS
   THEN
      gpr_return_status                                        := fnd_api.g_ret_sts_unexp_error;
      -- Get message count and data
      DBMS_OUTPUT.put_line ('err msg 3 is : ' || gpr_msg_data);
END;
/

HOW to Use QP_PREQ_PUB.PRICE_REQUEST API to Price an Item

For more information please refer to the Metalink Note 759804.1

DECLARE
   p_line_tbl                                        qp_preq_grp.line_tbl_type;
   p_qual_tbl                                        qp_preq_grp.qual_tbl_type;
   p_line_attr_tbl                                   qp_preq_grp.line_attr_tbl_type;
   p_line_detail_tbl                                 qp_preq_grp.line_detail_tbl_type;
   p_line_detail_qual_tbl                            qp_preq_grp.line_detail_qual_tbl_type;
   p_line_detail_attr_tbl                            qp_preq_grp.line_detail_attr_tbl_type;
   p_related_lines_tbl                               qp_preq_grp.related_lines_tbl_type;
   p_control_rec                                     qp_preq_grp.control_record_type;
   x_line_tbl                                        qp_preq_grp.line_tbl_type;
   x_line_qual                                       qp_preq_grp.qual_tbl_type;
   x_line_attr_tbl                                   qp_preq_grp.line_attr_tbl_type;
   x_line_detail_tbl                                 qp_preq_grp.line_detail_tbl_type;
   x_line_detail_qual_tbl                            qp_preq_grp.line_detail_qual_tbl_type;
   x_line_detail_attr_tbl                            qp_preq_grp.line_detail_attr_tbl_type;
   x_related_lines_tbl                               qp_preq_grp.related_lines_tbl_type;
   x_return_status                                   VARCHAR2 (240);
   x_return_status_text                              VARCHAR2 (240);
   qual_rec                                          qp_preq_grp.qual_rec_type;
   line_attr_rec                                     qp_preq_grp.line_attr_rec_type;
   line_rec                                          qp_preq_grp.line_rec_type;
   detail_rec                                        qp_preq_grp.line_detail_rec_type;
   ldet_rec                                          qp_preq_grp.line_detail_rec_type;
   rltd_rec                                          qp_preq_grp.related_lines_rec_type;
   l_pricing_contexts_tbl                            qp_attr_mapping_pub.contexts_result_tbl_type;
   l_qualifier_contexts_tbl                          qp_attr_mapping_pub.contexts_result_tbl_type;
   v_line_tbl_cnt                                    INTEGER;
   i                                                 BINARY_INTEGER;
   l_version                                         VARCHAR2 (240);
   l_file_val                                        VARCHAR2 (60);
BEGIN
   oe_debug_pub.debug_on;
   oe_debug_pub.initialize;
   l_file_val                                               := oe_debug_pub.set_debug_mode ('FILE');
   oe_debug_pub.setdebuglevel (5);
   DBMS_OUTPUT.put_line ('File : ' || l_file_val);
   qp_attr_mapping_pub.build_contexts (p_request_type_code           => 'ONT'
                                     , p_pricing_type                => 'L'
                                     , x_price_contexts_result_tbl   => l_pricing_contexts_tbl
                                     , x_qual_contexts_result_tbl    => l_qualifier_contexts_tbl
                                      );
   v_line_tbl_cnt                                           := 1;
---- Control Record
   p_control_rec.pricing_event                              := 'LINE';   -- 'BATCH';
   p_control_rec.calculate_flag                             := 'Y';   --QP_PREQ_GRP.G_SEARCH_N_CALCULATE;
   p_control_rec.simulation_flag                            := 'N';
   p_control_rec.rounding_flag                              := 'Q';
   p_control_rec.manual_discount_flag                       := 'Y';
   p_control_rec.request_type_code                          := 'ONT';
   p_control_rec.temp_table_insert_flag                     := 'Y';
-------------------------
---- Line Records ---------
   line_rec.request_type_code                               := 'ONT';
   line_rec.line_id                                         := 2125125;   -- Order Line Id. This can be any thing for this script
   line_rec.line_index                                      := '1';   -- Request Line Index
   line_rec.line_type_code                                  := 'LINE';   -- LINE or ORDER(Summary Line)
   line_rec.pricing_effective_date                          := SYSDATE;   -- Pricing as of what date ?
   line_rec.active_date_first                               := SYSDATE;   -- Can be Ordered Date or Ship Date
   line_rec.active_date_second                              := SYSDATE;   -- Can be Ordered Date or Ship Date
   line_rec.active_date_first_type                          := 'NO TYPE';   -- ORD/SHIP
   line_rec.active_date_second_type                         := 'NO TYPE';   -- ORD/SHIP
   line_rec.line_quantity                                   := 1;   -- Ordered Quantity
   line_rec.line_uom_code                                   := 'Ea';   -- Ordered UOM Code
   line_rec.currency_code                                   := 'USD';   -- Currency Code
   line_rec.price_flag                                      := 'Y';   -- Price Flag can have 'Y' , 'N'(No pricing) , 'P'(Phase)
   p_line_tbl (1)                                           := line_rec;
---- Line Attribute Record
   line_attr_rec.line_index                                 := 1;
   line_attr_rec.pricing_context                            := 'ITEM';   --
   line_attr_rec.pricing_attribute                          := 'PRICING_ATTRIBUTE3';
   line_attr_rec.pricing_attr_value_from                    := 'ALL';
   line_attr_rec.validated_flag                             := 'N';
   p_line_attr_tbl (1)                                      := line_attr_rec;
   line_attr_rec.line_index                                 := 1;
   line_attr_rec.pricing_context                            := 'ITEM';   --
   line_attr_rec.pricing_attribute                          := 'PRICING_ATTRIBUTE1';
   line_attr_rec.pricing_attr_value_from                    := '307627';   -- INVENTORY ITEM ID
   line_attr_rec.validated_flag                             := 'N';
   p_line_attr_tbl (2)                                      := line_attr_rec;
---- Qualifier Attribute Record
   qual_rec.line_index                                      := 1;   -- Attributes for the above line. Attributes are attached with the line index
   qual_rec.qualifier_context                               := 'MODLIST';
   qual_rec.qualifier_attribute                             := 'QUALIFIER_ATTRIBUTE4';
   qual_rec.qualifier_attr_value_from                       := '54824';   -- PRICE LIST ID
   qual_rec.comparison_operator_code                        := '=';
   qual_rec.validated_flag                                  := 'Y';
   p_qual_tbl (1)                                           := qual_rec;
   qual_rec.line_index                                      := 1;
   qual_rec.qualifier_context                               := 'CUSTOMER';
   qual_rec.qualifier_attribute                             := 'QUALIFIER_ATTRIBUTE2';
   qual_rec.qualifier_attr_value_from                       := 16071;   -- CUSTOMER ID;
   qual_rec.comparison_operator_code                        := '=';
   qual_rec.validated_flag                                  := 'Y';
   p_qual_tbl (2)                                           := qual_rec;
   qp_preq_pub.price_request (p_line_tbl
                            , p_qual_tbl
                            , p_line_attr_tbl
                            , p_line_detail_tbl
                            , p_line_detail_qual_tbl
                            , p_line_detail_attr_tbl
                            , p_related_lines_tbl
                            , p_control_rec
                            , x_line_tbl
                            , x_line_qual
                            , x_line_attr_tbl
                            , x_line_detail_tbl
                            , x_line_detail_qual_tbl
                            , x_line_detail_attr_tbl
                            , x_related_lines_tbl
                            , x_return_status
                            , x_return_status_text
                             );
-- Return Status Information ..
   DBMS_OUTPUT.put_line ('Return Status text ' || x_return_status_text);
   DBMS_OUTPUT.put_line ('Return Status  ' || x_return_status);
   DBMS_OUTPUT.put_line ('+---------Information Returned to Caller---------------------+ ');
   DBMS_OUTPUT.put_line ('-------------Request Line Information-------------------');
   i                                                        := x_line_tbl.FIRST;
   IF i IS NOT NULL
   THEN
      LOOP
         DBMS_OUTPUT.put_line ('Line Index: ' || x_line_tbl (i).line_index);
         DBMS_OUTPUT.put_line ('Unit_price: ' || x_line_tbl (i).unit_price);
         DBMS_OUTPUT.put_line ('Percent price: ' || x_line_tbl (i).percent_price);
         DBMS_OUTPUT.put_line ('Adjusted Unit Price: ' || x_line_tbl (i).adjusted_unit_price);
         DBMS_OUTPUT.put_line ('Pricing status code: ' || x_line_tbl (i).status_code);
         DBMS_OUTPUT.put_line ('Pricing status text: ' || x_line_tbl (i).status_text);
         EXIT WHEN i = x_line_tbl.LAST;
         i                                                        := x_line_tbl.NEXT (i);
      END LOOP;
   END IF;
   DBMS_OUTPUT.put_line ('-----------Pricing Attributes Information-------------');
   i                                                        := x_line_detail_attr_tbl.FIRST;
   IF i IS NOT NULL
   THEN
      LOOP
         DBMS_OUTPUT.put_line ('Line detail Index ' || x_line_detail_attr_tbl (i).line_detail_index);
         DBMS_OUTPUT.put_line ('Context ' || x_line_detail_attr_tbl (i).pricing_context);
         DBMS_OUTPUT.put_line ('Attribute ' || x_line_detail_attr_tbl (i).pricing_attribute);
         DBMS_OUTPUT.put_line ('Value ' || x_line_detail_attr_tbl (i).pricing_attr_value_from);
         DBMS_OUTPUT.put_line ('Status Code ' || x_line_detail_attr_tbl (i).status_code);
         DBMS_OUTPUT.put_line ('---------------------------------------------------');
         EXIT WHEN i = x_line_detail_attr_tbl.LAST;
         i                                                        := x_line_detail_attr_tbl.NEXT (i);
      END LOOP;
   END IF;
   DBMS_OUTPUT.put_line ('-----------Qualifier Attributes Information-------------');
   i                                                        := x_line_detail_qual_tbl.FIRST;
   IF i IS NOT NULL
   THEN
      LOOP
         DBMS_OUTPUT.put_line ('Line Detail Index ' || x_line_detail_qual_tbl (i).line_detail_index);
         DBMS_OUTPUT.put_line ('Context ' || x_line_detail_qual_tbl (i).qualifier_context);
         DBMS_OUTPUT.put_line ('Attribute ' || x_line_detail_qual_tbl (i).qualifier_attribute);
         DBMS_OUTPUT.put_line ('Value ' || x_line_detail_qual_tbl (i).qualifier_attr_value_from);
         DBMS_OUTPUT.put_line ('Status Code ' || x_line_detail_qual_tbl (i).status_code);
         DBMS_OUTPUT.put_line ('---------------------------------------------------');
         EXIT WHEN i = x_line_detail_qual_tbl.LAST;
         i                                                        := x_line_detail_qual_tbl.NEXT (i);
      END LOOP;
   END IF;
   i                                                        := x_line_detail_tbl.FIRST;
   DBMS_OUTPUT.put_line ('------------Price List/Discount Information------------');
   IF i IS NOT NULL
   THEN
      LOOP
         DBMS_OUTPUT.put_line ('Line Index: ' || x_line_detail_tbl (i).line_index);
         DBMS_OUTPUT.put_line ('Line Detail Index: ' || x_line_detail_tbl (i).line_detail_index);
         DBMS_OUTPUT.put_line ('Line Detail Type:' || x_line_detail_tbl (i).line_detail_type_code);
         DBMS_OUTPUT.put_line ('List Header Id: ' || x_line_detail_tbl (i).list_header_id);
         DBMS_OUTPUT.put_line ('List Line Id: ' || x_line_detail_tbl (i).list_line_id);
         DBMS_OUTPUT.put_line ('List Line Type Code: ' || x_line_detail_tbl (i).list_line_type_code);
         DBMS_OUTPUT.put_line ('Adjustment Amount : ' || x_line_detail_tbl (i).adjustment_amount);
         DBMS_OUTPUT.put_line ('Line Quantity : ' || x_line_detail_tbl (i).line_quantity);
         DBMS_OUTPUT.put_line ('Operand Calculation Code: ' || x_line_detail_tbl (i).operand_calculation_code);
         DBMS_OUTPUT.put_line ('Operand value: ' || x_line_detail_tbl (i).operand_value);
         DBMS_OUTPUT.put_line ('Automatic Flag: ' || x_line_detail_tbl (i).automatic_flag);
         DBMS_OUTPUT.put_line ('Override Flag: ' || x_line_detail_tbl (i).override_flag);
         DBMS_OUTPUT.put_line ('status_code: ' || x_line_detail_tbl (i).status_code);
         DBMS_OUTPUT.put_line ('status text: ' || x_line_detail_tbl (i).status_text);
         DBMS_OUTPUT.put_line ('-------------------------------------------');
         EXIT WHEN i = x_line_detail_tbl.LAST;
         i                                                        := x_line_detail_tbl.NEXT (i);
      END LOOP;
   END IF;
   DBMS_OUTPUT.put_line ('--------------Related Lines Information for Price Breaks/Service Items---------------');
   i                                                        := x_related_lines_tbl.FIRST;
   IF i IS NOT NULL
   THEN
      LOOP
         DBMS_OUTPUT.put_line ('Line Index :' || x_related_lines_tbl (i).line_index);
         DBMS_OUTPUT.put_line ('Line Detail Index: ' || x_related_lines_tbl (i).line_detail_index);
         DBMS_OUTPUT.put_line ('Relationship Type Code: ' || x_related_lines_tbl (i).relationship_type_code);
         DBMS_OUTPUT.put_line ('Related Line Index: ' || x_related_lines_tbl (i).related_line_index);
         DBMS_OUTPUT.put_line ('Related Line Detail Index: ' || x_related_lines_tbl (i).related_line_detail_index);
         DBMS_OUTPUT.put_line ('Status Code: ' || x_related_lines_tbl (i).status_code);
         EXIT WHEN i = x_related_lines_tbl.LAST;
         i                                                        := x_related_lines_tbl.NEXT (i);
      END LOOP;
   END IF;
END;