欢迎来到萧静默的博客

书山有路勤为径,学海无涯苦作舟。

SAP BP供应商的创建

具体就不解释了 直接上代码 ,看得懂就用

  METHOD ZII_SI_SAP_SY_REC_SUPPLIER~SI_SAP_SY_REC_SUPPLIER.
    DATA:GT_INPUT  TYPE TABLE OF ZDT_SUPPLIER_REQ_REQ_DATA,
         GS_INPUT  TYPE  ZDT_SUPPLIER_REQ_REQ_DATA,
         GT_OUTPUT TYPE TABLE OF ZDT_SUPPLIER_RES_RES_DATA,
         GS_OUTPUT TYPE  ZDT_SUPPLIER_RES_RES_DATA.
    DATA:LT_INPUT TYPE STANDARD TABLE OF ZBP002,
         WA_INPUT TYPE ZBP002.
    DATA:LT_RETURN TYPE STANDARD TABLE OF BAPIRET1 .
    SELECT * INTO TABLE @DATA(LT_TAX) FROM DFKKBPTAXNUM.
    SELECT * INTO TABLE @DATA(LT_LFA1) FROM LFA1.
    "PO传入数据赋值到函数传入参数
    LOOP AT INPUT-MT_SUPPLIER_REQ-REQ_DATA INTO DATA(WA_IN).
      MOVE-CORRESPONDING WA_IN TO WA_INPUT.
      "校验税号
      IF WA_INPUT-TAXNUMXL IS NOT INITIAL.
        READ TABLE LT_TAX INTO DATA(LS_TAXNUM) WITH KEY TAXNUM = WA_INPUT-TAXNUMXL.
        IF SY-SUBRC = 0 .
          GS_OUTPUT-ZTYPE = 'E'.
          GS_OUTPUT-MSG = '税号已存在,请核实'.
*          APPEND L_OUTPUT TO OUTPUT-MT_BP_CUSTOMER_RES-BP_CUSTOMER_RES.
          EXIT.
        ENDIF.
      ENDIF.
      "校验名称
      IF WA_INPUT-NAME_ORG1 IS NOT INITIAL.
        READ TABLE LT_LFA1 INTO DATA(LS_NAME1) WITH KEY NAME1 = WA_INPUT-NAME_ORG1.
        IF SY-SUBRC = 0 .
          GS_OUTPUT-ZTYPE = 'E'.
          GS_OUTPUT-MSG = '供应商名称已存在,请核实'.
*          APPEND L_OUTPUT TO OUTPUT-MT_BP_CUSTOMER_RES-BP_CUSTOMER_RES.
          EXIT.
        ENDIF.
      ENDIF.

      "扩充三厂
      WA_INPUT-EKORG = '6000'.
      WA_INPUT-BUKRS = '6000'.
      WA_INPUT-TOGRU = '6000'.
      APPEND WA_INPUT TO LT_INPUT.
      WA_INPUT-EKORG = '8000'.
      WA_INPUT-BUKRS = '8000'.
      WA_INPUT-TOGRU = '8000'.
      APPEND WA_INPUT TO LT_INPUT.
      WA_INPUT-EKORG = '9000'.
      WA_INPUT-BUKRS = '9000'.
      WA_INPUT-TOGRU = '9000'.
      APPEND WA_INPUT TO LT_INPUT.

      CALL FUNCTION 'Y_TEST_FM_BP005'
        TABLES
          TT_INPUT  = LT_INPUT
          TT_RETURN = LT_RETURN.

      LOOP AT  LT_RETURN INTO DATA(LS_RETURN).
        GS_OUTPUT-LIFNR = LS_RETURN-ID.
        SHIFT GS_OUTPUT-LIFNR LEFT DELETING LEADING '0'.
        GS_OUTPUT-ZTYPE = LS_RETURN-TYPE.
        GS_OUTPUT-MSG = LS_RETURN-MESSAGE.
      ENDLOOP.
    ENDLOOP.
    APPEND GS_OUTPUT TO OUTPUT-MT_SUPPLIER_RES-RES_DATA.
*  "校验税号
*    IF INPUT-MT_SUPPLIER_REQ-REQ_DATA IS INITIAL.
*      LS_OUTPUT-LIFNR = '11111'.
*      APPEND LS_OUTPUT TO OUTPUT-MT_SUPPLIER_RES-RES_DATA.
*    ELSE.
*
*      LS_OUTPUT-LIFNR = '22222'.
*      APPEND LS_OUTPUT TO OUTPUT-MT_SUPPLIER_RES-RES_DATA.
*  ENDIF.





  ENDMETHOD.
