Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Filling Message long text dynamically at runtime

vinod_vemuru2
Active Contributor
0 Kudos

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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.

[code]

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

RECEIVING

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

RECEIVING

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'.

ENDIF.

ENDLOOP.

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( ).

ENDLOOP.

ENDIF.

ENDIF.

ENDMETHOD.

[/code]

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

Andrew

4 REPLIES 4

Former Member
0 Kudos

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.

[code]

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

RECEIVING

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

RECEIVING

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'.

ENDIF.

ENDLOOP.

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( ).

ENDLOOP.

ENDIF.

ENDIF.

ENDMETHOD.

[/code]

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

Andrew

vinod_vemuru2
Active Contributor
0 Kudos

I am using 4.6C version

0 Kudos

Anybody have some solution for this?

vinod_vemuru2
Active Contributor
0 Kudos

Thank u