转自 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 去创建供应商主数据的更多相关文章

  1. 【SD系列】SAP SD模块-创建供应商主数据BAPI

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[SD系列]SAP SD模块-创建供应商主数据B ...

  2. 【ABAP系列】SAP ABAP 利用class创建客户/供应商主数据

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[MM系列]SAP ABAP 利用class创建 ...

  3. 批量创建客户主数据函数SD_CUSTOMER_MAINTAIN_ALL

    分享一下批创建客户主数据函数:SD_CUSTOMER_MAINTAIN_ALL TABLES:T077D,ZCITY,T005S,BNKA,ADRC,KNA1.  DATA: TMP_KTOKD(4) ...

  4. SAP MM01 创建物料主数据 [关注公众号后回复MM01获取更多资料]

    操作内容 物料主数据,适用于所有有物料编码物料相关信息的系统维护 业务流程 新项目设计冻结后—M公司 PD用-物料编码申请表D-BOM Material Number  Application部门内部 ...

  5. 在Salesforce中向外公布Service去创建Lead,并且用Asp.Net去调用此Service

    1):在Salesforce中如何配置,向外公布此Service,请看如下链接: http://www.shellblack.com/marketing/web-to-lead/ 2):如何在Asp. ...

  6. SAP 创建物料主数据分类视图特性

    1.CL01创建物料分类 2.去CT04中去创建特性值 创建完成之后保存, 3.创建物料的分类视图,选择相应的特性值

  7. 安装mysql5.7后无法启动,/var/run/mysqld 目录每次重启后都需要手动去创建--终极解决方案

    鉴于很多童鞋反应,mysql5.7安装后出现无法启动,建立/var/run/mysqld 并赋权mysql用户解决了启动的问题,但是重启系统后又出现无法启动的问题,导致/var/run/mysqld ...

  8. React 以两种形式去创建组件 类或者函数(二)

    08==>创建组件以 1类的形式 或者以 2函数的形式 09==>使用组件 在src下创建components文件夹 是放组件的 CompType.js 组件 组件开头大写(重要) Com ...

  9. 线程池不允许使用Executors去创建,而是通过ThreadPoolExecutor的方式

    1. 通过Executors创建线程池的弊端 在创建线程池的时候,大部分人还是会选择使用Executors去创建. 下面是创建定长线程池(FixedThreadPool)的一个例子,严格来说,当使用如 ...

随机推荐

  1. IOS详解TableView——内置刷新,EGO,以及搜索显示控制器

    内置刷新 内置刷新是苹果IOS6以后才推出的一个API,主要是针对TableViewController增加了一个属性,refreshControl,所以如果想用这个内置下拉刷新的话,最好给你的Tab ...

  2. day5 -指针

    指针和指针变量 指针就是地址,地址就是指针 地址就是存放单元的编号 指针变量是存放地址的变量 指针和指针变量是两个不同的概念,但是要注意,通常我们叙述时会把指针变量简称为指针,实际他们含义并不一样 指 ...

  3. hdu4352 XHXJ's LIS

    链接 这个题最不好想到的是状态的保存,也没有几亿的数组让你开,怎么保存前面出现了哪些数字. 题意让你求最长上升子序列的长度为k的数字的数目,可以是不连续的,可以保留一个状态栈,栈顶部依次更新,再保证长 ...

  4. drupal前端开发的第一点

    就是把admin/config/development/performance下面的选项全部去掉,方便作为一个匿名用户来访问,不用每次都drush cc all.

  5. 转帖-[教程] Win7精简教程(简易中度)2016年8月-0day

    [教程] Win7精简教程(简易中度)2016年8月 0day 发表于 2016-8-19 16:08:41  https://www.itsk.com/thread-370260-1-1.html ...

  6. win7 桌面上的网络邻居不见了

    win7 桌面上的网络邻居不见了,可能是以前在桌面上直接删除了.现右击桌面--个性化--更改桌面图标,也找不到网上邻居了.怎么找回来啊? 网上邻居已经改名叫网络了.可以右键桌面选择“个性化”,然后更改 ...

  7. N的阶乘末尾0的个数和其二进制表示中最后位1的位置

    问题一解法:     我们知道求N的阶乘结果末尾0的个数也就是说我们在从1做到N的乘法的时候里面产生了多少个10, 我们可以这样分解,也就是将从0到N的数分解成因式,再将这些因式相乘,那么里面有多少个 ...

  8. js String对象中常用方法小结(字符串操作)

    1.charCodeAt方法返回一个整数,代表指定位置字符的Unicode编码. strObj.charCodeAt(index) 说明: index将被处理字符的从零开始计数的编号.有效值为0到字符 ...

  9. android定义启动唯一apk

    <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="ht ...

  10. bootstrap笔记-布局

    1.通过文本对齐类,可以简单方便的将文字重新对齐. <p class="text-left">Left aligned text.</p> <p cl ...