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: 

Enhancements to add custom message log in purchase order

0 Kudos

Hi All,

I need to add a new custom error message using ME_PROCESS_PO_CUST in the application log of purchase order.

How can i access the applcation log data of the purchase order to add a new message.

Thanks and Regards,

Vijay

1 ACCEPTED SOLUTION

mvoros
Active Contributor
0 Kudos

Hi,

have you tried to use any macro from include mm_messages_mac? If you go to SE18 and enter your BADI, then you can display Sample code (Goto -> Sample Code -> Display). Unfortunately the method check is empty but if you check method process_item you can see there how to populate message into log using macros from include mm_messages_mac. I am not sure but these macros may work in CHECK method as well. Just give a try and test it.

Cheers

9 REPLIES 9

saranwin
Contributor
0 Kudos

Hey,

Write you custom message in Method : CHECK, it will trigger at the time of Check, Hold and Save the PO using T.code ME21, ME21N, ME22, ME22N, ME23 and ME23N. The error message will display in the Log.

Log : Where you will get all the error or warning message in pop-up screen.

to get the header and line item value use the below coding....

Sample Code:

data : ls_hdr type mepoheader,
           ls_mepo type mepoitem ,
           lt_itm type purchase_order_items,
           ls_itm type purchase_order_item.
 
  ls_hdr = im_header->get_data( ).
if  ( sy-tcode = 'ME21N' or sy-tcode = 'ME22N' or sy-tcode = 'ME23N'
      or sy-tcode = 'ME21' or  sy-tcode = 'ME22' or sy-tcode = 'ME23' or sy-tcode = 'ME28' or  sy-tcode = 'ME29N' ) and ls_hdr-ekorg eq 'IN01'.
      clear lt_itm.
      call method im_header->get_items
        receiving
          re_items = lt_itm.
      loop at lt_itm into ls_itm.
        call method ls_itm-item->get_data
          receiving
            re_data = ls_mepo.
        if ls_mepo-loekz eq 'L'.
          lv_del = 'X'.
        endif.
        if ls_mepo-elikz eq 'X'.
          lv_delivery = 'X'.
        endif.
      endloop.
Endif.

Regards,

Saravanan M

0 Kudos

Hi Saravanan,

Thanks for your reply.

In your sample code, you are not populating any error message to the popup log.

I want to know how we can populate the error message in the log inside the BADI.

Please let me know if you have the code.

Thanks and Regards,

Vijay

mvoros
Active Contributor
0 Kudos

Hi,

have you tried to use any macro from include mm_messages_mac? If you go to SE18 and enter your BADI, then you can display Sample code (Goto -> Sample Code -> Display). Unfortunately the method check is empty but if you check method process_item you can see there how to populate message into log using macros from include mm_messages_mac. I am not sure but these macros may work in CHECK method as well. Just give a try and test it.

Cheers

0 Kudos

Hi Martin,

Thanks.

I think the sample code message macro will solve my problem.

I will update the thread once I have done the coding.

Vijay

saranwin
Contributor

Hey Vijay,

Just write your error message inside the CHECK Method. It will come in the message List. No need of using any Macro's. I have done the samething...

Sample Code.

If.

Message 'Purchase order still containing faulty' type 'E'.

Endif.

The same code you write in CHECK Method and Let me know it will work.

Regards,

Saravanan M

0 Kudos

Hi Saravan,

My question is to log the message in the application log popup window of purchase order transaction.

Martin have given the answers in the message.

I am closing the message.

Thanks,

Vijay

Former Member
0 Kudos

Hi All,

I too have a similar issue. I want to display a warning message while saving the PO. I tried the above option and I am getting my message added to message log. But the problem is, I wanted the message to be displayed as item level message corresponding to particular PO item which has the error entry, but instead my message is logged as header level message. Can you people suggest me a solution to make my message to be logged as item message.

Thanks and Regards,

Abdul Shabeer.

0 Kudos

I have two error messages in the SAP Purchasing portals preventing me from completing my Purchase Order.

1) Purchase Order Applicant at header level must be introduced, Type E

2) Ite 010 Group of non-certified items Q6 for the supplier 0001500864

    Ite 020 Group of non-certified items Q6 for the supplier 0001500864

Please advise as to how to fix this.

Thank You,

Bob

jim_donahue
Explorer
0 Kudos

This message was moderated.