Application Development and Automation 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:Ā 
Read only

Problem in showing Error message

Former Member
0 Likes
2,621

Hi experts ,

                I am implementing the customer exit 'EXIT_SAPLMEREQ_008' which is triggered before saving data in PR . In this requirement , in some certain condition I have to display some pop messages like standard PR messages as shown below , so that after getting the intimation or warnings user can correct the data and save it again. So , Please anybody tell me the way in which I can display this type of message . If possible please give me some sample code .

                                                  

Thanks & regard ,

Deb .

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,852

Hi

You can try to call fm MM_DOCUMENT_MESSAGES_DISPLAY and after calling it raised the excption of exit   FAILED in order to abort the posting

Max

7 REPLIES 7
Read only

Former Member
0 Likes
1,852

This exit is for customer fields.

Check badi's,

ME_COMMITMNT_PARKING

ME_COMMTMNT_PO_RELEV

ME_COMMTMNT_PO_REL_C

ME_COMMITMENT_STO_CH

to implement error message. No need to do functionality for pop-up. when cursor reach to your message it will show in pop-up

Read only

0 Likes
1,852

Mr. Amol,

             The Exit I have mentioned is working fine for creating Purchase requisition(ME51N). What I need is ,to get this type of message(s) appeared in the given screen shots.

Thanks and regards,

DEB

Read only

Former Member
0 Likes
1,853

Hi

You can try to call fm MM_DOCUMENT_MESSAGES_DISPLAY and after calling it raised the excption of exit   FAILED in order to abort the posting

Max

Read only

0 Likes
1,852

Hi Max,

           Thanks for help . As per your advice I am able to get the messages successfully . But after clicking on continue button the purchase requisition (PR) is created .But my requirement is to stop the creation of Purchase requisition and stay on the same screen, so that any further changes can be done in that PR . Please tell me the way forward .If possible please give some sample code .'

Thanks and regards ,

Deb

Read only

0 Likes
1,852

Hi

You need to raise the exception FAILED: have you done it?

Max

Read only

Former Member
0 Likes
1,852

Hi,

You need to include program mm_messages_mac  and supply a macro with the msg.

macro is MMPUR_MESSAGE_FORCED .

The code will look somewhat like this :

include this program in the start of code:

INCLUDE mm_messages_mac.


use this statement to output message:

MMPUR_MESSAGE_FORCED 'E' 'SY' '499' 'THIS' 'IS' 'ERROR' 'MESSAGE'.



If this doesnt works, then you need to implement BADI ME_PROCESS_REQ_CUST and implement method IF_EX_ME_PROCESS_REQ_CUST~CHECK.

In this method, carry out your check and to display error message do the same as described above.



Regards,

Ashish

Read only

atul_mohanty
Active Contributor
0 Likes
1,852

Hi


Use BADI -  BADI ME_PROCESS_REQ_CUST and method CHECK.


It will trigger when you click 'check' or 'save' button.


Here are sample code :


INCLUDE mm_messages_mac.

   DATA: li_items  TYPE mmpur_requisition_items, 

          lw_items  TYPE mmpur_requisition_item, 

         li_req_item TYPE TABLE OF mereq_item,   

          lw_req_item TYPE   mereq_item,         

   DATA:lif_item TYPE REF TO if_purchase_requisition_item.

    REFRESH:li_items.


    CLEAR: lw_items,lw_req_item,

    IF im_header IS NOT INITIAL.
      CALL METHOD im_header->get_items
        RECEIVING
          re_items = li_items.
      IF li_items IS NOT INITIAL.
        CLEAR: lw_items,lw_req_item.

        LOOP AT li_items INTO lw_items.
          lif_item = lw_items-item.
          IF lif_item IS NOT INITIAL.
            CALL METHOD lif_item->get_data
              RECEIVING
                re_data = lw_req_item.

            APPEND lw_req_item TO li_req_item.
          ENDIF.
          CLEAR lw_req_item.
        ENDLOOP.
      ENDIF.
    ENDIF.


    IF li_req_item IS NOT INITIAL.

* message using the macro


MMPUR_MESSAGE_FORCED 'message type' 'Message ID' 'Message No' 'Value1 '  Value 2  Value 3 Value 4.

    ENDIF.