DBA Data[Home] [Help]

APPS.GMD_FORMULA_DETAIL_PUB SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 26

      SELECT meaning
      FROM   gmd_status
      WHERE  status_code = P_status_code;
Line: 33

    FOR C_status_code IN (Select formula_status from fm_form_mst_b
                         where  formula_id = vFormula_id) LOOP
      OPEN  get_status_meaning(C_status_code.formula_status);
Line: 47

  /*   Insert_FormulaDetail                                                   */
  /*                                                                          */
  /* DESCRIPTION:                                                             */
  /*   This PL/SQL procedure is responsible for                               */
  /*   inserting a formula detail.                                            */
  /* HISTORY:                                                                 */
  /*  10-Apr-2003 P.Raghu   Bug#2893682 Modified the code such that           */
  /*                        p_formula_detail_rec.item_no is correctly set to  */
  /*                        ITEM_NO TOKEN. Uncommented the assigment statement*/
  /*                        of GMDFMVAL_PUB.p_called_from_forms package       */
  /*                        variable in Insert_FormulaDetail procedure.       */
  /*  18-Apr-2003 J. Baird  Bug #2908311 Uncommented initialization of        */
  /*                        x_return_status                                   */
  /*  18-Apr-2003 J. Baird  Bug #2906124 Was not setting the TO_UOM token.    */
  /* ======================================================================== */
  PROCEDURE Insert_FormulaDetail
  (   p_api_version           IN          NUMBER
     ,p_init_msg_list         IN          VARCHAR2
     ,p_commit                IN          VARCHAR2
     ,p_called_from_forms     IN          VARCHAR2 := 'NO'
     ,x_return_status         OUT NOCOPY  VARCHAR2
     ,x_msg_count             OUT NOCOPY  NUMBER
     ,x_msg_data              OUT NOCOPY  VARCHAR2
     ,p_formula_detail_tbl    IN          formula_insert_dtl_tbl_type
  )
  IS
     /*  Local Variables definitions */
     l_api_name     CONSTANT    VARCHAR2(30)        := 'INSERT_FORMULADETAIL';
Line: 85

     p_formula_detail_rec    GMD_FORMULA_COMMON_PUB.formula_insert_rec_type;
Line: 86

     X_formula_detail_rec    GMD_FORMULA_COMMON_PUB.formula_insert_rec_type;
Line: 89

       SELECT owner_organization_id
       FROM   fm_form_mst_b
       WHERE  formula_id = V_formula_id;
Line: 99

        SELECT AUTO_PRODUCT_CALC
        FROM FM_FORM_MST_B
        WHERE FORMULA_ID = V_formula_id;
Line: 110

     SAVEPOINT  Insert_FormulaDetail;
Line: 141

     /* 2.  Call the private API that does the database inserts/ updates */
     IF (p_formula_detail_tbl.count = 0) THEN
         RAISE FND_API.G_EXC_ERROR;
Line: 234

	        SELECT segment1,recipe_enabled_flag  INTO v_item_no, v_recipe_enabled
	        FROM mtl_system_items_b
	        WHERE inventory_item_id =  p_formula_detail_rec.inventory_item_id AND
		    organization_id = p_formula_detail_rec.owner_organization_id;
Line: 240

	        ROLLBACK to Insert_FormulaDetail;
Line: 281

           SELECT nvl(max(line_no),0)+1 INTO new_line_no FROM fm_matl_dtl
           WHERE formula_id = l_formula_id AND
                      line_type = p_formula_detail_rec.line_type;
Line: 337

             GMDFMVAL_PUB.validate_insert_record (P_formula_dtl => P_formula_detail_rec,
	                                          X_formula_dtl => X_formula_detail_rec,
                                                  xReturn       => X_return_status);
Line: 420

               l_fm_matl_dtl_rec.last_update_date        := NVL(p_formula_detail_rec.last_update_date, SYSDATE);
Line: 421

               l_fm_matl_dtl_rec.last_update_login       :=  NVL(p_formula_detail_rec.last_update_login, l_user_id);-- Bug No.6672176  l_user_id; -- Bug 4603060
