SAP AUTOMAIL-自动发邮件功能

news2024/11/11 18:14:45

总结

针对发送邮件内容封装公用函数,针对不同业务场景即可实现AUTO MAIL自动触发邮件。

1. 邮件发送内容:正文,附件,超链接等等

1.1  正文可以是一般内容或表格明细清单,涉及到很多格式的设置,用HTML格式设置。

1.2  附件可以是DOC,  PDF ,EXCEL,JPG/PNG图片等等格式

1.3  邮件中可设置超链接地址,比如用户催办邮件,用户点超链接,可以直接调整到待办单据页面。

2.  邮件发送监控

发送邮件tcode: scot   可以监控邮件发送状态及内容

如果系统中所有邮件发送不出去 跟BASIS排查系统问题;若单据功能发送不出,排查程序的问题

应用1

1.SE37创建公用函数FUNCTION :ZFIFM_0164

2. Import 参数。

入参说明: 

IM_MAIL_CONTENTTYPESTRING                     邮件正文
IM_SUBJECTTYPESO_OBJ_DES                     邮件主题
IM_MAILTYPEBCSY_SMTPA                     主送邮件地址
IM_CCMAILTYPEBCSY_SMTPA                     抄送邮件地址
IM_CCMAIL_BLINDTYPEBCSY_SMTPA                     密抄送邮件地址
IM_SENDERTYPESYST_UNAME'ICP-NOTICE'邮件发送人
IM_OTFTYPETT_ITCOO                     附件PDF格式内表数据
IM_CONTENT_HEXTYPESOLIX_TAB                     附件EXCEL文件
IM_CONTENT_DOCTYPESOLIX_TAB                     附件WORD文件
IM_CONTENT_PNGTYPESOLIX_TAB                     附件图片文件
IT_EXPERTSTYPEZTTFI_GENERAL_RANGE                     Table type for general range table
IM_IMG_TOP_NAMETYPESTRING                     顶部图片
IM_IMG_BOTTOM_NAMETYPESTRING                     底部图片
IM_ATTACHMENT_SUBJECTTYPESO_OBJ_DES                     附件名称
IM_XSTRINGTYPEXSTRING                                                                                                    
IM_EXCEL_SIZETYPESO_OBJ_LEN                     EXCEL文档内容大小
IT_CONTENT_HEXTYPEZTEXCEL_FJ                     邮件附件表类型 
IM_XLSXTYPECHAR1                     附件格式XLSX

 EXCEPTION定义:

FUNCTION ZFIFM_0164.
*"----------------------------------------------------------------------
*"*"本地接口:
*"  IMPORTING
*"     VALUE(IM_MAIL_CONTENT) TYPE  STRING OPTIONAL
*"     VALUE(IM_SUBJECT) TYPE  SO_OBJ_DES OPTIONAL
*"     VALUE(IM_MAIL) TYPE  BCSY_SMTPA OPTIONAL
*"     VALUE(IM_CCMAIL) TYPE  BCSY_SMTPA OPTIONAL
*"     VALUE(IM_CCMAIL_BLIND) TYPE  BCSY_SMTPA OPTIONAL
*"     VALUE(IM_SENDER) TYPE  SYST_UNAME DEFAULT 'ICP-NOTICE'
*"     VALUE(IM_OTF) TYPE  TT_ITCOO OPTIONAL
*"     VALUE(IM_CONTENT_HEX) TYPE  SOLIX_TAB OPTIONAL
*"     VALUE(IM_CONTENT_DOC) TYPE  SOLIX_TAB OPTIONAL
*"     VALUE(IM_CONTENT_PNG) TYPE  SOLIX_TAB OPTIONAL
*"     REFERENCE(IT_EXPERTS) TYPE  ZTTFI_GENERAL_RANGE OPTIONAL
*"     VALUE(IM_IMG_TOP_NAME) TYPE  STRING OPTIONAL
*"     VALUE(IM_IMG_BOTTOM_NAME) TYPE  STRING OPTIONAL
*"     VALUE(IM_ATTACHMENT_SUBJECT) TYPE  SO_OBJ_DES OPTIONAL
*"     VALUE(IM_XSTRING) TYPE  XSTRING OPTIONAL
*"     VALUE(IM_EXCEL_SIZE) TYPE  SO_OBJ_LEN OPTIONAL
*"     VALUE(IT_CONTENT_HEX) TYPE  ZTEXCEL_FJ OPTIONAL
*"     VALUE(IM_XLSX) TYPE  CHAR1 OPTIONAL
*"  RAISING
*"      CX_SEND_REQ_BCS
*"----------------------------------------------------------------------
  DATA : LT_MAIL_BODY       TYPE SOLI_TAB,
         LO_CX_SEND_REQ_BCS TYPE REF TO CX_SEND_REQ_BCS,
         LO_EMAIL_BODY      TYPE REF TO CL_DOCUMENT_BCS,
         LO_RECEIVER        TYPE REF TO CL_CAM_ADDRESS_BCS,
         LO_EMAIL           TYPE REF TO CL_BCS,
         LO_SENDER          TYPE REF TO CL_SAPUSER_BCS,
         L_SEND_RESULT      TYPE OS_BOOLEAN,
         COS_MAIL           TYPE C LENGTH 10 VALUE '@vanke.com',
         COS_MAIL_HZ        TYPE C LENGTH 10 VALUE '@'.

**  设置签名相关变量
  DATA: L_LEN          TYPE SO_OBJ_LEN,
        LT_SOLIX       TYPE SOLIX_TAB,
        LV_IS_FOLDER   TYPE BOOLE_D,
        LV_CONTENT     TYPE XSTRING,
        LV_LOIO        TYPE SKWF_IO,
        LO_MR_API      TYPE REF TO IF_MR_API,
        LO_CONVERT     TYPE REF TO CL_BCS_CONVERT,
        LO_MIME_HELPER TYPE REF TO CL_GBT_MULTIRELATED_SERVICE.

**  邮件正文转换
  CALL FUNCTION 'CONVERT_STRING_TO_TAB'
    EXPORTING
      I_STRING         = IM_MAIL_CONTENT
      I_TABLINE_LENGTH = 255
    TABLES
      ET_TABLE         = LT_MAIL_BODY. "

**  设置集团 LOGO 签名
  IF LO_MR_API IS INITIAL.
    LO_MR_API = CL_MIME_REPOSITORY_API=>IF_MR_API~GET_API( ).

  ENDIF.

  CALL METHOD LO_MR_API->GET
    EXPORTING
      I_URL              = '/SAP/PUBLIC/VankeLogo4Mail.png'
    IMPORTING
      E_IS_FOLDER        = LV_IS_FOLDER
      E_CONTENT          = LV_CONTENT
      E_LOIO             = LV_LOIO
    EXCEPTIONS
      PARAMETER_MISSING  = 1
      ERROR_OCCURED      = 2
      NOT_FOUND          = 3
      PERMISSION_FAILURE = 4
      OTHERS             = 5.

  L_LEN = XSTRLEN( LV_CONTENT ).

  CREATE OBJECT LO_CONVERT.

  CALL METHOD LO_CONVERT->XSTRING_TO_SOLIX
    EXPORTING
      IV_XSTRING = LV_CONTENT
    RECEIVING
      ET_SOLIX   = LT_SOLIX.

  CREATE OBJECT LO_MIME_HELPER.

  CALL METHOD LO_MIME_HELPER->ADD_BINARY_PART
    EXPORTING
      CONTENT      = LT_SOLIX
      FILENAME     = 'vanke.jpg'
      EXTENSION    = 'JPG'
      DESCRIPTION  = 'descriptiongif'
      CONTENT_TYPE = 'image/jpg'
      LENGTH       = L_LEN
      CONTENT_ID   = 'vanke.jpg'.
  CALL METHOD LO_MIME_HELPER->SET_MAIN_HTML
    EXPORTING
      CONTENT     = LT_MAIL_BODY
      FILENAME    = 'vanke' "'xx'
      DESCRIPTION = 'yy'.


  IF IM_IMG_TOP_NAME IS NOT INITIAL.


    CALL METHOD LO_MR_API->GET
      EXPORTING
*       i_url              = '/SAP/PUBLIC/ZPO/ZAI_HED_EMIAL.PNG' "ZAI_BOTTOM_EMIAL
        I_URL              = '/SAP/PUBLIC/ZPO/' && IM_IMG_TOP_NAME "ZAI_BOTTOM_EMIAL
      IMPORTING
        E_IS_FOLDER        = LV_IS_FOLDER
        E_CONTENT          = LV_CONTENT
        E_LOIO             = LV_LOIO
      EXCEPTIONS
        PARAMETER_MISSING  = 1
        ERROR_OCCURED      = 2
        NOT_FOUND          = 3
        PERMISSION_FAILURE = 4
        OTHERS             = 5.

    L_LEN = XSTRLEN( LV_CONTENT ).

    CREATE OBJECT LO_CONVERT.

    CALL METHOD LO_CONVERT->XSTRING_TO_SOLIX
      EXPORTING
        IV_XSTRING = LV_CONTENT
      RECEIVING
        ET_SOLIX   = LT_SOLIX.

    CALL METHOD LO_MIME_HELPER->ADD_BINARY_PART
      EXPORTING
        CONTENT      = LT_SOLIX
*       filename     = 'ZAI_HED_EMIAL.PNG'
        FILENAME     = |{ IM_IMG_TOP_NAME }|
        EXTENSION    = 'PNG'
        DESCRIPTION  = 'descriptiongif'
        CONTENT_TYPE = 'image/png'
        LENGTH       = L_LEN
*       content_id   = 'ZAI_HED_EMIAL.PNG'.
        CONTENT_ID   = |{ IM_IMG_TOP_NAME }|.

  ENDIF.

  IF IM_IMG_BOTTOM_NAME IS NOT INITIAL.

    CLEAR :LV_IS_FOLDER,LV_CONTENT,LV_LOIO,L_LEN,LO_CONVERT,LT_SOLIX[].
    CALL METHOD LO_MR_API->GET
      EXPORTING
*       i_url              = '/SAP/PUBLIC/ZPO/ZAI_BOTTOM_EMIAL.PNG' "ZAI_BOTTOM_EMIAL
        I_URL              = '/SAP/PUBLIC/ZPO/' && IM_IMG_BOTTOM_NAME "ZAI_BOTTOM_EMIAL
      IMPORTING
        E_IS_FOLDER        = LV_IS_FOLDER
        E_CONTENT          = LV_CONTENT
        E_LOIO             = LV_LOIO
      EXCEPTIONS
        PARAMETER_MISSING  = 1
        ERROR_OCCURED      = 2
        NOT_FOUND          = 3
        PERMISSION_FAILURE = 4
        OTHERS             = 5.

    L_LEN = XSTRLEN( LV_CONTENT ).

    CREATE OBJECT LO_CONVERT.

    CALL METHOD LO_CONVERT->XSTRING_TO_SOLIX
      EXPORTING
        IV_XSTRING = LV_CONTENT
      RECEIVING
        ET_SOLIX   = LT_SOLIX.

*    CREATE OBJECT lo_mime_helper.

    CALL METHOD LO_MIME_HELPER->ADD_BINARY_PART
      EXPORTING
        CONTENT      = LT_SOLIX
*       filename     = 'ZAI_BOTTOM_EMIAL.PNG'
        FILENAME     = |{ IM_IMG_BOTTOM_NAME }|
        EXTENSION    = 'PNG'
        DESCRIPTION  = 'descriptiongif2'
        CONTENT_TYPE = 'image/png'
        LENGTH       = L_LEN
        CONTENT_ID   = |{ IM_IMG_BOTTOM_NAME }|.

  ENDIF.


  TRY.
      CALL METHOD CL_DOCUMENT_BCS=>CREATE_FROM_MULTIRELATED
        EXPORTING
          I_SUBJECT          = IM_SUBJECT
          I_MULTIREL_SERVICE = LO_MIME_HELPER
        RECEIVING
          RESULT             = LO_EMAIL_BODY.
    CATCH CX_DOCUMENT_BCS .
      MESSAGE E672(SO) WITH 'bcs error while creating bcs_doc'.
      EXIT.
    CATCH CX_BCOM_MIME .
      MESSAGE E672(SO) WITH 'mime error while creating bcs_doc'.
      EXIT.
    CATCH CX_GBT_MIME.

  ENDTRY.
*START-OF-MODIFICATION-ON 24.07.2017 15:28:09 ------------------------------*
*Description:发送XLS附件功能
  DATA:LT_CONTENTS  TYPE TABLE OF SOLIX.
  DATA:LT_CONTENTS_DOC  TYPE TABLE OF SOLIX.
  DATA:LT_CONTENTS_EXCEL  TYPE TABLE OF SOLIX.
  DATA:LV_PDF_SIZE  TYPE SO_OBJ_LEN.
  DATA:LV_DESCR     TYPE SO_OBJ_DES.
  DATA:LV_PDF       TYPE XSTRING.
  DATA:LV_SIZE      TYPE SO_OBJ_LEN.
  DATA:L_PDF_LEN    TYPE I,
       LT_PDF_LINES TYPE TABLE OF TLINE.
