0 Replies Latest reply on Sep 16, 2013 2:16 PM by 933351

    QP_Modifiers_PUB.Process_Modifiers returning an E status.

    933351

      Hi All,

      I am creating Modifier with the following code. this code is working fine for " Discount "  when i am trying  to create for " Promotional Goods "

      it shows the error. i am providing data for  "Define Details ".

       

      ********************************************************************************************************************************************************************************

       

      DECLARE

        

          l_control_rec                           QP_GLOBALS.Control_Rec_Type;

          l_return_status                         VARCHAR2(1);

          x_msg_count                             NUMBER;

          x_msg_data                              VARCHAR2(2000);

          x_msg_index                             NUMBER; 

           

          l_MODIFIER_LIST_rec                     QP_Modifiers_PUB.Modifier_List_Rec_Type;

          l_MODIFIER_LIST_rec1                    QP_Modifiers_PUB.Modifier_List_Rec_Type;

          l_MODIFIER_LIST_val_rec                 QP_Modifiers_PUB.Modifier_List_Val_Rec_Type;

          l_MODIFIERS_tbl                         QP_Modifiers_PUB.Modifiers_Tbl_Type;

          l_MODIFIERS_tbl1                        QP_Modifiers_PUB.Modifiers_Tbl_Type;

          l_MODIFIERS_val_tbl                     QP_Modifiers_PUB.Modifiers_Val_Tbl_Type;

          l_QUALIFIERS_tbl                        QP_Qualifier_Rules_PUB.Qualifiers_Tbl_Type;

          l_QUALIFIERS_val_tbl                    QP_Qualifier_Rules_PUB.Qualifiers_Val_Tbl_Type;

          l_PRICING_ATTR_tbl                      QP_Modifiers_PUB.Pricing_Attr_Tbl_Type;

          l_PRICING_ATTR_val_tbl                  QP_Modifiers_PUB.Pricing_Attr_Val_Tbl_Type;

         

          l_x_MODIFIER_LIST_rec                   QP_Modifiers_PUB.Modifier_List_Rec_Type;

          l_x_MODIFIER_LIST_val_rec               QP_Modifiers_PUB.Modifier_List_Val_Rec_Type;

          l_x_MODIFIERS_tbl                       QP_Modifiers_PUB.Modifiers_Tbl_Type;

          l_x_MODIFIERS_val_tbl                   QP_Modifiers_PUB.Modifiers_Val_Tbl_Type;

          l_x_QUALIFIERS_tbl                      QP_Qualifier_Rules_PUB.Qualifiers_Tbl_Type;

          l_x_QUALIFIERS_val_tbl                  QP_Qualifier_Rules_PUB.Qualifiers_Val_Tbl_Type;

          l_x_PRICING_ATTR_tbl                    QP_Modifiers_PUB.Pricing_Attr_Tbl_Type;

          l_x_PRICING_ATTR_val_tbl                QP_Modifiers_PUB.Pricing_Attr_Val_Tbl_Type;

         

          mll_rec                                 qp_list_lines%ROWTYPE;

          pra_rec                                 qp_pricing_attributes%ROWTYPE;

          l_msg_tbl                               OE_MSG_PUB.msg_tbl_type;

         

      BEGIN

       

         -- MO_GLOBAL.SET_POLICY_CONTEXT('S',84);

          --FND_GLOBAL.APPS_INITIALIZE(2113,21663,661);

          FND_GLOBAL.APPS_INITIALIZE(USER_ID=>1110,RESP_ID=>NULL,RESP_APPL_ID=>NULL);

          MO_GLOBAL.init('ONT');

        

          /* Create a Modifier header of type 'PRO' (Promotion) */

      --   l_MODIFIER_LIST_rec.list_header_id          := 17105;  --In case of Header Update,Pass this..and comment lines code

      /*  

          l_MODIFIER_LIST_rec.currency_code          := 'USD';

          l_MODIFIER_LIST_rec.list_type_code         := 'DLT';

          l_MODIFIER_LIST_rec.start_date_active      := sysdate;

          l_MODIFIER_LIST_rec.end_date_active        := sysdate+10;

          l_MODIFIER_LIST_rec.source_system_code     := 'QP';

          l_MODIFIER_LIST_rec.active_flag            := 'Y';

          l_MODIFIER_LIST_rec.name                   := 'STEST12345';

          l_MODIFIER_LIST_rec.description            := 'STEST12345';

          l_MODIFIER_LIST_rec.version_no             := NULL;

          l_MODIFIER_LIST_rec.pte_code               := 'ORDFUL';

          l_MODIFIER_LIST_rec.operation              := QP_GLOBALS.G_OPR_CREATE; --QP_GLOBALS.G_OPR_CREATE;--G_OPR_NONE; --QP_GLOBALS.G_OPR_UPDATE;

      /*

          /* Create a Modifier line to specify 'Get 10% discount' condition */

      /* Modifier Summery Columns */  

          l_MODIFIERS_tbl(1).list_header_id          := 17105;   --Comment Header Code and pass list_header_id if you are creating only Line

        --  l_MODIFIERS_tbl(1).list_line_id            := 28750;   --when updating line number pass the line number

          l_MODIFIERS_tbl(1).list_line_type_code     := 'PRG';

          l_MODIFIERS_tbl(1).automatic_flag          := 'Y';

          l_MODIFIERS_tbl(1).modifier_level_code     := 'LINE';

          l_MODIFIERS_tbl(1).accrual_flag            := 'N';

          l_MODIFIERS_tbl(1).start_date_active       := '18-SEP-2013';--sysdate+4;

          l_MODIFIERS_tbl(1).end_date_active         := '21-OCT-2013';           --sysdate+7;

          l_MODIFIERS_tbl(1).price_break_type_code   := 'RECURRING';

          l_MODIFIERS_tbl(1).product_precedence      := 220;

         

      /* Define Details */   

       

          l_MODIFIERS_tbl(1).arithmetic_operator        := '%';

          l_MODIFIERS_tbl(1).pricing_group_sequence     := 1;

          l_MODIFIERS_tbl(1).pricing_phase_id           := 2;--1121;

          l_MODIFIERS_tbl(1).operand                    := 50;

          l_MODIFIERS_tbl(1).benefit_price_list_line_id := 27339;

          l_MODIFIERS_tbl(1).benefit_qty                := 1;

          l_MODIFIERS_tbl(1).benefit_uom_code           := 'PCS';

          l_MODIFIERS_tbl(1).modifier_parent_index      := 1;

          l_MODIFIERS_tbl(1).operation                  := QP_GLOBALS.G_OPR_CREATE;

         

      /* Pricing Attributes */

          l_PRICING_ATTR_tbl(1).product_attribute_context  := 'ITEM';

          l_PRICING_ATTR_tbl(1).product_attribute          := 'PRICING_ATTRIBUTE1';

          l_PRICING_ATTR_tbl(1).product_attr_value         := '85963'; --Inventory Item Id

          l_PRICING_ATTR_tbl(1).pricing_attribute_context  :=  'VOLUME';--null;

          l_PRICING_ATTR_tbl(1).pricing_attribute          := 'VOLUME';

          l_PRICING_ATTR_tbl(1).pricing_attr_value_from    := 60;

          l_PRICING_ATTR_tbl(1).comparison_operator_code   := 'BETWEEN';

          l_PRICING_ATTR_tbl(1).product_uom_code           := 'PCS';

          l_PRICING_ATTR_tbl(1).excluder_flag              := 'N';

          l_PRICING_ATTR_tbl(1).accumulate_flag            := 'N';

          l_PRICING_ATTR_tbl(1).pricing_attribute_datatype := 'N';

          l_PRICING_ATTR_tbl(1).product_attribute_datatype := 'C';

          l_PRICING_ATTR_tbl(1).MODIFIERS_index            := 1;

          l_PRICING_ATTR_tbl(1).operation                  := QP_GLOBALS.G_OPR_CREATE;

        

         

        

          /* Call the Modifiers Public API to create the modifier header and a modifier line */

        

          OE_MSG_PUB.Initialize;

          QP_Modifiers_PUB.Process_Modifiers(

                                             p_api_version_number   => 1.0

                                            ,p_init_msg_list        => FND_API.G_TRUE

                                            ,p_return_values        => FND_API.G_TRUE

                                            ,p_commit               => FND_API.G_TRUE

                                            ,x_return_status        => l_return_status

                                            ,x_msg_count            => x_msg_count

                                            ,x_msg_data             => x_msg_data

                                            --,p_MODIFIER_LIST_rec    => l_MODIFIER_LIST_rec

                                            ,p_MODIFIERS_tbl        => l_MODIFIERS_tbl

                                          --,p_QUALIFIERS_tbl       => l_QUALIFIERS_tbl

                                            ,p_PRICING_ATTR_tbl     => l_PRICING_ATTR_tbl

                                            ,x_MODIFIER_LIST_rec    => l_MODIFIER_LIST_rec1

                                            ,x_MODIFIER_LIST_val_rec=> l_MODIFIER_LIST_val_rec

                                            ,x_MODIFIERS_tbl        => l_MODIFIERS_tbl1

                                            ,x_MODIFIERS_val_tbl    => l_MODIFIERS_val_tbl

                                            ,x_QUALIFIERS_tbl       => l_QUALIFIERS_tbl

                                            ,x_QUALIFIERS_val_tbl   => l_QUALIFIERS_val_tbl

                                            ,x_PRICING_ATTR_tbl     => l_PRICING_ATTR_tbl

                                            ,x_PRICING_ATTR_val_tbl => l_PRICING_ATTR_val_tbl

                                          );

                                         

          DBMS_OUTPUT.PUT_LINE ('Status:' || l_return_status);

        

          IF l_return_status <> FND_API.G_RET_STS_SUCCESS

          THEN

              RAISE FND_API.G_EXC_UNEXPECTED_ERROR;

          ELSE

              OE_MSG_PUB.get_msg_tbl( l_msg_tbl );

        

           IF l_msg_tbl.COUNT > 0

           THEN

        

            FOR i IN l_msg_tbl.FIRST..l_msg_tbl.LAST

            LOOP     

                DBMS_OUTPUT.PUT_LINE('Get Order Line API Error : '||l_msg_tbl(i).message);    

            END LOOP;

          

           END IF;  

        

              DBMS_OUTPUT.PUT_LINE('mod. tbl cnt:' || l_MODIFIERS_tbl1.count);

          COMMIT;

          END IF;

        

      EXCEPTION

       

          WHEN FND_API.G_EXC_ERROR

          THEN

              l_return_status := FND_API.G_RET_STS_ERROR;

              --Get message count and data

              DBMS_OUTPUT.PUT_LINE('err msg 1 is : ' || x_msg_data);

        

          WHEN FND_API.G_EXC_UNEXPECTED_ERROR

          THEN

              l_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;

              dbms_output.put_line(' msg count 2 is : ' || x_msg_count);

        

              FOR k IN 1 .. x_msg_count

              LOOP

                  x_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: ' || x_msg_data);

              END LOOP;

        

          WHEN OTHERS

          THEN

              l_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;

              dbms_output.put_line(' msg count 2 is : ' || x_msg_count);

         

              FOR k IN 1 .. x_msg_count

              LOOP

                  x_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: ' || x_msg_data);

              END LOOP;

      END;

      ******************************************************************************************************************************************************************************

      Out put :

      Status:E

      msg count 2 is : 1

      err msg 1is: You must define a Get Product in "Define Details" for the following modifier types: Other Item Discount or Promotional Goods.

      ******************************************************************************************************************************************************************************

       

      Thanks & Regard

      Suheeb