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: 

User exit for GR non-valuated checkbox

Former Member
0 Kudos

HI Experts,

In ME21N and ME51N,when user select Distribution account assignment (Distrib. on quantity basis/ Distribution by percentage), GR non-valuated (In Delivery tab) become checked automatically.

When select back Single account assignment, GR non-valuated will not be un-checked automatically. Do anyone know what user exit can be use to uncheck the GR non-valuated check-box automatically when select single account assignment?

I saw the same question in forum but there is not correct answer. Please help.

1 ACCEPTED SOLUTION

Former Member

I've solved the problem myself by using following user exits.

ME51N:

User Exit : MEREQ001

Function Exit : EXIT_SAPLMEREQ_005

ME21N:

User Exit :MM06E005

Function Exit : EXIT_SAPMM06E_012

Add in following coding to prompt error message instead of uncheck the GR non-valuated checkbox automatic.

Coding for ME21N:

DATA: ls_itm(6) TYPE C. 

LOOP AT tekpo WHERE knttp eq 'K' AND

                      vrtkz IS INITIAL AND

                      twrkz IS INITIAL AND

                      NOT weunb IS INITIAL.

    MOVE tekpo-ebelp TO ls_itm.

    SHIFT ls_itm LEFT DELETING LEADING '0'.

    MESSAGE ID 'SU' TYPE 'E' NUMBER '000' WITH 'Item ' ls_itm 'GR non-valuated should not check.'.

  ENDIF.

ENDLOOP.

Coding for ME51N:

DATA: itb_pr TYPE mereq_item,
      wa_bapiret2 TYPE bapiret2.

  IF im_req_item IS NOT INITIAL.

    itb_pr = im_req_item->get_data( ).

    IF itb_pr-knttp eq 'K' AND
       itb_pr-vrtkz IS INITIAL AND
       itb_pr-twrkz IS INITIAL AND
       NOT itb_pr-weunb IS INITIAL.

      wa_bapiret2-type       = 'E'.
      wa_bapiret2-id         = 'SU'.
      wa_bapiret2-number     = '000'.
      wa_bapiret2-message_v1 = 'GR non-valuated should not check.'.
      APPEND wa_bapiret2 TO ex_messages.
    ENDIF.
  ENDIF.

3 REPLIES 3

Former Member
0 Kudos

Hi,

I think you can try with the BADI ME_PROCESS_PO_CUST

Method : PROCESS_ITEM

IF_PURCHASE_ORDER_ITEM_MM

GET_PREVIOUS_DATA

SET_DATA

0 Kudos

Could you explain in more detail and provide some sample program. I'm not good in creating user exit. Thanks.

Former Member

I've solved the problem myself by using following user exits.

ME51N:

User Exit : MEREQ001

Function Exit : EXIT_SAPLMEREQ_005

ME21N:

User Exit :MM06E005

Function Exit : EXIT_SAPMM06E_012

Add in following coding to prompt error message instead of uncheck the GR non-valuated checkbox automatic.

Coding for ME21N:

DATA: ls_itm(6) TYPE C. 

LOOP AT tekpo WHERE knttp eq 'K' AND

                      vrtkz IS INITIAL AND

                      twrkz IS INITIAL AND

                      NOT weunb IS INITIAL.

    MOVE tekpo-ebelp TO ls_itm.

    SHIFT ls_itm LEFT DELETING LEADING '0'.

    MESSAGE ID 'SU' TYPE 'E' NUMBER '000' WITH 'Item ' ls_itm 'GR non-valuated should not check.'.

  ENDIF.

ENDLOOP.

Coding for ME51N:

DATA: itb_pr TYPE mereq_item,
      wa_bapiret2 TYPE bapiret2.

  IF im_req_item IS NOT INITIAL.

    itb_pr = im_req_item->get_data( ).

    IF itb_pr-knttp eq 'K' AND
       itb_pr-vrtkz IS INITIAL AND
       itb_pr-twrkz IS INITIAL AND
       NOT itb_pr-weunb IS INITIAL.

      wa_bapiret2-type       = 'E'.
      wa_bapiret2-id         = 'SU'.
      wa_bapiret2-number     = '000'.
      wa_bapiret2-message_v1 = 'GR non-valuated should not check.'.
      APPEND wa_bapiret2 TO ex_messages.
    ENDIF.
  ENDIF.