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: 

ME_PROCESS_REQ_CUST valid costcenter and plant

madhu_vadlamani
Active Contributor
0 Kudos
414

Hi All,

I want to valid Cost centre first four characters with plant four characters like cost centre is 100654356 and plant 1006 then i want to allow to create pr with that line item. I want to throw an error message if the first four characters of cost center is did not match with plant.

I tried methods check,PROCESS_ITEM,PROCESS_ACCOUNT in badi ME_PROCESS_REQ_CUST .Here i am able to valid but it is working only of enter press check in button in the total bar ,but i want to valid this after entering all the individual item and press enter. All valuable suggestions are welcome.

Regards,

Madhu.

1 ACCEPTED SOLUTION

eduardo_hinojosa
Active Contributor
0 Kudos
126

Hi Madhu,

Try with POPUP functions. For instance, set it in a customer function module (Z_*) and try with POPUP_TO_CONFIRM for instance. I did it with PO (it is very similar to this BADI for PR) and it works.

I hope this helps you

Regards

Eduardo

3 REPLIES 3

eduardo_hinojosa
Active Contributor
0 Kudos
127

Hi Madhu,

Try with POPUP functions. For instance, set it in a customer function module (Z_*) and try with POPUP_TO_CONFIRM for instance. I did it with PO (it is very similar to this BADI for PR) and it works.

I hope this helps you

Regards

Eduardo

0 Kudos
126

Hi Eduardo,

You are superb.thanks for your reply.

Method process_tem.

  CONSTANTS: c_int TYPE bsart    VALUE 'ZI',
             c_e   TYPE sy-msgty VALUE 'E',       " message for error
             c_w   TYPE sy-msgty VALUE 'W',       " message for error
             c_id  TYPE sy-msgid VALUE 'ZMM_MSG',
             c_dtype type BSTYP VALUE 'B',
             c_cat TYPE KNTTP VALUE 'U'.
include mm_messages_mac.
*             .
DATA : L_ITEM TYPE MEREQ_ITEM.
DATA kostl type cobl-Kostl.
data sakto type cobl-HKONT.

  CALL METHOD IM_ITEM->GET_DATA
    RECEIVING
      RE_DATA = L_ITEM.

  IMPORT Kostl to Kostl FROM MEMORY ID '1234'.
  IMPORT SAKTO to SAKTO from MEMORY ID 'ABCD'.


CHECK ( IM_COUNT = 1 ).

if kostl is NOT INITIAL.
if L_ITEM-BSTYP = c_dtype AND L_ITEM-KNTTP ne c_cat.
  IF L_ITEM-werks NE kostl+0(4).
*    mmpur_message_forced 'E' '00' '398'
*                    'Cost Center does not belong to Plant'
*                    space
*                    space
*                    space.
* MESSAGE ID c_id TYPE c_e NUMBER 008.



ENDIF.
endif.
ENDIF.

Method Process_account.

DATA : L_ACCOUNT TYPE EXKN.
  DATA : L_ITEM TYPE MEREQ_ITEM.
  data :kostl TYPE exkn-kostL,
        SAKTO  TYPE EXKN-SAKTO.

  CALL METHOD IM_ACCOUNT->GET_EXKN
    RECEIVING
      RE_EXKN = L_ACCOUNT.

  export Kostl FROM L_ACCOUNT-kostl to MEMORY ID '1234'.
  export SAKTO FROM L_ACCOUNT-SAKTO to MEMORY ID 'ABCD'.

Here this is working after i press enter but the issue is am getting it is not triggering at account assignment level tab,triggering only after entering all the items at item level.

Regards,

Madhu.

0 Kudos
126

Hi,

This is working by using badi and exit.

Regards,

Madhu.