FUNCTION Y_TEST_FM_BP005.
*"----------------------------------------------------------------------
*"*"本地接口:
*"  TABLES
*"      TT_INPUT STRUCTURE  ZBP002
*"      TT_RETURN STRUCTURE  BAPIRET1
*"----------------------------------------------------------------------


  PERFORM FM_CLEAR."清空内表
*检查重复,逻辑暂定

  RUN_ID = RUN_ID + 10.
*基本数据
  LOOP AT TT_INPUT.
    CLEAR LS_BP_GENERAL.

    LS_BP_GENERAL-RUN_ID      = RUN_ID.
    LS_BP_GENERAL-GROUPING    = TT_INPUT-GROUP."账户组
    LS_BP_GENERAL-CATEGORY    = '2'.           "
    LS_BP_GENERAL-OBJECT_TASK = 'I'.           "创建
    LS_BP_GENERAL-NAME1       = TT_INPUT-NAME_ORG1."名称
    LS_BP_GENERAL-SEARCHTERM1 = TT_INPUT-SORT1_TXT."搜索项
    LS_BP_GENERAL-TITLE_KEY   = '0003'.        "公司
*    LS_BP_GENERAL-PARTNEREXTERNAL = KEY_GROUP-KEY4."旧编码
    APPEND LS_BP_GENERAL TO IT_BP_GENERAL.

*地址数据
    LS_BP_ADDRESS-RUN_ID     = RUN_ID.
    LS_BP_ADDRESS-COUNTRY    = TT_INPUT-LAND1."国家
    LS_BP_ADDRESS-CITY       = TT_INPUT-CITY1.   "城市
    LS_BP_ADDRESS-REGION     = TT_INPUT-REGION. "地区编号
    LS_BP_ADDRESS-LANGU      = '1'.            "语言
    LS_BP_ADDRESS-STREET     = TT_INPUT-STREET. "街道信息
    LS_BP_ADDRESS-POSTL_COD1 = TT_INPUT-PSTCD1.  "邮编
    APPEND LS_BP_ADDRESS TO IT_BP_ADDRESS.
    CLEAR LS_BP_ADDRESS.

    "邮箱数据
    LS_BP_ADDRESS_EMAIL-RUN_ID = RUN_ID.
*    LS_BP_ADDRESS_EMAIL-CONSNUMBER = '001'.
    LS_BP_ADDRESS_EMAIL-E_MAIL = 'test001@qq.com'.
    APPEND LS_BP_ADDRESS_EMAIL TO IT_BP_ADDRESS_EMAIL.
    CLEAR:LS_BP_ADDRESS_EMAIL.
*    LS_BP_ADDRESS_EMAIL-RUN_ID = RUN_ID.
*    LS_BP_ADDRESS_EMAIL-CONSNUMBER = '002'.
*    LS_BP_ADDRESS_EMAIL-E_MAIL = 'test002@qq.com'.
*    APPEND LS_BP_ADDRESS_EMAIL TO IT_BP_ADDRESS_EMAIL.
*    CLEAR:LS_BP_ADDRESS_EMAIL.
    "邮箱数据-通讯人
    LS_BP_ADDRESS_EMAIL_REMARKS-RUN_ID = RUN_ID.
*    LS_BP_ADDRESS_EMAIL_REMARKS-CONSNUMBER = '001'.
    LS_BP_ADDRESS_EMAIL_REMARKS-COMM_NOTES = '测试人员01'.
    APPEND LS_BP_ADDRESS_EMAIL_REMARKS TO IT_BP_ADDRESS_EMAIL_REMARKS.
    CLEAR:LS_BP_ADDRESS_EMAIL_REMARKS.
