Skip to Content

Filling Message long text dynamically at runtime

Hi all,

We have a requirement where we need to display warning message if transportation data is not maintained for any one of the line item while creating(ME21N)/changing(ME22N) STO.(when save button is pressed). For this we are using FM AQ_INT_SHOW_MESSAGE_AS_POPUP in the user exit EXIT_SAPMM06E_013. If the user clicks the question mark on the warning popup we need to display all the material numbers for which transportation data is not maintained. Also we need to keep the document under HOLD if the transportation data is not maintained for any one of the line item.Is there any way to achieve these requirements? Please suggest some solution for this.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 04, 2007 at 02:03 PM

    What version are you on?

    If on ECC5 or ECC6 then the BADI 'ME_PROCESS_PO_CUST' may give better options.

    If you look at the following code implemented in the CHECK method of "ME_PROCESS_PO_CUST" BADI (from another post I did about this BADI) , you will see it adds a customer message to the standard PO error list using the macro MMPUR_MESSAGE from the MM_MESSAGES_MAC include.

    The invalidate() method prevents saving of the order until the error is fixed.

    You could add separate messages for each material number with problems.


    METHOD if_ex_me_process_po_cust~check.

    • NB: Add Type Group MMMFD to implementing class properties tab

    DATA: lt_items TYPE purchase_order_items,

    l_item_wa TYPE purchase_order_item,

    l_item TYPE mepoitem,

    l_total TYPE brtwr,

    l_matkl TYPE matkl,

    l_flag TYPE c.

    INCLUDE mm_messages_mac. "useful macros for message handling

    CLEAR: l_total, l_flag.

    • Read PO Line Items list

    CALL METHOD im_header->get_items


    re_items = lt_items.

    • Loop through items and calculate total

    LOOP AT lt_items INTO l_item_wa.

    • Get detail data for this line

    CALL METHOD l_item_wa-item->get_data


    re_data = l_item.

    l_matkl = l_item-matkl.

    l_total = l_total + l_item-brtwr.

    • Check if any lines missing contract number

    IF l_item-konnr IS INITIAL.

    l_flag = 'X'.



    IF l_flag = 'X'.

    IF l_total > 5000.

    mmpur_metafield mmmfd_agreement.

    mmpur_message 'E' '06' '999'

    'Purchase order over $5000.00 requires a contract' '' '' ''.

    • invalidate the object

    CALL METHOD im_header->invalidate( ).

    LOOP AT lt_items INTO l_item_wa.

    CALL METHOD l_item_wa-item->invalidate( ).






    There are other methods available for the Header or Line objects - possibly methods for "Hold".


    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 05, 2007 at 04:31 AM

    I am using 4.6C version

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 08, 2008 at 02:01 PM

    Thank u

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.