We have to make it possible that an automated email containing PO is sent to the vendor when PO is approved from Fiori PO Approval App.
Connecting PO Smart Form and sending email to relevant vendor using standard workflow was not working for us.
In order to make it possible without modifying standard workflow in short amount of time.I came up with an idea to make it possible as a separate functionality and run it as background job.
- PO smart from was working properly to start with so I just added email functionality to it using class method..CL_BCS.
- After adding mail functionality to PO smart from we were able to send PO to desired email address…To check mail status use t-code SOST.
- Now i have to make it possible to send multiple PO to the relevant email addresses only when they are approved in Fiori PO App.
To make it possible i made a program to run as background scheduled job..
- CDPOS and CDHDR are table used to record document change in SAP. I extracted document change from these table with certain conditions matching EKKO table where released PO’s will have release indicator 3.
- Once i had data in the internal table i checked it with EKKO.
- IF data is matched it is then recorded in internal table and all the non-matching entries are inserted in Z-table with messages of data missing.
- Now all the entries are present in internal table with PO number and vendor email addresses.
- All the verified data is then inserted in Ztable to keep track of emailed PO’s
- I used submit method to call my PO program with desired parameters and loop is required to iterate it with all the entries.
Note. Programming paradigm might change according to your expertise but the above code is pretty basic for understanding the concept.