ME11/ME12采购信息记录及条件记录创建及更新BAPI:ME_INFORECORD_MAINTAIN_MULTI

本文主要是介绍ME11/ME12采购信息记录及条件记录创建及更新BAPI:ME_INFORECORD_MAINTAIN_MULTI,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

使用ME_INFORECORD_MAINTAIN_MULTI函数进行采购信息记录及条件记录的创建以及更新,单独进行条件价格信息的创建及变更可以参照下面我的另一个帖子:

MEK1/VK11创建条件记录BAPIhttps://blog.csdn.net/DeveloperMrMeng/article/details/118896458?spm=1001.2014.3001.5501

**********************************************************************
* 创建者:  HAND05
* 接口描述:采购信息记录维护接口
* 创建日期:2022.04.15
**********************************************************************
FUNCTION ZIF_OA2RFC_MM_0004.
*"----------------------------------------------------------------------
*"*"本地接口:
*"  IMPORTING
*"     VALUE(IT_INFORECORD) TYPE  ZTMM_0004_ME11_I
*"  EXPORTING
*"     VALUE(EV_TYPE) TYPE  BAPI_MTYPE
*"     VALUE(EV_MESSAGE) TYPE  BAPI_MSG
*"     VALUE(ET_RETURN) TYPE  ZTMM_0004_RETURN_E
*"----------------------------------------------------------------------* 逻辑处理参数DATA:LV_MEINS      TYPE MEINS,LS_INFORECORD TYPE ZSMM_0004_ME11_I,LS_RETURN_E   TYPE ZSMM_0004_RETURN_E,LV_MESSAGE    TYPE BAPI_MSG.* BAPI创建参数DATA:LT_EINA          TYPE MEWIEINA_MIG_T,         "一般数据LS_EINA          TYPE MEWIEINA_MIG,           "一般数据LT_EINAX         TYPE MEWIEINAX_T,LS_EINAX         TYPE MEWIEINAX_TY,LT_EINE          TYPE MEWIEINE_T,             "采购组织数据LS_EINE          TYPE MEWIEINE_TY,            "采购组织数据LT_EINEX         TYPE MEWIEINEX_T,LS_EINEX         TYPE MEWIEINEX_TY,LT_COND_VALIDITY TYPE MEWIVALIDITY_TT,        "条件有效期LS_COND_VALIDITY TYPE MEWIVALIDITY_TY,        "条件有效期LT_CONDITION     TYPE MEWICONDITION_TT,       "条件明细LS_CONDITION     TYPE MEWICONDITION_TY,       "条件明细LT_EINA_E        TYPE MEWIEINA_MIG_T,         "创建返回-一般数据LT_EINE_E        TYPE MEWIEINE_T,             "创建返回-采购组织数据LT_RETURN        TYPE FS4MIG_T_BAPIRET2.      "创建返回消息* 获取物料单位SELECT A~MATNR,                                 "物料号B~WERKS,                                 "工厂A~MEINS,                                 "基本单位A~BSTME,                                 "采购单位B~PLIFZ                                  "计划交货时间(天)INTO TABLE @DATA(LT_MARA)FROM MARA AS AINNER JOIN MARC AS BON A~MATNR = B~MATNRFOR ALL ENTRIES IN @IT_INFORECORDWHERE A~MATNR = @IT_INFORECORD-MATNRAND B~WERKS = @IT_INFORECORD-WERKS.* 获取历史采购信息记录SELECT A~INFNR,A~MATNR,                                 "物料A~LIFNR,                                 "供应商B~EKORG,                                 "采购组织B~ESOKZ,                                 "信息类别B~WERKS                                  "工厂INTO TABLE @DATA(LT_INFOREC_OLD)FROM EINA AS AINNER JOIN EINE AS BON A~INFNR = B~INFNRFOR ALL ENTRIES IN @IT_INFORECORDWHERE A~MATNR = @IT_INFORECORD-MATNRAND A~LIFNR = @IT_INFORECORD-LIFNRAND B~EKORG = @IT_INFORECORD-EKORGAND B~ESOKZ = @IT_INFORECORD-ESOKZAND B~WERKS = @IT_INFORECORD-WERKS.* 获取历史条件价格信息SELECT A~LIFNR,                                 "供应商A~MATNR,                                 "物料A~EKORG,                                 "采购组织A~WERKS,                                 "工厂A~ESOKZ,                                 "信息类型A~DATAB,                                 "有效期自A~DATBI,                                 "有效期至A~KNUMH,                                 "条件记录编号B~KOPOS                                  "条件序列号INTO TABLE @DATA(LT_A017)FROM A017 AS AINNER JOIN KONP AS BON A~KNUMH = B~KNUMHFOR ALL ENTRIES IN @IT_INFORECORDWHERE A~MATNR = @IT_INFORECORD-MATNRAND A~LIFNR = @IT_INFORECORD-LIFNRAND A~EKORG = @IT_INFORECORD-EKORGAND A~ESOKZ = @IT_INFORECORD-ESOKZAND A~WERKS = @IT_INFORECORD-WERKSAND A~DATAB = @IT_INFORECORD-DATABAND A~DATBI = @IT_INFORECORD-DATBI.SORT LT_MARA        BY MATNR ASCENDINGWERKS ASCENDING.SORT LT_INFOREC_OLD BY MATNR ASCENDINGLIFNR ASCENDINGEKORG ASCENDINGESOKZ ASCENDINGWERKS ASCENDING.SORT LT_A017        BY LIFNR ASCENDINGMATNR ASCENDINGEKORG ASCENDINGWERKS ASCENDINGESOKZ ASCENDINGDATAB ASCENDINGDATBI ASCENDING.LOOP AT IT_INFORECORD INTO LS_INFORECORD.READ TABLE LT_MARA INTO DATA(LS_MARA)WITH KEY MATNR = LS_INFORECORD-MATNRBINARY SEARCH.IF SY-SUBRC = 0.IF LS_MARA-BSTME IS NOT INITIAL.LV_MEINS = LS_MARA-BSTME.ELSE.LV_MEINS = LS_MARA-MEINS.ENDIF.CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'EXPORTINGINPUT          = LS_INFORECORD-BPRMELANGUAGE       = SY-LANGUIMPORTINGOUTPUT         = LS_INFORECORD-BPRMEEXCEPTIONSUNIT_NOT_FOUND = 1OTHERS         = 2.IF LS_INFORECORD-BPRME <> LV_MEINS.EV_TYPE = 'E'.LS_RETURN_E-TYPE = 'E'.
*       物料&1的价格单位为&2,请修正导入数据单位!MESSAGE E013(ZMSG01) WITH LS_INFORECORD-MATNRLV_MEINSINTO LV_MESSAGE.LS_RETURN_E-MESSAGE = LV_MESSAGE.ENDIF.IF LS_INFORECORD-WERKS IS NOT INITIAL.READ TABLE LT_MARA INTO LS_MARAWITH KEY MATNR = LS_INFORECORD-MATNRWERKS = LS_INFORECORD-WERKSBINARY SEARCH.IF SY-SUBRC = 0.IF LS_MARA-PLIFZ IS INITIAL.EV_TYPE = 'E'.LS_RETURN_E-TYPE = 'E'.
*           物料&1计划交货时间未维护,请联系资材部!MESSAGE E015(ZMSG01) WITH LS_INFORECORD-MATNRINTO LV_MESSAGE.LS_RETURN_E-MESSAGE = LS_RETURN_E-MESSAGE && LV_MESSAGE.ENDIF.ENDIF.ENDIF.*     判断是否存在历史采购信息记录READ TABLE LT_INFOREC_OLD INTO DATA(LS_INFOREC_OLD)WITH KEY MATNR = LS_INFORECORD-MATNRLIFNR = LS_INFORECORD-LIFNREKORG = LS_INFORECORD-EKORGESOKZ = LS_INFORECORD-ESOKZWERKS = LS_INFORECORD-WERKSBINARY SEARCH.
*     存在记录IF SY-SUBRC = 0.IF LS_INFORECORD-ZSTATUS = 'V' OR         "V:校验LS_INFORECORD-ZSTATUS = 'C'.           "C:创建EV_TYPE          = 'E'.LS_RETURN_E-TYPE = 'E'.*         采购信息记录已存在!MESSAGE E207(ZMSG01) INTO LV_MESSAGE.LS_RETURN_E-MESSAGE = LS_RETURN_E-MESSAGE && LV_MESSAGE.ENDIF.ELSE.IF LS_INFORECORD-ZSTATUS = 'U'.           "U:更新EV_TYPE          = 'E'.LS_RETURN_E-TYPE = 'E'.*         采购信息记录不存在!MESSAGE E208(ZMSG01) INTO LV_MESSAGE.LS_RETURN_E-MESSAGE = LS_RETURN_E-MESSAGE && LV_MESSAGE.ENDIF.ENDIF.IF EV_TYPE <> 'E'.READ TABLE LT_A017 INTO DATA(LS_A017)WITH KEY LIFNR = LS_INFORECORD-LIFNRMATNR = LS_INFORECORD-MATNREKORG = LS_INFORECORD-EKORGWERKS = LS_INFORECORD-WERKSESOKZ = LS_INFORECORD-ESOKZDATAB = LS_INFORECORD-DATABDATBI = LS_INFORECORD-DATBIBINARY SEARCH.*       更新-基本数据LS_EINA-INFO_REC           = LS_INFOREC_OLD-INFNR. "采购信息记录编号LS_EINAX-INFO_RECN         = LS_INFOREC_OLD-INFNR. "采购信息记录编号*       更新-采购数据LS_EINE-INFO_REC           = LS_INFOREC_OLD-INFNR. "采购信息记录编号LS_EINEX-INFO_RECN         = LS_INFOREC_OLD-INFNR. "采购信息记录编号*       更新-条件价格有效期LS_COND_VALIDITY-INFO_REC  = LS_INFOREC_OLD-INFNR. "采购信息记录编号LS_COND_VALIDITY-SERIAL_ID = LS_A017-KNUMH.        "条件记录编号*       更新-条件价格信息LS_CONDITION-INFO_REC      = LS_INFOREC_OLD-INFNR. "采购信息记录编号LS_CONDITION-SERIAL_ID     = LS_A017-KNUMH.        "条件记录编号LS_CONDITION-COND_COUNT    = LS_A017-KOPOS.        "条件序列号*       条件价格信息更新标识IF LS_A017-KNUMH IS NOT INITIAL.LS_CONDITION-CHANGE_ID     = 'U'.ENDIF.*       创建&更新-基本数据LS_EINA-MATERIAL = LS_INFORECORD-MATNR.                  "物料号LS_EINA-VENDOR   = |{ LS_INFORECORD-LIFNR ALPHA = IN }|. "供应商APPEND LS_EINA TO LT_EINA.LS_EINAX-MATERIAL = 'X'.LS_EINAX-VENDOR   = 'X'.APPEND LS_EINAX TO LT_EINAX.*       创建&更新-采购数据LS_EINE-EINE_INDX  = '01'.                    "顺序编号LS_EINE-PURCH_ORG  = LS_INFORECORD-EKORG.     "采购组织LS_EINE-PLND_DELRY = LS_MARA-PLIFZ.           "计划交货时间(天)LS_EINE-INFO_TYPE  = LS_INFORECORD-ESOKZ.     "采购信息记录分类LS_EINE-PLANT      = LS_INFORECORD-WERKS.     "工厂LS_EINE-ORDERPR_UN = LS_INFORECORD-BPRME.     "订单价格单位(采购)LS_EINE-PRICE_UNIT = LS_INFORECORD-PEINH.     "价格单位LS_EINE-CURRENCY   = LS_INFORECORD-WAERS.     "货币码LS_EINE-TAX_CODE   = LS_INFORECORD-MWSKZ.     "销售/购买税代码APPEND LS_EINE TO LT_EINE.LS_EINEX-EINE_INDX  = '01'.LS_EINEX-PURCH_ORG  = 'X'.LS_EINEX-PLND_DELRY = 'X'.LS_EINEX-INFO_TYPE  = 'X'.LS_EINEX-PLANT      = 'X'.LS_EINEX-ORDERPR_UN = 'X'.LS_EINEX-PRICE_UNIT = 'X'.LS_EINEX-CURRENCY   = 'X'.LS_EINEX-TAX_CODE   = 'X'.APPEND LS_EINEX TO LT_EINEX.*       创建&更新-条件有效期IF LS_INFORECORD-DATAB IS INITIAL.EV_TYPE = 'E'.LS_RETURN_E-TYPE = 'E'.
*         有效期起始时间不能为空!MESSAGE E120(ZMSG01) INTO LV_MESSAGE.LS_RETURN_E-MESSAGE = LS_RETURN_E-MESSAGE && LV_MESSAGE.ENDIF.IF LS_INFORECORD-DATBI IS INITIAL.LS_INFORECORD-DATBI = '99991231'.ENDIF.LS_COND_VALIDITY-EINE_INDX  = '01'.                "顺序编号LS_COND_VALIDITY-PLANT      = LS_INFORECORD-WERKS. "工厂LS_COND_VALIDITY-VALID_FROM = LS_INFORECORD-DATAB. "有效期从LS_COND_VALIDITY-VALID_TO   = LS_INFORECORD-DATBI. "有效期至APPEND LS_COND_VALIDITY TO LT_COND_VALIDITY.*       创建&更新-条件明细LS_CONDITION-EINE_INDX  = '01'.               "顺序编号LS_CONDITION-COND_TYPE  = 'PB00'.             "条件类型LS_CONDITION-COND_VALUE = LS_INFORECORD-PBXX. "净价LS_CONDITION-CURRENCY   = LS_INFORECORD-WAERS."货币码LS_CONDITION-COND_P_UNT = LS_INFORECORD-PEINH."条件定价单位LS_CONDITION-COND_UNIT  = LS_INFORECORD-BPRME."条件单位APPEND LS_CONDITION TO LT_CONDITION.*       采购信息记录创建&更新IF EV_TYPE <> 'E'.CALL FUNCTION 'ME_INFORECORD_MAINTAIN_MULTI'IMPORTINGET_EINA       = LT_EINA_EET_EINE       = LT_EINE_ETABLEST_EINA        = LT_EINAT_EINAX       = LT_EINAXT_EINE        = LT_EINET_EINEX       = LT_EINEXCOND_VALIDITY = LT_COND_VALIDITYCONDITION     = LT_CONDITIONRETURN        = LT_RETURN.LOOP AT LT_RETURN INTO DATA(LS_RETURN) WHERE TYPE CA 'EAX'.EV_TYPE = 'E'.IF LS_RETURN_E-MESSAGE IS INITIAL.LS_RETURN_E-MESSAGE = LS_RETURN-MESSAGE.ELSE.LS_RETURN_E-MESSAGE = LS_RETURN_E-MESSAGE &&';' &&LS_RETURN-MESSAGE.ENDIF.ENDLOOP.IF SY-SUBRC = 0.CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.LS_RETURN_E-TYPE = 'E'.ELSE.CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.READ TABLE LT_EINA_E INTO DATA(LS_EINA_E) INDEX 1.LS_RETURN_E-TYPE  = 'S'.LS_RETURN_E-INFNR = LS_EINA_E-INFO_REC."采购信息号*           采购信息记录&1维护成功!MESSAGE S014(ZMSG01) WITH LS_EINA_E-INFO_RECINTO LS_RETURN_E-MESSAGE.ENDIF.ENDIF.ENDIF.LS_RETURN_E-ZOAITEM = LS_INFORECORD-ZOAITEM."OA行项目编码APPEND LS_RETURN_E TO ET_RETURN.ENDIF.CLEAR:LT_EINA_E,LT_EINE_E,LS_EINA,LT_EINA,LS_EINAX,LT_EINAX,LS_EINE,LT_EINE,LS_EINEX,LT_EINEX,LS_COND_VALIDITY,LT_COND_VALIDITY,LS_CONDITION,LT_CONDITION,LT_RETURN,LS_RETURN_E,LV_MESSAGE,LS_INFOREC_OLD,LS_A017.ENDLOOP.IF EV_TYPE = 'E'.EV_MESSAGE = '本次创建包含错误条目!'.ELSE.EV_TYPE = 'S'.EV_MESSAGE = '本次创建全部成功!'.ENDIF.ENDFUNCTION.