**附件PDF
  IF NOT IM_OTF[] IS INITIAL.
    CALL FUNCTION 'CONVERT_OTF'
      EXPORTING
        FORMAT                = 'PDF'
        MAX_LINEWIDTH         = 132
      IMPORTING
        BIN_FILESIZE          = L_PDF_LEN
        BIN_FILE              = LV_PDF        " BINARY FILE
      TABLES
        OTF                   = IM_OTF
        LINES                 = LT_PDF_LINES
      EXCEPTIONS
        ERR_MAX_LINEWIDTH     = 1
        ERR_FORMAT            = 2
        ERR_CONV_NOT_POSSIBLE = 3
        ERR_BAD_OTF           = 4
        OTHERS                = 5.
    IF SY-SUBRC = 0.
    ENDIF.

    LV_SIZE = XSTRLEN( LV_PDF ).
    LT_CONTENTS = CL_DOCUMENT_BCS=>XSTRING_TO_SOLIX( IP_XSTRING =  LV_PDF ).
    CONCATENATE IM_SUBJECT '.PDF' INTO LV_DESCR.
    TRY.
        CALL METHOD LO_EMAIL_BODY->ADD_ATTACHMENT(
            I_ATTACHMENT_TYPE    = 'PDF'
            I_ATT_CONTENT_HEX    = LT_CONTENTS
            I_ATTACHMENT_SIZE    = LV_SIZE
            I_ATTACHMENT_SUBJECT = LV_DESCR ).

      CATCH CX_DOCUMENT_BCS.

    ENDTRY.
  ENDIF.

  IF NOT IM_CONTENT_HEX[] IS INITIAL.
**附件XLS
*    APPEND LINES OF im_content_doc TO lt_contents_doc.
*    IF im_attachment_subject IS INITIAL.
*      CONCATENATE im_subject '.XLS' INTO lv_descr.
*    ELSE.
*      lv_descr = im_attachment_subject.
*    ENDIF.
*    TRY.
*        CALL METHOD lo_email_body->add_attachment(
*            i_attachment_type    = 'XLS'
*            i_att_content_hex    = lt_contents_doc
**           i_attachment_size    = lv_size
*            i_attachment_subject = lv_descr ).
*      CATCH cx_document_bcs.
*
*    ENDTRY.
    APPEND LINES OF IM_CONTENT_HEX TO LT_CONTENTS_EXCEL.
    IF IM_ATTACHMENT_SUBJECT IS INITIAL.
      IF IM_XLSX IS NOT INITIAL.
       CONCATENATE IM_SUBJECT '.XLSX' INTO LV_DESCR.
      ELSE.
       CONCATENATE IM_SUBJECT '.XLS' INTO LV_DESCR.
      ENDIF.
    ELSE.
      LV_DESCR = IM_ATTACHMENT_SUBJECT.
    ENDIF.
    IF IM_EXCEL_SIZE IS NOT INITIAL.
      LV_SIZE = IM_EXCEL_SIZE.
    ENDIF.
    TRY.
        CALL METHOD LO_EMAIL_BODY->ADD_ATTACHMENT(
            I_ATTACHMENT_TYPE    = 'BIN'
            I_ATT_CONTENT_HEX    = LT_CONTENTS_EXCEL
            I_ATTACHMENT_SIZE    = LV_SIZE
            I_ATTACHMENT_SUBJECT = LV_DESCR ).
      CATCH CX_DOCUMENT_BCS.

    ENDTRY.
  ENDIF.

  " 新增发送多个附件功能,按表传进来循环处理  
  LOOP AT  IT_CONTENT_HEX INTO DATA(LS_CONTENT_HEX).
    TRY.
        CALL METHOD LO_EMAIL_BODY->ADD_ATTACHMENT(
            I_ATTACHMENT_TYPE    = 'BIN'
            I_ATT_CONTENT_HEX    = LS_CONTENT_HEX-EXCEL
            I_ATTACHMENT_SIZE    = LS_CONTENT_HEX-SIZE
            I_ATTACHMENT_SUBJECT = LS_CONTENT_HEX-DESCR ).
      CATCH CX_DOCUMENT_BCS.

    ENDTRY.
  ENDLOOP.

  IF NOT IM_XSTRING IS INITIAL.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        BUFFER          = IM_XSTRING
        APPEND_TO_TABLE = ABAP_TRUE
      IMPORTING
        OUTPUT_LENGTH   = L_PDF_LEN
      TABLES
        BINARY_TAB      = LT_CONTENTS_DOC.
    IF IM_ATTACHMENT_SUBJECT IS INITIAL.
      CONCATENATE IM_SUBJECT '.XLSX' INTO LV_DESCR.
    ELSE.
      LV_DESCR = IM_ATTACHMENT_SUBJECT.
    ENDIF.
    TRY.
        CALL METHOD LO_EMAIL_BODY->ADD_ATTACHMENT(
            I_ATTACHMENT_TYPE    = 'BIN'
            I_ATT_CONTENT_HEX    = LT_CONTENTS_DOC
            I_ATTACHMENT_SIZE    = LV_SIZE
            I_ATTACHMENT_SUBJECT = LV_DESCR ).
      CATCH CX_DOCUMENT_BCS.

    ENDTRY.
  ENDIF.

  IF NOT IM_CONTENT_DOC[] IS INITIAL.
**附件DOC
    APPEND LINES OF IM_CONTENT_DOC TO LT_CONTENTS.
    CONCATENATE IM_SUBJECT '.DOC' INTO LV_DESCR.
    TRY.
        CALL METHOD LO_EMAIL_BODY->ADD_ATTACHMENT(
            I_ATTACHMENT_TYPE    = 'DOC'
            I_ATT_CONTENT_HEX    = LT_CONTENTS
*           i_attachment_size    = lv_size
            I_ATTACHMENT_SUBJECT = LV_DESCR ).
      CATCH CX_DOCUMENT_BCS.
    ENDTRY.
  ENDIF.

  IF NOT IM_CONTENT_PNG[] IS INITIAL.
**附件为图片
    APPEND LINES OF IM_CONTENT_PNG TO LT_CONTENTS.
    CONCATENATE IM_SUBJECT '.PNG' INTO LV_DESCR.
    TRY.
        CALL METHOD LO_EMAIL_BODY->ADD_ATTACHMENT(
            I_ATTACHMENT_TYPE    = 'PNG'
            I_ATT_CONTENT_HEX    = LT_CONTENTS
*           i_attachment_size    = lv_size
            I_ATTACHMENT_SUBJECT = LV_DESCR ).
      CATCH CX_DOCUMENT_BCS.
    ENDTRY.
  ENDIF.
*END-OF-MODIFICATION---24.07.2017 15:28:09 ---------------------------------*

  LO_EMAIL = CL_BCS=>CREATE_PERSISTENT( ).
  LO_EMAIL->SET_DOCUMENT( LO_EMAIL_BODY ).

** 主送邮件地址设置
  LOOP AT IM_MAIL INTO DATA(LS_MAIL).
**    检查是否有包含集团邮箱后缀 @XXXXX.com,没有则追加
    IF LS_MAIL NS COS_MAIL_HZ.
      LS_MAIL = LS_MAIL && COS_MAIL.
    ENDIF.

    TRY.
        LO_RECEIVER = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( LS_MAIL ).
        LO_EMAIL->ADD_RECIPIENT( I_RECIPIENT = LO_RECEIVER ).
      CATCH CX_ADDRESS_BCS.

    ENDTRY.

  ENDLOOP.

** 业务专家邮件地址设置
  LOOP AT IT_EXPERTS ASSIGNING FIELD-SYMBOL(<FS_EXP>).
**    检查是否有包含 集团邮箱后缀 @XXXXX.com,没有则追加
    IF <FS_EXP>-LOW NS COS_MAIL_HZ.
      LS_MAIL = <FS_EXP>-LOW && COS_MAIL.
    ENDIF.

    TRY.
        LO_RECEIVER = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( LS_MAIL ).
        LO_EMAIL->ADD_RECIPIENT( I_RECIPIENT = LO_RECEIVER ).
      CATCH CX_ADDRESS_BCS.

    ENDTRY.

  ENDLOOP.

** CC邮件地址设置
  LOOP AT IM_CCMAIL INTO DATA(LS_CCMAIL).
**    检查是否有包含集团邮箱后缀 @XXXXX.com,没有则追加
    IF LS_CCMAIL NS COS_MAIL_HZ.
      LS_CCMAIL = LS_CCMAIL && COS_MAIL.
    ENDIF.

    TRY.
        LO_RECEIVER = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( LS_CCMAIL ).
        LO_EMAIL->ADD_RECIPIENT( I_RECIPIENT = LO_RECEIVER I_COPY = ABAP_TRUE ).
      CATCH CX_ADDRESS_BCS.
    ENDTRY.

  ENDLOOP.


** 密抄邮件地址设置
  LOOP AT IM_CCMAIL_BLIND INTO  LS_CCMAIL.
**    检查是否有包含集团邮箱后缀 @XXXXX.com,没有则追加
    IF LS_CCMAIL NS COS_MAIL.
      LS_CCMAIL = LS_CCMAIL && COS_MAIL.
    ENDIF.

    TRY.
        LO_RECEIVER = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( LS_CCMAIL ).
        LO_EMAIL->ADD_RECIPIENT( I_RECIPIENT = LO_RECEIVER I_COPY = ABAP_TRUE I_BLIND_COPY = ABAP_TRUE ).
      CATCH CX_ADDRESS_BCS.
    ENDTRY.

  ENDLOOP.

  "Set Sender and send mail
  TRY.
      LO_SENDER = CL_SAPUSER_BCS=>CREATE( IM_SENDER ).
    CATCH CX_ADDRESS_BCS.

  ENDTRY.

  LO_EMAIL->SET_SENDER( LO_SENDER ).
  LO_EMAIL->SET_STATUS_ATTRIBUTES( I_REQUESTED_STATUS = 'E' I_STATUS_MAIL = 'E' ).""不返回执邮件
**  立即发送
  TRY.
      CALL METHOD LO_EMAIL->SET_SEND_IMMEDIATELY
        EXPORTING
          I_SEND_IMMEDIATELY = 'X'.
    CATCH CX_SEND_REQ_BCS .
*RAISE cx_send_req_bcs.
  ENDTRY.

  TRY.
      CALL METHOD LO_EMAIL->SEND
        RECEIVING
          RESULT = L_SEND_RESULT.

      COMMIT WORK.

    CATCH CX_SEND_REQ_BCS INTO LO_CX_SEND_REQ_BCS.

  ENDTRY.


ENDFUNCTION.

邮件中图片的说明:

1. 邮件中显示的图片在SE80 MIME资源库PUBLIC路径下上传

 2. 用户email中有时会出现图片打不开的问题,有时需要手工点击邮件加载图片才能出来,

 需要检查outlook设置了图片拦截之类。

应用2

1.SE37创建FUNCTION :Z_COM_AUTO_MAIL

2. Import 参数。

3.Export 参数

4.table参数

5.table参数中ZTMAILADD邮件地址表参数,SE11创建表类型ZTMAILADD

SE11创建结构ZSMAILADD

SE11创建数据元素

SE11创建域

6. 源码如下: 

FUNCTION Z_COM_AUTO_MAIL.
*"----------------------------------------------------------------------
*"*"區域介面:
*"  IMPORTING
*"     REFERENCE(I_SUBJECT) TYPE  SO_OBJ_DES OPTIONAL
*"     REFERENCE(I_MAILTO) TYPE  CHAR255 OPTIONAL
*"     REFERENCE(I_MAILCC) TYPE  CHAR255 OPTIONAL
*"  EXPORTING
*"     VALUE(E_RETURN) TYPE  CHAR255
*"  TABLES
*"      T_MAILADD TYPE  ZTMAILADD OPTIONAL
*"      T_CONTENT TYPE  SOLI_TAB
*"      T_ATTACHMENT TYPE  SOLI_TAB OPTIONAL
*"----------------------------------------------------------------------
 
  DATA:LO_DOCUMENT      TYPE REF TO CL_DOCUMENT_BCS, "用来放发送的内容的类
       LIT_CONTENTS     TYPE SOLI_TAB,
       L_CC             TYPE ADR6-SMTP_ADDR,
       L_TO             TYPE ADR6-SMTP_ADDR,
       L_BCS_TO         TYPE REF TO IF_RECIPIENT_BCS,
       L_BCS_CC         TYPE REF TO IF_RECIPIENT_BCS,
       LO_SENDER        TYPE REF TO CL_SAPUSER_BCS,
       L_RESULT         TYPE OS_BOOLEAN,
*      cl_bcs发送邮件主要用到的功能类, 包括创建发送请求, 添加发送内容,添加发送地址, 到最终的发送指令发出.
       W_DOCUMENT       TYPE REF TO CL_BCS,
       L_FILE_SIZE_CHAR TYPE SO_OBJ_LEN,
       L_FILEN          TYPE STRING,
       LIT_MAILHEX      TYPE SOLIX_TAB,
       L_FILE_SIZE      TYPE I,
       L_RC             TYPE I,
       L_STRING         TYPE STRING,
       L_SUBJECT        TYPE SO_OBJ_DES,
*      cx_bcs异常类, 捕捉发送邮件过程中出现的异常.
       LO_FAIL          TYPE REF TO CX_BCS.
