QP01 BAPI、QP02 BDC
近期在改动一个检验计划分配的一个程序。上网查了一些资料,分别对QP01检验计划创建、改动QP02、删除物料等操作。分享一下。
一、QP01 BAPI
BAPI_INSPECTIONPLAN_CREATE
二、BDC for QP02
REPORT ZQM_BDC_QP02.
************************************************************************
*TYPE-POOLS *
************************************************************************
TYPE-POOLS TRUXS.
************************************************************************
*TYPE DECLARATION *
************************************************************************
TYPES : BEGIN OF TYPE_BDCDATA,
PROGRAM TYPE BDC_PROG,
DYNPRO TYPE BDC_DYNR,
DYNBEGIN TYPE BDC_START,
FNAM TYPE FNAM_____4,
FVAL TYPE BDC_FVAL,
END OF TYPE_BDCDATA,
BEGIN OF TYPE_DATA,
MATNR TYPE MATNR_BI,
WERKS TYPE WERKS,
END OF TYPE_DATA.
************************************************************************
*WORK AREA DECLARATION *
************************************************************************
DATA : WA_BDCDATA TYPE TYPE_BDCDATA,
WA_DATA TYPE TYPE_DATA,
WA_MESSTAB TYPE BDCMSGCOLL,
WA_RAW TYPE TRUXS_T_TEXT_DATA.
************************************************************************
*INTERNAL TABLE DECLARATION *
************************************************************************
DATA : I_BDCDATA TYPE STANDARD TABLE OF TYPE_BDCDATA,
I_DATA TYPE STANDARD TABLE OF TYPE_DATA,
I_MESSTAB TYPE STANDARD TABLE OF BDCMSGCOLL.
************************************************************************
*DATA DECLARATION *
************************************************************************
DATA WF_MESSAGE(100).
************************************************************************
*SELECTION-SCREEN DECLARATION *
************************************************************************
SELECTION-SCREEN BEGIN OF BLOCK A1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_FILE TYPE LOCALFILE OBLIGATORY,
P_MODE DEFAULT 'A'.
SELECTION-SCREEN END OF BLOCK A1.
************************************************************************
*AT SELECTION-SCREEN ON VALUE-REQUEST DECLARATION *
************************************************************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
FIELD_NAME = 'P_FILE'
CHANGING
FILE_NAME = P_FILE
.
REFRESH I_DATA[].
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_LINE_HEADER = 'X'
I_TAB_RAW_DATA = WA_RAW
I_FILENAME = P_FILE
TABLES
I_TAB_CONVERTED_DATA = I_DATA
.
************************************************************************
*START-OF-SELECTION *
************************************************************************
START-OF-SELECTION.
LOOP AT I_DATA INTO WA_DATA.
perform bdc_dynpro using 'SAPLCPDI' '8010'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RC27M-MATNR'
WA_DATA-MATNR.
perform bdc_field using 'RC27M-WERKS'
WA_DATA-WERKS.
perform bdc_dynpro using 'SAPLCPDI' '1400'.
perform bdc_field using 'BDC_OKCODE'
'=ALD1'.
perform bdc_field using 'RC27X-ENTRY_ACT'
'1'.
perform bdc_dynpro using 'SAPLCPDA' '1200'.
perform bdc_field using 'BDC_OKCODE'
'=MTUE'.
perform bdc_dynpro using 'SAPLCZDI' '4010'.
perform bdc_field using 'MAPL-PLNAL(02)'
'1'.
perform bdc_field using 'MAPL-PLNAL(03)'
'1'.
perform bdc_field using 'MAPL-PLNAL(04)'
'1'.
perform bdc_field using 'MAPL-PLNAL(05)'
'1'.
perform bdc_field using 'MAPL-PLNAL(06)'
'1'.
perform bdc_field using 'MAPL-PLNAL(07)'
'1'.
perform bdc_field using 'MAPL-PLNAL(08)'
'1'.
perform bdc_field using 'MAPL-PLNAL(09)'
'1'.
perform bdc_field using 'MAPL-PLNAL(10)'
'1'.
perform bdc_field using 'MAPL-PLNAL(11)'
'1'.
perform bdc_field using 'MAPL-PLNAL(12)'
'1'.
perform bdc_field using 'MAPL-PLNAL(13)'
'1'.
perform bdc_field using 'MAPL-PLNAL(14)'
'1'.
perform bdc_field using 'MAPL-MATNR(02)'
'8514AA-MEG-0002-02'.
perform bdc_field using 'MAPL-MATNR(03)'
'8514AA-MEG-0002-03'.
perform bdc_field using 'MAPL-MATNR(04)'
'8514AA-MEG-0002-04'.
perform bdc_field using 'MAPL-MATNR(05)'
'8514AA-MEG-0002-05'.
perform bdc_field using 'MAPL-MATNR(06)'
'8514AA-MEG-0002-06'.
perform bdc_field using 'MAPL-MATNR(07)'
'8514AA-MEG-0002-07'.
perform bdc_field using 'MAPL-MATNR(08)'
'8514AA-MEG-0002-08'.
perform bdc_field using 'MAPL-MATNR(09)'
'8514AA-MEG-0002-09'.
perform bdc_field using 'MAPL-MATNR(10)'
'8514AA-MEG-0002-10'.
perform bdc_field using 'MAPL-MATNR(11)'
'8514AA-MEG-0002-11'.
perform bdc_field using 'MAPL-MATNR(12)'
'8514AA-MEG-0002-12'.
perform bdc_field using 'MAPL-MATNR(13)'
'8514AA-MEG-0002-13'.
perform bdc_field using 'MAPL-MATNR(14)'
'8514AA-MEG-0002-14'.
perform bdc_field using 'MAPL-WERKS(02)'
'2000'.
perform bdc_field using 'MAPL-WERKS(03)'
'2000'.
perform bdc_field using 'MAPL-WERKS(04)'
'2000'.
perform bdc_field using 'MAPL-WERKS(05)'
'2000'.
perform bdc_field using 'MAPL-WERKS(06)'
'2000'.
perform bdc_field using 'MAPL-WERKS(07)'
'2000'.
perform bdc_field using 'MAPL-WERKS(08)'
'2000'.
perform bdc_field using 'MAPL-WERKS(09)'
'2000'.
perform bdc_field using 'MAPL-WERKS(10)'
'2000'.
perform bdc_field using 'MAPL-WERKS(11)'
'2000'.
perform bdc_field using 'MAPL-WERKS(12)'
'2000'.
perform bdc_field using 'MAPL-WERKS(13)'
'2000'.
perform bdc_field using 'MAPL-WERKS(14)'
'2000'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_dynpro using 'SAPLCZDI' '4010'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MAPL-PLNAL(02)'
'1'.
perform bdc_field using 'MAPL-PLNAL(03)'
'1'.
perform bdc_field using 'MAPL-PLNAL(04)'
'1'.
perform bdc_field using 'MAPL-PLNAL(05)'
'1'.
perform bdc_field using 'MAPL-PLNAL(06)'
'1'.
perform bdc_field using 'MAPL-PLNAL(07)'
'1'.
perform bdc_field using 'MAPL-PLNAL(08)'
'1'.
perform bdc_field using 'MAPL-PLNAL(09)'
'1'.
perform bdc_field using 'MAPL-PLNAL(10)'
'1'.
perform bdc_field using 'MAPL-PLNAL(11)'
'1'.
perform bdc_field using 'MAPL-PLNAL(12)'
'1'.
perform bdc_field using 'MAPL-PLNAL(13)'
'1'.
perform bdc_field using 'MAPL-PLNAL(14)'
'1'.
perform bdc_field using 'MAPL-MATNR(02)'
'8514AA-MEG-0002-15'.
perform bdc_field using 'MAPL-MATNR(03)'
'8514AA-MEG-0002-16'.
perform bdc_field using 'MAPL-MATNR(04)'
'8514AA-MEG-0002-17'.
perform bdc_field using 'MAPL-MATNR(05)'
'8514AA-MEG-0002-18'.
perform bdc_field using 'MAPL-MATNR(06)'
'8514AA-MEG-0002-19'.
perform bdc_field using 'MAPL-MATNR(07)'
'8514AA-MEG-0002-20'.
perform bdc_field using 'MAPL-MATNR(08)'
'8514AA-MEG-0002-21'.
perform bdc_field using 'MAPL-MATNR(09)'
'8514AA-MEG-0002-22'.
perform bdc_field using 'MAPL-MATNR(10)'
'8514AA-MEG-0002-23'.
perform bdc_field using 'MAPL-MATNR(11)'
'8514AA-MEG-0002-24'.
perform bdc_field using 'MAPL-MATNR(12)'
'8514AA-MEG-0002-25'.
perform bdc_field using 'MAPL-MATNR(13)'
'8514AA-MEG-0002-26'.
perform bdc_field using 'MAPL-MATNR(14)'
'8514AA-MEG-0002-27'.
perform bdc_field using 'MAPL-WERKS(02)'
'2000'.
perform bdc_field using 'MAPL-WERKS(03)'
'2000'.
perform bdc_field using 'MAPL-WERKS(04)'
'2000'.
perform bdc_field using 'MAPL-WERKS(05)'
'2000'.
perform bdc_field using 'MAPL-WERKS(06)'
'2000'.
perform bdc_field using 'MAPL-WERKS(07)'
'2000'.
perform bdc_field using 'MAPL-WERKS(08)'
'2000'.
perform bdc_field using 'MAPL-WERKS(09)'
'2000'.
perform bdc_field using 'MAPL-WERKS(10)'
'2000'.
perform bdc_field using 'MAPL-WERKS(11)'
'2000'.
perform bdc_field using 'MAPL-WERKS(12)'
'2000'.
perform bdc_field using 'MAPL-WERKS(13)'
'2000'.
perform bdc_field using 'MAPL-WERKS(14)'
'2000'.
perform bdc_dynpro using 'SAPLCZDI' '4010'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLCZDI' '4010'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLCZDI' '4010'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLCZDI' '4010'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLCZDI' '4010'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLCZDI' '4010'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLCZDI' '4010'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLCZDI' '4010'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLCZDI' '4010'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLCZDI' '4010'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLCZDI' '4010'.
perform bdc_field using 'BDC_CURSOR'
'RC271-PLNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLCZDI' '4010'.
perform bdc_field using 'BDC_CURSOR'
'MAPL-WERKS(03)'.
perform bdc_field using 'BDC_OKCODE'
'=BACK'.
perform bdc_field using 'MAPL-PLNAL(03)'
'1'.
perform bdc_field using 'MAPL-MATNR(03)'
'8514AA-MEG-0002-28'.
perform bdc_field using 'MAPL-WERKS(03)'
'2000'.
perform bdc_dynpro using 'SAPLCPDA' '1200'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'BDC_CURSOR'
'PLKOD-KTEXT'.
perform bdc_field using 'PLKOD-KTEXT'
'8514AA-MEG-0002-01 -Package -04- RC C'
& 'oo'.
perform bdc_field using 'PLKOD-WERKS'
'2000'.
perform bdc_field using 'PLKOD-VERWE'
'Z1'.
perform bdc_field using 'PLKOD-STATU'
'4'.
perform bdc_field using 'PLKOD-LOSBS'
'99,999,999'.
perform bdc_field using 'PLKOD-PLNME'
'EA'.
perform bdc_field using 'PLKOD-SLWBEZ'
'Z01'.
CALL TRANSACTION 'QP02' USING I_BDCDATA MODE P_MODE UPDATE 'A' MESSAGES INTO I_MESSTAB.
REFRESH I_BDCDATA[].
ENDLOOP.
************************************************************************
*START-OF-SELECTION *
************************************************************************
END-OF-SELECTION.
LOOP AT I_MESSTAB INTO WA_MESSTAB.
CLEAR WF_MESSAGE.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = WA_MESSTAB-MSGID
LANG = SY-LANGU
NO = WA_MESSTAB-MSGNR
V1 = WA_MESSTAB-MSGV1
V2 = WA_MESSTAB-MSGV2
V3 = WA_MESSTAB-MSGV3
V4 = WA_MESSTAB-MSGV4
IMPORTING
MSG = WF_MESSAGE
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
WRITE / WF_MESSAGE .
ENDLOOP.
ULINE.
*&---------------------------------------------------------------------*
*& Form BDC_FIELD
*&---------------------------------------------------------------------*
FORM BDC_FIELD USING FNAM TYPE ANY
FVAL TYPE ANY.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = FNAM.
WA_BDCDATA-FVAL = FVAL.
APPEND WA_BDCDATA TO I_BDCDATA.
ENDFORM. " BDC_FIELD
*&---------------------------------------------------------------------*
*& Form BDC_DYNPRO
*&---------------------------------------------------------------------*
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR WA_BDCDATA.
WA_BDCDATA-PROGRAM = PROGRAM.
WA_BDCDATA-DYNPRO = DYNPRO.
WA_BDCDATA-DYNBEGIN = 'X'.
APPEND WA_BDCDATA TO I_BDCDATA.
ENDFORM. " BDC_DYNPRO
三、Deleting material assignments from inspection plans
ISSUE
Recently I had the issue that a material has been wrongly assigned to an inspection plan in a test system. If you remove the assignment in QP02 via the delete button, the system only sets a deletion indicator in table MAPL on this assignment. Hence the material
assignment is still blocking actions like "change of unit of measure". After digging a bit in the internet I found an SAP report for this, which I like to share also here on SCN.
STANDARD SOLUTION
The correct way to get rid of the assignment is to archive the complete inspection plan (I have not found a way so far to just archive a material-task list assignment).
WORKAROUND
Beside using transaction QSR6 (which deletes the complete inspection plan from the database without archiving), there is an SAP report that just deletes material assignments from the database: RCPMAPL1
With entering the task list type (e.g. Q) and the group ID, the report displays all assignments. The ones that should be removed can be marked and deleted. It is advisable to first remove the assignment with QP02, as then the deletion indicator will be visible
in the report. This ensures that you tick the right assignment...
WARNING
As always with these kind of actions: be aware that you bypass most SAP security concepts (like dependency/integrity checks,...) with this action! You will most likely need a special approval from (IT) Managment and you normally have to record these actions
and document them so that an auditor will understand why this had to be done.
QP01 BAPI、QP02 BDC的更多相关文章
- BAPI、badi 和 LSMW 的相同点和不同点及具体操作
一开始badi.BAPI.LSMW关系极其混乱,好像都是传输数据, just transfer data from SAP system to non-SAP system or transfer d ...
- LSMW应用
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...
- abap 常用 function
ABAP常用函数总结 alv .smartform. excel .text.邮件 .远程访问,FTP服务器... **********常用功能function REUSE_ALV_GRID_DI ...
- ABAP重点各种接口技术
转自 http://www.cnblogs.com/penley/archive/2008/11/12/1332140.html 下面总结一下ABAP中的各种接口技术,因为学习时间不是很长,肯定还不全 ...
- ABAP 生产订单的创建与修改函数
ABAP 生产订单的创建与修改函数转自http://www.cnblogs.com/aBaoRong/archive/2012/04/11/2441946.html 如果生产订单过多,可以批量创建 ...
- SAP Gateway简介
SAP Gateway在S4/HANA时代的ABAP开发模型中有着重要的地位.SAP Gateway是什么?它对ABAP开发有怎样的影响?可以为我们提供哪些方便?这篇译文将浅要地讨论这些话题. SAP ...
- SAP 优缺点
1.优点: SAP是全球所有ERP产品中对企业构架和财务控制考虑得最细致的系统,也是整体控制逻辑和整体系统结构是最严谨的系统,可以让企业引进先进的管理理念: 对产品在各种行业的适用性考虑得最多的系统, ...
- Informatica_(6)性能调优
六.实战汇总31.powercenter 字符集 了解源或者目标数据库的字符集,并在Powercenter服务器上设置相关的环境变量或者完成相关的设置,不同的数据库有不同的设置方法: 多数字符集的问题 ...
- SAP Web Service简介与配置方法
[版权声明]本文为博主原创文章,转载请在明显位置注明出处. 一. SAP Web Service简介 二. SAP Web Service配置准备工作 1. 通过RZ10配置服务器名称和其他参数 2. ...
随机推荐
- $(document).ready(function(){}),$().ready(function(){})和$(function(){})三个有区别么
三者都是一样的,最完整的写法是:$(document).ready(function(){})ready() 函数仅能用于当前文档,因此无需选择器.所以document选择器可以不要,那么就可以写成: ...
- [转]Delphi : keydown与keypress的区别,组合键
Shift 是一个集合变量. type TShiftState = set of (ssShift, ssAlt, ssCtrl, ssLeft, ssRight, ssMiddle, ssDoubl ...
- zepto源码研究 - callback.js
简要:$.Callbacks是一个生成回调管家Callback的工厂,Callback提供一系列方法来管理一个回调列表($.Callbacks的一个私有变量list),包括添加回调函数, 删除回调函数 ...
- sql注释
一般使用数据库客户端软件是navicat,上面写sql用的注释符号一般是“#”或者“/* */”,比如: #我是注释 /*我是注释*/ 记得之前看别人sql里用“--”作为注释符号,结果我今天也试了一 ...
- 高性能IO设计模式之阻塞/非阻塞,同步/异步解析
提到高性能,我想大家都喜欢这个,今天我们就主要来弄明白在高性能的I/O设计中的几个关键概念,做任何事最重要的第一步就是要把概念弄的清晰无误不是么?在这里就是:阻塞,非阻塞,同步,异步. OK, 现在来 ...
- dota监测
漫漫长假一个人无聊得很,整日DOTA,打的腰酸背痛腿抽筋的.就想着写一个脚本记录自己每天打游戏的时间,于是就产生了下面的这个东西... 运行环境:win7 32位. python版本:3.4.1 由于 ...
- underscorejs-every学习
2.10 every 2.10.1 语法: _.every(list, predicate, [context]) 2.10.2 说明: 对list集合的每个成员根据predicate进行真值检测,如 ...
- html5--canvas学习笔记
1. 添加<canvas>元素 right: <canvas id="myCanvas" width="300" height="3 ...
- 【转】.NET开发者必备的11款免费工具
摘要:本文介绍一些最适合.NET开发人员简化Web开发的最佳工具,这些工具都是开源的,有的开发工具你既可以从网上下载可执行文件,也可以下载源代码.一些工具拥有可扩展的框架,是一个持续集成工具. 原文链 ...
- php in_array比较原理和类型比较问题
in_array 是PHP 的检查数组中是否存在某个值 的函数,里面有三个参数 bool in_array ( mixed $needle , array $haystack [, bool $str ...