In my previous blog post, I have demonstrated how we can reset SAP password by just sending an email. But there were questions raised by many readers regarding UI, so today I will be explaining how we can beautify the user input.

Our tool has now evolved to a semi-bot, you send an email and an adaptive card will be sent to your Teams where we can select SAP-client and user id mapped to our email.

Implementation:-

I would recommend you to first read my previous blog post if you have not read it already. It is a continuation of my previous post, so I won’t be detailing SAP ABAP, SAP PO, or Integration Suite configuration as it remains the same.

SAP Password reset tool using Azure Logic App, SAP PO/Integration Suite and ABAP

 

Now the only thing I added is an Adaptive card Teams connector to my Azure Logic App.

Logic App – Adaptive Card

I have designed my adaptive card in the official Microsoft adaptive card designer Adaptive Cards Designer.

Designer

Designer

 

After adding the connector, whenever we send an email(you don’t have to worry about JSON structure in the email body this time 😉) we will be getting a teams message from Power Automate with an adaptive card where we just have to select the radio buttons. isn’t it amazing? 🙂

In the adaptive card, I have dynamically added the recipient from the sender email(From) from the “When a new email arrives” connector.

recipient%20in%20Adaptive%20Card

recipient in Adaptive Card

As soon as we send an email, the Logic App will trigger and the adaptive card will send a message to Microsoft teams.

Step 1:

send an email with the below subject line. (check my previous post to know why I am adding subject line )

Email

Email

Step 2:

The notification arrived in Microsoft Teams

Adaptive%20card%20received%20in%20teams

Adaptive card received in teams

Step 3:

as we select and submit Client (in step 2), a new popup will appear like below with user-id (retrieved from SAP) and user choice (unlock/reset)

User%20unlock%20or%20reset

User unlock or reset

Step 4:

Finally, after selecting user-id and action (Unlock or Reset) it will hit SAP and reset or unlock based on user choice.

Hit%20SAP

Hit SAP

for the above adaptive card connector I have composed a message and dynamically added SAP users to it.

Dynamically%20added%20SAP%20users

Dynamically added SAP users

to fetch the users registered against email-id, I am using another HTTP connector and hitting the SAP endpoint. finally, from SAP tables user ids are retrieved.

Step 5:

Finally, if everything goes well. SAP will do its job and return back the result to Logic App. then the Logic app will compose an email, and return it back to the email sender with an appropriate message.

Final%20email%20sent%20by%20Logic%20App

Final email sent by Logic App

 

My workflow looks like below.

 

Some other information:-

To fetch the list of users in SAP for an email-id, use the below query.

    SELECT b~bname INTO TABLE @DATA(lt_usr)
      FROM adr6 AS a
      INNER JOIN usr21 AS b
      ON a~addrnumber EQ b~addrnumber
      AND a~persnumber EQ b~persnumber
      WHERE a~smtp_addr EQ @ev_email.

      IF sy-subrc IS INITIAL.
        it_users = lt_usr.
      ELSE.
         iv_msg = 'No user maintained for email'.
      ENDIF.

 

Conclusion:-

In this blog post, I have used SAP PO to hit SAP ECC6 via PROXY, but developers can directly Hit ABAP RAP endpoint and get this done. Other ways of doing this are by creating a custom Function Module in SAP and directly invoking FM by using SAP Connector in Logic App.

If you have any thoughts, please write in the comment section.

Sara Sampaio

Sara Sampaio

Author Since: March 10, 2022

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x