Friday, 1 April 2011

okc_price_adjustment_pub.create_price_adjustment - API to create new price adjustment record

Here is sample snippet code for creating new price adjustment record for a Service Contract in R12

Fetch the line details for a given Service Contract.


DECLARE
      l_p_patv_rec    apps.okc_price_adjustment_pvt.patv_rec_type;
      l_x_patv_rec    apps.okc_price_adjustment_pvt.patv_rec_type;
      l_init_msg_list   VARCHAR2 (1000);
      l_x_retn_status  VARCHAR2 (10);
      l_x_msg_count  NUMBER;
      l_x_msg_data    VARCHAR2 (1000);

BEGIN

         l_p_patv_rec.cle_id    := 100;   --OKC line id, for a given Service Contract.
         l_p_patv_rec.modifier_mechanism_type_code := 'DLT';
         l_p_patv_rec.operand := 4.5;   --Header Discount,Rate;
         l_p_patv_rec.arithmetic_operator := '%';
         l_p_patv_rec.automatic_flag := 'N';
         l_p_patv_rec.update_allowed := 'Y';
         l_p_patv_rec.updated_flag := 'Y';
         l_p_patv_rec.applied_flag := 'Y';
         l_p_patv_rec.pricing_phase_id := 2;
         l_p_patv_rec.list_line_type_code := 'DIS';
         l_p_patv_rec.list_header_id :=  6016;  --Price List Header ID
         l_p_patv_rec.list_line_id := 6019;  ---Price List Line ID
         l_p_patv_rec.pricing_group_sequence := 1;
         l_p_patv_rec.accrual_flag := 'N';
         l_p_patv_rec.list_line_no := l_p_patv_rec.list_line_id;
         l_p_patv_rec.modifier_level_code := 'LINE';
         l_p_patv_rec.proration_type_code := NULL;

         apps.okc_price_adjustment_pub.create_price_adjustment
                       (p_api_version        => 1.0,
                        p_init_msg_list       => l_init_msg_list,
                        x_return_status      => l_x_retn_status,
                        x_msg_count         => l_x_msg_count,
                        x_msg_data           => l_x_msg_data,
                        p_patv_rec            => l_p_patv_rec,
                        x_patv_rec            => l_x_patv_rec
                        );
      IF (l_x_return_status <> 'S')
      THEN
         DBMS_OUTPUT.put_line ('API Error'|| l_x_return_status);
      ELSE
         DBMS_OUTPUT.put_line ('API Success'|| l_x_return_status);
      END IF;

END;
/

Here is the output created for the Service contracts -> Price Adjustments



No comments:

Post a Comment