If we have a requirement to add output message to Quotation or Order or Delivery or Invoice etc programmatically (not by configuration), then we can do it by calling SAP Function Modules RV_MESSAGES_INSERT followed by RV_MESSAGES_UPDATE. These two FMs should be called in the same order, Insert followed by Update. If the output message is not getting inserted at the desired place, then you need to add a commit work (depending on the place where you are writing your piece of code).
Common problem faced while using RV_MESSAGES_INSERT & RV_MESSAGES_UPDATE.
* You would be able to view the output message only in Display mode (ex VA23/VA03/VL03N/VF03) but NOT in Change mode (i.e. VA22/VA02/VL02N etc).
Solution: Pass NAST-MANUE = ‘X’. ” Message processed manually
Sample code to put Output Message to Delivery Header:
wa_nast-kappl = ‘V2’.
wa_nast-objky = wa_likp-vbeln.
wa_nast-mandt = wa_likp-mandt.
wa_nast-kschl = ‘ZINV’.
wa_nast-spras = ‘E’.
wa_nast-parnr = wa_likp-kunnr.
wa_nast-parvw = ‘SH’.
wa_nast-erdat = sy-datum.
wa_nast-eruhr = sy-uzeit.
wa_nast-nacha = ‘8’.
wa_nast-vsztp = ‘1’.
wa_nast-manue = ‘X’. ” Message processed manually (This is important)
APPEND wa_nast TO i_nast.
CALL FUNCTION ‘RV_MESSAGES_INSERT‘
tab_xnast = i_nast.
CALL FUNCTION ‘RV_MESSAGES_UPDATE‘
msg_kappl = wa_nast-kappl
msg_objky = wa_nast-objky.
If you want to get updates about our new tweaks and tricks, please subscribe. We respect your privacy and take protecting it seriously.
If you liked it, please share it. Thank you very much for your time!!
Image courtesy : www.iconfinder.com