Skip to Content
Apr 12 at 09:36 AM

how to send ME2N report output as excel to email id




1) New transaction to be called as ZME2N to have all fields same as ME2N on selection screen and in addition need to have new field called email ids as multiple input values and 2 radio button say Detail and Summary.

2) When 'Detail' radio button is clicked whatever ME2N output need to send as an excel to mentioned email id and output need not display on screen but message/pop up 'Detail report email sent'. The report result has many fields but some fixed fields say 20 fields to be send as excel ( This could be foreground and as well as background job every week and so it need not display result on screen in any case). Also, some extra fields to be added in excel and logic needs to be added for extra fields. Again this is applies only in excel not in report output.

3)When 'Summary' radio button is clicked need to send result, whatever ME2N output as an excel to mentioned email id but here it will have some extra logic to sum up rows and send fewer rows data and message/pop up 'Summary report email sent'.

Sending excel as email is somewhat familiar to us but how to have same selection screen as ME2N with extra fields, making use of same logic of ME2N ( so even if SAP changes in future, it should apply to us as well without any efforts) to get result and then send result as email. Please suggest best way or sample code if you are familiar.

Additional note: when we do the analysis we found there is no internal table but micros and write statement are there behind this transaction. Also, I think even migration to SAP S4 HANA doesn't have any change in this code as I saw some code of ECC and SAP S4 HANA for ME2N.