cancel
Showing results for 
Search instead for 
Did you mean: 

Attach a Business Object as link in Mail

Former Member
0 Kudos

Hi All.

I have requirement of attaching a business object as link in a mail step. I am instantiating the Business Object before the mail step.

I want the instantiated Business Object as an attachment or, link in the Mail. Please provide me with your valuable inputs.

Thanks.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Solved, the issue by creating a BUsiness Object and instantiating it.

MKM
Active Participant
0 Kudos

Hi Nageshwara,

I have also similar requirement.

I have to send a Link in SendMail step of workflow. Once user will click it, it will call FB03 transaction with a document.

I have tried using BOR object and attached it to _Adhoc_Objects. But link is not coming in SBWP.

Please help.

Best Regards,

Manoj

former_member185167
Active Contributor
0 Kudos

Please start a new thread instead of adding to old ones.

MKM
Active Participant
0 Kudos

Hi Rick,

Below is the new thread for my issue.

Thanks,

Manoj

Former Member
0 Kudos

Hi,

Do you want to attach the Business object name[EX : BUS2012] with in the mail??

Thanks.

Former Member
0 Kudos

Hi Viji.

You are absolutely right, i want to attach the business object instantiated in the previous step. Your example is right.

If u have sample code please do share.

Thanks.

Former Member
0 Kudos

Hi,

You can directly use the HTML code [ a href] in the send mail STep type.

When clicking on that link what should happend for you???

Thanks.

Edited by: Viji on Apr 12, 2010 11:36 AM

Former Member
0 Kudos

Hi Viji.

can u please provide me with the sample code. Would be of great help.

Thanks.

Former Member
0 Kudos

Hi,

Here Im not able to enter the HTML code. Search it like HTML link tags. Then use the same in your mail.

Thanks.

Former Member
0 Kudos

Hi All.

Can anyone help me out for attaching a business object to the SAP Mail. HTML Tag for linking an Business Object or otherwise if there is any way i could attach a business object.

Thanks & regards.

LVN Sharma

Former Member
0 Kudos

You have to use Function Module SWN_CREATE_SHORTCUT. Check the following links

http://wiki.sdn.sap.com/wiki/display/CRM/CRMWebUI-LaunchingtransactionsinGUIforWindows

http://wiki.sdn.sap.com/wiki/display/Snippets/CreatingaSAPshortcutforanytransactionandsendingitby+mail

Thanks

Arghadip

Former Member
0 Kudos

Hi Arghadip.

Hey, thanks friend, i have read many of your articles. Great Contributions.

Regarding my requirement, we work on portal. we have no user name and password. how do i proceed.

Thanks & Regards.

LVN Sharma

Edited by: sharmalvn on Apr 12, 2010 4:05 PM

Former Member
0 Kudos

If you are working on Portal this Prompt for logging in will not appear as you are already logged in to portal

Thanks

Arghadip

Former Member
0 Kudos

Hi Arghadip.

I have done as directed by you, sample code:

DATA : BEGIN OF zst_shortcut_par,

fieldname TYPE c LENGTH 60,

fieldvalue TYPE c LENGTH 255,

END OF zst_shortcut_par.

DATA: content TYPE string.

DATA: it_shortcut_param LIKE zst_shortcut_par OCCURS 0 WITH HEADER LINE.

DATA: doc_chng LIKE sodocchgi1.

DATA: tab_lines LIKE sy-tabix,

body_start LIKE sy-tabix.

DATA: it_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE.

DATA: it_objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.

DATA: it_objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.

DATA: it_reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.

CLEAR it_shortcut_param.

REFRESH it_shortcut_param.

it_shortcut_param-fieldname = 'G_VBELN'.

it_shortcut_param-fieldvalue = '0000000035'. "Employee number

APPEND it_shortcut_param.

break innshi.

PERFORM zfm_create_shortcut

TABLES

it_shortcut_param

USING

'INNSHI'

'/DS1/SD_C_I129_PGI'

CHANGING

content.

PERFORM send_mail.

&----


*& Form zfm_create_shortcut

&----


FORM zfm_create_shortcut

TABLES

shortcut_param STRUCTURE zst_shortcut_par

USING

recipient_user_id TYPE syuname

transaction TYPE tcode

CHANGING

content TYPE string.

      • Declaration for shortcut content

DATA : parameter TYPE text255,

v_pernr(12) TYPE c.

DATA : v_tcode TYPE tcode.

  • Check if transaction code is available

CLEAR v_tcode.

SELECT SINGLE tcode FROM tstc

INTO v_tcode

WHERE tcode EQ transaction.

IF v_tcode IS INITIAL.

