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. ...
随机推荐
- bitmap index
bitmap index 说明: set echo on drop table t purge; create table t ( processed_flag ) ); create bitmap ...
- UIScrollView设置了contentSize后还是没办法滚动?
1.最常见的原因是 contentSize 这个属性,比uiscrollview的frame要小, 无需滚动, 自然就滚动不了. scrollenabled 这个属性,标识着是否允许滚动,要言设成ye ...
- [技术翻译]Guava-libraries(一): 用户指导
用户指导 本文翻译自http://code.google.com/p/guava-libraries/wiki/GuavaExplained,由十八子将翻译,发表于博客园 http://www.cnb ...
- Java中final关键字的用法
- 自定义Back返回键(实现按两次返回键退出程序)
实现机制:当用户点击物理返回键时,Activity会调用onBackPressed(),只需在Activity中复写该方法即可 以下是代码实现: package com.example.qjm3662 ...
- PHP Countable接口
实现该接口可以使用count()方法来获取集合的总数
- Unique Binary Search Tree
Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For examp ...
- KeyPress事件
在做一个小demo的时候,发现在文本框中输入一个数字,按下“+”,数字增加了,但是“+”仍旧存在的问题,解决方案:提前执行键盘press事件 private void txtNum_KeyPress( ...
- C# 取小数点
1.Math.Round(0.333333,2);//按照四舍五入的国际标准2. double dbdata=0.335333; string str1=String.Format("{0: ...
- 嵌入式 现已发展为 IT行业的主流——高薪,且人才缺乏
嵌入式 现已发展为 IT行业的主流——高薪,且人才缺乏 硅谷芯微技术中心,注重实践操作,以实际项目带学员,让学员真正学到东西,达到企业用人标准,有兴趣的,可以前来了解,给自己多一个选择的机会,可以多家 ...