Skip to Content
avatar image
Former Member

Enhancements to add custom message log in purchase order

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

8 Answers

  • Best Answer
    Mar 04, 2009 at 12:43 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 03, 2009 at 07:12 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 04, 2009 at 12:24 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 04, 2009 at 12:52 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 04, 2009 at 12:31 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 04, 2009 at 12:45 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 07, 2010 at 06:55 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • May 14, 2010 at 09:54 PM

    This message was moderated.

    Add comment
    10|10000 characters needed characters exceeded