MESSAGE 'Enter a valid transaction' TYPE 'E' DISPLAY LIKE 'A'.

EXIT.

ENDIF.

  • Populate the parameters to be passed to the shortcut

IF NOT shortcut_param[] IS INITIAL.

CLEAR parameter.

LOOP AT shortcut_param.

CONCATENATE parameter shortcut_param-fieldname '='

shortcut_param-fieldvalue ';'

INTO parameter.

ENDLOOP.

ENDIF.

*CLEAR it_reclist.

*it_reclist-receiver = 'INNSHI'.

*it_reclist-rec_type = 'B'.

*APPEND it_reclist.

      • create the shortcut content for the required transaction

CALL FUNCTION 'SWN_CREATE_SHORTCUT'

EXPORTING

i_transaction = transaction

i_parameter = parameter

i_sysid = sy-sysid

  • i_client = sy-mandt

i_user = recipient_user_id

i_language = sy-langu

i_windowsize = 'Normal window'

IMPORTING

shortcut_string = content

EXCEPTIONS

inconsistent_parameters = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. "zfm_create_shortcut

&----


*& Form SEND_MAIL

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM send_mail .

      • Mail Subject

doc_chng-obj_descr = 'PGI Error Mail'.

      • Mail Contents

CONCATENATE ' The requested change has been made to your temporary address.'

' Please double click on the attachment and choose display to view the updated address'

INTO it_objtxt.

APPEND it_objtxt.

      • Creation of the entry for the document

DESCRIBE TABLE it_objtxt LINES tab_lines.

CLEAR it_objpack-transf_bin.

it_objpack-head_start = 1.

it_objpack-head_num = 0.

it_objpack-body_start = 1.

it_objpack-body_num = tab_lines.

it_objpack-doc_type = 'RAW'.

APPEND it_objpack.

      • Populate attachment content

CLEAR : tab_lines, it_objbin.

CONCATENATE content it_objbin-line INTO it_objbin-line.

APPEND it_objbin.

DESCRIBE TABLE it_objbin LINES tab_lines.

      • Creation of the entry for the compressed attachment

it_objpack-transf_bin = 'X'. "Will get content from content_bin

it_objpack-head_start = 1.

it_objpack-head_num = 1.

it_objpack-body_start = 1.

it_objpack-body_num = tab_lines.

it_objpack-doc_type = 'RAW'.

it_objpack-obj_name = 'PGI ERROR MAIL'.

it_objpack-obj_descr = 'PGI_ERROR REPORT'.

it_objpack-doc_size = tab_lines * 255.

APPEND it_objpack.

      • target recipent(s)

CLEAR it_reclist.

it_reclist-receiver = 'INNSHI'.

it_reclist-rec_type = 'B'.

APPEND it_reclist.

      • Sending the document to recipients with the shortcut attachment

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = doc_chng

put_in_outbox = 'X'

commit_work = 'X'

TABLES

packing_list = it_objpack

contents_bin = it_objbin

contents_txt = it_objtxt

receivers = it_reclist

EXCEPTIONS

too_many_receivers = 1

document_not_sent = 2

operation_no_authorization = 4

OTHERS = 99.

ENDFORM. " SEND_MAIL

it is sending a mail and getting an attachment, when opening it sometimes gives bin error. it_objpack-doc_type = 'OBJ'.

And when document type selected as 'OBJ' gives error 'ASC'.

Please Advice...

Former Member
0 Kudos

Hi,

I want to send mail to SAP inbox, with attachment to BO. With the Above i can send mail to SAP inbox, i am not able to get the object link or the Transaction Code link.

May be i might be doing some mistake.

Please advise.

Thanks

LVN Sharma

Edited by: sharmalvn on Apr 13, 2010 11:40 AM

Former Member
0 Kudos

Hi Arghadip.

I could create a hyper for the transaction, this i have done, as i could not get my object as link in the mail. I have created a transaction for my report and created a hyperlink in the mail. Now the problem with Passing parameter for the transaction. I am unable to pass the parameters. I would like to show the user with the reported executed, result of the report when he clicks on the hyperlink. Could u please advise.

Thanks

LVN Sharma

Former Member
0 Kudos

Hi

Lets say your report is Ztest and has certain parameters on the screen.

Creating a variant and then assigning the report and the variant to T.Code Ztest_wfl.

<A HREF="sap-object://CUST_TRAN ZTEST_WFL"> Call Transaction ZTEST_WFL</A>

With this when you execute the transaction from the mail the selection screen with variant values comes up.

Now point is that these values have to be changed for every instance.So using dynamic variants from STVARV and then modifying their values from workflow itself may help.

Thanks and Regards

aman