* 邮件正文
  LOOP AT T_CONTENT INTO L_STRING.
    APPEND L_STRING  TO LIT_CONTENTS.
  ENDLOOP.
  TRY.
*     CREATE THE DOCUMENT WITH CONTENTS
      CREATE OBJECT LO_DOCUMENT.
      LO_DOCUMENT = CL_DOCUMENT_BCS=>CREATE_DOCUMENT(
          I_TYPE       = 'HTM'
          I_SUBJECT    = I_SUBJECT  "邮件标题
          I_LENGTH     = L_FILE_SIZE_CHAR
          I_LANGUAGE   = SY-LANGU
          I_IMPORTANCE = '1'
          I_TEXT       = LIT_CONTENTS
          ).
 
* 附件类型为BIN接收任何类型的附件,包括视频、音频文件等。
* 读取附件
      IF T_ATTACHMENT IS NOT INITIAL.
        LOOP AT T_ATTACHMENT INTO DATA(P_FILE).
          L_FILEN = P_FILE.
          CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
            EXPORTING
              FILENAME                = L_FILEN
              FILETYPE                = 'BIN'  "
*             has_field_separator     = SPACE
*             header_length           = 0
*             read_by_line            = ''
*             dat_mode                = SPACE
*             codepage                = SPACE
*             ignore_cerr             = ABAP_TRUE
*             replacement             = '#'
*             virus_scan_profile      =
            IMPORTING
              FILELENGTH              = L_FILE_SIZE
*             header                  =
            CHANGING
              DATA_TAB                = LIT_MAILHEX
*             isscanperformed         = SPACE
            EXCEPTIONS
              FILE_OPEN_ERROR         = 1
              FILE_READ_ERROR         = 2
              NO_BATCH                = 3
              GUI_REFUSE_FILETRANSFER = 4
              INVALID_TYPE            = 5
              NO_AUTHORITY            = 6
              UNKNOWN_ERROR           = 7
              BAD_DATA_FORMAT         = 8
              HEADER_NOT_ALLOWED      = 9
              SEPARATOR_NOT_ALLOWED   = 10
              HEADER_TOO_LONG         = 11
              UNKNOWN_DP_ERROR        = 12
              ACCESS_DENIED           = 13
              DP_OUT_OF_MEMORY        = 14
              DISK_FULL               = 15
              DP_TIMEOUT              = 16
              NOT_SUPPORTED_BY_GUI    = 17
              ERROR_NO_GUI            = 18
              OTHERS                  = 19.
          IF SY-SUBRC <> 0.
            CASE SY-SUBRC.
              WHEN   '1' .
                E_RETURN = 'FILE_OPEN_ERROR         ' .
              WHEN   '2' .
                E_RETURN = 'FILE_READ_ERROR         ' .
              WHEN   '3' .
                E_RETURN = 'NO_BATCH                ' .
              WHEN   '4' .
                E_RETURN = 'GUI_REFUSE_FILETRANSFER ' .
              WHEN   '5' .
                E_RETURN = 'INVALID_TYPE            ' .
              WHEN   '6' .
                E_RETURN = 'NO_AUTHORITY            ' .
              WHEN   '7' .
                E_RETURN = 'UNKNOWN_ERROR           ' .
              WHEN   '8' .
                E_RETURN = 'BAD_DATA_FORMAT         ' .
              WHEN   '9' .
                E_RETURN = 'HEADER_NOT_ALLOWED      ' .
              WHEN   '10'.
                E_RETURN = 'SEPARATOR_NOT_ALLOWED   ' .
              WHEN   '11'.
                E_RETURN = 'HEADER_TOO_LONG         ' .
              WHEN   '12'.
                E_RETURN = 'UNKNOWN_DP_ERROR        ' .
              WHEN   '13'.
                E_RETURN = 'ACCESS_DENIED           ' .
              WHEN   '14'.
                E_RETURN = 'DP_OUT_OF_MEMORY        ' .
              WHEN   '15'.
                E_RETURN = 'DISK_FULL               ' .
              WHEN   '16'.
                E_RETURN = 'DP_TIMEOUT              ' .
              WHEN   '17'.
                E_RETURN = 'NOT_SUPPORTED_BY_GUI    ' .
              WHEN   '18'.
                E_RETURN = 'ERROR_NO_GUI            ' .
              WHEN OTHERS.
                E_RETURN = 'OTHERS mistake' .
            ENDCASE.
* Implement suitable error handling here
            RETURN.
          ENDIF.
* 附件长度,这个很重要,一定要有
          L_FILE_SIZE_CHAR = L_FILE_SIZE_CHAR.
*     获取附件名字及附件文件类型
          DATA(L_FILE) = P_FILE .
          DO .
            SPLIT L_FILE AT '\' INTO DATA(LV_TMP) L_FILE .
            SEARCH L_FILE FOR '\' .
            IF SY-SUBRC <> 0.
              EXIT .
            ENDIF.
          ENDDO.
          L_SUBJECT = L_FILE .
*     添加附件,可以添加多个附件
          CALL METHOD LO_DOCUMENT->ADD_ATTACHMENT
            EXPORTING
              I_ATTACHMENT_TYPE    = 'BIN'
              I_ATTACHMENT_SUBJECT = L_SUBJECT         "附件名称
              I_ATTACHMENT_SIZE    = L_FILE_SIZE_CHAR  "附件大小
              I_ATT_CONTENT_HEX    = LIT_MAILHEX.      "附件内容
        ENDLOOP.
      ENDIF.
*     CREATING PERSISTENT OBJECT WILL ALLOW YOU TO SET THE DOCUMENT IN THE MAIL
      W_DOCUMENT = CL_BCS=>CREATE_PERSISTENT( ).
*     发件人
*     前提是这个邮箱地址能发邮件,并且不需要密码
      LO_SENDER = CL_SAPUSER_BCS=>CREATE( SY-UNAME ).
      W_DOCUMENT->SET_SENDER( LO_SENDER ).
 
*     收件人
      IF I_MAILTO IS NOT INITIAL.
        L_TO = I_MAILTO.
        L_BCS_TO = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( L_TO ).
*     Add recipient to send request
        CALL METHOD W_DOCUMENT->ADD_RECIPIENT
          EXPORTING
            I_RECIPIENT = L_BCS_TO.
      ENDIF.
*    抄送人
      IF I_MAILCC IS NOT INITIAL.
        L_CC = I_MAILCC.  "
        L_BCS_CC = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( L_CC ).
        CALL METHOD W_DOCUMENT->ADD_RECIPIENT
          EXPORTING
            I_RECIPIENT = L_BCS_CC
            I_COPY      = 'X'.
        " i_express   = 'X'.
      ENDIF.
      "邮件地址表有值。
      IF T_MAILADD IS NOT INITIAL.
        LOOP AT T_MAILADD INTO DATA(LS_MAILADD).
          IF LS_MAILADD-MAILTYPE = 'T'.
            L_TO = LS_MAILADD-MAILADDR.
            L_BCS_TO = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( L_TO ).
*     Add recipient to send request
            CALL METHOD W_DOCUMENT->ADD_RECIPIENT
              EXPORTING
                I_RECIPIENT = L_BCS_TO.
          ELSEIF LS_MAILADD-MAILTYPE = 'C'.
            L_CC = LS_MAILADD-MAILADDR.  "
            L_BCS_CC = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( L_CC ).
 
            CALL METHOD W_DOCUMENT->ADD_RECIPIENT
              EXPORTING
                I_RECIPIENT = L_BCS_CC
                I_COPY      = 'X'.
            " i_express   = 'X'.
          ENDIF.
        ENDLOOP.
      ENDIF.
*     SEND THE MAIL
      W_DOCUMENT->SET_SEND_IMMEDIATELY( 'X' ).  "设置立即发送
      W_DOCUMENT->SEND_REQUEST->SET_LINK_TO_OUTBOX( 'X' ). "与outbox关联
      CALL METHOD W_DOCUMENT->SET_DOCUMENT( LO_DOCUMENT ).
      CALL METHOD W_DOCUMENT->SEND(
        EXPORTING
          I_WITH_ERROR_SCREEN = 'X'
        RECEIVING
          RESULT              = L_RESULT ).
    CATCH CX_BCS INTO LO_FAIL.
  ENDTRY.
* YOU CAN VERIFY THE STATUS IN THE LIST, YOU CAN ALSO SUBMIT THIS AS A BACKGROUND JOB.
  IF L_RESULT = 'X'.
    COMMIT WORK AND WAIT.
  ELSE.
    ROLLBACK WORK.
    E_RETURN = '发送失败' .
  ENDIF.
ENDFUNCTION.

邮件附件表可添加多个附件及多个不同的邮件种类,ABAP获取附件的方法可查看另一篇博文:ABAP选择本地文件,获取文件地址

以上,function已经创建完成,可以使用了。返回消息为空就代表发送成功了。下面我们创建将测试程序。

se38创建测试程序(代码中的邮件地址改为自己的哟,目前为本人邮箱)。

*&---------------------------------------------------------------------*
*& Report ZLQT_COM_AUTO_MAIL
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ZLQT_COM_AUTO_MAIL.
 
DATA I_SUBJECT    TYPE SO_OBJ_DES .              "邮件主题
DATA I_MAILTO     TYPE CHAR255    .              "收件人
DATA I_MAILCC     TYPE CHAR255    .              "抄送
DATA E_RETURN     TYPE CHAR255    .              "返回消息
DATA T_MAILADD    TYPE TABLE OF ZSMAILADD WITH HEADER LINE   .   "邮件地址表
DATA T_CONTENT    TYPE TABLE OF SOLI      WITH HEADER LINE   .   "邮件正文内容
DATA T_ATTACHMENT TYPE TABLE OF SOLI      WITH HEADER LINE   .   "邮件附件地址
I_SUBJECT = '邮件主题' .
*T_MAILADD-MAILTYPE = 'T' .
*T_MAILADD-MAILADDR = 'szmis11@lotestech.com' .
*APPEND T_MAILADD .
*
*T_MAILADD-MAILTYPE = 'C' .
*T_MAILADD-MAILADDR = '979621537@QQ.com' .
*APPEND T_MAILADD .
I_MAILTO  = 'szmis11@lotestech.com'.
I_MAILCC  = '979621537@QQ.com' .
T_CONTENT-LINE = SY-UNAME && SY-DATUM  .
APPEND T_CONTENT .
T_ATTACHMENT-LINE = 'C:\Users\szmis11\Desktop\WeChat 圖片_202]]]]]01109190311.jpg' .
APPEND T_ATTACHMENT.
T_ATTACHMENT-LINE = 'C:\Users\szmis11\Desktop\automail.docx' .
APPEND T_ATTACHMENT.
CALL FUNCTION 'Z_COM_AUTO_MAIL'
 EXPORTING
   I_SUBJECT          = I_SUBJECT
   I_MAILTO           = I_MAILTO
   I_MAILCC           = I_MAILCC
 IMPORTING
   E_RETURN           = E_RETURN
  TABLES
    T_MAILADD          = T_MAILADD
    T_CONTENT          = T_CONTENT
    T_ATTACHMENT       = T_ATTACHMENT
          .
WRITE : E_RETURN .

以上为-自动发邮件FUNCTION,AUTOMAIL功能全部内容,若代码存在问题,欢迎评论指正。

应用3

