转自 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. 从容而优雅(leisurely and elegant)

    每时每刻, 我都变得更好了. ----- 法国心理学家   埃米尔 . 库埃 每时每刻, 我都变得更忙了. ----- 罗伯特 . 西奥迪尼 咬牙切齿的寒风, 昏暗的路灯, 默默的走过那一段从教室到寝 ...

  2. D3.js 用层画条形图

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  3. SSO之CAS总结

    1.采用kerberos原理 2.特点,经纪人模式即需要sso的所有用户账号要集中在一起 3.安全性保证方法: 关键就是保证TS和TGC的安全. 3.1)TS生成是采用足够随机算法,一次性使用,设置有 ...

  4. Ubuntu中设置静态IP和DNS

    在Ubuntu中设置静态IP共两步:1>设置IP:2>设置DNS1>设置IP    编辑 /etc/network/interface文件:       sudo vi /etc/n ...

  5. Laravel Container分析

    在分析Laravel流程具体细节之前我们先来了解一下它的Container容器,容器的作用简单的说就是用来存储对象(类名称或者实例),包括提供一些生成对象实例的方法. 我们查看Illuminate\C ...

  6. 修改内联CSS(点击按钮连续改变文字大小、位置,.animate()方法)

    $(document).ready(function(){            $('#swticher-large').click(function(){                var $ ...

  7. javascript内置属性——arguments

    arguments是javascript中的内置属性,可以直接调用函数的参数,作用类似Array,但本身并不是数组.这次发现它是为了实现封装函数,将不确定数量的数字乘积.比如function mult ...

  8. vuex是啥

    vuex是一个状态管理工具. vuex store与一个简单的全局变量的区别是: 1.vuex stores 是响应式的,当组件改变state时,它能响应并高效地更新state. 2.state不能被 ...

  9. 第八章 企业项目开发--分布式缓存memcached

    注意:本节代码基于<第七章 企业项目开发--本地缓存guava cache> 1.本地缓存的问题 本地缓存速度一开始高于分布式缓存,但是随着其缓存数量的增加,所占内存越来越大,系统运行内存 ...

  10. hdu 4635 Strongly connected

    http://acm.hdu.edu.cn/showproblem.php?pid=4635 我们把缩点后的新图(实际编码中可以不建新图 只是为了概念上好理解)中的每一个点都赋一个值 表示是由多少个点 ...