*    LS_BP_ADDRESS_EMAIL_REMARKS-RUN_ID = RUN_ID.
*    LS_BP_ADDRESS_EMAIL_REMARKS-CONSNUMBER = '002'.
*    LS_BP_ADDRESS_EMAIL_REMARKS-COMM_NOTES = '测试人员02'.
*    APPEND LS_BP_ADDRESS_EMAIL_REMARKS TO IT_BP_ADDRESS_EMAIL_REMARKS.
*    CLEAR:LS_BP_ADDRESS_EMAIL_REMARKS.
*税号信息

    LS_BP_TAX_NUMBER-RUN_ID    = RUN_ID.
    LS_BP_TAX_NUMBER-TAXTYPE   = 'CN0'.        "税码国家
    LS_BP_TAX_NUMBER-TAXNUMBER = TT_INPUT-TAXNUMXL."税码
    APPEND LS_BP_TAX_NUMBER TO IT_BP_TAX_NUMBER.
    CLEAR LS_BP_TAX_NUMBER.

*银行信息
    IF TT_INPUT-BANKL IS NOT INITIAL.
      LS_BP_BANK_DETAILS-RUN_ID = RUN_ID.
      LS_BP_BANK_DETAILS-BANK_KEY        = TT_INPUT-BANKL."银行代码
*      LS_BP_BANK_DETAILS-BANK_CTRY       = LS_DATA-BANKS."银行的城市
      LS_BP_BANK_DETAILS-BANK_ACCT       = TT_INPUT-BANKN."银行账户
      LS_BP_BANK_DETAILS-CTRL_KEY        = TT_INPUT-BKONT."z账户用途
      LS_BP_BANK_DETAILS-BANK_REF        = TT_INPUT-BANK_REF."参考明细
      LS_BP_BANK_DETAILS-BANKACCOUNTNAME = TT_INPUT-BKDSC."银行名称
*      LS_BP_BANK_DETAILS-ACCOUNTHOLDER   = LS_DATA-NAME. "银行账户持有人
      LS_BP_BANK_DETAILS-DATA_KEY = '0001'.
      IF LS_BP_BANK_DETAILS-BANK_CTRY  IS INITIAL .
        LS_BP_BANK_DETAILS-BANK_CTRY    = 'CN'.
      ENDIF.
      APPEND  LS_BP_BANK_DETAILS TO IT_BP_BANK_DETAILS.
      CLEAR   LS_BP_BANK_DETAILS.
    ENDIF.
    VERKF = TT_INPUT-VERKF.
    TELF1 = TT_INPUT-TELF1.
    ZEMAIL = TT_INPUT-ZEMAIL.
    ZNAME = TT_INPUT-ZNAME.
    ZTEL = TT_INPUT-ZTEL.
    ZEMAIL1 = TT_INPUT-ZEMAIL1.

    CLEAR TT_INPUT.
    EXIT.
  ENDLOOP.

  "填充扩充数据
  LOOP AT TT_INPUT.
*
*    IF LS_DATA-FKFS IS NOT  INITIAL .
*      FS_ADR = LS_DATA-FKFS.
*    ENDIF.
*公司代码数据
*    IF LS_DATA-BUKRS IS NOT INITIAL AND LS_DATA-AKONT IS NOT INITIAL.
*供应商基本数据
    LS_SUP_GENERAL-RUN_ID = RUN_ID.
    APPEND LS_SUP_GENERAL TO IT_SUP_GENERAL.
    CLEAR LS_SUP_GENERAL.
    "角色
    CLEAR LS_BP_ROLE.
    LS_BP_ROLE-RUN_ID         =  RUN_ID.
    LS_BP_ROLE-DATA_KEY       = 'FLVN00'.
    LS_BP_ROLE-ROLECATEGORY   = 'FLVN00'.
    APPEND LS_BP_ROLE TO IT_BP_ROLE.
    "详细信息
    LS_SUP_COMPANY-RUN_ID = RUN_ID.
    LS_SUP_COMPANY-BUKRS  = TT_INPUT-BUKRS."公司代码
    LS_SUP_COMPANY-AKONT  = TT_INPUT-AKONT."统驭科目
    LS_SUP_COMPANY-TOGRU  = TT_INPUT-TOGRU."容差组
    LS_SUP_COMPANY-REPRF  = 'X'.          "发票重复检查
    LS_SUP_COMPANY-ZTERM  = TT_INPUT-ZTERM."付款条件
    LS_SUP_COMPANY-ZWELS  = TT_INPUT-ZWELS."付款方式
    APPEND LS_SUP_COMPANY TO IT_SUP_COMPANY.
    CLEAR  LS_SUP_COMPANY.

