首页 > 其他分享 >How To Delete Reservations Using Standard API INV_RESERVATION_PUB.Delete_Reservation (Doc ID 2219367

How To Delete Reservations Using Standard API INV_RESERVATION_PUB.Delete_Reservation (Doc ID 2219367

时间:2023-11-17 11:23:49浏览次数:31  
标签:err -- Doc API Reservation msg reservation id Delete

Solution

Summary: The reservation API INV_RESERVATION_PUB.Delete_Reservation will delete reservations accepting the reservation id and optionally serial numbers to locate and remove reservations. Care should be taken to ensure related objects like sales orders no longer need the reservation to avoid errors like Negative balances when attempting to ship material. You might also use the reservation API that relieves reservations instead -- INV_RESERVATION_PUB.Relieve_Reservation API.

Details: Here is an example of using the delete reservation API. The example includes values for the inventory application id (401), an example Manufacturing and Distribution Manager responsibility id, and an example MFG user id. Change the values to the appropriate ids on your environment. The SQL also prompts for the organization id and item number. In this example, the code loops through reservations on this item removing them but rownum is limited to 1 so only the first row is removed.

--set serveroutput on
DECLARE
  p_rsv      apps.inv_reservation_global.mtl_reservation_rec_type;
  p_dummy_sn apps.inv_reservation_global.serial_number_tbl_type;

  l_msg_count  NUMBER;
  l_msg_data   VARCHAR2(240);
  l_status     VARCHAR2(1);
  l_index_out  NUMBER;
  v_reserv_id  NUMBER;
  l_err_status VARCHAR2(50);
  l_err_mesg   VARCHAR2(2000);

  -- User Variables: Update for your environment ~~!
  l_resp_appl_id NUMBER := 401; --FND_PROFILE.VALUE ('RESP_APPL_ID');
  l_resp_id      NUMBER := 56229; --FND_PROFILE.VALUE ('RESP_ID');
  l_user_id      NUMBER := 1068; --FND_PROFILE.VALUE ('USER_ID');

  -- Item/Organization Variables
  l_organization_id NUMBER := &yourorgid;
  l_youritem        VARCHAR2(100) := '&YourPartNumber';

  -- Find 1 reservation for your item
  CURSOR c_reserve IS
    SELECT DISTINCT reservation_id
      FROM apps.mtl_reservations_all_v
     WHERE inventory_item_id IN (SELECT inventory_item_id
                                   FROM apps.mtl_system_items_b
                                  WHERE organization_id = l_organization_id
                                        AND segment1 = l_youritem)
           AND organization_id = l_organization_id --p_organization_id;
           AND rownum < 2;

BEGIN
  fnd_global.apps_initialize(user_id      => l_user_id
                            ,resp_id      => l_resp_id
                            ,resp_appl_id => l_resp_appl_id);

  FOR r_reserve IN c_reserve
  LOOP
  
    dbms_output.put_line('Reservation ID : ' || r_reserve.reservation_id);
  
    p_rsv.reservation_id := r_reserve.reservation_id;
  
    apps.inv_reservation_pub.delete_reservation(p_api_version_number => 1.0
                                               ,p_init_msg_lst       => fnd_api.g_false
                                               ,p_rsv_rec            => p_rsv
                                               ,p_serial_number      => p_dummy_sn
                                               ,
                                                -- p_validation_flag => fnd_api.g_true,
                                                x_return_status => l_status
                                               ,x_msg_count     => l_msg_count
                                               ,x_msg_data      => l_msg_data);
  
    dbms_output.put_line('Reservation API : ' || l_status);
  
    IF l_status <> 'S' THEN
      fnd_msg_pub.get(p_msg_index     => l_msg_count
                     ,p_data          => l_msg_data
                     ,p_encoded       => 'F'
                     ,p_msg_index_out => l_index_out);
    
      l_err_status := 'E';
      l_err_mesg   := 'Delete Allocations API failed ' || rtrim(l_msg_data);
      dbms_output.put_line('API failed ' || l_err_mesg);
    
    ELSE
      l_err_status := 'S';
      l_err_mesg   := NULL;
      dbms_output.put_line('API success ' || l_err_mesg);
    END IF;
  
  END LOOP;

END;
/

标签:err,--,Doc,API,Reservation,msg,reservation,id,Delete
From: https://www.cnblogs.com/su1999/p/17838245.html

相关文章

  • truncate和delete的区别
    truncate和delete的区别在于四个方面:1.条件删除、2.事务回滚、3.清理速度、4.高水位重置。因为delete是可以带WHERE的,所以支持条件删除;而truncate只能删除整个表。1.条件删除这个比较好理解,因为delete是可以带WHERE的,所以支持条件删除;而truncate只能删除整个表。2.事......
  • docker 拉取最新版本,发现并不是最新的?
    如果你在使用Docker拉取镜像时发现并不是最新版本,可能是因为以下几个原因:缓存问题:Docker会默认使用本地的缓存来加快镜像的拉取速度。这意味着当你再次拉取同一个镜像时,Docker会检查本地缓存是否已经存在该镜像,并将其视为最新版本。解决这个问题的方法是使用--no-cache选项,强制Dock......
  • Linux 离线安装docker
    一、Linux离线安装docker1.下载Linux版本离线安装包下载地址https://download.docker.com/linux/static/stable/x86_64/下载的最新版本docker-24.0.7.tgz2.安装docker上传安装包创建文件夹dockersoftware#mkdirdockersoftware上传docker-24.0.7.tgz到/docke......
  • 修改/etc/docker/daemon.json中的log-opts配置发现无效 docker 限制日志大小
    https://colobu.com/2018/10/22/no-space-left-on-device-for-docker/在/etc/docker/daemon.json中修改或添加log-opts参数"log-driver":"json-file","log-opts":{"max-size":"50m","max-file":"3"}网上很......
  • 详解数据库SQL中的三个语句:DROP、TRUNCATE 、DELETE
    本文分享自华为云社区《GaussDB数据库SQL系列-DROP&TRUNCATE&DELETE》,作者:Gauss松鼠会小助手2。一、前言在数据库中,SQL作为一种常用的数据库编程语言,扮演着至关重要的角色。SQL不仅可以用于创建、修改和查询数据库,还可以通过DROP、DELETE和TRUNCATE等语句来删除数据。这些......
  • docker 监控工具 uptime
    该项目可以用来监控服务正常运行时间,它界面美观、支持Docker一键部署,提供了中文界面、通知、多状态页面等实用功能。项目特点监控HTTP(s)/TCP/HTTP(s)关键字/HTTP(s)Json查询/Ping/DNS记录/推送/Steam游戏服务器/Docker容器的正常运行时间。精美、反应式......
  • docker使用--gpus all报错: docker: Error response from daemon: could not select d
    报错信息:docker:Errorresponsefromdaemon:couldnotselectdevicedriver""withcapabilities:[[gpu]].解决方法:1,任意路径下创建nvidia-container-runtime-script.sh文件vimnvidia-container-runtime-script.sh拷贝下方内容到nvidia-container-runtime-script.......
  • docker compose和docker swarm 和 docker stack
    dockercompose:单机部署,使用dockercompose编排多个服务dockerswarm:多机部署,实现对单个服务的简单部署(通过dockerfile)dockerstack:实现集群环境下多服务编排。(通过compose.yml)狂神说docker(最全笔记)_狂神说docker笔记            docker-compose教程(安装,使用,快......
  • JavaDoc生成文档(待完善)
    使用IDEA产生Java.doc文档在网摘点赞里  命令行:javadoc-encoding UTF-8-charsetUTF-8Doc.java(文件名)    ......
  • Docker部署fastposter | 一款快速开发海报的工具
    一、介绍fastposter海报生成器是一款快速开发海报的工具。只需上传一张背景图,在对应的位置放上组件(文字、图片、二维码、头像)即可生成海报。点击代码直接生成各种语言SDK的调用代码,方便快速开发。二、搭建fastposter绿联DX4600为例,首先我们打开Docker管理器,进入镜像管理,然......