FUNCTION zplfm_zznotice_email.
*"----------------------------------------------------------------------
*"*"本地接口:
*"  IMPORTING
*"     VALUE(IV_ZZGUID) TYPE  ZTPL0050-ZZGUID
*"  EXPORTING
*"     VALUE(EV_SENT) TYPE  CHAR1
*"----------------------------------------------------------------------
  DATA:BEGIN OF ls_uname,
         ver_inner     TYPE ztpp0001-ver_inner,
         bbnum         TYPE      i,
         timestamp_upd TYPE     ztpp0001-timestamp_upd,
         uname         TYPE      ztpp0001-uname,
         posid         TYPE      ztpp0002-posid,
         post1         TYPE      ztpp0002-post1,
       END OF ls_uname.
  DATA lt_uname LIKE TABLE OF ls_uname.
  DATA lt_ldnumt TYPE zspl0010_t.
  DATA ls_ldnumt TYPE zspl0010.
  DATA lt_pernr TYPE zcl_wd_pl_c017_r05=>tt_pernr.
  DATA ls_pernr TYPE zcl_wd_pl_c017_r05=>ty_pernr.
  DATA lt_csr TYPE zcl_wd_pl_c017_r05=>tt_csr.
  DATA lv_appnam TYPE string.
  DATA:im_para TYPE  tihttpnvp,
       is_para TYPE  ihttpnvp.
  DATA:ls_url TYPE string,
       ls_par TYPE string.
  DATA lt_urls TYPE ztmail02.
  DATA lt_wfs_person TYPE zpst_employee.
  DATA ls_wfs_person TYPE zpss_employee.
  DATA lv_key TYPE string.
  DATA lv_lines TYPE sy-tabix.
  DATA lv_hname1 TYPE ze_hname.
  DATA lt_mjcy  TYPE ziwci_wd_pl_c004_newbz=>elements_nd_mjcy.
  DATA ls_mjcy  TYPE ziwci_wd_pl_c004_newbz=>element_nd_mjcy.
  DATA lo_pl_c004_newbz TYPE REF TO zcl_wd_pl_c004_newbz.

  CREATE OBJECT lo_pl_c004_newbz.

  "取证照下的楼栋
  SELECT ztpl0051~zzguid,
         ztpl0051~linkid,
         ztpl0050~zzlx,
         ztpl0050~loaddat,"add by c-zhabl01 at 20220720 for yisz:增加上传人的显示
         ztpl0050~loadusr,"add by c-zhabl01 at 20220720 for yisz:增加上传人的显示
         ztpl0050~loadusr_v,"add by c-zhabl01 at 20220720 for yisz:增加上传人的显示
         ztpl0051~ldnum,
         ztpl0051~pspid,      "add by yisz
         prps~post1 AS ldnam   "add by yisz 2022/10/20
    FROM ztpl0051
    INNER JOIN ztpl0050 ON ztpl0050~zzguid = ztpl0051~zzguid
    INNER JOIN prps ON prps~posid = ztpl0051~ldnum
    WHERE ztpl0050~zzguid = @iv_zzguid
    AND prps~stufe = 3
    INTO TABLE @DATA(lt_ldnum).
  IF sy-subrc EQ 0.

    DATA(lv_ldnum) = lt_ldnum[ 1 ]-ldnum.
    DATA(lv_zzlx) = lt_ldnum[ 1 ]-zzlx.
    DATA(lv_loaddat) = lt_ldnum[ 1 ]-loaddat.  "add by c-zhabl01 at 20220720 for yisz:增加上传人的显示
    DATA(lv_loadusr) = lt_ldnum[ 1 ]-loadusr.   "add by c-zhabl01 at 20220720 for yisz:增加上传人的显示

    "楼栋所属项目
    SELECT SINGLE psphi
      FROM prps
      WHERE posid = @lv_ldnum
      INTO @DATA(lv_psphi).
    IF sy-subrc EQ 0.
      SELECT SINGLE posid,fbukrs,post1
        FROM prps
        WHERE psphi = @lv_psphi
          AND stufe = '1'
        INTO ( @DATA(lv_posid_xm),@DATA(lv_fbukrs),@DATA(lv_post1)  ).
      IF sy-subrc EQ 0.

        "取楼栋的最新阶段,只有当最新阶段小于当前证照对应的阶段时,才发邮件提醒
        DATA(lv_step_id_n) = zcl_pl_asset_tag_service=>get_step_id_by_zzlx( CONV string( lv_zzlx ) ).

        SELECT ztpp0002~posid,
               ztpp0002~step_id,
               ztpp0001~bbnum,
               ztpp0002~ver_inner
          FROM ztpp0002
          INNER JOIN ztpp0001 ON ztpp0001~ver_inner = ztpp0002~ver_inner
          FOR ALL ENTRIES IN @lt_ldnum
          WHERE ztpp0001~bbstat IN ( 'AP','IN' )
            AND ztpp0002~posid = @lt_ldnum-ldnum
          INTO TABLE @DATA(lt_step_id).
        IF sy-subrc EQ 0.
          SORT lt_step_id BY posid bbnum DESCENDING.
          DELETE ADJACENT DUPLICATES FROM lt_step_id COMPARING posid.
        ENDIF.

        CLEAR lt_ldnumt[].
        LOOP AT lt_ldnum INTO DATA(ls_ldnum).
          DATA(lv_tabix) = sy-tabix.

          READ TABLE lt_step_id INTO DATA(ls_step_id) WITH KEY posid = ls_ldnum-ldnum.
          IF sy-subrc NE 0.
            CLEAR ls_step_id.
          ENDIF.

          IF ls_step_id IS INITIAL OR ls_step_id-step_id GE lv_step_id_n OR ls_ldnum-ldnum IS INITIAL.
            DELETE lt_ldnum INDEX lv_tabix.
          ENDIF.

          CLEAR ls_ldnumt.
          ls_ldnumt-ldnum = ls_ldnum-ldnum.
          ls_ldnumt-ldnam = ls_ldnum-ldnam.
          APPEND ls_ldnumt TO lt_ldnumt.
        ENDLOOP.

        CHECK lt_ldnum IS NOT INITIAL.
        "项目的最新版本
        SELECT ztpp0001~ver_inner,
               ztpp0001~bbnum,
               ztpp0001~timestamp_upd,
               ztpp0001~uname,
               ztpp0002~posid,
               ztpp0002~post1
          FROM ztpp0002
          INNER JOIN ztpp0001 ON ztpp0001~ver_inner = ztpp0002~ver_inner
          WHERE ztpp0002~posid = @lv_posid_xm
          INTO TABLE @DATA(lt_uname_c).
        IF sy-subrc EQ 0.

          LOOP AT lt_uname_c INTO DATA(ls_uname_c).
            ls_uname_c-bbnum = zcl_pl_asset_tag_service=>read_0_to_z( iv_source = |{ ls_uname_c-bbnum }| iv_separator = 'V' iv_direction = 'A' iv_deep_reading = 'X' ).
            IF ls_uname_c-bbnum IS INITIAL.
              ls_uname_c-bbnum = 0.
            ENDIF.

            CLEAR ls_uname.
            MOVE-CORRESPONDING ls_uname_c TO ls_uname.
            APPEND ls_uname TO lt_uname.
          ENDLOOP.
          SORT lt_uname BY bbnum DESCENDING timestamp_upd DESCENDING.

          REFRESH lt_mjcy.
          CLEAR ls_uname.
          READ TABLE lt_uname INTO ls_uname INDEX 1.
          IF sy-subrc EQ 0.
            lo_pl_c004_newbz->get_mjcy(
                  EXPORTING
                    iv_ver_inner      = ls_uname-ver_inner   "项目最新版本
                    iv_zzlx = lv_zzlx          "发邮件的后台job的程序只留下工规证 云效:424267
                 IMPORTING
                    et_mjcy           =  lt_mjcy
             ).
            "delete lt_mjcy where ldfw ns ls_xm-posid.
          ENDIF.

          CHECK lt_mjcy IS NOT INITIAL.     "没有差异,不发邮件提醒

          "获取超链接地址
          DATA lt_param TYPE tihttpnvp.
          DATA ls_param TYPE ihttpnvp.
          ls_param-name = 'POSID'.
          ls_param-value = ls_uname-posid.
          APPEND ls_param TO lt_param.

          ls_param-name = 'SYSFR'.
          ls_param-value = 'MJJHMAIL'.
          APPEND ls_param TO lt_param.

          ls_param-name = 'LDNUM'.
          ls_param-value = lt_mjcy[ 1 ]-ldfw.
          APPEND ls_param TO lt_param.


          DATA(lv_title) = |{ ls_uname-post1 }{ ls_uname-bbnum }项目详情|.

          DATA(lv_url) = ||.

          CALL FUNCTION 'ZPORTALFM_001'
            EXPORTING
              im_appnam = 'ZWD_PL_C004_NEWBZ_DIS'
              im_para   = lt_param
              im_title  = lv_title
            IMPORTING
              ev_url    = lv_url.

          "取收件人
          "ADD BY YISZ 2022/10/19 增加项目人员配置的收件人/抄送人,邮件的收件人,优先取配置表的
          SELECT *
            INTO TABLE @DATA(lt_ztpl0058n)
            FROM ztpl0058n
            WHERE fqnum = @lv_posid_xm.
          IF sy-subrc EQ 0.
            LOOP AT lt_ztpl0058n ASSIGNING FIELD-SYMBOL(<lfs_0058n>).
              TRANSLATE <lfs_0058n>-mail TO UPPER CASE.
            ENDLOOP.

            SORT lt_ztpl0058n BY rercc pernr mail.
            DELETE ADJACENT DUPLICATES FROM lt_ztpl0058n COMPARING rercc pernr mail."modify by c-zhabl01 at 20221122 :避免收件人重复
          ENDIF.

          DATA(lv_receiver_name) = ||.

          LOOP AT lt_ztpl0058n INTO DATA(ls_ztpl0058n) WHERE rercc = 'R'.
            CLEAR ls_pernr.
            ls_pernr-email = ls_ztpl0058n-mail.
            ls_pernr-pernr = ls_ztpl0058n-pernr.
            APPEND ls_pernr TO lt_pernr.

            lv_receiver_name = |{ lv_receiver_name }/{ ls_ztpl0058n-ename }|.
          ENDLOOP.

          "MARK BY YISZ 2022/10/25 BEGIN
*          LOOP AT lt_uname INTO ls_uname.
*            DATA(ls_fiout) = VALUE zsfm0035_fi( ).
*            CALL FUNCTION 'ZPLFM_0035'
*              EXPORTING
*                uname = ls_uname-uname
*                otype = 'U'
*              IMPORTING
*                fiout = ls_fiout.
*
*            IF ls_fiout-yx_hcode EQ lv_fbukrs.
*              EXIT.
*            ENDIF.
*          ENDLOOP.
          "MARK BY YISZ 2022/10/25 END


*          根据证照关联的楼栋,找到对应的项目,根据ZTPP0001里面的最后更新人(更新人判断:根据项目的所属一线公司,取ZTPP0001的版本倒序查找,判断更新人的组织是否一致,若不一致,则继续查找上一版本的最后更新人,直至组织一致为止)、
          "ADD BY YISZ 2022/10/25 BEGIN
          "解决问题:ZTPP0001-uname有的存的不是域账号而是姓名,导致找不到邮箱地址
          IF lt_pernr IS INITIAL.
            DELETE lt_uname WHERE uname = 'SYSADM' OR uname = 'S_PI_SERVICE' OR uname CS 'ERP'.
            LOOP AT lt_uname INTO ls_uname.
              DATA(ls_fiout) = VALUE zsfm0035_fi( ).
              IF cl_abap_matcher=>matches( pattern = '[a-z|A-Z]*-?[a-z|A-Z]*[0-9?]*' text = ls_uname-uname ).
                "域账号
                CALL FUNCTION 'ZPLFM_0035'
                  EXPORTING
                    uname = ls_uname-uname
                    otype = 'U'
                  IMPORTING
                    fiout = ls_fiout.
                IF ls_fiout-yx_hcode IS NOT INITIAL.
                  IF ls_fiout-yx_hcode EQ lv_fbukrs.  "找到一个属于当前项目所属公司的用户,退出,作为收件人
                    EXIT.
                  ENDIF.
                ENDIF.
              ELSE.
                "通过姓名查询出人员域账号;姓名重名时,通过项目所属的一线公司过滤
                CLEAR:  lv_key,lt_wfs_person[],lv_lines.
                lv_key = ls_uname-uname.

                CALL FUNCTION 'ZPLFM_0025A'
                  EXPORTING
                    iv_key        = lv_key
                  IMPORTING
                    it_wfs_person = lt_wfs_person[].

                CLEAR ls_wfs_person.
                DELETE lt_wfs_person WHERE ename NE lv_key.
                DESCRIBE TABLE lt_wfs_person LINES lv_lines.
                IF lv_lines > 1.

                  "非一线公司的人员,yx_hcode为空
                  LOOP AT lt_wfs_person INTO ls_wfs_person.
                    IF ls_wfs_person-yx_hcode IS NOT INITIAL.
                      DELETE lt_wfs_person WHERE yx_hcode NS lv_fbukrs.
                    ELSEIF ls_wfs_person-bm_stext IS NOT INITIAL.
                      CLEAR lv_hname1.
                      SELECT SINGLE hname INTO lv_hname1 FROM ztfi0005 WHERE hcode = lv_fbukrs AND ntype = 'C'.
                      DELETE lt_wfs_person WHERE bm_stext NS lv_hname1+0(2).
                    ENDIF.
                  ENDLOOP.
                ENDIF.
                "通过一线公司过滤还存在多个重名时,同一个合作方用户的历史无效账号去掉
                DELETE lt_wfs_person WHERE uname CS 'H-' OR uname CS 'V-'.
                READ TABLE lt_wfs_person INTO ls_wfs_person INDEX 1.
                IF sy-subrc = 0.
*                  modify by c-zhabl01 at 20221116 :取不到收件人名称问题修复---begin
                  "优先取配置表的
*                  clear ls_ztpl0058n.
*                  read table lt_ztpl0058n into ls_ztpl0058n with key mail = ls_fiout-mail.
*                  if sy-subrc = 0.
*                    clear ls_fiout.
*                    exit.
*                  else.
*                    ls_fiout-mail = ls_wfs_person-mail.
                  IF ls_wfs_person-yx_hcode EQ lv_fbukrs.
                    ls_fiout-mail = ls_wfs_person-mail.
                    ls_fiout-ename = ls_wfs_person-ename.
                    EXIT.
                  ENDIF.
*                  endif.
*                  modify by c-zhabl01 at 20221116 :取不到收件人名称问题修复---end

                ENDIF.
              ENDIF.
            ENDLOOP.

            IF ls_fiout-mail IS NOT INITIAL.
              lt_pernr = VALUE #( ( email = |{ ls_fiout-mail }| uname = |{ ls_fiout-uname }| ) ).
            ELSE.
              IF ls_fiout-uname IS NOT INITIAL.
                lt_pernr = VALUE #( ( email = |{ ls_fiout-uname }@VANKE.COM|  uname = |{ ls_fiout-uname }| ) ).
              ENDIF.
            ENDIF.

            IF ls_fiout-ename IS NOT INITIAL.
              lv_receiver_name = |{ lv_receiver_name }/{ ls_fiout-ename }|.
            ENDIF.