3070467 - ME_INFORECORD_MAINTAIN_MULTI: Template for creating info record

这篇关于ME11/ME12采购信息记录及条件记录创建及更新BAPI:ME_INFORECORD_MAINTAIN_MULTI的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/238303

相关文章

poj3468(线段树成段更新模板题)

题意:包括两个操作:1、将[a.b]上的数字加上v;2、查询区间[a,b]上的和 下面的介绍是下解题思路: 首先介绍  lazy-tag思想:用一个变量记录每一个线段树节点的变化值,当这部分线段的一致性被破坏我们就将这个变化值传递给子区间,大大增加了线段树的效率。 比如现在需要对[a,b]区间值进行加c操作,那么就从根节点[1,n]开始调用update函数进行操作,如果刚好执行到一个子节点,

hdu1394(线段树点更新的应用)

题意:求一个序列经过一定的操作得到的序列的最小逆序数 这题会用到逆序数的一个性质,在0到n-1这些数字组成的乱序排列,将第一个数字A移到最后一位,得到的逆序数为res-a+(n-a-1) 知道上面的知识点后,可以用暴力来解 代码如下: #include<iostream>#include<algorithm>#include<cstring>#include<stack>#in

hdu1689(线段树成段更新)

两种操作:1、set区间[a,b]上数字为v;2、查询[ 1 , n ]上的sum 代码如下: #include<iostream>#include<algorithm>#include<cstring>#include<stack>#include<queue>#include<set>#include<map>#include<stdio.h>#include<stdl

