ME01 创建货源清单function

CALL FUNCTION ‘ME_DIRECT_INPUT_SOURCE_LIST‘

Function module IDOC_INPUT_SRCLST

FUNCTION IDOC_INPUT_SRCLST.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(INPUT_METHOD) LIKE BDWFAP_PAR-INPUTMETHD
*" VALUE(MASS_PROCESSING) LIKE BDWFAP_PAR-MASS_PROC
*" EXPORTING
*" VALUE(WORKFLOW_RESULT) LIKE BDWF_PARAM-RESULT
*" VALUE(APPLICATION_VARIABLE) LIKE BDWF_PARAM-APPL_VAR
*" VALUE(IN_UPDATE_TASK) LIKE BDWFAP_PAR-UPDATETASK
*" VALUE(CALL_TRANSACTION_DONE) LIKE BDWFAP_PAR-CALLTRANS
*" TABLES
*" IDOC_CONTRL STRUCTURE EDIDC
*" IDOC_DATA STRUCTURE EDIDD
*" IDOC_STATUS STRUCTURE BDIDOCSTAT
*" RETURN_VARIABLES STRUCTURE BDWFRETVAR
*" SERIALIZATION_INFO STRUCTURE BDI_SER
*" EXCEPTIONS
*" WRONG_FUNCTION_CALLED
*"----------------------------------------------------------------------
ENHANCEMENT-POINT IDOC_INPUT_SRCLST_G1 SPOTS ES_SAPLMEAI.
*$*$-Start: IDOC_INPUT_SRCLST_G1----------------------------------------------------------------$*$*
ENHANCEMENT 1 MGV_GENERATED_IDOC_INPUT_SR000. "active version
*{ALE Begin} generation http://intranet.sap.com/materialversion
CALL FUNCTION ‘MGV_ALE_ADD_INTERNAL_MATNR‘
TABLES
idoc_data = idoc_data
idoc_contrl = idoc_contrl
EXCEPTIONS
NUMBER_MISMATCH = 1
OTHERS = 2.
*{ALE End} generation
ENDENHANCEMENT.
*$*$-End: IDOC_INPUT_SRCLST_G1----------------------------------------------------------------$*$*

DATA: F_IDOC_CONTROL LIKE EDIDC,
F_IDOC_STATUS LIKE BDIDOCSTAT,
F_E1EORDH LIKE E1EORDH,
SUBRC LIKE SY-SUBRC.

DATA: T_IDOC_DATA LIKE EDIDD OCCURS 0 WITH HEADER LINE,
T_EORD LIKE EORD OCCURS 0 WITH HEADER LINE,
T_EORDU LIKE EORDU OCCURS 0 WITH HEADER LINE,
lt_tupel TYPE STANDARD TABLE OF metup WITH DEFAULT KEY,"1389182
ls_tupel TYPE metup.

DATA: BEGIN OF F_EORDKEY,
MATNR LIKE EORD-MATNR,
WERKS LIKE EORD-WERKS,
END OF F_EORDKEY.

*--- refresh workflow result
WORKFLOW_RESULT = C_WF_RESULT_OK.

CLEAR SERIALIZATION_INFO.
REFRESH SERIALIZATION_INFO.
*- serialization info get
CALL FUNCTION ‘IDOC_SERIALIZATION_CHECK‘
TABLES
IDOC_SERIAL = SERIALIZATION_INFO
IDOC_DATA = IDOC_DATA
IDOC_CONTROL = IDOC_CONTRL.

* Initialization
CALL FUNCTION ‘ME_INITIALIZE_SOURCE_LIST‘.

LOOP AT IDOC_CONTRL.
F_IDOC_CONTROL = IDOC_CONTRL.

* check idoc type
IF F_IDOC_CONTROL-IDOCTP <> C_IDOCTP_SRCLST01.
RAISE WRONG_FUNCTION_CALLED.
ENDIF.

* Read data records for each idoc
REFRESH T_IDOC_DATA.
LOOP AT IDOC_DATA WHERE DOCNUM = F_IDOC_CONTROL-DOCNUM.
T_IDOC_DATA = IDOC_DATA.
APPEND T_IDOC_DATA.
ENDLOOP.

* refresh target tables
CLEAR: T_EORD, F_IDOC_STATUS, SUBRC, F_E1EORDH, T_EORDU, lt_tupel."1389182
REFRESH: T_EORD, T_EORDU.

* check skipped entries
PERFORM CHECK_SERIAL_SRCLST
TABLES
SERIALIZATION_INFO
USING F_IDOC_CONTROL-DOCNUM
F_IDOC_STATUS
SUBRC.
* error occurs in check of skipped entries
IF SUBRC <> 0.
IDOC_STATUS = F_IDOC_STATUS.
IDOC_STATUS-DOCNUM = F_IDOC_CONTROL-DOCNUM.
APPEND IDOC_STATUS.

