Wednesday, 9 May 2018

How-To Perform any Action from Email Using /SKYBFR/YCA1 Add-On

As you are probably already aware, Skybuffer Simple Communication SAP Add-On (/SKYBFR/YCA1) can be used to perform any actions with any business objects in the system. You can record inbound email comments, you can create orders, etc.

Now we are going to show you how to create a button in email for any custom action which is not assigned to work item so that we could get a received action and comment in a custom comment-processing BADi.

Business Case


In our case, we have a background ABAP report that sends weekly notifications to Project Managers to update their Project Status. Project Manager can just press Action Button in email, write Current Status and send it. /SKYBFR/YCA1 processes that Action Email and calls custom BADi which writes that Status to Project data.

Implementation


We’ll only show the code specific to this case here.

The button is created through a usual method of GET_HTML_BUTTONS

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials and Materials

To deliver ONLY:

Iv_email – Inbound Address for /SKYBFR/YCA1

Is_gosobject – Object Type (not existing in the system as it is to be differentiated from standard ones) and Object ID as a string of Keys according to which we are to find our object in the system

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials and Materials

Iv_action1 – Action Code for us to be able to understand what to do with this object

Iv_text1 – Text to be written on the button (can be omitted if it is already in the template)

Iv_templatename или iv_template – name or HTML code of the Template

As we can see, GUID is formed in the table and all the necessary information is captured by /SKYBFR/YCA1.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials and Materials

Then you prepare and send your email in a regular way using standard /SKYBFR/YCA1 methods.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials and Materials

When the button in the email is pressed, and the comment is written and sent, there comes an inbound email and /SKYBFR/YCA1 processes it correctly as any usual Action Email.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials and Materials

There are no actions performed, our settings for GOS object type are customized to ban comments and attachments capturing so that YCA1 does not attempt to process them.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials and Materials

But we get everything necessary in a comment-processing BADi.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials and Materials

In BADi we only implement processing of a necessary type of object according to IF.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Tutorials and Materials

We parse our encoded keys and find this object.

We record a comment where we believe it fits (and/or perform an action for specified Action Code).

2 comments: