cancel
Showing results for 
Search instead for 
Did you mean: 

Sending WD component link in email through Workflow

ameya_kulkarni3
Participant
0 Kudos

Hi ,

I have a Web dynpro component created.The WD application would trigger a Workflow through a Business Object event. In the workflow the user would receive an email on his outlook with the WD component link.

I have 2 questions:

1) How will we send the email to the outlook mail? And the link would be a fairly long string as it is of a WD application.How can we send the link?

2) There is 1 more requirement in which there is a inventory number,which is the key field for the WD screen.The person receiving the outlook email with the link will be getting the link as

eg: http://tcbdci20.xyz.net:8020/sap/bc/webdynpro/xyz/cbb_a4201_invmt?WiNr=4711.

Here the "WiNr" would be the Inventory number parameter name and "4711" would be the inventory number.This link should directly take the user to the inventory number data filled on the WD screen.

Is there any way thsis kind of link can be sent and generated?

Many thanks for your help.

Regards,

Ameya Kulkarni

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI Ameya,

This requirement is quite feasible.

FIrst of all, since you are sending only email, there doesn't seems any need for workflow here.

You can make use of FM SO_NEW_DOCUMENT_ATT_SEND_API1 to send mail from your web dynpro component.

Alternatively, if you want to make use of workflow, you need to pass the hyperlink of the WD application in the event container when event is triggered.Once WF is triggered, make use of WF step ' SEND MAIL' and pass the hyperlink to the mail step.

If the link is too long, make use of ALias through SICF.

FOr point 2, you need to create a WD component with windows parameter type WiNr=4711. Now concatnate your WD link with WiNr=4711and pass this link to the mail step. That would call the basic view of that WD component thath you can design.

Hope this helps.

Regards,

Sangvir SIngh

Former Member
0 Kudos

1) First use the Send mail activity of WF , in mail tab maintain t he Recipent type has U E-Mail Address there and you can give the recipient mail id directly like (xyz@gmailcom)

2) In the same Send mail activity give the link in HTML anchor tabs, like shown below and it will be a hyper link to you r WD app.

  <a href = " http://www.xyz.com"> Link</a> 

To generate the link you have to concatenate the parameters accordingly in all environments (DEV/QA or PROD)

Edited by: chandra shekhar on Mar 17, 2011 9:23 AM

ameya_kulkarni3
Participant
0 Kudos

Hi Sangvir,

By "windows parameter for WiNr = 4711 ",do you mean creating an import parameter in WD which will store "4711".

Regards,

Ameya Kulkarni

ameya_kulkarni3
Participant
0 Kudos

Hi Chandra,

The link I need to send is very long around 75 chars,and I need to show the full link with the WiNr = 4711 appended.

I cannot accomodate that length at a stretch in the Send mail step.Can you suggest any alternative or a solution to longer length?

Regards,

Ameya Kullkarni

Former Member
0 Kudos

Hi,

Please see the below code by which I am able to send link more than 160 charecter.

*** BEGIN_METHOD SEND_MAIL_TO_USERS CHANGING CONTAINER.
* Data declaration
DATA:
      lt_user_IDS type STANDARD TABLE OF SWHACTOR,
      ls_user_IDS type SWHACTOR,
      lt_EMAIL_ADDRESSES TYPE STANDARD TABLE OF ADR6-SMTP_ADDR,
      ls_EMAIL_ADDRESSES  type ADR6-SMTP_ADDR,
      lv_STATUS TYPE CFS_STATUS-STATUS_ID,
      Lv_Object_ID type crmd_orderadm_h-object_id,
      ls_document_data TYPE sodocchgi1,
      lt_text TYPE solisti1 OCCURS 0,
      l_document_data TYPE sodocchgi1,
      lt_receivers TYPE somlreci1 OCCURS 0,
      ls_wa_receive TYPE somlreci1,
      ls_text TYPE solisti1,
      lv_link_title  TYPE char50.


DATA: lv_link1 TYPE char200 VALUE
'http://golitsapd39.go-d01.local:8001/sap/bc/gui/sap/its/webgui?sap-',
      lv_link2 TYPE char200 VALUE
'language=EN&sap-client=850&~transaction=DSWP_SAPSHORTCUT&~OkCode=',
      lv_link3 TYPE char200 VALUE '/08&pcmd=CRMVW&pmsgnum=',
      lv_link  TYPE char200.


* Get container values
  SWC_GET_table CONTAINER 'User_ids' lt_USER_IDS.
  SWC_GET_table CONTAINER 'Email_addresses' lt_EMAIL_ADDRESSES.
  SWC_GET_ELEMENT CONTAINER 'Status' lv_STATUS.
  SWC_GET_ELEMENT CONTAINER 'Object_ID' lv_Object_ID.

*=======================================================================
* Createing final link
*=======================================================================
CONCATENATE lv_link1 lv_link2 lv_link3 lv_object_id INTO
            lv_link.


*=======================================================================
* createing subject
*=======================================================================
Condense  lv_status.
Translate  lv_status to upper case.

CASE lv_status.
  WHEN 'NEW'.
    CONCATENATE 'Pls assign Support Msg ' lv_object_id
    INTO ls_document_data-obj_descr SEPARATED BY space.
  WHEN 'AUTHORIZED'.
    CONCATENATE 'CR' lv_object_id 'is autorized'
    INTO ls_document_data-obj_descr SEPARATED BY space.
  WHEN 'CRCREATED'.
    CONCATENATE 'Please authorize' lv_object_id
    INTO ls_document_data-obj_descr SEPARATED BY space.
  WHEN OTHERS.
    CONCATENATE 'Support Msg' lv_object_id
    'is in' lv_status 'status'
    INTO ls_document_data-obj_descr SEPARATED BY space.
ENDCASE.


*=======================================================================
* createing Body
*=======================================================================
* Hi
CLEAR : ls_text.
ls_text = 'Hi,'.
APPEND ls_text TO lt_text.

*Blank Line
CLEAR : ls_text.
ls_text = '<br></br>'.
APPEND ls_text TO lt_text.
CASE lv_status.
  WHEN 'NEW'.
*Support Message has been created or reassigned in NEW status.
    CLEAR : ls_text.
    CONCATENATE 'Support Messag' lv_object_id
    'has been created or reassigned to you.'
    INTO ls_text SEPARATED BY space.
    APPEND ls_text TO lt_text.

*Blank Line
    CLEAR : ls_text.
    ls_text = '<br>'.
    APPEND ls_text TO lt_text.


*Please raise a CR and waith untill it is aurorized then make the status
*ASSIGNED to continue further.
    CLEAR : ls_text.
    CONCATENATE
    'Please raise a CR and waith untill it is aurorized then make the'
    'status ASSIGNED to continue further.'
    INTO ls_text SEPARATED BY space.
    APPEND ls_text TO lt_text.

*Blank Line
    CLEAR : ls_text.
    ls_text = '</br>'.
    APPEND ls_text TO lt_text.


 WHEN 'AUTHORIZED'.
    CLEAR : ls_text.
    CONCATENATE 'CR' lv_object_id 'is authorized.'
    INTO ls_text SEPARATED BY space.
    APPEND ls_text TO lt_text.

*Blank Line
    CLEAR : ls_text.
    ls_text = '<br>'.
    APPEND ls_text TO lt_text.

*Please check and make the status of the support message ASSIGNED
*status to continue further.
    CLEAR : ls_text.
    CONCATENATE 'Please check and make the status of the support'
                'message ASSIGNED status to continue further.'
    INTO ls_text SEPARATED BY space.
    APPEND ls_text TO lt_text.

*Blank Line
    CLEAR : ls_text.
    ls_text = '</br>'.
    APPEND ls_text TO lt_text.

 WHEN 'CRCREATED'.
    CLEAR : ls_text.
    CONCATENATE 'CR' lv_object_id 'has been created.'
    INTO ls_text SEPARATED BY space.
    APPEND ls_text TO lt_text.

*Blank Line
    CLEAR : ls_text.
    ls_text = '<br>'.
    APPEND ls_text TO lt_text.

*Please check and authorized it.
    CLEAR : ls_text.
    ls_text = 'Please check and authorized it.'.
    APPEND ls_text TO lt_text.

*Blank Line
    CLEAR : ls_text.
    ls_text = '</br>'.
    APPEND ls_text TO lt_text.