*            clear ls_fiout.
          ENDIF.
          "ADD BY YISZ 2022/10/25 END

          CHECK lt_pernr IS NOT INITIAL.   "找到收件人了,发送邮件

          IF lv_receiver_name IS NOT INITIAL AND lv_receiver_name+(1) EQ '/'.
            lv_receiver_name = lv_receiver_name+1.
          ENDIF.

          IF sy-sysid EQ 'ED1'.
            lt_csr = VALUE #( BASE lt_csr ( email = |dengw01@VANKE.COM| ) ).
          ENDIF.

          IF sy-sysid+0(2) EQ 'EP'.
            lt_csr = VALUE #( BASE lt_csr ( email = |HUKE@VANKE.COM| ) ).
            lt_csr = VALUE #( BASE lt_csr ( email = |FANHL@VANKE.COM| ) ).
            lt_csr = VALUE #( BASE lt_csr ( email = |YANGZT02@VANKE.COM| ) ).
            lt_csr = VALUE #( BASE lt_csr ( email = |ZHANGYX166@VANKE.COM| ) ).
          ENDIF.
          lt_csr = VALUE #( BASE lt_csr ( email = |WANGX89@VANKE.COM| ) ).
*          lt_csr = VALUE #( BASE lt_csr ( email = |C-LIM18@VANKE.COM| ) ).

          DATA(lv_subject) = CONV so_obj_des( |项目阶段面积校核提醒| ).
          DATA(lt_main_text) = VALUE bcsy_text( ).

          DATA(lv_ld) = ||.
          LOOP AT lt_ldnum INTO ls_ldnum.
            lv_ld = |{ lv_ld }/{ ls_ldnum-ldnum }【{ ls_ldnum-ldnam }】|.
          ENDLOOP.

          IF lv_ld IS NOT INITIAL.
            lv_ld = lv_ld+1.
          ENDIF.

          DATA(lv_ddtext) = VALUE dd07v-ddtext( ).
          CALL FUNCTION 'DOMAIN_VALUE_GET'
            EXPORTING
              i_domname  = 'ZD_ZZLX'
              i_domvalue = CONV dd07v-domvalue_l( lv_zzlx )
            IMPORTING
              e_ddtext   = lv_ddtext
            EXCEPTIONS
              not_exist  = 1
              OTHERS     = 2.
          IF sy-subrc <> 0.
* Implement suitable error handling here
          ENDIF.

*--- add by c-zhabl01 at 20220720 for yisz:增加上传人的显示---begin
          DATA(ls_fiout_load) = VALUE zsfm0035_fi( ).
          CALL FUNCTION 'ZPLFM_0035'
            EXPORTING
              pernr = lv_loadusr
              otype = 'P'
            IMPORTING
              fiout = ls_fiout_load.
*---add by c-zhabl01 at 20220720 for yisz:增加上传人的显示---end

          DATA(lv_yjzw) = ||.

          "证照面积差异明细显示在邮件正文 2022/8/15 yisz add begin
          lv_yjzw =  |{ lv_yjzw }<body lang=ZH-CN link="#0563C1" vlink="#954F72" style='text-justify-trim:punctuation'><div class=WordSection1>|.
          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal style='margin-right:3.75pt;line-height:150%'>{ lv_receiver_name },您好!</p>|.


          "正文第一段
          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal style='mso-margin-top-alt:0cm;margin-right:3.75pt;margin-bottom:0cm;margin-left:12.15pt;margin-bottom:.0001pt;text-indent:12.0pt;line-height:150%'>|.
          lv_yjzw =  |{ lv_yjzw }依据<b>《销售型物业数据管理办法》</b>,为确保成本财务核算及资源统计的准确,需参照法定证照,及时维护<span lang=EN-US>ICP</span>系统面积指标。<span lang=EN-US><o:p></o:p></span></p>|.

          "第二段
          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal style='margin-left:12.15pt;text-indent:8.85pt;line-height:150%'>|.
          lv_yjzw =  |{ lv_yjzw }系统通过自动比对发现,项目<b>【{ lv_posid_xm } { lv_post1 }】</b>如下楼栋存在面积差异,请点击<span lang=EN-US><a href="|.


          lv_yjzw =  |{ lv_yjzw }{ lv_url }|.

          lv_yjzw =  |{ lv_yjzw }" target="_blank"><strong><span lang=EN-US style='font-size:10.5pt;line-height:150%;font-family:宋体;color:blue'><span lang=EN-US>项目主数据管理</span></span></strong></a>|.
          lv_yjzw =  |{ lv_yjzw }去校核及更新面积|.
          lv_yjzw =  |{ lv_yjzw }</span><span style='font-size:10.5pt;line-height:150%'>。</span>|.
          lv_yjzw =  |{ lv_yjzw }<span lang=EN-US style='font-size:10.5pt;line-height:150%;font-family:"Songti SC",serif'><o:p></o:p></span></p>|.

          "第三段
          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal style='margin-left:12.15pt;text-indent:8.85pt;line-height:150%'><span style='color:black'>系统操作指引请参考:</span>|.
          lv_yjzw =  |{ lv_yjzw }<span lang=EN-US><a href="https://yun.vanke.com/l/b1ka45" target="_blank"><span style='font-family:"Songti SC",serif'>https://yun.vanke.com/l/b1ka45</span></a>|.
          lv_yjzw =  |{ lv_yjzw }</span><span style='color:black'>。</span> <span lang=EN-US><o:p></o:p></span></p>|.

          "列表
          lv_yjzw =  |{ lv_yjzw }<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=961 style='width:721.0pt;margin-left:21.3pt;border-collapse:collapse'>|.
          lv_yjzw =  |{ lv_yjzw }<tr style='height:30.0pt'><td width=117 style='width:88.0pt;border:solid windowtext 1.0pt;background:#F2F2F2;padding:0cm 5.4pt 0cm 5.4pt;height:30.0pt'>|.
          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal align=center style='text-align:center'><b><span style='font-size:10.5pt;color:black'>证照类型<span lang=EN-US><o:p></o:p></span></span></b></p></td>|.
          lv_yjzw =  |{ lv_yjzw }<td width=117 style='width:88.0pt;border:solid windowtext 1.0pt;border-left:none;background:#F2F2F2;padding:0cm 5.4pt 0cm 5.4pt;height:30.0pt'>| .
          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal align=center style='text-align:center'><b><span style='font-size:10.5pt;color:black'>证照编号<span lang=EN-US><o:p></o:p></span></span></b></p>| .
          lv_yjzw =  |{ lv_yjzw }<td width=117 style='width:88.0pt;border:solid windowtext 1.0pt;border-left:none;background:#F2F2F2;padding:0cm 5.4pt 0cm 5.4pt;height:30.0pt'>| .
          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal align=center style='text-align:center'><b><span style='font-size:10.5pt;color:black'>证照面积</span></b>| .
          lv_yjzw =  |{ lv_yjzw }<b><span lang=EN-US style='font-size:10.5pt;font-family:"Times New Roman",serif;color:black'>&nbsp;(C)</span></b>| .
          lv_yjzw =  |{ lv_yjzw }<b><span lang=EN-US style='font-size:10.5pt;color:black'><o:p></o:p></span></b></p></td>| .
          lv_yjzw =  |{ lv_yjzw }<td width=117 style='width:88.0pt;border:solid windowtext 1.0pt;border-left:none;background:#F2F2F2;padding:0cm 5.4pt 0cm 5.4pt;height:30.0pt'>| .
          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal align=center style='text-align:center'><b><span style='font-size:10.5pt;color:black'>楼栋总面积</span></b>| .
          lv_yjzw =  |{ lv_yjzw }<b><span lang=EN-US style='font-size:10.5pt;font-family:"Times New Roman",serif;color:black'>(D)</span></b>| .
          lv_yjzw =  |{ lv_yjzw }<b><span lang=EN-US style='font-size:10.5pt;color:black'><o:p></o:p></span></b></p></td>| .
          lv_yjzw =  |{ lv_yjzw }<td width=117 style='width:88.0pt;border:solid windowtext 1.0pt;border-left:none;background:#F2F2F2;padding:0cm 5.4pt 0cm 5.4pt;height:30.0pt'>| .
          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal align=center style='text-align:center'><b><span style='font-size:10.5pt;color:black'>面积差异</span></b>| .
          lv_yjzw =  |{ lv_yjzw }<b><span lang=EN-US style='font-size:10.5pt;font-family:"Times New Roman",serif;color:black'>(C-D)</span></b>| .
          lv_yjzw =  |{ lv_yjzw }<b><span lang=EN-US style='font-size:10.5pt;color:black'><o:p></o:p></span></b></p></td>| .
          lv_yjzw =  |{ lv_yjzw }<td width=245 style='width:184.0pt;border:solid windowtext 1.0pt;border-left:none;background:#F2F2F2;padding:0cm 5.4pt 0cm 5.4pt;height:30.0pt'>| .
          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal align=center style='text-align:center'><b><span style='font-size:10.5pt;color:black'>核对标准<span lang=EN-US><o:p></o:p></span></span></b></p></td>| .
          lv_yjzw =  |{ lv_yjzw }<td width=129 style='width:97.0pt;border:solid windowtext 1.0pt;border-left:none;background:#F2F2F2;padding:0cm 5.4pt 0cm 5.4pt;height:30.0pt'>| .
          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal align=center style='text-align:center'><b><span style='font-size:10.5pt;color:black'>待校核楼栋<span lang=EN-US><o:p></o:p></span></span></b></p></td>| .
          lv_yjzw =  |{ lv_yjzw }</tr>| .


          "证照类型/项目阶段
          DATA lt_dd07v TYPE TABLE OF dd07v.
          SELECT domname domvalue_l ddtext
            FROM dd07v
            INTO CORRESPONDING FIELDS OF TABLE lt_dd07v
            WHERE ( domname = 'ZD_ZZLX'
            OR domname = 'ZD_STEP_ID' )
              AND ddlanguage = sy-langu.

          LOOP AT lt_mjcy INTO ls_mjcy.

            lv_yjzw =  |{ lv_yjzw }<tr style='height:43.2pt'>| .

            "证照类型
            READ TABLE lt_dd07v INTO DATA(ls_dd07v) WITH KEY domname = 'ZD_ZZLX' domvalue_l = ls_mjcy-zzlx_n.

            lv_yjzw =  |{ lv_yjzw }<td width=117 style='width:88.0pt;border:solid windowtext 1.0pt;border-top:none;padding:0cm 5.4pt 0cm 5.4pt;height:43.2pt'>| .
            lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.5pt;color:black'>| .
            lv_yjzw =  |{ lv_yjzw }{ ls_dd07v-ddtext }<span lang=EN-US><o:p></o:p></span></span></p></td>| .

            "证照编号
            lv_yjzw =  |{ lv_yjzw }<td width=117 style='width:88.0pt;border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:43.2pt'>| .
            lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal align=center style='text-align:center'>|.
            lv_yjzw =  |{ lv_yjzw }<span style='font-size:10.5pt;color:black'>{ ls_mjcy-zzno }</span><span lang=EN-US style='font-size:10.5pt;font-family:"Times New Roman",serif;color:black'><o:p></o:p></span></p></td>| .

            "证照面积
            DATA(lv_mj) = |{ ls_mjcy-mj_zz }|.
            zcl_pl_asset_tag_service=>remove_ending_0_of_decimal( CHANGING cv_data = lv_mj ).
            DATA(lv_mj_c) = CONV char100( lv_mj ).
            zcl_pl_asset_tag_service=>display_in_thousands( CHANGING cv_str = lv_mj_c ).
            lv_mj = lv_mj_c.
            lv_yjzw =  |{ lv_yjzw }<td width=117 style='width:88.0pt;border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:43.2pt'>| .
            lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal align=center style='text-align:center'>|.
            lv_yjzw =  |{ lv_yjzw }<span lang=EN-US style='font-size:10.5pt;font-family:"Times New Roman",serif;color:black'>{ lv_mj }<o:p></o:p></span></p></td>|.


            "icp面积
*
            lv_mj = |{ ls_mjcy-mj_icp }|.
            zcl_pl_asset_tag_service=>remove_ending_0_of_decimal( CHANGING cv_data = lv_mj ).
            lv_mj_c = CONV char100( lv_mj ).
            zcl_pl_asset_tag_service=>display_in_thousands( CHANGING cv_str = lv_mj_c ).
            lv_mj = lv_mj_c.
            lv_yjzw =  |{ lv_yjzw }<td width=117 style='width:88.0pt;border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:43.2pt'>|.
            lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal align=center style='text-align:center'><span lang=EN-US style='font-size:10.5pt;font-family:"Times New Roman",serif;color:black'>{ lv_mj }<o:p></o:p></span></p></td>| .


            "差异面积
