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: 

Enhancement to raise error for some gl accounts while saving purchase order creation

Former Member
0 Kudos

Hi All,

        Need List of Enhancement to raise error for some GL accounts, while saving purchase order document creation or change.

        Or else need enhancement once the GL account is entered in the screen.

        I have found the Exits

          EXIT_SAPMM06E_012

          EXIT_SAPMM06E_013

        I am not sure how can this be used to raise message.

        Thanks in advance.

       

Regards,

Kishan Raj

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

Use  BAdI ME_PROCESS_PO_CUST, you can use either methods

  • PROCESS_ACCOUNT (so at PAI of screen)
  • CHECK (executed at request or before save) there loop on items and inner loop on their accounting data

Small sample for PROCESS_ACCOUNT, but use search tool, already many samples available


* macro for messages

  include mm_messages_mac.

* Load accounting and item values

  ls_accounting = im_account->get_data( ).

  im_item = im_account->get_item( ).

  ls_item = im_item->get_data( ).

* Be clean, remove message raised previous execution

  mmpur_context mmcnt_context_badi.

  if not ls_accounting-id is initial.

    mmpur_remove_msg_by_context ls_accounting-id mmcnt_context_badi.

  endif.

* Raise some error message

  if 1 = 2.

    mmpur_metafield mmmfd_g_l_acct.

    mmpur_message_forced 'E' 'ZCLASS' '123' ls_accounting-sakto ' ' ' ' ' '.

    im_account->invalidate( ).

    exit.

  endif.

Regards,

Raymond

2 REPLIES 2

Former Member
0 Kudos

Dear Kishan,

You can use BADI ME_PROCESS_PO_CUST for validating Purchase Order.

Regards,

Yance

raymond_giuseppi
Active Contributor
0 Kudos

Use  BAdI ME_PROCESS_PO_CUST, you can use either methods

  • PROCESS_ACCOUNT (so at PAI of screen)
  • CHECK (executed at request or before save) there loop on items and inner loop on their accounting data

Small sample for PROCESS_ACCOUNT, but use search tool, already many samples available


* macro for messages

  include mm_messages_mac.

* Load accounting and item values

  ls_accounting = im_account->get_data( ).

  im_item = im_account->get_item( ).

  ls_item = im_item->get_data( ).

* Be clean, remove message raised previous execution

  mmpur_context mmcnt_context_badi.

  if not ls_accounting-id is initial.

    mmpur_remove_msg_by_context ls_accounting-id mmcnt_context_badi.

  endif.

* Raise some error message

  if 1 = 2.

    mmpur_metafield mmmfd_g_l_acct.

    mmpur_message_forced 'E' 'ZCLASS' '123' ls_accounting-sakto ' ' ' ' ' '.

    im_account->invalidate( ).

    exit.

  endif.

Regards,

Raymond