【Python编程】Linux创建虚拟环境并配置与notebook相连接

1.创建 使用 venv 创建虚拟环境。例如,在当前目录下创建一个名为 myenv 的虚拟环境: python3 -m venv myenv 2.激活 激活虚拟环境使其成为当前终端会话的活动环境。运行: source myenv/bin/activate 3.与notebook连接 在虚拟环境中,使用 pip 安装 Jupyter 和 ipykernel: pip instal

在cscode中通过maven创建java项目

在cscode中创建java项目 可以通过博客完成maven的导入 建立maven项目 使用快捷键 Ctrl + Shift + P 建立一个 Maven 项目 1 Ctrl + Shift + P 打开输入框2 输入 "> java create"3 选择 maven4 选择 No Archetype5 输入 域名6 输入项目名称7 建立一个文件目录存放项目,文件名一般为项目名8 确定

hdu 1754 I Hate It(线段树,单点更新,区间最值)

题意是求一个线段中的最大数。 线段树的模板题,试用了一下交大的模板。效率有点略低。 代码: #include <stdio.h>#include <string.h>#define TREE_SIZE (1 << (20))//const int TREE_SIZE = 200000 + 10;int max(int a, int b){return a > b ? a :

业务中14个需要进行A/B测试的时刻[信息图]

