cancel
Showing results for 
Search instead for 
Did you mean: 

How to approve Order from Outlook Email

AB069
Active Participant
0 Kudos
1,386

Hi Frds,

I have created a functionality where Order Approval notification sent to Res person MS Outlook mail.

Now requirement is that the approver can approve or reject form Out Look mail itself, For this i need to create a link for approve and reject at the end of the mail body which on click in either link update the status of Order.

Please do the needful

I appricete if you provide some sample code.

Thanks

Imran 

Accepted Solutions (1)

Accepted Solutions (1)

AB069
Active Participant
0 Kudos

Hi All,

Thanks for your Help. I dont know how. but the code is working fine.

Thanks Deepika. All credit to gone to you.

Regards

Imran

deepika_chandrasekar
Active Contributor
0 Kudos

Hi Imran,

Happy that it helped you. Close this thread

Regards,

Deepika.

deepika_chandrasekar
Active Contributor
0 Kudos

Hi Imran,

Why you closed this thread with assumed answered?

Regards,

Deepika.

AB069
Active Participant
0 Kudos

Hi Deepika,

One last ques. Act there are two object which sent mail, one is report where i have created link and working fine. and other is from Workflow which use Business object zmethod to sent mail. (bus2000115). I stuck to get Workflow ID number.

Could you please let me know how can i get this WF ID. All i have Order ID , GUID and related details.

Thanks

Imran

deepika_chandrasekar
Active Contributor
0 Kudos

Hi Imran

You can use program exits in workitem step to send mail

check this link

Program Exits In Workflow - ABAP Development - SCN Wiki

or else u can use below tables.

SELECT wi_id FROM sww_wi2obj INTO TABLE lt_wiid WHERE catid = 'BO' AND typeid = 'BUS2000111' AND instid = 'docguid'.

SELECT wi_id  FROM swwwihead INTO TABLE lt_wihead  FOR ALL ENTRIES IN lt_wiid WHERE wi_id = lt_wiid-wi_id wi_stat = 'READY'

wi_rh_task = 'ur workitem task id'.

.

Regards,

Deepika.

AB069
Active Participant
0 Kudos

Thanks Deepika... Its working...

AB069
Active Participant
0 Kudos

Hi Deepika,

I need to capture the mail body but its not caputring to get reason for rejection.

Below is the code.

method IF_INBOUND_EXIT_BCS~PROCESS_INBOUND.

data : io_sreg TYPE REF TO CL_SEND_REQUEST_BCS. 

document type ref to if_document_bcs,

document = io_sreg->get_document( ).

The variable document give subject text but not body text. Any idea.

Below is the mail Body.

APPROVED.

Testing reason text….. Testing reason text….. Testing reason text….. Testing reason text…..
!!!Please do not change this automatically generated email. Enter Rejection\Return Notes in this Email Body ABOVE THIS MESSAGE!%

Regards

Imran

deepika_chandrasekar
Active Contributor
0 Kudos

Hi Imran.

data:

lt_body TYPE soli_tab,
ls_body
TYPE soli,


 
TRY.
      lo_document
= io_sreq->get_document( ).
      l_mail_attr
= lo_document->get_body_part_attributes( '1' ).
   
CATCH cx_document_bcs.
 
ENDTRY.


 
TRY.
      l_mail_content
= lo_document->get_body_part_content( '1' ).
   
CATCH cx_document_bcs.
 
ENDTRY.

lt_body =  l_mail_content-cont_text.

Loop lt_body and take the content.

Regards,

Deepika.

AB069
Active Participant
0 Kudos

Hi Deepika,

Thanks i tried but Still l_mail_content is empty. though i am getting subject line with the same lo_document. do we need to make some arrangement in the mail body. i texted many line in the mail body to test it.

I appriciate your time. also please check ur mail.

Thanks

Imran

deepika_chandrasekar
Active Contributor
0 Kudos

