CALL FUNCTION 'ME_DIRECT_INPUT_SOURCE_LIST'

*&---------------------------------------------------------------------*
*& Report YTST_USE_019_003
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------* REPORT YTST_FF_006. TABLES:MARA,
EORD. DATA:GT_EORDU TYPE STANDARD TABLE OF EORDU,
WA_EORDU TYPE EORDU,
GT_XEORD TYPE STANDARD TABLE OF EORDU.
DATA:GT_EORD TYPE STANDARD TABLE OF EORD,
WA_EORD TYPE EORD. SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-. SELECT-OPTIONS:S_MATNR FOR MARA-MATNR MODIF ID WH NO INTERVALS NO-EXTENSION,
S_WERKS FOR EORD-WERKS MODIF ID WH NO INTERVALS NO-EXTENSION,
S_LIFNR FOR EORD-LIFNR MODIF ID WH NO INTERVALS NO-EXTENSION.
PARAMETER:P_VDATU LIKE EORD-VDATU.
*PARAMETER:P_LIFNR LIKE EORD-LIFNR. SELECTION-SCREEN BEGIN OF BLOCK B4 WITH FRAME TITLE TEXT-.
PARAMETER:RB_CJ RADIOBUTTON GROUP G2 DEFAULT 'X',
RB_XG RADIOBUTTON GROUP G2.
SELECTION-SCREEN END OF BLOCK B4. SELECTION-SCREEN END OF BLOCK B3. DATA:L_ERR TYPE STRING,
L_TEXT TYPE STRING. IF RB_CJ EQ 'X'.
*&创建货源清单
WA_EORDU-MATNR = S_MATNR-LOW.
WA_EORDU-WERKS = S_WERKS-LOW.
WA_EORDU-LIFNR = S_LIFNR-LOW.
WA_EORDU-EKORG = 'P001'.
WA_EORDU-VDATU = P_VDATU.
WA_EORDU-BDATU = ''.
WA_EORDU-FLIFN = 'X'.
WA_EORDU-KZ = 'I'.
SELECT SINGLE MEINS
INTO WA_EORDU-MEINS
FROM EINA
WHERE MATNR EQ S_MATNR-LOW
AND LIFNR EQ S_LIFNR-LOW.
APPEND WA_EORDU TO GT_EORDU. * CALL FUNCTION 'ME_DIRECT_INPUT_SOURCE_LIST'
* EXPORTING
* I_MATNR =
* I_WERKS =
** I_MT06E =
** I_NO_MATERIAL_READ =
** ACTIVITY = 'V'
** I_VORGA =
** I_LOGSY =
* TABLES
* T_EORD =
** EXCEPTIONS
** PLANT_MISSING =
** MATERIAL_MISSING =
** OTHERS =
* .
* IF SY-SUBRC <> .
** Implement suitable error handling here
* ENDIF.
*
*CALL FUNCTION 'ME_DIRECT_INPUT_INFORECORD'
* EXPORTING
** ACTIVITY = 'V'
* I_EINA =
** I_EINE =
** O_EINA =
** O_EINE =
** I_NO_SUPPOSE =
** I_VORGA =
** I_SKIP_NR_CHECK =
** IMPORTING
** E_EINA =
** E_EINE =
** TABLES
** T_HEAD =
** T_LINE =
** EXCEPTIONS
** TEXTNAME_INVALID =
** OTHERS =
* .
*IF SY-SUBRC <> .
** Implement suitable error handling here
*ENDIF. CALL FUNCTION 'ME_DIRECT_INPUT_SOURCE_LIST'
EXPORTING
I_MATNR = S_MATNR-LOW
I_WERKS = S_WERKS-LOW
TABLES
T_EORD = GT_EORDU
EXCEPTIONS
PLANT_MISSING =
MATERIAL_MISSING =
ERROR_MESSAGE =
OTHERS = . IF SY-SUBRC <> .
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4
INTO L_TEXT.
L_ERR = 'FAIL'.
* CONTINUE.
ELSE.
CALL FUNCTION 'ME_POST_SOURCE_LIST_NEW'
EXPORTING
I_MATNR = S_MATNR-LOW.
IF SY-SUBRC <> .
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
L_ERR = 'FAIL'.
* CONTINUE.
ENDIF.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
IF SY-SUBRC <> .
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
L_ERR = 'FAIL'.
* CONTINUE.
ENDIF. IF L_ERR NE 'FAIL'.
L_ERR = '创建货源清单成功'.
ENDIF. ENDIF.
ELSE.
*&修改货源清单
SELECT *
INTO TABLE GT_EORD
FROM EORD
WHERE MATNR EQ S_MATNR-LOW
AND WERKS EQ S_WERKS-LOW. * WA_EORDU-MATNR = S_MATNR-LOW.
* WA_EORDU-WERKS = S_WERKS-LOW.
* WA_EORDU-LIFNR = S_LIFNR-LOW.
* WA_EORDU-EKORG = 'P001'.
* WA_EORDU-VDATU = P_VDATU.
* WA_EORDU-BDATU = ''.
* WA_EORDU-FLIFN = 'X'.
* WA_EORDU-KZ = 'I'.
* SELECT SINGLE MEINS
* INTO WA_EORDU-MEINS
* FROM EINA
* WHERE MATNR EQ S_MATNR-LOW
* AND LIFNR EQ S_LIFNR-LOW.
* APPEND WA_EORDU TO GT_EORD. MOVE-CORRESPONDING GT_EORD TO GT_XEORD.
LOOP AT GT_XEORD INTO WA_EORDU.
WA_EORDU-LIFNR = S_LIFNR-LOW.
WA_EORDU-VDATU = P_VDATU.
WA_EORDU-KZ = 'I'.
MODIFY GT_XEORD FROM WA_EORDU TRANSPORTING LIFNR VDATU.
ENDLOOP. * CALL FUNCTION 'ME_UPDATE_SOURCES_OF_SUPPLY'
** EXPORTING
** DOCUMENT_NUMBER = ' '
** I_CHANGEDOCUMENT =
* TABLES
* XEORD =
* YEORD =
*
CALL FUNCTION 'ME_UPDATE_SOURCES_OF_SUPPLY'
TABLES
XEORD = GT_XEORD
YEORD = GT_EORD.
IF SY-SUBRC = .
COMMIT WORK AND WAIT.
L_ERR = 'SUCCESS'.
ELSE.
ROLLBACK WORK.
L_ERR = 'FAIL'.
ENDIF.
ENDIF. WRITE:L_ERR,
L_TEXT.