WHEN OTHERS.
    CLEAR : ls_text.
    CONCATENATE 'Support Message' lv_object_id
    'is in' lv_status 'status now.'
    INTO ls_text SEPARATED BY space.
    APPEND ls_text TO lt_text.

*Blank Line
    CLEAR : ls_text.
    ls_text = '<br>'.
    APPEND ls_text TO lt_text.

*Please check and start working as soon as possible.
    CLEAR : ls_text.
    ls_text = 'Please check and start working as soon as possible.'.
    APPEND ls_text TO lt_text.

*Blank Line
    CLEAR : ls_text.
    ls_text = '</br>'.
    APPEND ls_text TO lt_text.
ENDCASE.

*Blank Line
CLEAR : ls_text.
ls_text = '</br></br>'.
APPEND ls_text TO lt_text.

*Please click the following link to take a action.
CLEAR : ls_text.
ls_text = 'Please click the following link to take a action.'.
APPEND ls_text TO lt_text.

*inseting link
CLEAR : ls_text.
CONCATENATE 'VIEW/EDIT Object' lv_object_id INTO lv_link_title
SEPARATED BY space.

CONCATENATE '<A HREF=' lv_link '>'
   INTO ls_text.
APPEND ls_text TO lt_text.

CLEAR : ls_text.
CONCATENATE  '<H5>' lv_link_title '</H5></A>'
INTO ls_text.
APPEND ls_text TO lt_text.

*Blank Line
CLEAR : ls_text.
ls_text = '<br></br>'.
APPEND ls_text TO lt_text.

*Adding Signature
*WThanks and regards
CLEAR : ls_text.
ls_text = 'Thanks and regards,'.
APPEND ls_text TO lt_text.

*Blank Line
CLEAR : ls_text.
ls_text = '<br>'.
APPEND ls_text TO lt_text.

*WF-Batch
CLEAR : ls_text.
ls_text = 'WF-BATCH'.
APPEND ls_text TO lt_text.

* Receiver
Loop at lt_user_IDS into ls_user_IDS.
ls_wa_receive-rec_type = 'G'.        "SAP User
ls_wa_receive-receiver = ls_user_IDS. "Mail Address
APPEND ls_wa_receive TO lt_receivers.
Endloop.

Loop at lt_EMAIL_ADDRESSES into ls_EMAIL_ADDRESSES.
ls_wa_receive-rec_type = 'U'. "Internet User
ls_wa_receive-receiver = ls_EMAIL_ADDRESSES. "Mail Address
APPEND ls_wa_receive TO lt_receivers.
Endloop.

*This function module is used to send mail
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
  EXPORTING
    document_data              = ls_document_data
    document_type              = 'HTM'
    put_in_outbox              = 'X'
    commit_work                = 'X'
  TABLES
    object_content             = lt_text
    receivers                  = lt_receivers
  EXCEPTIONS
    too_many_receivers         = 1
    document_not_sent          = 2
    document_type_not_exist    = 3
    operation_no_authorization = 4
    parameter_error            = 5
    x_error                    = 6
    enqueue_error              = 7
    OTHERS                     = 8.



*If Mail Send Successful
IF sy-subrc EQ 0.
  COMMIT WORK.
*   Push mail out from SAP outbox
  SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.          "#EC CI_SUBMIT
ENDIF.



END_METHOD. ***

Thanks and regards,

SNJY

Former Member
0 Kudos

Hi Ameya,

When you are creating WD component, you can create windows parameter under WINDOW part of WD component. This will add to the URL of the WD component. This will act as import parameter for the WD component. Now based on this import parameter, create a view that will show you the desired result.

Regards,

Sangvir SIngh

Answers (1)

Answers (1)

Former Member
0 Kudos

1) First use the Send mail activity of WF , in mail tab maintain t he Recipent type has "U E-Mail Address" there and you can give the recipient mail id directly like (xyz@gmailcom)

2) In the same Send mail activity give the link in HTML anchor tabs, like shown below and it will be a hyper link to you r WD app. <a href = " http://www.mydrreddys.com">; http://www.mydrreddys.com</a>.

To generate the link you have to concatenate the parameters accordingly in all environments (DEV/QA or PROD)

Regards,

Chandra,

+91 9989888971.