*采购数据
*    IF LS_DATA-WAERS IS NOT INITIAL AND LS_DATA-EKORG IS NOT INITIAL.
*供应商基本数据
    LS_SUP_GENERAL-RUN_ID = RUN_ID.
    APPEND LS_SUP_GENERAL TO IT_SUP_GENERAL.
    CLEAR LS_SUP_GENERAL.
    "角色
    CLEAR LS_BP_ROLE.
    LS_BP_ROLE-RUN_ID         =  RUN_ID.
    LS_BP_ROLE-DATA_KEY       = 'FLVN01'.
    LS_BP_ROLE-ROLECATEGORY   = 'FLVN01'.
    APPEND LS_BP_ROLE TO IT_BP_ROLE.
    "详细信息
    LS_SUP_PURCHASING-RUN_ID = RUN_ID.
    LS_SUP_PURCHASING-EKORG  = TT_INPUT-EKORG.
*  LS_SUP_PURCHASING-EIKTO  = TT_INPUT-MALX.  "物料类型
    LS_SUP_PURCHASING-WAERS  = TT_INPUT-WAERS ."订单货币
    LS_SUP_PURCHASING-VERKF  = TT_INPUT-VERKF. "销售员
    LS_SUP_PURCHASING-TELF1  = TT_INPUT-TELF1. "电话
    LS_SUP_PURCHASING-ZTERM  = TT_INPUT-ZTERM1."付款方式
    LS_SUP_PURCHASING-WEBRE  = TT_INPUT-WEBRE. "基于收货的发票验证
    LS_SUP_PURCHASING-KZAUT  = TT_INPUT-KZAUT. "自动产生允许的采购订单


    APPEND LS_SUP_PURCHASING TO IT_SUP_PURCHASING.
    LS_SUP_PURCH_FUNCTIONS-RUN_ID = RUN_ID.
    LS_SUP_PURCH_FUNCTIONS-EKORG  = TT_INPUT-EKORG.
    LS_SUP_PURCH_FUNCTIONS-PARVW  = 'BA'.
    APPEND LS_SUP_PURCH_FUNCTIONS TO IT_SUP_PURCH_FUNCTIONS.
    LS_SUP_PURCH_FUNCTIONS-RUN_ID = RUN_ID.
    LS_SUP_PURCH_FUNCTIONS-EKORG  = TT_INPUT-EKORG.
    LS_SUP_PURCH_FUNCTIONS-PARVW  = 'LF'.
    LS_SUP_PURCH_FUNCTIONS-DEFPA  = 'X'.
    APPEND LS_SUP_PURCH_FUNCTIONS TO IT_SUP_PURCH_FUNCTIONS.
    LS_SUP_PURCH_FUNCTIONS-RUN_ID = RUN_ID.
    LS_SUP_PURCH_FUNCTIONS-EKORG  = TT_INPUT-EKORG.
    LS_SUP_PURCH_FUNCTIONS-PARVW  = 'RS'.
    LS_SUP_PURCH_FUNCTIONS-DEFPA  = ''.
    APPEND LS_SUP_PURCH_FUNCTIONS TO IT_SUP_PURCH_FUNCTIONS.

    CLEAR TT_INPUT.
  ENDLOOP.
  SORT  IT_BP_ROLE BY RUN_ID  DATA_KEY.
  SORT  IT_SUP_GENERAL BY RUN_ID.
  DELETE ADJACENT DUPLICATES FROM  IT_BP_ROLE COMPARING  RUN_ID  DATA_KEY.
  DELETE ADJACENT DUPLICATES FROM  IT_SUP_GENERAL COMPARING  RUN_ID.
*调用创建的方法
  CALL FUNCTION 'RFC_CVI_EI_INBOUND_MAIN'
*   EXPORTING
*     IV_DOCOMMIT                        = 'X'
*     IV_CREATE_APPLOG                   =
*     IV_SUPPRESS_TAXJUR_CHECK           =
    TABLES
      IT_BP_GENERAL          = IT_BP_GENERAL
      IT_BP_ROLE             = IT_BP_ROLE
*     IT_BP_INDUSTRY         =
*     IT_BP_IDENT_NUMBERS    =
      IT_BP_BANK_DETAILS     = IT_BP_BANK_DETAILS
      IT_BP_TAX_NUMBER       = IT_BP_TAX_NUMBER
*     IT_BP_TAX_NUMBER_COMMON            =
      IT_BP_ADDRESS          = IT_BP_ADDRESS
