转自 http://blog.sina.com.cn/s/blog_9ae2f2940102uxyp.html
VMD_EI_API=>MAINTAIN_BAPI 去创建供应商主数据的部分数据代码。 *&---------------------------------------------------------------------*
*& Report ZVENDOR
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------* REPORT ZVENDOR.
*&---------------------------------------------------------------------*
*& Form FRM_CREATE_VENDOR
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> text
*----------------------------------------------------------------------*
" FRM_CREATE_VENDOR *&---------------------------------------------------------------------*
*& Form FRM_CREATE_VENDOR
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> text
*----------------------------------------------------------------------* DATA: LS_RETURN TYPE BAPIRET2.
DATA: LS_MASTER_DATA TYPE VMDS_EI_MAIN.
DATA: LS_MASTER_DATA_CORRECT TYPE VMDS_EI_MAIN,
LS_MESSAGE_CORRECT TYPE CVIS_MESSAGE,
LS_MASTER_DATA_DEFECTIVE TYPE VMDS_EI_MAIN,
LS_MESSAGE_DEFECTIVE TYPE CVIS_MESSAGE.
DATA: LS_VMDS_EI_EXTERN TYPE VMDS_EI_EXTERN.
DATA: LS_CORRECT_EXTERN TYPE VMDS_EI_EXTERN.
DATA: LS_REMARKS TYPE CVIS_EI_REM.
DATA: LS_BANK TYPE CVIS_EI_CVI_BANKDETAIL.
DATA: LS_COMMUNICATION_PHONE TYPE CVIS_EI_PHONE_STR,
LS_COMMUNICATION_FAX TYPE CVIS_EI_FAX_STR,
LS_COMMUNICATION_SMTP TYPE CVIS_EI_SMTP_STR.
DATA: LV_STRING TYPE STRING .
DATA: LV_APPROVED_DATE TYPE STRING,
LV_APPROVED_DATE1 TYPE STRING.
DATA: LV_ADRNR TYPE ADRNR,
LS_KNVK TYPE KNVK,
* LS_ZMMR1010 TYPE ZMMR1010,
LV_RETCODE TYPE NRRETURN,
LV_PERSON_NUMBER TYPE AD_PERSNUM.
DATA: LS_CVI_BANKDETAIL TYPE CVIS_EI_CVI_BANKDETAIL,
LS_BANKDETAIL_KEY TYPE CVIS_EI_BANKDETAIL_KEY,
LS_BANKDETAIL_DATA TYPE CVIS_EI_BANKDETAIL_DATA,
LS_BANKDETAIL_DATAX TYPE CVIS_EI_BANKDETAIL_DATAX.
DATA: LV_MAX_LIFNR TYPE LIFNR.
DATA: LS_VMDS_CMP TYPE VMDS_EI_COMPANY,
LS_VMDS_PUR TYPE VMDS_EI_PURCHASING,
LS_VMDS_FUN TYPE VMDS_EI_FUNCTIONS.
DATA: ZLFBK TYPE LFBK.
DATA:IV_FLAG TYPE C .
CLEAR:LS_RETURN ,
LS_MASTER_DATA ,
LS_MASTER_DATA_CORRECT ,
LS_MESSAGE_CORRECT ,
LS_MASTER_DATA_DEFECTIVE ,
LS_MESSAGE_DEFECTIVE ,
LS_VMDS_EI_EXTERN ,
LS_CORRECT_EXTERN ,
LS_REMARKS ,
LS_BANK ,
LS_COMMUNICATION_PHONE ,
LS_COMMUNICATION_FAX ,
LS_COMMUNICATION_SMTP ,
LV_STRING ,
LV_APPROVED_DATE ,
LV_APPROVED_DATE1 ,
LV_ADRNR ,
LS_KNVK ,
LV_RETCODE ,
LV_PERSON_NUMBER ,
LS_CVI_BANKDETAIL ,
LS_BANKDETAIL_KEY ,
LS_BANKDETAIL_DATA ,
LS_BANKDETAIL_DATAX ,
LV_MAX_LIFNR ,
LS_VMDS_CMP ,
LS_VMDS_PUR ,
LS_VMDS_FUN ,
ZLFBK ,
IV_FLAG .
CLEAR LS_VMDS_EI_EXTERN. * 维护标识:插入、更新
IV_FLAG = 'I' .
LS_VMDS_EI_EXTERN-HEADER-OBJECT_TASK = IV_FLAG.
* LS_VMDS_EI_EXTERN-HEADER-OBJECT_INSTANCE-LIFNR = IT_LIFNR-LIFNR. "供应商 * 公司代码默认:JNPC ???
CLEAR LS_VMDS_CMP.
LS_VMDS_CMP-TASK = IV_FLAG.
LS_VMDS_CMP-DATA_KEY-BUKRS = '2000' . "取采购组织下的
LS_VMDS_CMP-DATA-AKONT = '0000062130'. "总帐中的统驭科目 其他应付款-往来
LS_VMDS_CMP-DATA-FDGRV = 'A5'.
* LS_VMDS_CMP-DATA-XVERR = 'X'. " 结算客户 LS_VMDS_CMP-DATAX-AKONT = 'X'. "总帐中的统驭科目 其他应付款-往来
LS_VMDS_CMP-DATAX-FDGRV = 'X'.
* LS_VMDS_CMP-DATAX-XVERR = 'X'. "结算客户
APPEND LS_VMDS_CMP TO LS_VMDS_EI_EXTERN-COMPANY_DATA-COMPANY. * 采购组织默认:1000
* CLEAR LS_VMDS_PUR.
* LS_VMDS_PUR-TASK = IV_FLAG.
* LS_VMDS_PUR-DATA_KEY-EKORG = IS_VENDOR_DATA-EKORG.
* LS_VMDS_PUR-DATA-WAERS = IS_VENDOR_DATA-WAERS."'RMB'. * 合同伙伴
* LS_VMDS_FUN-TASK = IV_FLAG.
* LS_VMDS_FUN-DATA_KEY-PARVW = 'LF'. "供应商
* LS_VMDS_FUN-DATA-PARTNER = .
* LS_VMDS_FUN-DATAX-PARTNER = 'X'.
* APPEND LS_VMDS_FUN TO LS_VMDS_PUR-FUNCTIONS-FUNCTIONS. * CLEAR LS_VMDS_FUN.
* LS_VMDS_FUN-TASK = IV_FLAG.
* LS_VMDS_FUN-DATA_KEY-PARVW = 'RS'. "发票提供者
* LS_VMDS_FUN-DATA-PARTNER = LV_LIFNR.
* LS_VMDS_FUN-DATAX-PARTNER = 'X'.
* APPEND LS_VMDS_FUN TO LS_VMDS_PUR-FUNCTIONS-FUNCTIONS. * CLEAR LS_VMDS_FUN.
* LS_VMDS_FUN-TASK = IV_FLAG.
* LS_VMDS_FUN-DATA_KEY-PARVW = 'BA'. "订货地址在表TPAR里查 原厂商 VN 供应商
* LS_VMDS_FUN-DATA-PARTNER = LV_LIFNR.
* LS_VMDS_FUN-DATAX-PARTNER = 'X'.
* APPEND LS_VMDS_FUN TO LS_VMDS_PUR-FUNCTIONS-FUNCTIONS.
* APPEND LS_VMDS_PUR TO LS_VMDS_EI_EXTERN-PURCHASING_DATA-PURCHASING. * 外部接口:组织地址
LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-TASK = IV_FLAG.
LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATA-TITLE = '0003'. "公司
LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATA-NAME = '我擦'."描述
LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATA-COUNTRY = 'CN' . "国家
LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATA-LANGU = SY-LANGU. "语言
LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATA-SORT1 = '搜索条件.
* LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATA-CITY = IS_VENDOR_DATA-ORT01. "城市
* LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATA-POSTL_COD1 = IS_VENDOR_DATA-PSTLZ. "邮编
* LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATA-SORT1 = IS_VENDOR_DATA-ZGFJC. "简称
* LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATA-COMM_TYPE = 'INT'. "???邮件
* LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATA-EXTENS_1 = LV_APPROVED_DATE. "资质有效期 LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATAX-TITLE = 'X'.
LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATAX-NAME = 'X'.
LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATAX-COUNTRY = 'X'.
LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATAX-LANGU = 'X'.
LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATAX-SORT1 = 'X' .
* LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATAX-CITY = 'X'. "城市
* LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATAX-DISTRICT = 'X'. "???
* LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATAX-POSTL_COD1 = 'X' . “邮编
* ls_vmds_ei_extern-central_data-address-postal-datax-postl_cod2 = 'X'.
* LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATAX-PO_BOX = 'X'. "邮政信箱???
* LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATAX-STREET = 'X'. "街道
* LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATAX-SORT1 = 'X'.
* LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATAX-REGION = 'X'."地区(省/自治区/直辖市、市、县)
* LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATAX-COMM_TYPE = 'X'.
* LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-POSTAL-DATAX-EXTENS_1 = 'X'. "资质有效期 *
* CLEAR:LV_STRING, LS_VMDS_FUN.
* CONCATENATE 'L_' IT_LIFNR-LIFNR INTO LV_STRING .
* IF IT_LIFNR-LIFNR = 'Y001'.
* LV_STRING = 'Y_SH01' . "特殊情况
* ENDIF.
* CONDENSE LV_STRING NO-GAPS .
LS_VMDS_EI_EXTERN-CENTRAL_DATA-CENTRAL-DATA-KUNNR = '0000000484' . "客户
LS_VMDS_EI_EXTERN-CENTRAL_DATA-CENTRAL-DATA-VBUND = '002000' . "贸易伙伴
LS_VMDS_EI_EXTERN-CENTRAL_DATA-CENTRAL-DATA-KTOKK = 'Z001'. "帐户组 LS_VMDS_EI_EXTERN-CENTRAL_DATA-CENTRAL-DATAX-KUNNR = 'X' . "客户
LS_VMDS_EI_EXTERN-CENTRAL_DATA-CENTRAL-DATAX-VBUND = 'X' . "贸易伙伴
LS_VMDS_EI_EXTERN-CENTRAL_DATA-CENTRAL-DATAX-KTOKK = 'X' . * IF IS_VENDOR_DATA-BANKN IS NOT INITIAL AND IS_VENDOR_DATA-BANKL IS NOT INITIAL.
* LS_bank-TASK = IV_FLAG.
* LS_bank-DATA_KEY-BANKS = IS_VENDOR_DATA-LAND1. "银行国家代码 = IV_FLAG.
* LS_bank-DATA_KEY-BANKL = IS_VENDOR_DATA-BANKL. "银行帐户号码
* LS_bank-DATA_KEY-BANKN = IS_VENDOR_DATA-BANKN."银行编号
* LS_bank-DATA-BKREF = IS_VENDOR_DATA-BANKN2."银行编号参考
* IF IV_FLAG = 'U'.
* SELECT SINGLE * INTO ZLFBK FROM LFBK WHERE LIFNR = LV_LIFNR.
* IF SY-SUBRC = 0.
* LS_BANK-TASK = 'D'.
* LS_BANK-DATA_KEY-BANKS = ZLFBK-BANKS. "银行国家代码 = IV_FLAG.
* LS_BANK-DATA_KEY-BANKL = ZLFBK-BANKL. "银行帐户号码
* LS_BANK-DATA_KEY-BANKN = ZLFBK-BANKN."银行编号
* LS_bank-DATA-BKREF = IS_VENDOR_DATA-BANKN2."银行编号参考
* LS_bank-DATAX-BKREF = 'X'."银行编号参考
* APPEND LS_BANK TO LS_VMDS_EI_EXTERN-CENTRAL_DATA-BANKDETAIL-BANKDETAILS.
* ENDIF.
* ENDIF.
* LS_BANK-TASK = 'I'.
* LS_BANK-DATA_KEY-BANKS = IS_VENDOR_DATA-LAND1. "银行国家代码 = IV_FLAG.
* LS_BANK-DATA_KEY-BANKL = IS_VENDOR_DATA-BANKL. "银行帐户号码
* LS_BANK-DATA_KEY-BANKN = IS_VENDOR_DATA-BANKN."银行编号
* LS_BANK-DATA-BKREF = IS_VENDOR_DATA-BANKN2."银行编号参考
* APPEND LS_BANK TO LS_VMDS_EI_EXTERN-CENTRAL_DATA-BANKDETAIL-BANKDETAILS.
* if IV_FLAG = 'U'.
* LS_VMDS_EI_EXTERN-CENTRAL_DATA-BANKDETAIL-CURRENT_STATE = IV_FLAG.
* endif.
* ENDIF.
* 外部接口:地址注释
* LS_REMARKS-TASK = IV_FLAG.
*
* LS_REMARKS-DATA-LANGU = SY-LANGU.
* LS_REMARKS-DATAX-LANGU = 'X'.
* LS_REMARKS-DATAX-ADR_NOTES = 'X'.
* APPEND LS_REMARKS TO LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-REMARK-REMARKS.
*
** 外部接口:电话号码
* LS_COMMUNICATION_PHONE-CONTACT-TASK = IV_FLAG.
* LS_COMMUNICATION_PHONE-CONTACT-DATA-TELEPHONE = IS_VENDOR_DATA-TELF1.
* LS_COMMUNICATION_PHONE-CONTACT-DATA-COUNTRY = IS_VENDOR_DATA-LAND1. "'CN'.IS_VENDOR_DATA-COUNTRY.
*
* LS_COMMUNICATION_PHONE-CONTACT-DATAX-TELEPHONE = 'X'.
* LS_COMMUNICATION_PHONE-CONTACT-DATAX-COUNTRY = 'X'.
* APPEND LS_COMMUNICATION_PHONE TO LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-COMMUNICATION-PHONE-PHONE.
** 外部接口:传真
* LS_COMMUNICATION_FAX-CONTACT-TASK = IV_FLAG.
* LS_COMMUNICATION_FAX-CONTACT-DATA-FAX = IS_VENDOR_DATA-TELFX.
* LS_COMMUNICATION_FAX-CONTACT-DATA-COUNTRY = IS_VENDOR_DATA-LAND1. "'CN'.IS_VENDOR_DATA-COUNTRY.
*
* LS_COMMUNICATION_FAX-CONTACT-DATAX-FAX = 'X'.
* LS_COMMUNICATION_FAX-CONTACT-DATAX-COUNTRY = 'X'.
* APPEND LS_COMMUNICATION_FAX TO LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-COMMUNICATION-FAX-FAX.
*
*
** 扩展接口:电子邮件号
* LS_COMMUNICATION_SMTP-CONTACT-TASK = IV_FLAG.
* LS_COMMUNICATION_SMTP-CONTACT-DATA-E_MAIL = IS_VENDOR_DATA-SMTP_ADDR.
* LS_COMMUNICATION_SMTP-CONTACT-DATAX-E_MAIL = 'X'.
* APPEND LS_COMMUNICATION_SMTP TO LS_VMDS_EI_EXTERN-CENTRAL_DATA-ADDRESS-COMMUNICATION-SMTP-SMTP. * 复杂外部接口的供应商
APPEND LS_VMDS_EI_EXTERN TO LS_MASTER_DATA-VENDORS. SET UPDATE TASK LOCAL. * 调用api维护供应商
CALL METHOD VMD_EI_API=>MAINTAIN_BAPI
EXPORTING
IV_COLLECT_MESSAGES = 'X'
IS_MASTER_DATA = LS_MASTER_DATA
IMPORTING
ES_MASTER_DATA_CORRECT = LS_MASTER_DATA_CORRECT
ES_MESSAGE_CORRECT = LS_MESSAGE_CORRECT
ES_MASTER_DATA_DEFECTIVE = LS_MASTER_DATA_DEFECTIVE
ES_MESSAGE_DEFECTIVE = LS_MESSAGE_DEFECTIVE. * 返回结果处理
LOOP AT LS_MESSAGE_DEFECTIVE-MESSAGES
TRANSPORTING NO FIELDS
WHERE TYPE CA 'EA'.
EXIT.
ENDLOOP.
IF SY-SUBRC = 0. "失败 CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
* IT_LIFNR-FLAG = 'N' .
ELSE."成功 CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
* IT_LIFNR-FLAG = 'Y' . ENDIF.
" FRM_CREATE_VENDOR
VMD_EI_API=>MAINTAIN_BAPI 去创建供应商主数据的更多相关文章
-
【SD系列】SAP SD模块-创建供应商主数据BAPI
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[SD系列]SAP SD模块-创建供应商主数据B ...
-
【ABAP系列】SAP ABAP 利用class创建客户/供应商主数据
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[MM系列]SAP ABAP 利用class创建 ...
-
批量创建客户主数据函数SD_CUSTOMER_MAINTAIN_ALL
分享一下批创建客户主数据函数:SD_CUSTOMER_MAINTAIN_ALL TABLES:T077D,ZCITY,T005S,BNKA,ADRC,KNA1. DATA: TMP_KTOKD(4) ...
-
SAP MM01 创建物料主数据 [关注公众号后回复MM01获取更多资料]
操作内容 物料主数据,适用于所有有物料编码物料相关信息的系统维护 业务流程 新项目设计冻结后—M公司 PD用-物料编码申请表D-BOM Material Number Application部门内部 ...
-
在Salesforce中向外公布Service去创建Lead,并且用Asp.Net去调用此Service
1):在Salesforce中如何配置,向外公布此Service,请看如下链接: http://www.shellblack.com/marketing/web-to-lead/ 2):如何在Asp. ...
-
SAP 创建物料主数据分类视图特性
1.CL01创建物料分类 2.去CT04中去创建特性值 创建完成之后保存, 3.创建物料的分类视图,选择相应的特性值
-
安装mysql5.7后无法启动,/var/run/mysqld 目录每次重启后都需要手动去创建--终极解决方案
鉴于很多童鞋反应,mysql5.7安装后出现无法启动,建立/var/run/mysqld 并赋权mysql用户解决了启动的问题,但是重启系统后又出现无法启动的问题,导致/var/run/mysqld ...
-
React 以两种形式去创建组件 类或者函数(二)
08==>创建组件以 1类的形式 或者以 2函数的形式 09==>使用组件 在src下创建components文件夹 是放组件的 CompType.js 组件 组件开头大写(重要) Com ...
-
线程池不允许使用Executors去创建,而是通过ThreadPoolExecutor的方式
1. 通过Executors创建线程池的弊端 在创建线程池的时候,大部分人还是会选择使用Executors去创建. 下面是创建定长线程池(FixedThreadPool)的一个例子,严格来说,当使用如 ...
随机推荐
-
逻辑思维面试题-java后端面试-遁地龙卷风
(-1)写在前面 最近参加了一次面试,对笔试题很感兴趣,就回来百度一下.通过对这些题目的思考让我想起了建模中的关联,感觉这些题如果没接触就是从0到1,考验逻辑思维的话从1到100会更好,并且编程简易模 ...
-
微信开发之.Net
撸主是一个新手,最近几天在研究微信服务号交互,上网搜了搜C#的代码,再结合自己的习惯,下面把代码解析一下,其中有些代码非本人原创. 首先,你要有个公众服务号,只有服务号才可以自定义菜单,没有条件的可以 ...
-
Laravel 5 基础(三)- 向视图传送数据(续)
我们不仅仅可以向视图传送一个数据,同样我们可以传送Array public function about() { return view('pages.about')->with([ 'firs ...
-
在linux下安装memcacheq
#!/bin/bash mkdir ~/build cd ~/build wget http://download.oracle.com/berkeley-db/db-5.1.19.tar.gz .t ...
-
浅谈break 、continue、return,goto四种语句的区别。
浅谈break .continue.return三种语句的区别: break,continue,return这三个具有跳转功能的语句在c语言中经常被用到,近期身边有些小伙伴总是把它们的用法搞乱,在这里 ...
-
【Unity】Unity中C#与Android中Java的互相调用遇到的一些问题
1.有关调用的一些问题: (1).在C#中直接调用java中的代码,无返回值: 在java中: public static void setAge(Context context , int leve ...
-
c语言基础学习04
=============================================================================涉及到的知识点有:程序的三种结构.条件分支语句 ...
-
Code Review Checklist
左按:当年需要一份详细的代码评审清单作参考,翻译了此文. 版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[-] General Code Smoke Test 通用测试 Comm ...
-
php java aes
class CryptAES{ protected $cipher = MCRYPT_RIJNDAEL_128; protected $mode = MCRYPT_MODE_ECB; protecte ...
-
Python连接redis时要注意的点
一.一般连接redis情况 from redis import Redis # 实例化redis对象 rdb = Redis(host='localhost', port=6379, db=0) rd ...