Line: 422

               l_fm_matl_dtl_rec.last_updated_by         :=  l_user_id; -- Bug 4603060
Line: 465

              GMD_FORMULA_DETAIL_PVT.Insert_FormulaDetail
              (  p_api_version         =>  p_api_version
                 ,p_init_msg_list      =>  p_init_msg_list
                 ,p_commit             =>  FND_API.G_FALSE
                 ,x_return_status      =>  x_return_status
                 ,x_msg_count          =>  x_msg_count
                 ,x_msg_data           =>  x_msg_data
                 ,p_formula_detail_rec =>  l_fm_matl_dtl_rec
              );
Line: 485

        /* Product Qty Calculation after Inserting a Record */
        IF l_formula_calc_flag = 'Y' THEN
        GMD_COMMON_VAL.Calculate_Total_Product_Qty( p_formula_id  =>l_formula_id ,
                            x_return_status  => x_return_status,
                            x_msg_count      => x_msg_count,
                            x_msg_data       => x_msg_data);
Line: 494

           rather than trying to insert other lines */
        IF (x_return_status = FND_API.G_RET_STS_ERROR) THEN
           RAISE FND_API.G_EXC_ERROR;
Line: 501

      END LOOP; -- for number of lines to be inserted
Line: 518

          ROLLBACK to Insert_FormulaDetail;
Line: 530

          ROLLBACK to Insert_FormulaDetail;
Line: 542

          ROLLBACK to Insert_FormulaDetail;
Line: 554

  END Insert_FormulaDetail;
Line: 559

  /*   Update_FormulaDetail                                                   */
  /*                                                                          */
  /* DESCRIPTION:                                                             */
  /*   This PL/SQL procedure is responsible for updating a formula.           */
  /*   details.                                                               */
  /* HISTORY:                                                                 */
  /*  10-Apr-2003 P.Raghu   Bug#2893682 Modified the code such that           */
  /*                        p_formula_detail_rec.item_no is correctly set     */
  /*                        to ITEM_NO TOKEN.                                 */
  /*  07-MAR-2006 Kapil M   Bug#4603056 Added the check for update of revision*/
  /*                         of non-revision controlled item                  */
  /* ======================================================================== */
  PROCEDURE Update_FormulaDetail
  (  p_api_version           IN            NUMBER
    ,p_init_msg_list         IN            VARCHAR2
    ,p_commit                IN            VARCHAR2
    ,p_called_from_forms     IN            VARCHAR2 := 'NO'
    ,x_return_status         OUT NOCOPY    VARCHAR2
    ,x_msg_count             OUT NOCOPY    NUMBER
    ,x_msg_data              OUT NOCOPY    VARCHAR2
    ,p_formula_detail_tbl    IN            formula_update_dtl_tbl_type
  )
  IS
     /*  Local Variables definitions */
     l_api_name              CONSTANT    VARCHAR2(30)        := 'UPDATE_FORMULADETAIL';
Line: 591

     p_formula_detail_rec    GMD_FORMULA_COMMON_PUB.formula_update_rec_type;
Line: 592

     X_formula_detail_rec    GMD_FORMULA_COMMON_PUB.formula_update_rec_type;
Line: 646

       SELECT * from fm_matl_dtl
       WHERE formulaline_id = vFormulaline_id;
Line: 650

       SELECT owner_organization_id
       FROM   fm_form_mst_b
       WHERE  formula_id = V_formula_id;
Line: 656

       SELECT inventory_item_id
       FROM   fm_matl_dtl
       WHERE  formulaline_id = V_formulaline_id;
Line: 661

       SELECT concatenated_segments
       FROM   mtl_system_items_kfv
       WHERE  inventory_item_id = V_item_id;
Line: 671

        SELECT AUTO_PRODUCT_CALC
        FROM FM_FORM_MST_B
        WHERE FORMULA_ID = V_formula_id;
Line: 677

     SAVEPOINT  Update_FormulaDetail;
Line: 703

     /* 2.  Call the private API that does the database updates */
     IF (p_formula_detail_tbl.count = 0) THEN
         RAISE FND_API.G_EXC_ERROR;