*     IT_BP_ADDRESS_USAGE    =
*     IT_BP_ADDRESS_TELENO   =
*     IT_BP_ADDRESS_TELENO_REMARKS       =
*     IT_BP_ADDRESS_FAXNO    =
     IT_BP_ADDRESS_EMAIL    = IT_BP_ADDRESS_EMAIL
     IT_BP_ADDRESS_EMAIL_REMARKS        = IT_BP_ADDRESS_EMAIL_REMARKS
*     IT_BP_ADDRESS_URI      =
*     IT_BP_RELATIONS        =
*     IT_BP_FINSERV          = IT_BP_FINSERV
*     IT_CUST_GENERAL        =
*     IT_CUST_GENERAL_CREDITCARD         =
*     IT_CUST_GENERAL_TEXTS  =
*     IT_CUST_GENERAL_LOADING            =
*     IT_CUST_GENERAL_EXPORT =
*     IT_CUST_GENERAL_ALT_PAYEE          =
*     IT_CUST_COMPANY        =
*     IT_CUST_COMPANY_WTAX   =
*     IT_CUST_COMPANY_TEXTS  =
*     IT_CUST_COMPANY_ALT_PAYEE          =
*     IT_CUST_SALES          =
*     IT_CUST_SALES_TEXTS    =
*     IT_CUST_COMP_DUNNING   =
*     IT_CUST_SALES_FUNCTIONS            =
*     IT_CUST_TAX_INDICATOR  =
*     IT_CUST_CONTACTS       =
*     IT_CUST_CONT_ADDRESS1  =
*     IT_CUST_CONT_ADDRESS2  =
*     IT_CUST_CONT_ADDRESS3  =
*     IT_CUST_CONT_TELENO1   =
*     IT_CUST_CONT_TELENO2   =
*     IT_CUST_CONT_TELENO3   =
*     IT_CUST_CONT_FAX1      =
*     IT_CUST_CONT_FAX2      =
*     IT_CUST_CONT_FAX3      =
*     IT_CUST_CONT_EMAIL1    =
*     IT_CUST_CONT_EMAIL2    =
*     IT_CUST_CONT_EMAIL3    =
*     IT_CUST_CONT_TEXTS     =
*     IT_CUST_GENERAL_VAT    =
*     IT_SUP_GENERAL_ALT_PAYEE           =
      IT_SUP_GENERAL         = IT_SUP_GENERAL
*     IT_SUP_GENERAL_TEXTS   =
      IT_SUP_COMPANY         = IT_SUP_COMPANY
*     IT_SUP_COMPANY_TEXTS   =
*     IT_SUP_COMPANY_WTAX    =
*     IT_SUP_COMPANY_ALT_PAYEE           =
*     IT_SUP_PURCHASING_TEXTS            =
      IT_SUP_PURCHASING      = IT_SUP_PURCHASING
*     IT_SUP_PURCHASING2     =
      IT_SUP_PURCH_FUNCTIONS = IT_SUP_PURCH_FUNCTIONS
*     IT_SUPPLIER_CONTACTS   =
*     IT_SUP_CONT_ADDRESS1   =
*     IT_SUP_CONT_ADDRESS2   =
*     IT_SUP_CONT_ADDRESS3   =
*     IT_SUP_CONT_TELENO1    =
*     IT_SUP_CONT_TELENO2    =
*     IT_SUP_CONT_TELENO3    =
*     IT_SUP_CONT_FAX1       =
*     IT_SUP_CONT_FAX2       =
*     IT_SUP_CONT_FAX3       =
*     IT_SUP_CONT_EMAIL1     =
*     IT_SUP_CONT_EMAIL2     =
*     IT_SUP_CONT_EMAIL3     =
*     IT_SUP_GENERAL_VAT     =
      CT_RETURN              = CT_RETURN.
*更新数据
  READ TABLE CT_RETURN INTO DATA(LS_RETURN) WITH KEY TYPE = 'S'.

  IF SY-SUBRC = 0.
