SAP Password reset tool – Part 2
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.
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.
Now the only thing I added is an Adaptive card Teams connector to my Azure Logic App.
I have designed my adaptive card in the official Microsoft adaptive card designer Adaptive Cards 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.
As soon as we send an email, the Logic App will trigger and the adaptive card will send a message to Microsoft teams.
send an email with the below subject line. (check my previous post to know why I am adding subject line )
The notification arrived in Microsoft Teams
Finally, after selecting user-id and action (Unlock or Reset) it will hit SAP and reset or unlock based on user choice.
for the above adaptive card connector I have composed a message and dynamically added SAP users to it.
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.
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.
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.
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.