ABAP-创建货源清单的更多相关文章

  1. SAP ME01创建货源清单

    1业务说明 此文档使用函数:ME_DIRECT_INPUT_SOURCE_LIST创建货源清单 2前台实现 事务代码:ME01 输入抬头信息 保存即可 3代码实现 3.1调用函数 定义参数 字段 调用 ...

  2. ME01 创建货源清单

    [转自 http://blog.sina.com.cn/s/blog_6466e5f70100ix3p.html ] SAP中采购货源清单创建的方法有以下几种: 1.ME01 手动逐个创建. 2.ME ...

  3. ME01 创建货源清单function

    CALL FUNCTION 'ME_DIRECT_INPUT_SOURCE_LIST' Function module IDOC_INPUT_SRCLST FUNCTION IDOC_INPUT_SR ...

  4. ABAP 创建和调用WebService

    1.创建WebService ① SE37创建RFC函数 ② SE80创建企业服务-service provider-existing ABAP object 或SE37-实用程序-创建Web服务 ③ ...

  5. ABAP开源项目清单

    因为曾经的“SAP Code Exchange”平台已经于2013年倒闭,现在无论在SCN还是网络上都比较难找到一个地方来关注全部的优秀ABAP开源项目. 本文将这些项目的地址和他们的描述列出,以供参 ...

  6. ABAP 创建function model 返回参数为内表类型

    1:通过T-CODE  se11  创建一个structure   ZSTRU2. 2:   创建一个table type, 表名 ZTAB1. 3: 表的row type 选择 ZSTRU2 4: ...

  7. AD10中创建材料清单(BOM表)

    材料清单可以用来作为元件的采购清单,同时也可以用于查看PCB中的元件封装信息是否正确. 操作: Reports----->Bill of Materials

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

  9. ABAP 创建测试文件

    使用 CG3Y 下载,可以改成下载txt到本地. FORM CREATE_TESTFILE. ), L_OFF LIKE SY-TABIX, L_LEN LIKE SY-TABIX, L_SUM LI ...

随机推荐

  1. php cli模式下调试

    //设置内存大小 ini_set('memory_limit','512M'); //打开日志 ini_set('log_errors', 'On'); //定向日志记录文件 ini_set('err ...

  2. gitlab gitlab runner

    1.安装gitlab https://about.gitlab.com/installation/#ubuntu 2.安装runner https://docs.gitlab.com/runner/i ...

  3. 性能调优培训 windbg --woodytu

    http://www.cnblogs.com/woodytu/p/4675479.html http://www.cnblogs.com/fjicn/p/3405716.html http://www ...

  4. Android JNI&NDK编程小结及建议

    前言 由于网上关于JNI/NDK相关的知识点介绍的比较零散而且不具备参照性,所以写了这篇JNI/NDK笔记,便于作为随时查阅的工具类型的文章,本文主要的介绍了在平时项目中常用的命令.JNI数据类型.签 ...

  5. 【spring boot logback】日志使用自定义的logback-spring.xml文件后,application.properties中关于日志的相关配置还会起作用么

    本篇 将针对[日志使用自定义的logback-spring.xml文件后,application.properties中关于日志的相关配置还会起作用么]这一个主题进行探索. 这个测试项目是根据[spr ...

  6. php数据库操作代码

    数据库名为reg,表名为member,字段名为username,password,regdate <?php $link=@mysql_connect("localhost" ...

  7. 【GLSL教程】(八)纹理贴图 【转】

    http://blog.csdn.net/racehorse/article/details/6664717 简单的纹理贴图(Simple Texture) 为了在GLSL中应用纹理,我们需要访问每个 ...

  8. (原创)linux安装xgboost快速高效方法

    1.先安装git ubuntu:   apt-get install git centos:    yum install git 2.下载xgboost仓库,注意有--recursive(有子模块哦 ...

  9. 微信小程序(应用号)开发新闻客户端的实战课程

    摘要: 本实例将演示从零开发一个微信应用号的过程,页面轮播与跳转传值,实现单元格自定义布局,全部源码可通过github下载. 下载最新版的微信小程序开发工具,目前是v0.9.092300 下载地址:h ...

  10. Leetcode 编程训练(转载)

    Leetcode这个网站上的题都是一些经典的公司用来面试应聘者的面试题,很多人通过刷这些题来应聘一些喜欢面试算法的公司,比如:Google.微软.Facebook.Amazon之类的这些公司,基本上是 ...