RETURN_VARIABLES-WF_PARAM = C_WF_PAR_PROCESSED_IDOCS.
RETURN_VARIABLES-DOC_NUMBER = F_IDOC_CONTROL-DOCNUM.
APPEND RETURN_VARIABLES.
RETURN_VARIABLES-WF_PARAM = C_WF_PAR_APPL_OBJECTS.
F_EORDKEY-MATNR = SPACE.
F_EORDKEY-WERKS = SPACE.
RETURN_VARIABLES-DOC_NUMBER = F_EORDKEY.
APPEND RETURN_VARIABLES.
CONTINUE.
ENDIF.

* fill application structures
PERFORM FILL_APPL_STRUCTURES_SRCLST
TABLES T_IDOC_DATA
T_EORD
USING F_IDOC_CONTROL
F_IDOC_STATUS
F_E1EORDH
SUBRC.
* error occurs in filling application structures
IF SUBRC <> 0.
IDOC_STATUS = F_IDOC_STATUS.
IDOC_STATUS-DOCNUM = F_IDOC_CONTROL-DOCNUM.
APPEND IDOC_STATUS.

RETURN_VARIABLES-WF_PARAM = C_WF_PAR_ERROR_IDOCS.
RETURN_VARIABLES-DOC_NUMBER = F_IDOC_CONTROL-DOCNUM.
APPEND RETURN_VARIABLES.
WORKFLOW_RESULT = C_WF_RESULT_ERROR.
CONTINUE.
ENDIF.

LOOP AT T_EORD.
T_EORDU = T_EORD.
T_EORDU-KZ = C_FLAG_INSERT.
APPEND T_EORDU.
* create MRP relevant information
CLEAR ls_tupel. "1389182
ls_tupel-matnr = t_eord-matnr.
ls_tupel-werks = t_eord-werks.
ls_tupel-read = abap_true.
INSERT ls_tupel INTO TABLE lt_tupel.
ENDLOOP.
SORT T_EORDU BY ZEORD.

CALL FUNCTION ‘ME_DIRECT_INPUT_SOURCE_LIST‘
EXPORTING
I_MATNR = F_E1EORDH-MATNR
I_WERKS = F_E1EORDH-WERKS
I_VORGA = C_CODE_ALE
I_LOGSY = F_E1EORDH-LOGSY
TABLES
T_EORD = T_EORDU
EXCEPTIONS
PLANT_MISSING = 1
MATERIAL_MISSING = 2
ERROR_MESSAGE = 4
OTHERS = 3.

SUBRC = SY-SUBRC.
IF SUBRC <> 0.
CLEAR IDOC_STATUS.
IDOC_STATUS-DOCNUM = F_IDOC_CONTROL-DOCNUM.
IDOC_STATUS-STATUS = C_IDOC_STAT_INPUT_ERROR.
IDOC_STATUS-MSGID = SY-MSGID.
IDOC_STATUS-MSGTY = SY-MSGTY.
IDOC_STATUS-MSGNO = SY-MSGNO.
IDOC_STATUS-MSGV1 = SY-MSGV1.
IDOC_STATUS-MSGV2 = SY-MSGV2.
IDOC_STATUS-MSGV3 = SY-MSGV3.
IDOC_STATUS-MSGV4 = SY-MSGV4.
IDOC_STATUS-UNAME = SY-UNAME.
IDOC_STATUS-REPID = SY-REPID.
APPEND IDOC_STATUS.

RETURN_VARIABLES-WF_PARAM = C_WF_PAR_ERROR_IDOCS.
RETURN_VARIABLES-DOC_NUMBER = F_IDOC_CONTROL-DOCNUM.
APPEND RETURN_VARIABLES.
WORKFLOW_RESULT = C_WF_RESULT_ERROR.
CONTINUE.
ELSE.
CLEAR IDOC_STATUS.
IDOC_STATUS-DOCNUM = F_IDOC_CONTROL-DOCNUM.
IDOC_STATUS-STATUS = C_IDOC_STAT_IS_POSTED.
IDOC_STATUS-MSGID = C_MSG_ID_ME. "391782
IDOC_STATUS-MSGTY = C_MSG_TY_I.
IDOC_STATUS-MSGNO = ‘877‘. "391782
IDOC_STATUS-MSGV1 = F_E1EORDH-MATNR.
IDOC_STATUS-MSGV2 = F_E1EORDH-WERKS.
IDOC_STATUS-UNAME = SY-UNAME.
IDOC_STATUS-REPID = SY-REPID.
APPEND IDOC_STATUS.

RETURN_VARIABLES-WF_PARAM = C_WF_PAR_PROCESSED_IDOCS.
RETURN_VARIABLES-DOC_NUMBER = F_IDOC_CONTROL-DOCNUM.
APPEND RETURN_VARIABLES.
RETURN_VARIABLES-WF_PARAM = C_WF_PAR_APPL_OBJECTS.
F_EORDKEY-MATNR = F_E1EORDH-MATNR.
F_EORDKEY-WERKS = F_E1EORDH-WERKS.
RETURN_VARIABLES-DOC_NUMBER = F_EORDKEY.
APPEND RETURN_VARIABLES.
CONTINUE.
ENDIF.