*    IF FS_ADR IS NOT INITIAL.
*      PERFORM FRM_ADD_FS USING LS_RETURN-OBJECT_KEY  FS_ADR ."更改办事处
*    ENDIF.
"101里XK02有问题 先放弃录屏
*    PERFORM  FRM_ADJUST_BDC USING
*          LS_RETURN-OBJECT_KEY VERKF
*          TELF1
*          ZEMAIL
*          ZNAME
*          ZTEL
*          ZEMAIL1
*          .


    TT_RETURN-TYPE = 'S'.
    TT_RETURN-ID = LS_RETURN-OBJECT_KEY.
    TT_RETURN-MESSAGE = |BP创建供应商成功,编号:{ LS_RETURN-OBJECT_KEY } { LS_RETURN-MESSAGE }|.
    APPEND TT_RETURN.
    CLEAR:TT_RETURN.
  ELSE.
    TT_RETURN-TYPE = 'E'.
    TT_RETURN-ID = LS_RETURN-OBJECT_KEY.
    LOOP AT CT_RETURN INTO DATA(GS_RE) WHERE TYPE = 'E'.
      TT_RETURN-MESSAGE =  TT_RETURN-MESSAGE  && GS_RE-MESSAGE.
    ENDLOOP.
    APPEND TT_RETURN.
    CLEAR:TT_RETURN.
  ENDIF.

ENDFUNCTION.
*----------------------------------------------------------------------*
***INCLUDE LZKING005F01.
*----------------------------------------------------------------------*

FORM FM_CLEAR .
*RFC_CVI_EI_INBOUND_MAIN
  REFRESH:  IT_BP_ROLE,
  IT_BP_GENERAL,
  CT_RETURN,
  IT_BP_BANK_DETAILS,
  IT_BP_TAX_NUMBER,
  IT_BP_ADDRESS,
  IT_SUP_COMPANY,
  IT_SUP_PURCHASING,
  IT_SUP_PURCH_FUNCTIONS,
  IT_SUP_PURCHASING2,
  IT_SUP_GENERAL.
ENDFORM.


FORM FRM_ADJUST_BDC USING
      P_LS_RETURN-OBJECT_KEY
      P_VERKF
      P_TELF1
      P_ZEMAIL
      P_ZNAME
      P_ZTEL
      P_ZEMAIL1.

  PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0101'.
  PERFORM BDC_FIELD       USING 'BDC_CURSOR'
        'USE_ZAV'.
  PERFORM BDC_FIELD       USING 'BDC_OKCODE'
        '/00'.
  PERFORM BDC_FIELD       USING 'RF02K-LIFNR'
        P_LS_RETURN-OBJECT_KEY.
  PERFORM BDC_FIELD       USING 'RF02K-D0110'
        'X'.
  PERFORM BDC_FIELD       USING 'USE_ZAV'
        'X'.
  PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0111'.
  PERFORM BDC_FIELD       USING 'BDC_OKCODE'
        '=$INT'.
  PERFORM BDC_FIELD       USING 'BDC_CURSOR'
        'SZA1_D0100-MOB_NUMBER'.
  PERFORM BDC_FIELD       USING 'SZA1_D0100-MOB_NUMBER'
        P_ZTEL.
  PERFORM BDC_DYNPRO      USING 'SAPLSZA6' '0600'.
  PERFORM BDC_FIELD       USING 'BDC_CURSOR'
        'ADSMTP-SMTP_ADDR(01)'.
  PERFORM BDC_FIELD       USING 'BDC_OKCODE'
        '=NEWL'.
  PERFORM BDC_FIELD       USING 'ADSMTP-SMTP_ADDR(01)'
        P_ZEMAIL1.
  PERFORM BDC_FIELD       USING 'ADSMTP-REMARK(01)'
        P_ZNAME.
  PERFORM BDC_DYNPRO      USING 'SAPLSZA6' '0600'.
  PERFORM BDC_FIELD       USING 'BDC_CURSOR'
        'ADSMTP-REMARK(01)'.
  PERFORM BDC_FIELD       USING 'BDC_OKCODE'
        '=CONT'.
  PERFORM BDC_FIELD       USING 'ADSMTP-SMTP_ADDR(01)'
        P_ZEMAIL.
  PERFORM BDC_FIELD       USING 'ADSMTP-REMARK(01)'
        P_VERKF.
  PERFORM BDC_DYNPRO      USING 'SAPMF02K' '0111'.
  PERFORM BDC_FIELD       USING 'BDC_OKCODE'
        '=UPDA'.
  PERFORM BDC_FIELD       USING 'BDC_CURSOR'
        'SZA1_D0100-MOB_NUMBER'.

  CALL TRANSACTION 'XK02' USING BDCDATA
        MODE 'N'
        UPDATE 'S'
        MESSAGES INTO MESSTAB.
  CLEAR BDCDATA[].


  READ TABLE MESSTAB WITH KEY MSGTYP = 'E'.
  IF SY-SUBRC = 0.
    MESSAGE '添加邮箱失败' TYPE 'E'.
    EXIT.
  ELSE.
  ENDIF.