*            .
            lv_mj = |{ ls_mjcy-mjcy }|.
            zcl_pl_asset_tag_service=>remove_ending_0_of_decimal( CHANGING cv_data = lv_mj ).
            lv_mj_c = CONV char100( lv_mj ).
            zcl_pl_asset_tag_service=>display_in_thousands( CHANGING cv_str = lv_mj_c ).
            lv_mj = lv_mj_c.
            lv_yjzw =  |{ lv_yjzw }<td width=117 style='width:88.0pt;border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:43.2pt'>|.
            lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal align=center style='text-align:center'><span lang=EN-US style='font-size:10.5pt;font-family:"Times New Roman",serif;color:red'>{ lv_mj }<o:p></o:p></span></p></td>| .

            "核对标准
            lv_yjzw =  |{ lv_yjzw }<td width=245 style='width:184.0pt;border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:43.2pt'>| .
            lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal align=center style='text-align:center'><span style='font-size:10.5pt;color:black'>{ ls_mjcy-hdbz }</span></p></td>| .

            "待校核楼栋
            lv_yjzw =  |{ lv_yjzw }<td width=129 style='width:97.0pt;border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:43.2pt'>| .
            lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal align=center style='text-align:center'>{ ls_mjcy-ldfw }</p></td>| .
            lv_yjzw =  |{ lv_yjzw }</tr>|.
          ENDLOOP.

          lv_yjzw =  |{ lv_yjzw }</table>|.

          " MODIFY BY DENGW01  云效434295   start
          SELECT oparea, opperson
            FROM ztplmopconfig
            INTO TABLE @DATA(lt_ztplmopconfig).


          "联系人
          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>|.
          lv_yjzw =  |{ lv_yjzw }<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=609 style='width:456.8pt;margin-left:8.4pt;border-collapse:collapse'>| .
          lv_yjzw =  |{ lv_yjzw }<tr style='height:14.4pt'>| .
          lv_yjzw =  |{ lv_yjzw }<td width=609 colspan=4 style='width:456.8pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'>| .
          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal>若面积校核不是您负责,请帮忙将此邮件转发给责任人,并抄送以下系统运维同事:<span lang=EN-US><o:p></o:p></span></p></td></tr>| .

          LOOP AT lt_ztplmopconfig INTO DATA(ls_ztplmopconfig).
            lv_yjzw =  |{ lv_yjzw }<tr style='height:14.4pt'><td width=277 nowrap style='width:208.1pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'>| .
            lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal><b><span lang=EN-US>{ ls_ztplmopconfig-oparea }<o:p></o:p></span></b></p></td>| .
            lv_yjzw =  |{ lv_yjzw }<td width=402 nowrap style='width:326.5pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'>| .
            lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal>{ ls_ztplmopconfig-opperson }<span lang=EN-US><o:p></o:p></span></p></td>| .
            lv_yjzw =  |{ lv_yjzw }<td width=15 nowrap style='width:11.1pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'></td>| .
            lv_yjzw =  |{ lv_yjzw }<td width=15 nowrap style='width:11.1pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'></td></tr>| .

*            lv_yjzw =  |{ lv_yjzw }<tr style='height:14.4pt'><td width=277 nowrap style='width:208.1pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'>| .
*            lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal><b>南方区域:<span lang=EN-US><o:p></o:p></span></b></p></td>| .
*            lv_yjzw =  |{ lv_yjzw }<td width=302 nowrap style='width:226.5pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'>| .
*            lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal>袁绍滨(<span lang=EN-US>c-yuansb</span>)<span lang=EN-US><o:p></o:p></span></p></td>| .
*            lv_yjzw =  |{ lv_yjzw }<td width=15 nowrap style='width:11.1pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'></td>| .
*            lv_yjzw =  |{ lv_yjzw }<td width=15 nowrap style='width:11.1pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'></td></tr>| .
*
*            lv_yjzw =  |{ lv_yjzw }<tr style='height:14.4pt'><td width=277 nowrap style='width:208.1pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'>| .
*            lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal><b>北京<span lang=EN-US>/</span>华中<span lang=EN-US>/</span>西北<span lang=EN-US>/</span>西南区域:<span lang=EN-US><o:p></o:p></span></b></p></td>| .
*            lv_yjzw =  |{ lv_yjzw }<td width=302 nowrap style='width:226.5pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'>| .
*            lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal>黎<span lang=EN-US>&nbsp; </span>梅(<span lang=EN-US>c-lim18</span>)<span lang=EN-US><o:p></o:p></span></p></td>| .
*            lv_yjzw =  |{ lv_yjzw }<td width=15 nowrap style='width:11.1pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'></td></tr>| .
*
*            lv_yjzw =  |{ lv_yjzw }<tr style='height:28.8pt'><td width=277 nowrap valign=top style='width:208.1pt;padding:0cm 5.4pt 0cm 5.4pt;height:28.8pt'>| .
*            lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal><b>除<span lang=EN-US>7BG</span>外其他公司:<span lang=EN-US><o:p></o:p></span></b></p></td>| .
*            lv_yjzw =  |{ lv_yjzw }<td width=302 valign=top style='width:226.5pt;padding:0cm 5.4pt 0cm 5.4pt;height:28.8pt'>| .
*            lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal>黎梅(<span lang=EN-US>c-lim18</span>)<span lang=EN-US><br></span>赵庆(<span lang=EN-US>c-zhaoq05</span>)<span lang=EN-US><o:p></o:p></span></p>| .
*            lv_yjzw =  |{ lv_yjzw }</td><td width=15 nowrap style='width:11.1pt;padding:0cm 5.4pt 0cm 5.4pt;height:28.8pt'></td>| .
*            lv_yjzw =  |{ lv_yjzw }<td width=15 nowrap style='width:11.1pt;padding:0cm 5.4pt 0cm 5.4pt;height:28.8pt'></td></tr>|.

          ENDLOOP.
          lv_yjzw =  |{ lv_yjzw }</table>|.
          lv_yjzw =  |{ lv_yjzw }<p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:15.0pt;margin-bottom:.0001pt'><span lang=EN-US><o:p>&nbsp;</o:p></span></p>| .
          lv_yjzw =  |{ lv_yjzw }<p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:15.0pt;margin-bottom:.0001pt'>祝好!<span lang=EN-US><o:p></o:p></span></p>| .
          lv_yjzw =  |{ lv_yjzw }<p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:15.0pt;margin-bottom:.0001pt'>崔筱盼<span lang=EN-US><o:p></o:p></span></p>| .
          lv_yjzw =  |{ lv_yjzw }<p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:15.0pt;margin-bottom:.0001pt'>集团总部 事业中心<span lang=EN-US><o:p></o:p>| .
          lv_yjzw =  |{ lv_yjzw }</span></p><p class=MsoNormal><span lang=EN-US | .
          lv_yjzw =  |{ lv_yjzw }style='font-size:10.5pt;font-family:等线'><o:p>&nbsp;</o:p></span></p></div></body>| .

          " MODIFY BY DENGW01  云效434295   end

*          "联系人
*          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p>|.
*          lv_yjzw =  |{ lv_yjzw }<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=609 style='width:456.8pt;margin-left:8.4pt;border-collapse:collapse'>| .
*          lv_yjzw =  |{ lv_yjzw }<tr style='height:14.4pt'>| .
*          lv_yjzw =  |{ lv_yjzw }<td width=609 colspan=4 style='width:456.8pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'>| .
*          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal>若面积校核不是您负责,请帮忙将此邮件转发给责任人,并抄送以下系统运维同事:<span lang=EN-US><o:p></o:p></span></p></td></tr>| .
*          lv_yjzw =  |{ lv_yjzw }<tr style='height:14.4pt'><td width=277 nowrap style='width:208.1pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'>| .
*          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal><b>东北<span lang=EN-US>/</span>上海区域:<span lang=EN-US><o:p></o:p></span></b></p></td>| .
*          lv_yjzw =  |{ lv_yjzw }<td width=302 nowrap style='width:226.5pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'>| .
*          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal>黄新辉(<span lang=EN-US>c-huangxh03</span>)<span lang=EN-US><o:p></o:p></span></p></td>| .
*          lv_yjzw =  |{ lv_yjzw }<td width=15 nowrap style='width:11.1pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'></td>| .
*          lv_yjzw =  |{ lv_yjzw }<td width=15 nowrap style='width:11.1pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'></td></tr>| .
*          lv_yjzw =  |{ lv_yjzw }<tr style='height:14.4pt'><td width=277 nowrap style='width:208.1pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'>| .
*          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal><b>南方区域:<span lang=EN-US><o:p></o:p></span></b></p></td>| .
*          lv_yjzw =  |{ lv_yjzw }<td width=302 nowrap style='width:226.5pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'>| .
*          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal>袁绍滨(<span lang=EN-US>c-yuansb</span>)<span lang=EN-US><o:p></o:p></span></p></td>| .
*          lv_yjzw =  |{ lv_yjzw }<td width=15 nowrap style='width:11.1pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'></td>| .
*          lv_yjzw =  |{ lv_yjzw }<td width=15 nowrap style='width:11.1pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'></td></tr>| .
*          lv_yjzw =  |{ lv_yjzw }<tr style='height:14.4pt'><td width=277 nowrap style='width:208.1pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'>| .
*          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal><b>北京<span lang=EN-US>/</span>华中<span lang=EN-US>/</span>西北<span lang=EN-US>/</span>西南区域:<span lang=EN-US><o:p></o:p></span></b></p></td>| .
*          lv_yjzw =  |{ lv_yjzw }<td width=302 nowrap style='width:226.5pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'>| .
*          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal>黎<span lang=EN-US>&nbsp; </span>梅(<span lang=EN-US>c-lim18</span>)<span lang=EN-US><o:p></o:p></span></p></td>| .
*          lv_yjzw =  |{ lv_yjzw }<td width=15 nowrap style='width:11.1pt;padding:0cm 5.4pt 0cm 5.4pt;height:14.4pt'></td></tr>| .
*          lv_yjzw =  |{ lv_yjzw }<tr style='height:28.8pt'><td width=277 nowrap valign=top style='width:208.1pt;padding:0cm 5.4pt 0cm 5.4pt;height:28.8pt'>| .
*          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal><b>除<span lang=EN-US>7BG</span>外其他公司:<span lang=EN-US><o:p></o:p></span></b></p></td>| .
*          lv_yjzw =  |{ lv_yjzw }<td width=302 valign=top style='width:226.5pt;padding:0cm 5.4pt 0cm 5.4pt;height:28.8pt'>| .
*          lv_yjzw =  |{ lv_yjzw }<p class=MsoNormal>黎梅(<span lang=EN-US>c-lim18</span>)<span lang=EN-US><br></span>赵庆(<span lang=EN-US>c-zhaoq05</span>)<span lang=EN-US><o:p></o:p></span></p>| .
*          lv_yjzw =  |{ lv_yjzw }</td><td width=15 nowrap style='width:11.1pt;padding:0cm 5.4pt 0cm 5.4pt;height:28.8pt'></td>| .
*          lv_yjzw =  |{ lv_yjzw }<td width=15 nowrap style='width:11.1pt;padding:0cm 5.4pt 0cm 5.4pt;height:28.8pt'></td></tr></table>| .
*          lv_yjzw =  |{ lv_yjzw }<p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:15.0pt;margin-bottom:.0001pt'><span lang=EN-US><o:p>&nbsp;</o:p></span></p>| .
*          lv_yjzw =  |{ lv_yjzw }<p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:15.0pt;margin-bottom:.0001pt'>祝好!<span lang=EN-US><o:p></o:p></span></p>| .
*          lv_yjzw =  |{ lv_yjzw }<p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:15.0pt;margin-bottom:.0001pt'>崔筱盼<span lang=EN-US><o:p></o:p></span></p>| .
*          lv_yjzw =  |{ lv_yjzw }<p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:15.0pt;margin-bottom:.0001pt'>集团总部 事业中心<span lang=EN-US><o:p></o:p>| .
*          lv_yjzw =  |{ lv_yjzw }</span></p><p class=MsoNormal><span lang=EN-US | .
*          lv_yjzw =  |{ lv_yjzw }style='font-size:10.5pt;font-family:等线'><o:p>&nbsp;</o:p></span></p></div></body>| .


*
*
*            append |<th style='width:150px;background-color:#FFFFFF;font-size:12pt;text-align: center;font-family:"楷体",sans-serif'>{ ls_mjcy-zzno }</th>| to lt_main_text.
*
*
*
*            append |<th style='width:150px;background-color:#FFFFFF;font-size:12pt;text-align: center;font-family:"楷体",sans-serif'>{ lv_mj }</th>| to lt_main_text.
*
*
*            append |<th style='width:150px;background-color:#FFFFFF;font-size:12pt;text-align: center;font-family:"楷体",sans-serif'>{ lv_mj } </th>| to lt_main_text.