在本指南中,我们将全面了解有关 A/B测试 的所有内容。 我们将介绍不同类型的A/B测试,如何有效地规划和启动测试,如何评估测试是否成功,您应该关注哪些指标,多年来我们发现的常见错误等等。 什么是A/B测试? A/B测试(有时称为“分割测试”)是一种实验类型,其中您创建两种或多种内容变体——如登录页面、电子邮件或广告——并将它们显示给不同的受众群体,以查看哪一种效果最好。 本质上,A/B测

AI行业应用(不定期更新)

ChatPDF 可以让你上传一个 PDF 文件,然后针对这个 PDF 进行小结和提问。你可以把各种各样你要研究的分析报告交给它,快速获取到想要知道的信息。https://www.chatpdf.com/

Java 创建图形用户界面(GUI)入门指南(Swing库 JFrame 类)概述

概述 基本概念 Java Swing 的架构 Java Swing 是一个为 Java 设计的 GUI 工具包,是 JAVA 基础类的一部分,基于 Java AWT 构建,提供了一系列轻量级、可定制的图形用户界面(GUI)组件。 与 AWT 相比,Swing 提供了许多比 AWT 更好的屏幕显示元素,更加灵活和可定制,具有更好的跨平台性能。 组件和容器 Java Swing 提供了许多

【北交大信息所AI-Max2】使用方法

BJTU信息所集群AI_MAX2使用方法 使用的前提是预约到相应的算力卡,拥有登录权限的账号密码,一般为导师组共用一个。 有浏览器、ssh工具就可以。 1.新建集群Terminal 浏览器登陆10.126.62.75 (如果是1集群把75改成66) 交互式开发 执行器选Terminal 密码随便设一个(需记住) 工作空间:私有数据、全部文件 加速器选GeForce_RTX_2080_Ti