ENDFORM.

FORM BDC_DYNPRO USING PROGRAM DYNPRO.
  CLEAR BDCDATA.
  BDCDATA-PROGRAM  = PROGRAM.
  BDCDATA-DYNPRO   = DYNPRO.
  BDCDATA-DYNBEGIN = 'X'.
  APPEND BDCDATA.
ENDFORM.
FORM BDC_FIELD USING FNAM FVAL.
  CLEAR BDCDATA.
  BDCDATA-FNAM = FNAM.
  BDCDATA-FVAL = FVAL.
  APPEND BDCDATA.

ENDFORM.
FUNCTION-POOL ZKING005.                     "MESSAGE-ID ..

* INCLUDE LZKING005D...                      " Local class definition

DATA : BEGIN OF ITAB_DATA OCCURS 0,
*         SEL(1),"选择
*         ICON              TYPE ICON_D, "状态标识
*         OLD_LIFNR         TYPE STRING, "旧供应商编号

         "基本视图
         KTOKK             TYPE CVIS_BP_GENERAL-GROUPING,             "账户组
         NAME1             TYPE CVIS_BP_GENERAL-NAME1,                "供应商名称
         SORTL             TYPE CVIS_BP_GENERAL-SEARCHTERM1,          "搜索项
         STREET            TYPE CVIS_BP_ADDRESS-STREET ,              "街道(详细地址)
         PCODE             TYPE CVIS_BP_ADDRESS-POSTL_COD1,           "邮编
         CITY              TYPE CVIS_BP_ADDRESS-CITY ,                "城市
         COUNTRY           TYPE CVIS_BP_ADDRESS-COUNTRY,              "国家
         REGION            TYPE CVIS_BP_ADDRESS-REGION ,              "地区
         FAX               TYPE CVIS_SUPP_CONT_FAX1-FAX,              "传真
         BANKS             TYPE CVIS_BP_BANK_DETAILS-BANK_CTRY,       "银行国家代码
         BANKL             TYPE CVIS_BP_BANK_DETAILS-BANK_KEY,        "银行代码
         BANKA             TYPE CVIS_BP_BANK_DETAILS-BANKACCOUNTNAME, "银行名称
         BANKN             TYPE CVIS_BP_BANK_DETAILS-BANK_ACCT,       "银行账号
         BKREF             TYPE CVIS_BP_BANK_DETAILS-BANK_REF,         "银行帐户的参考规定
         BKONT             TYPE CVIS_BP_BANK_DETAILS-CTRL_KEY,         "银行控制代码

         NAME              TYPE CVIS_BP_BANK_DETAILS-ACCOUNTHOLDER,   "账户持有人名称
         "公司视图
         BUKRS             TYPE CVIS_SUPPLIER_COMPANY-BUKRS, "公司代码
         AKONT             TYPE CVIS_SUPPLIER_COMPANY-AKONT, "统驭科目
         STCD1             TYPE CVIS_BP_TAX_NUMBER-TAXNUMBER, "税号
         TOGRU             TYPE CVIS_SUPPLIER_COMPANY-TOGRU, "容差组
         REPRF             TYPE CVIS_SUPPLIER_COMPANY-REPRF, "检查重复发票
         ZTERM             TYPE CVIS_SUPPLIER_COMPANY-ZTERM, "付款条款
         ZWELS             TYPE CVIS_SUPPLIER_COMPANY-ZWELS, "付款方式
         "采购视图
         EKORG             TYPE CVIS_SUPPLIER_PURCHASING-EKORG, "采购组织
         MALX              TYPE CVIS_SUPPLIER_PURCHASING-EIKTO, "物料类型
         WAERS             TYPE CVIS_SUPPLIER_PURCHASING-WAERS, "订单货币
         FKFS              TYPE STRING, "付款方式
         ZTERM1            TYPE CVIS_SUPPLIER_PURCHASING-ZTERM, "付款条款
         WEBRE             TYPE CVIS_SUPPLIER_PURCHASING-WEBRE, "基于收货的发票验证
         KZAUT             TYPE CVIS_SUPPLIER_PURCHASING-KZAUT, "自动产生允许的采购订单
         VERKF             TYPE CVIS_SUPPLIER_PURCHASING-VERKF, "销售员
         TELF1             TYPE CVIS_SUPPLIER_PURCHASING-TELF1, "销售人员电话
         EMAIL             TYPE STRING,                         "销售员邮箱
         PERSON            TYPE STRING,      "公司人员
         TELF2             TYPE STRING,      "公司人员电话
         EMAIL1            TYPE STRING,       "公司人员邮箱
         MESTEXT(100),"处理消息
         MESTEXTEMAIL(100),"邮箱处理消息
         LIFNR             TYPE LFA1-LIFNR,   "供应商编号
         TYPE              TYPE STRING  VALUE 'X',     "标识
       END OF ITAB_DATA.

