供应商主数据创建有三种方法:第一种是BDC 第二种是用SAP自身的一个方法VMD_EI_API=>MAINTAIN_BAPI 第三种是用IDOC的方式。IDOC的方式比较简单,通过配置IDOC然后就可以实现。IDOC TYPE为CREMAS03或者CREMAS05都可以 看你的需要啦。如果有些字段在IDOC TYPE里面没有的(比如EMAIL这样的字段)那么就要写IDOC增强,不过写增强还得找出口还得去增强标准的一些代码我觉得很烦,我是把它的IDOC关联的标准FUNCTION COPY出来创建完成后生成了供应商代码,然后再写一个更新EMAIL的function去更新email信息和其他IDOC TYPE 里面没有的字段信息。以下为通过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 ,