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: 415

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

               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: 417

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

              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: 480

        /* 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: 489

           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: 496

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

          ROLLBACK to Insert_FormulaDetail;
Line: 525

          ROLLBACK to Insert_FormulaDetail;
Line: 537

          ROLLBACK to Insert_FormulaDetail;
Line: 549

  END Insert_FormulaDetail;
Line: 554

  /*   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: 586

     p_formula_detail_rec    GMD_FORMULA_COMMON_PUB.formula_update_rec_type;
Line: 587

     X_formula_detail_rec    GMD_FORMULA_COMMON_PUB.formula_update_rec_type;
Line: 641

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

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

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

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

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

     SAVEPOINT  Update_FormulaDetail;
Line: 698

     /* 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: 709

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

        /* 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: 809

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

        /* (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: 896

          p_formula_detail_rec.last_updated_by := l_user_id;
Line: 903

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

          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: 952

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

        /* 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: 1396

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

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

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

           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: 1452

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

        /* 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: 1479

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

          ROLLBACK to Update_FormulaDetail;
Line: 1504

          ROLLBACK to Update_FormulaDetail;
Line: 1515

          ROLLBACK to Update_FormulaDetail;
Line: 1527

  END Update_FormulaDetail;
Line: 1532

  /*   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: 1563

     p_formula_detail_rec  GMD_FORMULA_COMMON_PUB.formula_update_rec_type;
Line: 1572

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

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

       SELECT 1
       FROM gmd_recipes_b rcp,
            gmd_recipe_validity_rules vr,
            ic_item_mst 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.item_no = pitem_no
         AND vr.item_id = it.item_id
         AND vr.recipe_id = rcp.recipe_id
         AND rcp.formula_id = pformula_id;
Line: 1601

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

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

     SAVEPOINT  Delete_FormulaDetail;
Line: 1632

     /* 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: 1707

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

            /* 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: 1745

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

              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: 1802

        /* 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: 1810

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

          ROLLBACK to Delete_FormulaDetail;
Line: 1831

          ROLLBACK to Delete_FormulaDetail;
Line: 1838

          ROLLBACK to Delete_FormulaDetail;
Line: 1845

  END Delete_FormulaDetail;