Line: 714

          gmd_debug.put_line(' In Formula Detail Update Pub - Entering loop with row # '||i);
Line: 765

        /* Check if update is allowed */
        IF NOT GMD_COMMON_VAL.Update_Allowed('FORMULA',l_formula_id) THEN
           FND_MESSAGE.SET_NAME('GMD','GMD_CANNOT_UPD_ENTITY');
Line: 814

               FND_MESSAGE.SET_NAME('GMD','GMD_INVALID_COL_UPDATES');
Line: 848

        /* (fm_matl_dtl).  If any field value is not provided, update it     */
        /* with what exists in the db                                        */
        /* ================================================================= */
        IF (l_debug = 'Y') THEN
           gmd_debug.put_line(' In Formula Detail Pub - '
                   ||' Retrieving all not null columns '
                              ||' for formula line id = '
                              ||p_formula_detail_rec.formulaline_id
                              ||' - '
                              ||x_return_status);
Line: 909

          p_formula_detail_rec.last_updated_by := l_user_id;
Line: 916

          IF (p_formula_detail_rec.last_update_date IS NULL) THEN
              p_formula_detail_rec.last_update_date := SYSDATE;
Line: 924

          IF (p_formula_detail_rec.last_update_login IS NULL) THEN
              p_formula_detail_rec.last_update_login := fmline_not_null.last_update_login;
Line: 965

          GMDFMVAL_PUB.validate_update_record (P_formula_dtl => P_formula_detail_rec,
	                                       X_formula_dtl => X_formula_detail_rec,
                                               xReturn       => X_return_status);
Line: 992

        /* as the user is intending to update the field to NULL */
        IF (get_detail_rec%FOUND) THEN
           /*Bug 2509076 - Thomas Daniel */
           /* QM Integration */
           IF (p_formula_detail_rec.by_product_type = FND_API.G_MISS_CHAR) THEN
             l_by_product_type := NULL;
Line: 1415

            l_fm_matl_dtl_rec.last_update_date        := p_formula_detail_rec.last_update_date;
Line: 1416

            l_fm_matl_dtl_rec.last_update_login       := p_formula_detail_rec.last_update_login;
Line: 1417

            l_fm_matl_dtl_rec.last_updated_by         := p_formula_detail_rec.last_updated_by;
Line: 1459

           GMD_FORMULA_DETAIL_PVT.Update_FormulaDetail
           (  p_api_version            =>   1.0
              ,p_init_msg_list         =>   p_init_msg_list
              ,p_commit                =>   FND_API.G_FALSE
              ,x_return_status         =>   x_return_status
              ,x_msg_count             =>   x_msg_count
              ,x_msg_data              =>   x_msg_data
              ,p_formula_detail_rec    =>   l_fm_matl_dtl_rec
           );
Line: 1471

                   ||' After Update Pvt API call   '
                   ||' - '
                   ||x_return_status);
Line: 1490

        /* IF update of a line fails - Raise an exception
           rather than trying to insert other lines */
        IF (x_return_status = FND_API.G_RET_STS_ERROR) THEN
           RAISE FND_API.G_EXC_ERROR;
Line: 1498

     END LOOP; -- End of main update loop
Line: 1512

          ROLLBACK to Update_FormulaDetail;
Line: 1523

          ROLLBACK to Update_FormulaDetail;
Line: 1534

          ROLLBACK to Update_FormulaDetail;
Line: 1546

  END Update_FormulaDetail;
