Skip to Content

One of the greatest benefits of implementing Personas is the ability to add new functionality that doesn’t require a developer – at least not in the traditional ABAP sense.  With the use of JavaScript, you can interact with not only the elements within the SAP screen, but with external programs.  During my presentation at TechEd last week in Las Vegas, I demonstrated how to add an email button to a customer master record.  This is very simple and can be added to any master record that has an email field.

I’m using an IDES system with Personas 2.0 for this example and have already simplified the screen.  This is the FD03 (Customer Master) transaction on the General Data screen.

CustomerScreen1.JPG

From here, I added a new script button with the following steps.

EmailScript.JPG

Step 1 just checks to see if the email field is empty.  Step 2 then copies the value of the email field into a variable called ’email’.  Step 3 is the Javascript which concatenates the full string into a “mailto:{email_address}” argument then calls the program with the window.location.href command.

Here is the text of the JavaScript:

args.mailto = “mailto:”;

args.fullmail = args.mailto.concat(args.email);

window.location.href = args.fullmail;

After saving the script and the flavor, my screen now shows the following:

CustomerScreen_withemail.JPG

And after clicking the ‘Email’ button, my Outlook ‘New message’ screen pops up with the email address prefilled. 

eMail_popup.JPG

Since Outlook is my default email client, this works very well for me, as well as my customers who use Outlook.  One small quirk that I’ve found is between Internet Explorer and Google Chrome.  When clicking on the button from within IE, the Outlook window displays immediately.  When clicking on the button from Chrome, the browser prompts me with the message “Confirm Navigation.  All unsaved data will be lost” which requires me to click on “Leave Screen’.

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Bhaskar Burra

    Everything looks good except the last line,


    window.location.href = args.fullmail,  with this you are actually replacing the url with the email url. instead, try the following, it wont prompt the warning message


    window.open(args.fullmail,'_blank');

    this is actually asking to open in a new tab/page so, it wont close the existing window.

    (0) 
    1. Todd Barber Post author

      Hi Bhaskar,

      Yes, I looked at that method; however, with Chrome this method opens a new browser window first before opening Outlook.  The way I wrote it, does not close my window but does require you to click a button.  My client preferred to click on ‘Leave the Screen’ as opposed to having a browser window to close after sending my email.  Additionally, they were primarily IE and not Chrome so it wasn’t a big issue.  Of course, that’s just a personal preference.

      Thanks for the alternative!

      Todd

      (0) 

Leave a Reply