转自 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 = '我擦'.