*            lv_trunc = trunc( ls_mjcy-mjcy ).
*            lv_frac2 = frac( ls_mjcy-mjcy ) * 10000.
**              data(lv_frac2) = conv i( substring_after( val = |{ ls_mjcy-mj_icp - lv_trunc }| sub = '.' ) ).
*            if lv_frac2 ne 0.
*              lv_frac2_s = |{ trunc( lv_frac2 ) }|.
*              do 4 times.
*                lv_offset = 4 - sy-index.
*                if lv_frac2_s+lv_offset(1) eq 0.
*                  lv_frac2_s = lv_frac2_s+0(lv_offset).
*                else.
*                  exit.
*                endif.
*              enddo.
*
*              if lv_frac2_s is not initial and lv_frac2_s+0(1) = '-'.
*                lv_frac2_s = lv_frac2_s+1.
*              endif.
*              lv_mj = |{ lv_trunc }.{ lv_frac2_s }|.
*            else.
*              lv_mj = |{ lv_trunc }|.
*            endif.
*            append |<th style='width:150px;background-color:#FFFFFF;color:red;font-size:12pt;text-align: center;font-family:"楷体",sans-serif'>{ lv_mj }</th>| to lt_main_text.
*            append |<th style='width:200px;background-color:#FFFFFF;font-size:12pt;text-align: center;font-family:"楷体",sans-serif'>{ ls_mjcy-hdbz }</th>| to lt_main_text.
**                MODIFY by c-zhabl01 at 20220906:处理ldfw超长被截断问题---begin
*            append |<th style='width:200px;background-color:#FFFFFF;font-size:12pt;text-align: center;font-family:"楷体",sans-serif'>| to lt_main_text.
*            while ls_mjcy-ldfw is not initial.
*              data(lv_len) = cond i( when strlen( ls_mjcy-ldfw ) gt 255 then 255 else strlen( ls_mjcy-ldfw ) ).
*              append |{ ls_mjcy-ldfw+0(lv_len) }| to lt_main_text.
*              ls_mjcy-ldfw = ls_mjcy-ldfw+lv_len.
*            endwhile.
*            append |</th>| to lt_main_text.
**                MODIFY by c-zhabl01 at 20220906:处理ldfw超长被截断问题---end
*            append |</tr>| to lt_main_text.
*          endloop.
*          append |</table>| to lt_main_text.
*          append |</p>| to lt_main_text.
*          append |</body>| to lt_main_text.
**          endif.
*
*
*          append |<body style="width:2000px;">| to lt_main_text.
**          append |<br></br>| to lt_main_text.
*          append |<p style='font-size:12.0pt;font-family:"楷体";margin:0;margin-left:20px'>&nbsp;&nbsp;处理过程中若有问题,烦请您联系以下同事协助处理:</p>| to lt_main_text.
*          append |<p style='font-size:12.0pt;font-family:"楷体";margin:0;margin-left:20px'>&nbsp;&nbsp;上海/东北区域:黄新辉 c-huangxh03 </p>| to lt_main_text.
*          append |<p style='font-size:12.0pt;font-family:"楷体";margin:0;margin-left:20px'>&nbsp;&nbsp;南方区域:袁绍滨c-yuansb </p>| to lt_main_text.
*          append |<p style='font-size:12.0pt;font-family:"楷体";margin:0;margin-left:20px'>&nbsp;&nbsp;北京/西南/西北/华中区域:黎梅c-lim18 </p>| to lt_main_text.
*          append |<p style='font-size:12.0pt;font-family:"楷体";margin:0;margin-left:20px'>&nbsp;&nbsp;除7BG外其他:黎梅c-lim18 /赵庆c-zhaoq05 </p>| to lt_main_text.
*          append |<p style='font-size:12.0pt;font-family:"楷体";margin:0;margin-left:20px'>&nbsp;&nbsp;若面积校核不是您负责,请帮忙转发邮件给面积校核的责任人,并告知我们责任人的域账号,我们进行邮件发送人的更新,谢谢! </p>| to lt_main_text.
*
*
*          "ADD BY YISZ 2022/10/19 BEGIN
*          refresh im_para.
*          lv_appnam = 'ZWD_PL_C019N'.
*          append value #( name = 'PSPID' value = lv_posid_xm ) to im_para.
*          "生成URL地址
*          call function 'ZPORTALFM_003'
*            exporting
*              im_appnam        = lv_appnam
*              im_para          = im_para
*              im_switch_portal = 'X'
*            importing
*              ev_url           = ls_url.
*
*          append |<p style='font-size:12.0pt;font-family:"楷体";color:black;margin:0;margin-left:20px'>&nbsp;&nbsp;您也可以点击此处超链接| to lt_main_text.
*          ls_url = |<a style='color:red' href="| && ls_url && |" target="_blank" >进行项目{ lv_posid_xm }【{ lv_post1 }】的面积校核人员维护</a></p>|.
*
*          clear lt_urls.
*          call function 'CONVERT_STRING_TO_TAB'
*            exporting
*              i_string         = ls_url
*              i_tabline_length = 255
*            tables
*              et_table         = lt_urls.
*          append  lines of lt_urls to lt_main_text.
*          "ADD BY YISZ 2022/10/19 END
*
*          "签名
*          append |<br></br>| to lt_main_text.
*          append |<p style='font-size:12.0pt;font-family:"楷体";color:black;margin:0;margin-left:20px'>祝好!</p>| to lt_main_text.
*          append |<p style='font-size:12.0pt;font-family:"楷体";color:black;margin:0;margin-left:20px'>崔筱盼</p>| to lt_main_text.
*          append |<p style='font-size:12.0pt;font-family:"楷体";color:black;margin:0;margin-left:20px'>集团总部 事业中心</p>| to lt_main_text.
*          append |</body>| to lt_main_text.
          "证照面积差异明细显示在邮件正文 2022/8/15 yisz add end

          CLEAR lt_main_text.
          CLEAR lt_urls.
          CALL FUNCTION 'CONVERT_STRING_TO_TAB'
            EXPORTING
              i_string         = lv_yjzw
              i_tabline_length = 255
            TABLES
              et_table         = lt_urls.
          APPEND  LINES OF lt_urls TO lt_main_text.

*            ====发送邮件======
          DATA:l_subject          TYPE so_obj_des,
               lr_email_body      TYPE REF TO cl_document_bcs,
               lr_email           TYPE REF TO cl_bcs,
               lo_cx_send_req_bcs TYPE REF TO cx_send_req_bcs,
               l_mail_address     TYPE adr6-smtp_addr,
               lr_receiver        TYPE REF TO cl_cam_address_bcs,
*       l_sender           type ref to cl_sapuser_bcs,
               l_sender           TYPE REF TO if_sender_bcs,
               l_send_result      TYPE os_boolean,
               lo_mr_api          TYPE REF TO if_mr_api,
               lo_convert         TYPE REF TO cl_bcs_convert,
               lo_mime_helper     TYPE REF TO cl_gbt_multirelated_service.

          l_subject = lv_subject.  "邮件标题
          TRY.
              CREATE OBJECT lo_mime_helper.

*              delete by c-zhabl01 at 20220802 for wangx:操作手册改为超链接---begin
*                "添加附件-操作手册
*                data(lv_bina_data) = value xstring( ).
*                data(lv_content_type) = value w3conttype( ).
*
*                zcl_cd_rps=>wda_get_mime_object(
*                    exporting
*                      iv_wdc_name  = 'ZWD_PL_C017'    " Web Dynpro Application ID
*                      iv_mime_id   = 'ZWD_PL_C017_MIME_1'    " MIME object ID
*                    importing
*                      ev_bina_data = lv_bina_data    " binary data
*                      ev_mime_type = lv_content_type    " binary data
*                  ).
*
*                if lv_bina_data is not initial.
*
*                  data(lt_solix) = value solix_tab( ).
*
*                  create object lo_convert.
*                  call method lo_convert->xstring_to_solix
*                    exporting
*                      iv_xstring = lv_bina_data
*                    receiving
*                      et_solix   = lt_solix.
*                  data(lv_len) = conv so_obj_len( xstrlen( lv_bina_data ) ).
*
*                  call method lo_mime_helper->add_binary_part
*                    exporting
*                      content      = lt_solix
*                      filename     = '证照面积核对功能操作手册.doc'
*                      extension    = 'doc'
*                      description  = '证照面积核对功能操作手册'
*                      content_type = lv_content_type
*                      length       = lv_len
*                      content_id   = '证照面积核对功能操作手册.doc'.
**            *    p_document->add_attachment( i_attachment_type = 'png'
**                                i_attachment_subject = 'CB'
**                                i_att_content_hex = lt_solix ).
*
*                endif.
*              delete by c-zhabl01 at 20220802 for wangx:操作手册改为超链接---end

              CALL METHOD lo_mime_helper->set_main_html
                EXPORTING
                  content = lt_main_text[].
            CATCH cx_root.
          ENDTRY.

          TRY.
              CALL METHOD cl_document_bcs=>create_from_multirelated
                EXPORTING
                  i_subject          = l_subject
                  i_multirel_service = lo_mime_helper
                RECEIVING
                  result             = lr_email_body.
            CATCH cx_root.
          ENDTRY.

          lr_email = cl_bcs=>create_persistent( ).
          lr_email->set_document( lr_email_body ).

*// 收件人
          LOOP AT lt_pernr INTO ls_pernr.      "add by c-zhabl01 at 20220222 for lilt:增加多个收件人
            TRANSLATE ls_pernr-email TO UPPER CASE.
            MODIFY lt_pernr FROM ls_pernr INDEX sy-tabix.
            l_mail_address = ls_pernr-email.
            TRY.
                lr_receiver = cl_cam_address_bcs=>create_internet_address( l_mail_address  ).
                lr_email->add_recipient( i_recipient = lr_receiver ).
              CATCH cx_root.
            ENDTRY.
          ENDLOOP.

          DATA lv_cs TYPE n LENGTH 3.
*// 抄送人
*          IF sy-sysid+0(2) = 'ED'.
*            CLEAR ls_ztpl0058n.
*            ls_ztpl0058n-rercc =  'C'.
*            ls_ztpl0058n-mail = 'C-ZHABL01@VANKE.COM'.
*            INSERT ls_ztpl0058n INTO lt_ztpl0058n INDEX 1.
*          ENDIF.

          LOOP AT lt_ztpl0058n INTO ls_ztpl0058n WHERE rercc = 'C'.
            READ TABLE lt_pernr WITH KEY email = ls_ztpl0058n-mail TRANSPORTING NO FIELDS.
            IF sy-subrc NE 0.
              l_mail_address = ls_ztpl0058n-mail.
              TRY.
                  lv_cs = lv_cs + 1.
                  lr_receiver = cl_cam_address_bcs=>create_internet_address( i_address_string = l_mail_address ).
*                lr_receiver->set_so_key( conv char10( lv_cs  ) ).
                  lr_email->add_recipient( i_recipient = lr_receiver i_copy = 'X' ).
                CATCH cx_root.
              ENDTRY.
            ENDIF.
          ENDLOOP.

          LOOP AT lt_csr INTO DATA(ls_csr).
            TRANSLATE ls_csr-email TO UPPER CASE.
            READ TABLE lt_ztpl0058n WITH KEY mail = ls_csr-email TRANSPORTING NO FIELDS.
            IF sy-subrc NE 0.

              l_mail_address = ls_csr-email.
              TRY.
                  lv_cs = lv_cs + 1.
                  lr_receiver = cl_cam_address_bcs=>create_internet_address( l_mail_address ).     "邮件地址转换
*                  lr_receiver->set_so_key( conv char10(  lv_cs  ) ).
*                  lr_email->add_recipient( exporting i_recipient = lr_receiver i_blind_copy = 'X' ).     "添加邮件地址到发送请求---密件抄送
                  lr_email->add_recipient( EXPORTING i_recipient = lr_receiver i_copy = 'X' ).     "添加邮件地址到发送请求
                CATCH cx_root.
              ENDTRY.
            ENDIF.
          ENDLOOP.

*// 邮件发送人
          "Set Sender and send mail
          DATA lv_sender TYPE syst_uname.
          TRY.
              IF sy-sysid+0(2) EQ 'EP' .
*        lv_sender = |{ 'ICP-NOTICE' }|.
                lv_sender = |{ 'V-CUIXP' }|.
              ELSE.
                lv_sender = |{ 'ICP' }|.
              ENDIF.

*                lv_sender = |{ 'V-CUIXP' }|.
              l_sender ?= cl_sapuser_bcs=>create( lv_sender ).
            CATCH cx_address_bcs.
              "l_mail_address = 'ICP@VANKE.COM'.
              IF sy-sysid+0(2) EQ 'EP' .
                l_mail_address = 'V-CUIXP@VANKE.COM'.
              ELSE.
                l_mail_address = 'ICP@VANKE.COM'.
              ENDIF.

              l_sender ?= cl_cam_address_bcs=>create_internet_address(
                                                                      i_address_string = l_mail_address
                                                                      i_address_name   = l_mail_address ).
          ENDTRY .

          lr_email->set_sender( l_sender ).
          lr_email->set_status_attributes( i_requested_status = 'E' i_status_mail = 'E' ).""不返回执邮件