ENDLOOP. "<------------------------- idoc_contrl.

CALL FUNCTION ‘ME_POST_SOURCE_LIST_NEW‘.
* trigger MRP update
CALL FUNCTION ‘ME_WRITE_DISP_RECORD_SOS‘ IN UPDATE TASK "1389182
TABLES
eord_alt = t_eord
eord_neu = t_eordu
tupel = lt_tupel.

CALL CUSTOMER-FUNCTION ‘002‘
EXPORTING
MESSAGE_TYPE = F_IDOC_CONTROL-MESTYP.

IN_UPDATE_TASK = C_TRUE.

ENDFUNCTION.

时间: 2024-10-14 08:52:06

ME01 创建货源清单function的相关文章

ME01 创建货源清单

[转自 http://blog.sina.com.cn/s/blog_6466e5f70100ix3p.html ] SAP中采购货源清单创建的方法有以下几种: 1.ME01 手动逐个创建. 2.ME05 系统自动批量创建. 3.通过信息记录中的菜单“附加”-“源清单”创建. 4.通过采购合同中的菜单“项目”-“维护货源清单”创建. 5.通过计划协议中的菜单“项目”-“维护货源清单”创建. 另外,没有料号的物料也可以建货源清单,只是不能由ME01去建立,而是通过采购合同去建,并且这时会有“排除标

SAP中货源清单创建的几种方法

SAP中采购货源清单创建的方法有以下几种: 1.ME01 手动逐个创建. 2.ME05 系统自动批量创建. 3.通过信息记录中的菜单“附加”-“源清单”创建. 4.通过采购合同中的菜单“项目”-“维护货源清单”创建. 5.通过计划协议中的菜单“项目”-“维护货源清单”创建. 另外,没有料号的物料也可以建货源清单,只是不能由ME01去建立,而是通过采购合同去建,并且这时会有“排除标识”,可以将相同物料组下的一些料号排除在外.当然,“排除标识”选不选中可以根据实际情况去设. 转载:http://ww

货源清单决定

1.物料级别的货源清单 在物料主档采购视图中勾选源清单 2.工厂级别的货源清单 SPRO->物料管理->货源清单->定义工厂层的货源清单需求 3.建立货源清单:ME01 A.冻结供应商 B.固定供应商 4.维护货源清单 A:框架协议:ME32K/ME31K 菜单中的项目->维护源清单 B:信息记录:ME11/ME12 菜单中的附加->源清单 C:计划协议:ME32L/ME31L 菜单中的项目->维护源清单 D:自动产生:ME05 5.没有物流编号的也可以建立货源清单,此

ME11创建信息记录 Function

转自 http://blog.csdn.net/zeewjj/article/details/7941530  CALL FUNCTION 'ME_DIRECT_INPUT_INFORECORD' DATA: WA_EINA TYPE EINA,      WA_EINE TYPE EINE,      WA_EINA_NEW TYPE EINA,      WA_EINE_NEW TYPE EINE. DATA: IT_HEAD TYPE STANDARD TABLE OF MESTXH,  

【Asp.net入门5】创建产品清单

SAP 常用T-CODE

Plant Maintenance (PM) IW32 - Change Plant Maintenance Order IW33 - Display Plant Maintenance Order IW34 - Create Notification Order IW51 - Create Service Notification IW52 - Change Service Notification IW53 - Display Service Notification IW54 - Crea

SAP 经常使用T-CODE

Plant Maintenance (PM) IW32 - Change Plant Maintenance Order IW33 - Display Plant Maintenance Order IW34 - Create Notification Order IW51 - Create Service Notification IW52 - Change Service Notification IW53 - Display Service Notification IW54 - Crea

重要Transaction Code

与客户相关  VD01 建立客户 Create customerVD02 更改客户 Change customerVD03 显示客户 Display customerVK11 创建条件 Create ConditionVK12 修改条件 Change ConditionVK13 显示条件 Display ConditionVA21 创建报价 Create QuotationVA22 更改报价 Change QuotationVA23 显示报价 Display QuotationVA01 创建销售

MM常用t-code

MM常用事务码(T Code)清单 MM01 - 创建物料主数据XK01 - 创建供应商主数据ME11 - 创建采购信息记录ME01 - 维护货源清单ME51N- 创建采购申请ME5A - 显示采购申请清单ME55 - 批准采购申请(批准组:YH)ME57 – 分配并处理采购申请MB21 - 预留MB24 - 显示预留清单ME21N- 创建采购订单ME28 - 批准采购订单(批准组:YS)ME9F - 采购订单发送确认ME2L - 查询供应商的采购凭证ME31 - 创建采购协议MD03 - 手动