Hi Imran

I sent mail to your ID. Check it.

You need to set the body text using Link Approve / Reject..

Regards,

Deepika.

Former Member
0 Kudos

Hi ,

I am having similar issue the workitem doesnt get updated even after processing the email.

When i debug the standard method IF_INBOUND_EXIT_BCS~PROCESS_INBOUND 

  lo_document = io_sreq->get_document( )  statement is always failing to get the Email content so nothing is being processed.

Please advice.

Thanks,

Niel

.

AB069
Active Participant
0 Kudos

Hi Niel,

I just saw your post. Let me now if you still faceing same prob.

Thanks

Imran

Answers (3)

Answers (3)

AB069
Active Participant
0 Kudos

HI Frds,

Now i received mail into my CRM system. bt i am stuck in updating the order status.

In SCOT, I  maintain handler class exit and in one method of class when i am trying to read my current Mail it getting fail.below is the code.

data : lv_document  type ref to        if_document_bcs,

          io_sreq     type ref to        CL_SEND_REQUEST_BCS.

lv_document  = io_sreq->get_document( ).

lv_document valiable is found intial. It shoud contan all details of mail.

 
Please suggest what else needed to be done.

Thanks,

Imran

deepika_chandrasekar
Active Contributor
0 Kudos

HI,

How you are taking io_sreq ?

Regards,

Deepika.

0 Kudos

Hello Imran,

I looks like you have already the notification mail working for order approval. Please check the link

URL's for quick access to WebUI - CRM - SCN Wiki to find out the way to display , edit and create an CRM Object. I am not sure if status update is possible. You can try out the parameter "crm-object-action " as "C", If this doesnt work then you have have a RFC FM call via a link to perform the update.

Hope this helps.

Best Regards,

Rajesh

deepika_chandrasekar
Active Contributor
0 Kudos

Hi Imran,

Check this Link

http://www.saptechnical.com/Tutorials/Workflow/offline/Index.htm

Do configuartion specified in above link.

for link in mail while adding mail content you should use below code.

      ls_message-line = '<a href="' .

      APPEND ls_message TO lt_message.

      CONCATENATE 'APPROVE' iv_wi_id   INTO lv_text .

      CONCATENATE 'mailto:test@abc.com?Subject=' lv_text INTO lv_text.

      ls_message-line = lv_text.

      APPEND ls_message TO lt_message.

      lv_text = '&body=Comments:'..

      ls_message-line = lv_text.

      APPEND ls_message TO lt_message.

      ls_message-line =  'target="_top">'.

      APPEND ls_message TO lt_message.

      ls_message-line = 'Approve</a>'.

      APPEND ls_message TO lt_message.

Regards,

Deepika.

AB069
Active Participant
0 Kudos

Hi Deepika,

Your suggestion are very Helpful. Could you please provide the complete code which build Link in the mail body and when we click ,it sent mail to SAP system.

Example : Approval / Reject

On onclick on Approval link ,it sent Approval respone and onclick on Reject it sent reject response to sap system

please mail if possible: imranra.sap@gmail.com

Regards

Imran

deepika_chandrasekar
Active Contributor
0 Kudos

Hi Imran.


While sending mail itself in mail content add the code i mentioned above where you want approve/ reject option. you shoud give approve and reject separately like click approve or reject.

replace test@abc.com with your mailbox email ID you have configured for this email reply.

Regards,

Deepika.

deepika_chandrasekar
Active Contributor
0 Kudos

Hi Imran,

You are able to get the links in mail?

Regards,

Deepika.

AB069
Active Participant
0 Kudos

Thanks Dipika.

Yes, i recieved your mail. I really appriciate you help.

Thanks

imran

Former Member
0 Kudos

Hii Imran,

I am having same issue. Can you please send me the code that Deepika as forwarded to u. Your help is really appreciated. My mailid is anilkumar662@gmail.com

Thanks & Regards

Anil.