其他分享
首页 > 其他分享> > 供应商主数据批导

供应商主数据批导

作者:互联网

原文链接:(26条消息) ABAP 供应商主数据批量导入_寒武青锋的博客-CSDN博客_sap 客户主数据导入

在抄了阿丰作业之后,发现无法更新供应商通用数据地址信息,数据会新增到地址概览里面。

具体办法:

如有需要可先 BAPI_BUPA_ADDRESS_GETDETAIL 获取明细,再用BAPI_BUPA_ADDRESS_CHANGE 修改

代码如下:

FORM IMPORT_DATA .
  DATA:
    LS_CVIS_BP_GENERAL          TYPE CVIS_BP_GENERAL,           "一般数据
    LT_CVIS_BP_GENERAL          TYPE TABLE OF CVIS_BP_GENERAL,
    LT_CVIS_BP_ROLE             TYPE TABLE OF CVIS_BP_ROLE,    "角色信息
    LS_CVIS_BP_BANK_DETAILS     TYPE CVIS_BP_BANK_DETAILS,     "银行信息
    LT_CVIS_BP_BANK_DETAILS     TYPE TABLE OF CVIS_BP_BANK_DETAILS,
    LS_CVIS_BP_TAX_NUMBER       TYPE CVIS_BP_TAX_NUMBER,       "税号信息
    LT_CVIS_BP_TAX_NUMBER       TYPE TABLE OF CVIS_BP_TAX_NUMBER,
    LS_CVIS_BP_ADDRESS          TYPE CVIS_BP_ADDRESS,          "地址信息
    LT_CVIS_BP_ADDRESS          TYPE TABLE OF CVIS_BP_ADDRESS,
    LS_CVIS_BP_ADDRESS_TELENO   TYPE CVIS_BP_ADDRESS_TELENO,   "电话信息
    LT_CVIS_BP_ADDRESS_TELENO   TYPE TABLE OF CVIS_BP_ADDRESS_TELENO,
    LS_CVIS_BP_ADDRESS_FAXNO    TYPE CVIS_BP_ADDRESS_FAXNO,    "传真信息
    LT_CVIS_BP_ADDRESS_FAXNO    TYPE TABLE OF CVIS_BP_ADDRESS_FAXNO,
    LS_CVIS_BP_ADDRESS_EMAIL    TYPE CVIS_BP_ADDRESS_EMAIL,    "邮箱信息
    LT_CVIS_BP_ADDRESS_EMAIL    TYPE TABLE OF CVIS_BP_ADDRESS_EMAIL,
    LT_CVIS_BP_RETURN           TYPE TABLE OF CVIS_BP_RETURN,  "返回消息
    LS_CVIS_SUPPLIER_GENERAL    TYPE CVIS_SUPPLIER_GENERAL,    "
    LT_CVIS_SUPPLIER_GENERAL    TYPE TABLE OF CVIS_SUPPLIER_GENERAL,
    LS_CVIS_SUPPLIER_COMPANY    TYPE CVIS_SUPPLIER_COMPANY,    "公司视图
    LT_CVIS_SUPPLIER_COMPANY    TYPE TABLE OF CVIS_SUPPLIER_COMPANY,
    LS_CVIS_SUPPLIER_PURCHASING TYPE CVIS_SUPPLIER_PURCHASING, "采购视图
    LT_CVIS_SUPPLIER_PURCHASING TYPE TABLE OF CVIS_SUPPLIER_PURCHASING, "
    LS_SUP_PURCH_FUNCTIONS      TYPE CVIS_SUPPLIER_PURCH_FUNC, "合作伙伴
    LT_SUP_PURCH_FUNCTIONS      TYPE TABLE OF CVIS_SUPPLIER_PURCH_FUNC,
    LV_RUN_ID                   TYPE CVI_RUN_ID,
    LV_MESSAGE                  TYPE BAPI_MSG,
    LV_SUBRC                    TYPE SYST-SUBRC.
  DATA:
    LS_ADDRESSDATA     TYPE BAPIBUS1006_ADDRESS, "地址信息
    LS_ADDRESSDATA_X   TYPE BAPIBUS1006_ADDRESS_X,
    LS_BAPIADTEL       TYPE BAPIADTEL,          "电话信息
    LT_BAPIADTEL       TYPE TABLE OF BAPIADTEL,
    LS_BAPIADTEL_X     TYPE BAPIADTELX,
    LT_BAPIADTEL_X     TYPE TABLE OF BAPIADTELX,
    LS_BAPIADFAX       TYPE BAPIADFAX,          "传真信息
    LT_BAPIADFAX       TYPE TABLE OF BAPIADFAX,
    LS_BAPIADFAX_X     TYPE BAPIADFAXX,
    LT_BAPIADFAX_X     TYPE TABLE OF BAPIADFAXX,
    LS_BAPIADVERSORG   TYPE BAPIAD1VD,          "一般数据
    LT_BAPIADVERSORG   TYPE TABLE OF BAPIAD1VD,
    LS_BAPIADVERSORG_X TYPE BAPIAD1VDX,
    LT_BAPIADVERSORG_X TYPE TABLE OF BAPIAD1VDX,
    LT_RETURN          TYPE TABLE OF BAPIRET2.
  "供应商信息
  SELECT PARTNER,PARTNER_GUID
     INTO TABLE @DATA(LT_LFA1)
    FROM BUT000
    FOR ALL ENTRIES IN @GT_OUT
    WHERE PARTNER EQ @GT_OUT-PARTNER.
  IF SY-SUBRC EQ 0.
    SORT LT_LFA1 BY PARTNER.
  ENDIF.
  "税号信息
  SELECT PARTNER,TAXTYPE
    INTO TABLE @DATA(LT_DFKKBPTAXNUM)
    FROM DFKKBPTAXNUM
    FOR ALL ENTRIES IN @GT_OUT
    WHERE PARTNER EQ @GT_OUT-PARTNER.
  IF SY-SUBRC EQ 0.
    SORT LT_DFKKBPTAXNUM BY PARTNER.
  ENDIF.

  CHECK GV_DONE NE ABAP_TRUE.
  LOOP AT GT_OUT ASSIGNING FIELD-SYMBOL(<FS_OUT>) WHERE ZICON EQ ICON_GREEN_LIGHT
                                                    AND ZSEL  EQ ABAP_TRUE.

    LV_RUN_ID = '1000000'.
    <FS_OUT>-PARTNER = |{ <FS_OUT>-PARTNER ALPHA = IN }|.
    <FS_OUT>-AKONT   = |{ <FS_OUT>-AKONT   ALPHA = IN }|.
    "供应商存在-U 不存在 I
    CLEAR LT_CVIS_BP_GENERAL.
    READ TABLE LT_LFA1 INTO DATA(LS_LFA1) WITH KEY PARTNER = <FS_OUT>-PARTNER TRANSPORTING NO FIELDS.
    IF SY-SUBRC EQ 0.
      LS_CVIS_BP_GENERAL-OBJECT_TASK = CNS_TASK_U.
      DATA(LV_GUID) = LS_LFA1-PARTNER_GUID.
      LS_CVIS_BP_GENERAL-BPARTNERGUID = LV_GUID.
    ELSE.
      LS_CVIS_BP_GENERAL-OBJECT_TASK = CNS_TASK_I.
      LV_GUID = ZCL_UTIL=>GET_GUID( ).
      APPEND VALUE #( PARTNER = <FS_OUT>-PARTNER PARTNER_GUID = LV_GUID ) TO LT_LFA1.
    ENDIF.

    LS_CVIS_BP_GENERAL-RUN_ID      = LV_RUN_ID.         "运行标识
    LS_CVIS_BP_GENERAL-CATEGORY    = '2'.               "业务伙伴类别
    LS_CVIS_BP_GENERAL-GROUPING    = <FS_OUT>-BU_GROUP. "业务合作伙伴组
    LS_CVIS_BP_GENERAL-BPARTNER    = <FS_OUT>-PARTNER.  "伙伴编码
    LS_CVIS_BP_GENERAL-NAME1       = <FS_OUT>-NAME_ORG1."名称·1
    LS_CVIS_BP_GENERAL-SEARCHTERM1 = <FS_OUT>-BU_SORT1. "搜索项
    LS_CVIS_BP_GENERAL-TITLE_KEY   = <FS_OUT>-TITLE.    "称谓
    APPEND LS_CVIS_BP_GENERAL TO LT_CVIS_BP_GENERAL.

    "税号
    IF LS_CVIS_BP_GENERAL-OBJECT_TASK EQ CNS_TASK_I.
      READ TABLE LT_DFKKBPTAXNUM WITH KEY PARTNER = <FS_OUT>-PARTNER TRANSPORTING NO FIELDS.
      IF SY-SUBRC NE 0.
        CLEAR LT_CVIS_BP_TAX_NUMBER.
        LS_CVIS_BP_TAX_NUMBER-RUN_ID    = LV_RUN_ID.     "运行标识
        LS_CVIS_BP_TAX_NUMBER-TAXTYPE   = CNS_TAXTYPE.   "增值税发票号
        LS_CVIS_BP_TAX_NUMBER-TAXNUMBER = <FS_OUT>-STCEG."增值税发票号
        APPEND LS_CVIS_BP_TAX_NUMBER TO LT_CVIS_BP_TAX_NUMBER.
        APPEND VALUE #( PARTNER = <FS_OUT>-PARTNER TAXTYPE = CNS_TAXTYPE ) TO LT_DFKKBPTAXNUM.
      ENDIF.

      "通用信息
      CLEAR LT_CVIS_BP_ADDRESS.
      LS_CVIS_BP_ADDRESS-RUN_ID     = LV_RUN_ID.     "运行标识
      LS_CVIS_BP_ADDRESS-GUID       = LV_GUID.       "UUID
      LS_CVIS_BP_ADDRESS-LANGU      = <FS_OUT>-SPRAS."语言
      LS_CVIS_BP_ADDRESS-POSTL_COD1 = <FS_OUT>-PSTL2."邮政编码
      LS_CVIS_BP_ADDRESS-CITY       = <FS_OUT>-ORT01."城市
      LS_CVIS_BP_ADDRESS-REGION     = <FS_OUT>-REGIO."区号
      LS_CVIS_BP_ADDRESS-STREET     = <FS_OUT>-STRAS."地址
      LS_CVIS_BP_ADDRESS-COUNTRY    = <FS_OUT>-LAND1."国家代码
      LS_CVIS_BP_ADDRESS-COMM_TYPE  = CNS_COMMTYPE.  "通讯方法 (关键字)(业务地址服务)
      APPEND LS_CVIS_BP_ADDRESS TO LT_CVIS_BP_ADDRESS.

      "电话信息
      CLEAR LT_CVIS_BP_ADDRESS_TELENO.
      LS_CVIS_BP_ADDRESS_TELENO-RUN_ID    = LV_RUN_ID.     "运行标识
      LS_CVIS_BP_ADDRESS_TELENO-COUNTRY   = <FS_OUT>-LAND1."国家
      LS_CVIS_BP_ADDRESS_TELENO-TELEPHONE = <FS_OUT>-TELF1."电话
      LS_CVIS_BP_ADDRESS_TELENO-R_3_USER  = '2'.
      APPEND LS_CVIS_BP_ADDRESS_TELENO TO LT_CVIS_BP_ADDRESS_TELENO .

      "传真信息
      CLEAR LT_CVIS_BP_ADDRESS_FAXNO.
      LS_CVIS_BP_ADDRESS_FAXNO-RUN_ID  = LV_RUN_ID.     "运行标识
      LS_CVIS_BP_ADDRESS_FAXNO-COUNTRY = <FS_OUT>-LAND1."国家
      LS_CVIS_BP_ADDRESS_FAXNO-FAX     = <FS_OUT>-TELFX."传真
      APPEND LS_CVIS_BP_ADDRESS_FAXNO TO LT_CVIS_BP_ADDRESS_FAXNO."传真号码
    ELSE.
      "更新 地址
      LS_ADDRESSDATA-STANDARDADDRESS = CNS_FLAG.
      LS_ADDRESSDATA-CITY            = <FS_OUT>-ORT01."城市
      LS_ADDRESSDATA-POSTL_COD1      = <FS_OUT>-PSTL2."邮政编码
      LS_ADDRESSDATA-STREET          = <FS_OUT>-STRAS."地址
      LS_ADDRESSDATA-REGION          = <FS_OUT>-REGIO."区号
      LS_ADDRESSDATA-LANGU           = <FS_OUT>-SPRAS."语言
      LS_ADDRESSDATA-COUNTRY         = <FS_OUT>-LAND1."国家代码

      LS_ADDRESSDATA_X-STANDARDADDRESS = CNS_FLAG.
      LS_ADDRESSDATA_X-CITY            = CNS_FLAG."城市
      LS_ADDRESSDATA_X-POSTL_COD1      = CNS_FLAG."邮政编码
      LS_ADDRESSDATA_X-STREET          = CNS_FLAG."地址
      LS_ADDRESSDATA_X-REGION          = CNS_FLAG."区号
      LS_ADDRESSDATA_X-LANGU           = CNS_FLAG."语言
      LS_ADDRESSDATA_X-COUNTRY         = CNS_FLAG."国家代码
      "更新 电话
      CLEAR LT_BAPIADTEL.
      LS_BAPIADTEL-COUNTRY    = <FS_OUT>-LAND1.
      LS_BAPIADTEL-COUNTRYISO = <FS_OUT>-LAND1."国家
      LS_BAPIADTEL-TELEPHONE  = <FS_OUT>-TELF1."电话
      APPEND LS_BAPIADTEL TO LT_BAPIADTEL.

      CLEAR LT_BAPIADTEL_X.
      LS_BAPIADTEL_X-COUNTRY    = CNS_FLAG.
      LS_BAPIADTEL_X-COUNTRYISO = CNS_FLAG.
      LS_BAPIADTEL_X-TELEPHONE  = CNS_FLAG.
      APPEND LS_BAPIADTEL_X TO LT_BAPIADTEL_X.
      "更新 传真
      CLEAR LT_BAPIADFAX.
      LS_BAPIADFAX-COUNTRY    = <FS_OUT>-LAND1.
      LS_BAPIADFAX-COUNTRYISO = <FS_OUT>-LAND1."国家
      LS_BAPIADFAX-FAX        = <FS_OUT>-TELFX."传真
      APPEND LS_BAPIADFAX TO LT_BAPIADFAX.

      CLEAR LT_BAPIADFAX_X.
      LS_BAPIADFAX_X-COUNTRY    = CNS_FLAG.
      LS_BAPIADFAX_X-COUNTRYISO = CNS_FLAG.
      LS_BAPIADFAX_X-FAX        = CNS_FLAG.
      APPEND LS_BAPIADFAX_X TO LT_BAPIADFAX_X.
      "更新 通用数据
      CLEAR LT_BAPIADVERSORG.
      LS_BAPIADVERSORG-TITLE = <FS_OUT>-TITLE.    "名称·1
      LS_BAPIADVERSORG-NAME  = <FS_OUT>-NAME_ORG1."搜索项
      LS_BAPIADVERSORG-SORT1 = <FS_OUT>-BU_SORT1. "称谓
      APPEND LS_BAPIADVERSORG TO LT_BAPIADVERSORG.

      CLEAR LT_BAPIADVERSORG_X.
      LS_BAPIADVERSORG_X-TITLE = CNS_FLAG.
      LS_BAPIADVERSORG_X-NAME  = CNS_FLAG.
      LS_BAPIADVERSORG_X-SORT1 = CNS_FLAG.
      APPEND LS_BAPIADVERSORG_X TO LT_BAPIADVERSORG_X.
      "更新 税号
      CLEAR LT_CVIS_BP_TAX_NUMBER.
      LS_CVIS_BP_TAX_NUMBER-RUN_ID    = LV_RUN_ID.     "运行标识
      LS_CVIS_BP_TAX_NUMBER-TAXTYPE   = CNS_TAXTYPE.   "增值税发票号
      LS_CVIS_BP_TAX_NUMBER-TAXNUMBER = <FS_OUT>-STCEG."增值税发票号
      APPEND LS_CVIS_BP_TAX_NUMBER TO LT_CVIS_BP_TAX_NUMBER.
    ENDIF.

    CLEAR LT_CVIS_BP_ROLE.
    APPEND VALUE #( RUN_ID = LV_RUN_ID DATA_KEY = 'FLVN00' ) TO LT_CVIS_BP_ROLE.
    IF <FS_OUT>-BU_GROUP NE 'S004' AND <FS_OUT>-BU_GROUP NE 'S005'.
      APPEND VALUE #( RUN_ID = LV_RUN_ID DATA_KEY = 'FLVN01' ) TO LT_CVIS_BP_ROLE.
    ENDIF.

    "供应商一般数据
    CLEAR LT_CVIS_SUPPLIER_GENERAL.
    LS_CVIS_SUPPLIER_GENERAL-RUN_ID      = LV_RUN_ID.      "运行标识
    LS_CVIS_SUPPLIER_GENERAL-OBJECT_TASK = CNS_TASK_M.       "TASK = M->创建/更改
    LS_CVIS_SUPPLIER_GENERAL-LIFNR       = <FS_OUT>-PARTNER."供应商
    APPEND LS_CVIS_SUPPLIER_GENERAL TO LT_CVIS_SUPPLIER_GENERAL.

    IF <FS_OUT>-BANKN IS NOT INITIAL.
      CLEAR LT_CVIS_BP_BANK_DETAILS.
      LS_CVIS_BP_BANK_DETAILS-RUN_ID    = LV_RUN_ID.     "运行标识
      LS_CVIS_BP_BANK_DETAILS-BANK_CTRY = <FS_OUT>-BANKS."银行国家
      LS_CVIS_BP_BANK_DETAILS-BANK_KEY  = <FS_OUT>-BANKL."银行代码
      IF STRLEN( <FS_OUT>-BANKN ) GT 18 .
        LS_CVIS_BP_BANK_DETAILS-BANK_ACCT = <FS_OUT>-BANKN."银行账号前18
        LS_CVIS_BP_BANK_DETAILS-BANK_REF = <FS_OUT>-BANKN+18(2)."后2
      ELSE.
        LS_CVIS_BP_BANK_DETAILS-BANK_ACCT = <FS_OUT>-BANKN."银行账号前18
      ENDIF.
      APPEND LS_CVIS_BP_BANK_DETAILS TO LT_CVIS_BP_BANK_DETAILS.
    ENDIF.

    "=================== 公司视图
    CLEAR LT_CVIS_SUPPLIER_COMPANY.
    LS_CVIS_SUPPLIER_COMPANY-RUN_ID = LV_RUN_ID.        "运行标识
    LS_CVIS_SUPPLIER_COMPANY-BUKRS  = <FS_OUT>-BUKRS.   "公司代码
    LS_CVIS_SUPPLIER_COMPANY-AKONT  = <FS_OUT>-AKONT.   "统驭科目
    LS_CVIS_SUPPLIER_COMPANY-ZUAWA  = <FS_OUT>-ZUAWA.   "排序码
    LS_CVIS_SUPPLIER_COMPANY-ZTERM  = <FS_OUT>-ZTERM_WK."付款条件
    LS_CVIS_SUPPLIER_COMPANY-ZWELS  = <FS_OUT>-ZWELS.   "付款方式
    LS_CVIS_SUPPLIER_COMPANY-REPRF  = <FS_OUT>-REPRF .  "双重发票校验
    APPEND LS_CVIS_SUPPLIER_COMPANY TO LT_CVIS_SUPPLIER_COMPANY.

    "=================== 采购视图
    IF <FS_OUT>-BU_GROUP NE 'S004' AND <FS_OUT>-BU_GROUP NE 'S005'.
      CLEAR LT_CVIS_SUPPLIER_PURCHASING.
      LS_CVIS_SUPPLIER_PURCHASING-RUN_ID = LV_RUN_ID.      "运行标识
      LS_CVIS_SUPPLIER_PURCHASING-EKORG  = <FS_OUT>-EKORG. "采购组织
      LS_CVIS_SUPPLIER_PURCHASING-WAERS  = <FS_OUT>-WAERS. "币种
      LS_CVIS_SUPPLIER_PURCHASING-ZTERM  = <FS_OUT>-ZTERM_EK."付款条件
      LS_CVIS_SUPPLIER_PURCHASING-WEBRE  = <FS_OUT>-WEBRE ."基于收货的发票校验
      LS_CVIS_SUPPLIER_PURCHASING-VERKF  = <FS_OUT>-VERKF. "供应商联系人
      LS_CVIS_SUPPLIER_PURCHASING-TELF1  = <FS_OUT>-TELF2. "供应商联系电话
      APPEND LS_CVIS_SUPPLIER_PURCHASING TO LT_CVIS_SUPPLIER_PURCHASING.
    ENDIF.

    "合同伙伴
    CLEAR LT_SUP_PURCH_FUNCTIONS.
    LS_SUP_PURCH_FUNCTIONS-RUN_ID  = LV_RUN_ID.       "运行标识
    LS_SUP_PURCH_FUNCTIONS-EKORG   = <FS_OUT>-EKORG.  "采购组织
    LS_SUP_PURCH_FUNCTIONS-PARVW   = 'BA'.            "合作伙伴职能
    LS_SUP_PURCH_FUNCTIONS-PARTNER = <FS_OUT>-PARTNER."合作伙伴
    APPEND LS_SUP_PURCH_FUNCTIONS TO LT_SUP_PURCH_FUNCTIONS.

    LS_SUP_PURCH_FUNCTIONS-RUN_ID  = LV_RUN_ID.       "运行标识
    LS_SUP_PURCH_FUNCTIONS-EKORG   = <FS_OUT>-EKORG.  "采购组织
    LS_SUP_PURCH_FUNCTIONS-PARVW   = 'LF'.            "合作伙伴职能
    LS_SUP_PURCH_FUNCTIONS-PARTNER = <FS_OUT>-PARTNER."合作伙伴
    APPEND LS_SUP_PURCH_FUNCTIONS TO LT_SUP_PURCH_FUNCTIONS.

    LS_SUP_PURCH_FUNCTIONS-RUN_ID  = LV_RUN_ID.       "运行标识
    LS_SUP_PURCH_FUNCTIONS-EKORG   = <FS_OUT>-EKORG.  "采购组织
    LS_SUP_PURCH_FUNCTIONS-PARVW   = 'RS'.            "合作伙伴职能
    LS_SUP_PURCH_FUNCTIONS-PARTNER = <FS_OUT>-PARTNER."合作伙伴
    APPEND LS_SUP_PURCH_FUNCTIONS TO LT_SUP_PURCH_FUNCTIONS.

    "创建/更新 BP主数据
    DATA(LV_COMMIT) = ABAP_TRUE.
    CALL FUNCTION 'RFC_CVI_EI_INBOUND_MAIN'
      EXPORTING
        IV_DOCOMMIT            = LV_COMMIT
      TABLES
        IT_BP_GENERAL          = LT_CVIS_BP_GENERAL
        IT_BP_ROLE             = LT_CVIS_BP_ROLE
        IT_BP_TAX_NUMBER       = LT_CVIS_BP_TAX_NUMBER
        IT_BP_ADDRESS          = LT_CVIS_BP_ADDRESS
        IT_BP_BANK_DETAILS     = LT_CVIS_BP_BANK_DETAILS
        IT_BP_ADDRESS_TELENO   = LT_CVIS_BP_ADDRESS_TELENO
        IT_BP_ADDRESS_FAXNO    = LT_CVIS_BP_ADDRESS_FAXNO
        IT_BP_ADDRESS_EMAIL    = LT_CVIS_BP_ADDRESS_EMAIL
        IT_SUP_GENERAL         = LT_CVIS_SUPPLIER_GENERAL
        IT_SUP_COMPANY         = LT_CVIS_SUPPLIER_COMPANY
        IT_SUP_PURCHASING      = LT_CVIS_SUPPLIER_PURCHASING
        IT_SUP_PURCH_FUNCTIONS = LT_SUP_PURCH_FUNCTIONS
        CT_RETURN              = LT_CVIS_BP_RETURN.
    LOOP AT LT_CVIS_BP_RETURN INTO DATA(LS_CVIS_RETURN) WHERE TYPE CA 'AEX'.
      LV_SUBRC = 4.
      LV_MESSAGE = LS_CVIS_RETURN-MESSAGE.
      EXIT.
    ENDLOOP.

    "更新BP 通用数据——地址与电话数据
    IF LS_CVIS_BP_GENERAL-OBJECT_TASK EQ CNS_TASK_U AND LV_SUBRC EQ 0.
      CALL FUNCTION 'BAPI_BUPA_ADDRESS_CHANGE'
        EXPORTING
          BUSINESSPARTNER = <FS_OUT>-PARTNER
          ADDRESSDATA     = LS_ADDRESSDATA
          ADDRESSDATA_X   = LS_ADDRESSDATA_X
        TABLES
          BAPIADTEL       = LT_BAPIADTEL
          BAPIADFAX       = LT_BAPIADFAX
          BAPIADVERSORG   = LT_BAPIADVERSORG
          BAPIADTEL_X     = LT_BAPIADTEL_X
          BAPIADFAX_X     = LT_BAPIADFAX_X
          BAPIADVERSORG_X = LT_BAPIADVERSORG_X
          RETURN          = LT_RETURN.
      LOOP AT LT_RETURN INTO DATA(LS_RETURN) WHERE TYPE CA 'AEX'.
        LV_MESSAGE = LS_RETURN-MESSAGE.
        LV_SUBRC = 4.
        EXIT.
      ENDLOOP.
    ENDIF.

    IF LV_SUBRC NE 0.
      <FS_OUT>-ZICON = ICON_RED_LIGHT.
      <FS_OUT>-ZMSG  = LV_MESSAGE.
    ELSE.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          WAIT = 'X'.

      <FS_OUT>-ZICON = ICON_GREEN_LIGHT.
      <FS_OUT>-ZMSG  = |供应商:{ <FS_OUT>-PARTNER }创建/修改成功|.
    ENDIF.

    CLEAR:LT_RETURN,
          LT_CVIS_BP_RETURN,
          LV_MESSAGE,
          LV_SUBRC,
          LS_CVIS_BP_GENERAL.
  ENDLOOP.

  GV_DONE = ABAP_TRUE.

 

标签:TYPE,供应商,CVIS,LT,BP,批导,ADDRESS,数据,LS
来源: https://www.cnblogs.com/moonhahaday/p/16408195.html