Line: 1551

  /*   Delete_FormulaDetail */
  /* */
  /* DESCRIPTION: */
  /*   This PL/SQL procedure is responsible for  */
  /*   delete a formula detail. */
  /* */
  /* HISTORY                                        */
  /*  06-Nov-2001  M. Grosser  BUGS 1922679, 1981755 - Modified procedure Delete_FormulaDetail   */
  /*                            to not allow the deletion of a product with a valid */
  /*                            validity rule against it and to not delete the only */
  /*                            ingredient or product in a formula */
  /* =============================================  */
  PROCEDURE Delete_FormulaDetail
  (   p_api_version           IN         NUMBER
     ,p_init_msg_list         IN         VARCHAR2
     ,p_commit                IN         VARCHAR2
     ,p_called_from_forms     IN         VARCHAR2 := 'NO'
     ,x_return_status         OUT NOCOPY VARCHAR2
     ,x_msg_count             OUT NOCOPY NUMBER
     ,x_msg_data              OUT NOCOPY VARCHAR2
     ,p_formula_detail_tbl    IN         formula_update_dtl_tbl_type
  )
  IS
     /*  Local Variables definitions */
     l_api_name            CONSTANT    VARCHAR2(30)        := 'DELETE_FORMULADETAIL';
Line: 1582

     p_formula_detail_rec  GMD_FORMULA_COMMON_PUB.formula_update_rec_type;
Line: 1591

       SELECT count(*)
       FROM fm_matl_dtl
       WHERE formula_id = pformula_id
       AND line_type = pline_type;
Line: 1597

       SELECT  formula_id
       FROM    fm_matl_dtl
       WHERE   formulaline_id = vFormulaLine_id;
Line: 1602

       SELECT 1
       FROM gmd_recipes_b rcp,
            gmd_recipe_validity_rules vr,
            mtl_system_items_vl it
       WHERE vr.delete_mark = 0
         AND vr.validity_rule_status < 1000
         AND (vr.end_date IS NULL OR vr.end_date >= SYSDATE)
         AND it.concatenated_segments = pitem_no
         AND vr.inventory_item_id = it.inventory_item_id
         AND vr.recipe_id = rcp.recipe_id
         AND rcp.formula_id = pformula_id;
Line: 1620

        SELECT OWNER_ORGANIZATION_ID
        FROM FM_FORM_MST_B
        WHERE FORMULA_ID = V_formula_id;
Line: 1625

        SELECT AUTO_PRODUCT_CALC
        FROM FM_FORM_MST_B
        WHERE FORMULA_ID = V_formula_id;
Line: 1631

     SAVEPOINT  Delete_FormulaDetail;
Line: 1651

     /* 2.  Call the private API that does the database inserts/ updates */

     IF (p_formula_detail_tbl.count = 0) THEN
         RAISE FND_API.G_EXC_ERROR;
Line: 1726

        IF NOT GMD_COMMON_VAL.Update_Allowed('FORMULA',l_formula_id) THEN
           FND_MESSAGE.SET_NAME('GMD','GMD_CANNOT_UPD_ENTITY');
Line: 1745

            /* If there s only 1 ingredient or product, stop the delete */
            IF (l_count < 2) THEN
              IF p_formula_detail_rec.line_type = 1 THEN
                FND_MESSAGE.SET_NAME('GMD', 'GMD_MUST_HAVE_PRODUCT');
Line: 1763

              /* If there are valid validity rules, stop the delete */
              IF (check_validity_rules%FOUND) THEN
                 FND_MESSAGE.SET_NAME('GMD', 'GMD_VALID_VALIDITY');
Line: 1785

              GMD_FORMULA_DETAIL_PVT.Delete_FormulaDetail
              (  p_api_version           =>  p_api_version
                 ,p_init_msg_list         =>  p_init_msg_list
                 ,p_commit                =>  FND_API.G_FALSE
                 ,x_return_status         =>  x_return_status
                 ,x_msg_count             =>  x_msg_count
                 ,x_msg_data              =>  x_msg_data
                 ,p_formula_detail_rec    =>  l_fm_matl_dtl_rec
              );
Line: 1820

        /* IF delete of a line fails - Raise an exception
           rather than trying to deleting other lines */
        IF (x_return_status = FND_API.G_RET_STS_ERROR) THEN
           RAISE FND_API.G_EXC_ERROR;
Line: 1828

     END LOOP; -- End of main delete loop
Line: 1842

          ROLLBACK to Delete_FormulaDetail;
Line: 1849

          ROLLBACK to Delete_FormulaDetail;
Line: 1856

          ROLLBACK to Delete_FormulaDetail;
Line: 1863

  END Delete_FormulaDetail;