*// 立即发送 Send email directly
          TRY.
              CALL METHOD lr_email->set_send_immediately
                EXPORTING
                  i_send_immediately = 'X'.
            CATCH cx_root .
          ENDTRY.

          TRY.
              CALL METHOD lr_email->send
                RECEIVING
                  result = l_send_result.

              ev_sent = abap_true.
              COMMIT WORK.

              "记录提醒记录
              SELECT *
                FROM ztpp1066
                FOR ALL ENTRIES IN @lt_ldnum
                WHERE zzlx = @lt_ldnum-zzlx
                  AND ldnum = @lt_ldnum-ldnum
                INTO TABLE @DATA(lt_ztpp1066).
              IF sy-subrc EQ 0.
                SORT lt_ztpp1066 BY zzlx ldnum.
              ENDIF.

              DATA lt_ztpp1066_new TYPE STANDARD TABLE OF ztpp1066.

              DATA(lv_receiver) = ||.
              LOOP AT lt_pernr INTO ls_pernr.
                IF ls_pernr-uname IS NOT INITIAL.
                  lv_receiver = |{ lv_receiver },{ ls_pernr-uname }|.
                ELSE.
                  lv_receiver = |{ lv_receiver },{ substring_before( sub = '@' val = ls_pernr-email ) }|.
                ENDIF.
              ENDLOOP.

              IF lv_receiver IS NOT INITIAL.
                lv_receiver = lv_receiver+1.
              ENDIF.

              LOOP AT lt_ldnum INTO ls_ldnum.

                READ TABLE lt_ztpp1066 INTO DATA(ls_ztpp1066) WITH KEY zzlx = ls_ldnum-zzlx ldnum = ls_ldnum-ldnum BINARY SEARCH.
                IF sy-subrc EQ 0.
                  zcl_pl_asset_tag_service=>set_usrdt( EXPORTING iv_mode = 'U' CHANGING cs_usrdt = ls_ztpp1066-usrdt ).
                ELSE.
                  zcl_pl_asset_tag_service=>set_usrdt( EXPORTING iv_mode = 'I' CHANGING cs_usrdt = ls_ztpp1066-usrdt ).
                ENDIF.

                ls_ztpp1066-zzlx = ls_ldnum-zzlx.
                ls_ztpp1066-ldnum = ls_ldnum-ldnum.

*                ls_ztpp1066-receiver = ls_fiout-uname."add by c-zhabl01 at 20220707 for wangx:增加收件人记录
                ls_ztpp1066-receiver = lv_receiver."modify by c-zhabl01 at 20221102 :收件人可能是多个,用,隔开

                APPEND ls_ztpp1066 TO lt_ztpp1066_new.
              ENDLOOP.

              MODIFY ztpp1066 FROM TABLE lt_ztpp1066_new.
              IF sy-subrc EQ 0.
                COMMIT WORK.

*--- ADD BY C-ZHABL01 AT 20220915:增加阶段自动升版---begin
                SELECT psphi,
                       posid AS ldnum
                  FROM prps
                  FOR ALL ENTRIES IN @lt_ztpp1066_new
                  WHERE posid = @lt_ztpp1066_new-ldnum
                  INTO TABLE @DATA(lt_psphi).
                IF sy-subrc EQ 0.
                  SELECT posid,
                         psphi
                    FROM prps
                    FOR ALL ENTRIES IN @lt_psphi
                    WHERE psphi = @lt_psphi-psphi
                      AND stufe = '1'
                    INTO TABLE @DATA(lt_xm).
                  IF sy-subrc EQ 0.
                    SELECT *
                      FROM ztpp1071
                      FOR ALL ENTRIES IN @lt_xm
                      WHERE posid = @lt_xm-posid
                        AND status IN ( 'N','E' )
                      INTO TABLE @DATA(lt_ztpp1071_old).
                    IF sy-subrc EQ 0.
                      SORT lt_ztpp1071_old BY posid.
                    ENDIF.

                    DATA lt_ztpp1071_new TYPE STANDARD TABLE OF ztpp1071.

                    SORT lt_psphi BY ldnum.
                    SORT lt_xm BY psphi.
                    LOOP AT lt_xm INTO DATA(ls_xm).

                      APPEND INITIAL LINE TO lt_ztpp1071_new ASSIGNING FIELD-SYMBOL(<lfs_1071_new>).
                      <lfs_1071_new>-posid = ls_xm-posid.
                      <lfs_1071_new>-fbdat = sy-datum.
                      <lfs_1071_new>-status = 'N'.
                      zcl_pl_asset_tag_service=>set_usrdt( EXPORTING iv_mode = 'I' CHANGING cs_usrdt = <lfs_1071_new>-stamp ).

                      READ TABLE lt_ztpp1071_old WITH KEY posid = ls_xm-posid TRANSPORTING NO FIELDS BINARY SEARCH.
                      IF sy-subrc EQ 0.
                        LOOP AT lt_ztpp1071_old INTO DATA(ls_1071) FROM sy-tabix.
                          IF ls_1071-posid NE ls_xm-posid.
                            EXIT.
                          ENDIF.

                          IF ls_1071-fbdat EQ <lfs_1071_new>-fbdat.
                            CONTINUE.
                          ENDIF.

                          ls_1071-status = 'I'.

                          zcl_pl_asset_tag_service=>set_usrdt( EXPORTING iv_mode = 'U' CHANGING cs_usrdt = ls_1071-stamp ).

                          APPEND ls_1071 TO lt_ztpp1071_new.
                        ENDLOOP.
                      ENDIF.
                    ENDLOOP.

                    MODIFY ztpp1071 FROM TABLE lt_ztpp1071_new.
                    IF sy-subrc EQ 0.
                      COMMIT WORK.
                    ELSE.
                      ROLLBACK WORK.
                    ENDIF.
                  ENDIF.
                ENDIF.
*---ADD BY C-ZHABL01 AT 20220915:增加阶段自动升版---end
              ELSE.
                ROLLBACK WORK.
              ENDIF.
            CATCH cx_root.
          ENDTRY.
          "         ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDIF.
ENDFUNCTION.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2074943.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

SSM网上人才招聘系统—计算机毕业设计源码23541

目 录 摘要 1 绪论 1.1研究意义 1.2研究背景 1.3研究原因 1.4 ssm框架介绍 1.5论文结构与章节安排 2 网上人才招聘系统系统分析 2.1 可行性分析 2.2 系统流程分析 2.2.1数据增加流程 2.2.2数据修改流程 2.2.3数据删除流程 2.3 系统功能分析 2.3.1 功能性分析 2…

《黑神话:悟空》游戏中的江苏元素

《黑神话&#xff1a;悟空》作为一款以中国经典文学小说《西游记》为基础创作的动作游戏&#xff0c;不仅在游戏剧情和角色设计上深受原著影响&#xff0c;还在游戏场景和元素中融入了大量的中国传统文化&#xff0c;其中不乏江苏地区的特色元素。以下是对游戏中江苏元素的详细…

音频格式转换免费软件有哪些?实用转换工具大揭秘

不知道大家在日常生活中&#xff0c;会不会跟我一样经常遇到需要将音频文件从一种格式转换为另一种格式的情况呢&#xff1f;无论是为了在不同的设备上播放&#xff0c;还是为了节省存储空间&#xff0c;音频转换软件都显得尤为重要。 我最近发现&#xff0c;市面上有许多音频…

力扣1703.得到连续K个1的最少相邻交换次数

力扣1703.得到连续K个1的最少相邻交换次数 中位数贪心 前缀和 设pi qi - i&#xff0c;则问题变为所有pi到x的距离和的最小值 同时x应取pi的中位数 因此枚举i作为最左端的1&#xff0c;求最小值即可 推出距离和公式&#xff1a;s[i] s[ik] - s[ik/2]2 - p[ik/2](k%2) …

pytorch深度学习基础 8 (使用PyTorch的内置功能和默认参数来构建和训练一个简单的线性模型)

co 上面几节都是自定义了很多东西&#xff0c;比如模型的权重&#xff0c;偏置的大小&#xff0c;学习率&#xff0c;损失函数等等&#xff0c;但是实际上pytorch有很多内置的函数以及默认的参数可以对我们的模型部分进行替换&#xff0c;效果也是非常好的&#xff0c;今天我们…

客户信任的秘密武器:为什么每个网站都需要SSL证书?

SSL证书&#xff0c;是网络安全的一把钥匙&#xff0c;它不仅能够锁住数据的安全&#xff0c;还能够建立起用户与网站之间的信任桥梁。在这个数字化日益发展的时代&#xff0c;每个网站都需要配备SSL证书&#xff0c;其背后的原因是多方面的&#xff0c;涉及到技术、安全、信任…

一文掌握数据要素、数据资源、数据资产、数字资产、数据管理、数据治理、数字资产入表是什么?以及关系

数据要素、数据资源、数据资产、数字资产、数据管理、数据治理、数字资产入表到底是什么呢&#xff1f;他们之间是什么关系呢&#xff1f; 数据要素是构建块&#xff0c;数据资源是这些构建块的集合&#xff0c;而数据资产则是具有价值的资源。数据管理和数据治理则确保这些数据…

Lesson 87 A car crash

Lesson 87 A car crash 词汇 attendant n. 接待员&#xff0c;随从 构成&#xff1a;attend v. 出席&#xff0c;参加    -ant / -ent 人 例如&#xff1a;student 学生    assistant 助理 相关&#xff1a;attendance n. 出勤率 例句&#xff1a;Conan以前是一个好接待…

【已解决】我可以再docker里面装Nginx,然后再Nginx下装java吗?

我可以再docker里面装Nginx,然后再Nginx下装java吗&#xff1f; Docker 是一个开源的应用容器引擎&#xff0c;它允许开发者打包他们的应用以及应用的运行环境到一个可移植的容器中&#xff0c;然后发布到任何流行的 Linux 机器上&#xff0c;也可以实现虚拟化。Docker 容器通常…

私域流量池|家政小程序开发,便捷服务新模式

随着时代的进步和需求的日益增长&#xff0c;家政服务行业也迎来了显著的发展提升。随着科技的不断发展&#xff0c;数字化已经成为各行各业的重要趋势。家政小程序因此而应运而生&#xff0c;成为提高家政服务效率的智能化工具。不仅满足了用户对服务的灵活性需求&#xff0c;…

2024年开发者必备的一款服务端组件

最新技术资源&#xff08;建议收藏&#xff09; https://www.grapecity.com.cn/resources/ 前言 在现代工作环境中&#xff0c;信息的处理和管理是至关重要的。表格是一种常见的数据呈现和整理工具&#xff0c;被广泛应用于各行各业。然而&#xff0c;随着技术的不断发展&…

NC设计LRU缓存结构

系列文章目录 文章目录 系列文章目录前言 前言 前些天发现了一个巨牛的人工智能学习网站&#xff0c;通俗易懂&#xff0c;风趣幽默&#xff0c;忍不住分享一下给大家。点击跳转到网站&#xff0c;这篇文章男女通用&#xff0c;看懂了就去分享给你的码吧。 描述 设计LRU(最近…

leetcode215. 数组中的第K个最大元素,小根堆/快排思想

leetcode215. 数组中的第K个最大元素 给定整数数组 nums 和整数 k&#xff0c;请返回数组中第 k 个最大的元素。 请注意&#xff0c;你需要找的是数组排序后的第 k 个最大的元素&#xff0c;而不是第 k 个不同的元素。 你必须设计并实现时间复杂度为 O(n) 的算法解决此问题。…

vue面试集合

缓存 浏览器缓存和http缓存 浏览器缓存&#xff1a; 1&#xff0c;简单的缓存方式有cookie&#xff0c;localStorage和sessionStorage。 2&#xff0c;vue中keep-alive缓存动态组件&#xff1a; 全部缓存&#xff1a;使用<keep-alive>标签包裹缓存路由&#xff0c;ro…

JAVA电子器件制造行业生产管理系统计算机毕设计算机毕业设计

项目开发意义 目前小型企业基本上是采用人工完成生产及物料的车间计划,由于企业运作是以订单驱动而非计划生产,人工手段无法及时随新订单的到来更新计划,造成计划偏离实际;各个生产单位(车间)各自为战,分别提出物料、设备、专用工具的需求,在整个企业层面上很难较精确地控制物料…

机器学习:集成学习之随机森林

目录 前言 一、集成学习 1.集成学习的含义 2.集成学习的代表 3.集成学习的应用 二、随机森林 1.随机森林的特点 2.随机森林生成步骤 3.随机森林优点 4.随机森林的缺点 三、代码实现 1.完整代码 2.数据预处理 3.创建并训练模型 4.测试模型 总结 前言 随机森林是…

集合及数据结构第十二节(下)————哈希表、字符串常量池和练习题

系列文章目录 集合及数据结构第十二节&#xff08;下&#xff09;————哈希表、字符串常量池和练习题 哈希表、字符串常量池和练习题 哈希表的概念冲突-概念冲突-避免冲突-解决冲突严重时的解决办法冲突严重时的解决办法的实现性能分析和 java 类集的关系Hashmap的使用案…

R8RS标准之重要特性及用法实例(四十)

简介&#xff1a; CSDN博客专家&#xff0c;专注Android/Linux系统&#xff0c;分享多mic语音方案、音视频、编解码等技术&#xff0c;与大家一起成长&#xff01; 新书发布&#xff1a;《Android系统多媒体进阶实战》&#x1f680; 优质专栏&#xff1a; Audio工程师进阶系列…

LDR6500Type-C pd OTGi协议芯片讲解

LDR6500是一款由乐得瑞科技推出的USB-C DRP&#xff08;Dual Role Port&#xff0c;双角色端口&#xff09;接口USB PD&#xff08;Power Delivery&#xff0c;功率传输&#xff09;通信芯片。这款芯片具备一系列先进的功能和特点&#xff0c;特别适合于手机音频转接器、USB Ty…