cancel
Showing results for 
Search instead for 
Did you mean: 

RPA clipboard activity vs email body

liskaj01
Participant
0 Kudos

Hello experts,

I have list of values (x rows and 4 columns) that I would like to put to e-mail body.

When marking all records and using standard ALV grid SAP button for copying to clipboard (using click activity) :

and after that in email body using "Get Clipboard" activity I am able to get the data to e-mail body. However they are not formatted to columns. It looks like this:

If I simulate this in same way using the button above and then Ctrl+V in new e-mail in Outlook, it is really not formatted. But if you get the values from Excel and then put them to new mail body they are formatted.

So I have tried to use Excel as extra step workaround (downloaded the result, marked records in excel sheet and put them to e-mail body) and:

1) When using Get Values (Cells) and putting result of this step to body I am getting error "the type of /body must be a string"

2) When marking records (Select Range) in Excel and using Set Clipboard and Get Clipboard activities I am getting error "Expected a string, got an object" when setting clipboard

3) When Selecting Range and simulating keystrokes Ctrl + C and in e-mail body Ctrl + V it fails on DispInvoke after selecting that range.

My question is whether this could be solved somehow and get a formatted data in mail body using IRPA or its better to send it as attachment?

Thank you

Accepted Solutions (0)

Answers (2)

Answers (2)

liskaj01
Participant

Hello and thanks Martina for that code as it really helped to point me to direction of html body. So I noticed, that there is possibility directly in SAP to export results to html file. Then in IRPA you only use function Read file and put result of this action to mail body. Body has to be in html format.

MartinaKolafova
Explorer
0 Kudos

Hi Jaroslav, you can take text from the clipboard and then insert HTML tags into it using a custom script. Set isHtmlBody to true and you will have a table in the e-mail:

MartinaKolafova
Explorer
0 Kudos
// Split the string into rowsvar rows = tableString.split('\n');
// Create the HTML tablevar htmlTable = '<table border="1">\n';
// Process each rowfor (var i = 0; i < rows.length; i++) { // Split each row into cells var cells = rows[i].split(',');
// Create a table row (tr) for each row htmlTable += ' <tr>\n';
// Process each cell in the row for (var j = 0; j < cells.length; j++) { // Add a table data (td) for each cell htmlTable += ' <td>' + cells[j].trim() + '</td>\n'; }
// Close the table row (tr) for each row htmlTable += ' </tr>\n';}
// Close the HTML tablehtmlTable += '</table>';

return htmlTable;