DATA: IT_BP_ROLE                  TYPE TABLE OF CVIS_BP_ROLE,
      LS_BP_ROLE                  TYPE CVIS_BP_ROLE,
      IT_BP_GENERAL               TYPE TABLE OF CVIS_BP_GENERAL,
      LS_BP_GENERAL               TYPE CVIS_BP_GENERAL,
      CT_RETURN                   TYPE TABLE OF CVIS_BP_RETURN,
      "银行信息
      IT_BP_BANK_DETAILS          TYPE TABLE OF CVIS_BP_BANK_DETAILS,
      LS_BP_BANK_DETAILS          TYPE CVIS_BP_BANK_DETAILS,
      "税码
      IT_BP_TAX_NUMBER            TYPE TABLE OF CVIS_BP_TAX_NUMBER,
      LS_BP_TAX_NUMBER            TYPE CVIS_BP_TAX_NUMBER,
      "地址
      IT_BP_ADDRESS               TYPE TABLE OF CVIS_BP_ADDRESS,
      LS_BP_ADDRESS               TYPE CVIS_BP_ADDRESS,
      "邮箱
      IT_BP_ADDRESS_EMAIL         TYPE TABLE OF CVIS_BP_ADDRESS_EMAIL,
      LS_BP_ADDRESS_EMAIL         TYPE  CVIS_BP_ADDRESS_EMAIL,
      "邮箱--通讯
      IT_BP_ADDRESS_EMAIL_REMARKS TYPE TABLE OF CVIS_ADDRESS_EMAIL_REMARKS,
      LS_BP_ADDRESS_EMAIL_REMARKS TYPE  CVIS_ADDRESS_EMAIL_REMARKS,

      "公司代码数据
      IT_SUP_COMPANY              TYPE TABLE OF CVIS_SUPPLIER_COMPANY,
      LS_SUP_COMPANY              TYPE CVIS_SUPPLIER_COMPANY,
      "采购数据
      IT_SUP_PURCHASING           TYPE TABLE OF CVIS_SUPPLIER_PURCHASING,
      LS_SUP_PURCHASING           TYPE CVIS_SUPPLIER_PURCHASING,
      IT_SUP_PURCH_FUNCTIONS      TYPE TABLE OF CVIS_SUPPLIER_PURCH_FUNC,
      LS_SUP_PURCH_FUNCTIONS      TYPE  CVIS_SUPPLIER_PURCH_FUNC,
      IT_SUP_PURCHASING2          TYPE TABLE OF CVIS_SUPPLIER_PURCHASING2,
      LS_SUP_PURCHASING2          TYPE CVIS_SUPPLIER_PURCHASING2,
      IT_SUP_GENERAL              TYPE TABLE OF CVIS_SUPPLIER_GENERAL,
      LS_SUP_GENERAL              TYPE  CVIS_SUPPLIER_GENERAL.


DATA:   BDCDATA LIKE BDCDATA    OCCURS 0 WITH HEADER LINE.
DATA:   MESSTAB LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA:   E_GROUP_OPENED.
DATA:   L_MSTRING(480).
DATA:TYPE    TYPE STRING  VALUE 'X',     "标识
     ZTEL    TYPE STRING, "公司人员电话
     TELF1   TYPE STRING, "销售人员电话
     ZNAME   TYPE STRING, "公司人员
     ZEMAIL1 TYPE STRING, "公司人员邮箱
     ZEMAIL  TYPE STRING, "销售员邮箱
     VERKF   TYPE STRING. "销售员
DATA RUN_ID TYPE I.

 

posted @ 2021-11-04 17:26  萧静默  阅读(1660)  评论(0编辑  收藏  举报