Workflow - add Travel Expense as PDF to email

Jun 19, 2017 at 09:04 AM


avatar image


I'm trying to attach the travel expense form as PDF to an e-mail notification in the expense form approval flow.

I am generating the expense form with the BUS20891 "GENERATEEXPENSEFORM" method, but I don't know how to convert it to PDF or how to add it to "_attachment_objects" in the email step.

Could anyone help, please?

Thank you

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Lukas Weigelt Jul 17, 2017 at 02:11 PM

Hi there,

it's refreshing to see a distinct and tangible question for once :-)

Your approach won't work for your requirement because the Method GetExpenseForm of BUS2089 (assuming it's a typo in your opening post and we're talking about the same thing here) ultimately executes RPRTEF00 which returns the old ABAP List only - no ADS involved here whatsoever. There is no "officially supported for end customers"-FM that I know of, but there is, of course a way with internal standard-means. You can use the following snippet to get a PDF form for a REINR in BLOB format:

i_employeenumber = <pernr>
i_tripnumber = <reinr>
i_periodnumber = <perionr>
i_trip_component = ' '
i_trip_data_source = 'DB'
i_display_form = ' '
e_pdf_form = <pdf_form_content>
et_return = <et_return>.

Move the result to an xstring variable, the conversion works internally; that's your pdf.

If I understood correctly, you apparently want to attach that PDF to an Email within a workflow. You might want to do a bit research in the direction of interface IF_SWF_IFS_WORKITEM_EXIT, since this part of your requirement is basic workflow knowlegde and can be derived from the official documentation. ;-)

Cheers, Lukas

10 |10000 characters needed characters left characters exceeded
Skip to Content