首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网络技术 > 网络基础 >

转 Offline Workflow Approval in ECC R/三 without SAP Logon from E-Mail (Outlook)

2013-11-08 
转 Offline Workflow Approval in ECC R/3 without SAP Logon from E-Mail (Outlook)Offline Workflow App

转 Offline Workflow Approval in ECC R/3 without SAP Logon from E-Mail (Outlook)
Offline Workflow Approval in ECC R/3 without SAP Logon from E-Mail (Outlook)

By Anirban Bhattacharjee, KPIT Cummins and Infosystems from Link

The e-mail ID created in the first step, is also entered here in the Address tab as shown (eccoffline@ecc-dev.yourdomain.com

      CLEAR: body_text.      CONCATENATE body_text                  '<tr><td>Invoice Number</td><td>'                  lv_belnr                  '</td></tr>'                  INTO body_text.      CONDENSE body_text.      APPEND body_text TO text.      wa_message-line = body_text.      APPEND wa_message TO it_message.      CLEAR: wa_message.
      CLEAR: body_text.      CONCATENATE body_text                  '<tr><td>Company Code</td><td>'                  lv_bukrs                  '</td></tr>'                  INTO body_text.      CONDENSE body_text.      APPEND body_text TO text.      wa_message-line = body_text.      APPEND wa_message TO it_message.      CLEAR: wa_message.
      CLEAR: body_text.      CONCATENATE body_text                  '<tr><td>Fiscal Year</td><td>'                  lv_gjahr                  '</td></tr>'                  INTO body_text.      CONDENSE body_text.      APPEND body_text TO text.      wa_message-line = body_text.      APPEND wa_message TO it_message.      CLEAR: wa_message.
      CLEAR: body_text.      CONCATENATE body_text                  '<tr><td>Gross Invoice Value (USD)</td><td>200,000.00</td></tr></table>'                  INTO body_text.      APPEND body_text TO text.      wa_message-line = body_text.      APPEND wa_message TO it_message.      CLEAR: wa_message.*--------------------------------** End Invoice Table*--------------------------------*
*--------------------------------** Start Multiline Table*--------------------------------*      CLEAR: body_text.      CONCATENATE body_text                  '<h4>Line Item Data displayed in tabular format</h4>'                  INTO body_text.      APPEND body_text TO text.      wa_message-line = body_text.      APPEND wa_message TO it_message.      CLEAR: wa_message.
      CLEAR: body_text.      CONCATENATE body_text                  '<table border="1" bgcolor = "lightgreen">'                  INTO body_text.      APPEND body_text TO text.      wa_message-line = body_text.      APPEND wa_message TO it_message.      CLEAR: wa_message.
      CLEAR: body_text.      CONCATENATE body_text                  '<tr>'                  '<th>Header 1</th>'                  '<th>Header 2</th>'                  '<th>Header 3</th>'                  '<th>Header 4</th>'                  '<tr>'                  '<td>row 1, cell 1</td>'                  '<td>row 1, cell 2</td>'                  '<td>row 1, cell 3</td>'                  '<td>row 1, cell 4</td>'                  '</tr>'                  INTO body_text.      APPEND body_text TO text.      wa_message-line = body_text.      APPEND wa_message TO it_message.      CLEAR: wa_message.
      CLEAR: body_text.      CONCATENATE body_text                  '<tr>'                  '<td>row 2, cell 1</td>'                  '<td>row 2, cell 2</td>'                  '<td>row 2, cell 3</td>'                  '<td>row 2, cell 4</td>'                  '</tr>'                  INTO body_text.      APPEND body_text TO text.      wa_message-line = body_text.      APPEND wa_message TO it_message.      CLEAR: wa_message.
      CLEAR: body_text.      CONCATENATE body_text                  '<tr>'                  '<td>row 3, cell 1</td>'                  '<td>row 3, cell 2</td>'                  '<td>row 3, cell 3</td>'                  '<td>row 3, cell 4</td>'                  '</tr>'                  INTO body_text.      APPEND body_text TO text.      wa_message-line = body_text.      APPEND wa_message TO it_message.      CLEAR: wa_message.
      CLEAR: body_text.      CONCATENATE body_text                  '<tr>'                  '<td>row 4, cell 1</td>'                  '<td>row 4, cell 2</td>'                  '<td>row 4, cell 3</td>'                  '<td>row 4, cell 4</td>'                  '</tr>'                  '</table>'                  INTO body_text.      APPEND body_text TO text.      wa_message-line = body_text.      APPEND wa_message TO it_message.      CLEAR: wa_message.
*--------------------------------** End Multiline Table*--------------------------------*
      CLEAR: body_text.      CONCATENATE body_text                  '<h3>What you need to do:</h3>'                  INTO body_text.      APPEND body_text TO text.      wa_message-line = body_text.      APPEND wa_message TO it_message.      CLEAR: wa_message.
      CLEAR: body_text.      CONCATENATE body_text                  'To approve the invoice via portal, please log onto the YOUR-COMPANY Business Portal by clicking here:'                  INTO body_text.      APPEND body_text TO text.      wa_message-line = body_text.      APPEND wa_message TO it_message.      CLEAR: wa_message.
* Generate the YOUR Company Portal Production Link      CLEAR: body_text.      CONCATENATE body_text                  '<a href="http://companyprderp.yourcompany.net:50000/irj/portal">YOUR_COMPANY Portal</a></p>'                  INTO body_text.      APPEND body_text TO text.      wa_message-line = body_text.      APPEND wa_message TO it_message.      CLEAR: wa_message.
* Genrate the Dynamic MAILTO Links      CLEAR: body_text.      CONCATENATE body_text                  'To process directly from e-mail, make your selection here &nbsp;'                  INTO body_text.      APPEND body_text TO text.      wa_message-line = body_text.      APPEND wa_message TO it_message.      CLEAR: wa_message.
      CLEAR: body_text.      CONCATENATE body_text                  '<a href="mailto:eccoffline@ecc-dev.yourcompany.com?subject=A'                  lv_wid_text                  ' - Approve Document">APPROVE</a>&nbsp;&nbsp;'                  INTO body_text.      APPEND body_text TO text.      wa_message-line = body_text.      APPEND wa_message TO it_message.      CLEAR: wa_message.
      CLEAR: body_text.      CONCATENATE body_text                  '<a href="mailto:eccoffline@ecc-dev.yourcompany.com?subject=R'                  lv_wid_text                  ' - Reject Document">REJECT</a>'                  INTO body_text.      APPEND body_text TO text.      wa_message-line = body_text.      APPEND wa_message TO it_message.      CLEAR: wa_message.
* Start DISCLAIMERS and WARNING Notifications      CLEAR: body_text.      CONCATENATE body_text                  '<br><h4>Please Note: The links will send an e-mail via MICROSOFT OUTLOOK.'                  'Please do not change the subject, body or any information in that e-mail.</h4>'                  INTO body_text.      APPEND body_text TO text.      wa_message-line = body_text.      APPEND wa_message TO it_message.      CLEAR: wa_message.
      CLEAR: body_text.      CONCATENATE body_text                  '<h4>MICROSOFT Outlook must be installed in your system.</h4>'                  INTO body_text.      APPEND body_text TO text.      wa_message-line = body_text.      APPEND wa_message TO it_message.      CLEAR: wa_message.
      CLEAR: body_text.      CONCATENATE body_text                  '<span style="color:#FF0000">' "This is color for RED. Browser Safe colors mandatory to prevent broswer crash.                  INTO body_text.      APPEND body_text TO text.      wa_message-line = body_text.      APPEND wa_message TO it_message.      CLEAR: wa_message.
      CLEAR: body_text.      CONCATENATE body_text                  '<h4> <style="color: red"> CAUTION! Please do not reply to this e-mail.'                  'For approval via e-mail, please click the links provided only. </h4></br>'                  INTO body_text.      APPEND body_text TO text.      wa_message-line = body_text.      APPEND wa_message TO it_message.      CLEAR: wa_message.
      CLEAR: body_text.      CONCATENATE body_text                  '</span>'                  INTO body_text.      APPEND body_text TO text.      wa_message-line = body_text.      APPEND wa_message TO it_message.      CLEAR: wa_message.
      CLEAR: body_text.      CONCATENATE body_text                  '</body></html>'                  INTO body_text.      APPEND body_text TO text.      wa_message-line = body_text.      APPEND wa_message TO it_message.      CLEAR: wa_message.*--------------------------------** End of HTML Code Body*--------------------------------*
* Calculate the Document Size      CLEAR: lv_lines, lv_so_obj_len.      DESCRIBE TABLE it_message LINES lv_lines.      lv_so_obj_len = 255 * lv_lines.
* Create the Document      document = cl_document_bcs=>create_document(                      i_type    = 'HTM' "Send HTML E-Mail and not 'RAW'                      i_text    = text                      i_length  = lv_so_obj_len                       i_subject = 'E-Mail sent AFTER Work Item Creation' ).
*     Add document to send request      CALL METHOD send_request->set_document( document ).
*     --------- set sender -------------------------------------------*     note: this is necessary only if you want to set the sender*           different from actual user (SY-UNAME). Otherwise sender is*           set automatically with actual user.
      sender = cl_sapuser_bcs=>create( sy-uname ).      CALL METHOD send_request->set_sender        EXPORTING          i_sender = sender.
*     --------- Add recipient (e-mail address) -----------------------*     Create recipient - passing the e-mail ID here      recipient = cl_cam_address_bcs=>create_internet_address( lv_email ).
*     Add recipient with its respective attributes to send request      CALL METHOD send_request->add_recipient        EXPORTING          i_recipient = recipient          i_express   = 'X'.
*     ---------- Send document ---------------------------------------      CALL METHOD send_request->send(        EXPORTING          i_with_error_screen = 'X'        RECEIVING          result              = sent_to_all ).
*      IF sent_to_all = 'X'.*        WRITE text-003.*      ENDIF.
      COMMIT WORK.
* -----------------------* *                     exception handling* -----------------------    CATCH cx_bcs INTO bcs_exception.*      WRITE: text-001.*      WRITE: text-002, bcs_exception->error_type.*      EXIT.  ENDTRY.
*--------------------------------** Another way to send e-mail in HTML via function module*--------------------------------*  CLEAR: w_doc_data.  w_doc_data-sensitivty = 'F'. "Fill the document data and get size of attachment  w_doc_data-doc_size   = lv_lines * 255. "Populate the subject/generic message attributes  w_doc_data-obj_langu  = sy-langu.  w_doc_data-obj_name   = 'SAPRPT'.  w_doc_data-obj_descr  = 'E-Mail sent AFTER Work Item Creation'.
  CLEAR: wa_receivers.  REFRESH: t_receivers[].  wa_receivers-receiver   = lv_email. "Get requestor mail id from table PA0105 based on his PERNR.  wa_receivers-rec_type   = 'U'.  wa_receivers-com_type   = 'INT'.  wa_receivers-notif_del  = 'X'.  wa_receivers-notif_ndel = 'X'.  APPEND wa_receivers TO t_receivers.
* Send the HTML E-Mail  CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'    EXPORTING      document_data  = w_doc_data      document_type  = 'HTM'   " To get the notification in HTML format      commit_work    = 'X'    TABLES      object_content = it_message      receivers      = t_receivers.
ENDMETHOD.

We have successfully processed a work item via e-mail without logging into SAP System. We also managed to get the system respond to the e-mails and do the desired processing and reply back with the correct status. We did not require SAP GUI to do any processing. Also SAP Login ID and Password was not needed to do the Workflow Processing..

?

?

?

热点排行