How to develop approval buttons IN Purchase Orders Approval

Dear Experts,

One of our customers request for development to send a mail behind the Forward button in purchase orders/purchase requisitions. As you know, in the standard application, the following screen is displayed behind the forward button.

blog 2.1

In this case, I want to share with you how to develop approval buttons (e.g. Approve/Reject/Forward) in Purchase Orders Approval. In case of need, you can switch the buttons off / on or interfere with back operations.

First, we copy the standard application and upload it to WEBIDE.

blog 2.2

Next step, we add the code below to the top of “onInit”. (the all of code is shared below) In this case, the Approve, Reject and Forward buttons will be manually generated below. At the same time, we can remove the wanted button. Now we can develop for these buttons.

blog 2.3

Next step, Instead of the “handleForward” function used by the Forward button, we write the “sentMail“ function and we use the “sentMail“ function below.

blog 2.4

We are developing to open mail screen in “sendMail” function and add PO number as text. 

blog 2.5

I definitely recommend cleaning the cache in the Fiori system after the process is completed and deployed. I share methods to clear cache.

  1. Transaction: /IWFND/CACHE_CLEANUP on Gateway (oData cache clearing).
  2. Transaction: /IWBEP/CACHE_CLEANUP on Backend and Gateway (oData cache clearing).
  3. Run report /UI2/INVALIDATE_GLOBAL_CACHES. This cache clearing is mandatory especially to verify the translations integrated for ex tiles,groups,catalogs in Launchpad admin

Now we can send PO number using Forward button.

blog 2.6

You can get the complete code from the link below

https://ufile.io/mjr56
blog 2.7

Yazar: S4C