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: 

Block Duplication of Line item in me21n

Former Member
0 Kudos

Hi Sap User,

I want restrict same material  no. in 2 line at po creation time.

Guide me ........

Moderator message: please do more research before posting.


Message was edited by: Thomas Zloch

2 REPLIES 2

former_member214878
Active Participant
0 Kudos

I think you will need to define new order process strategy in SPRO.

Copy the existing one program and need to write own routine to validate the material numbers.

This is just a clue by looking at question, will try and post detail one.

Thanks and regards,

Ravindra Sonar.

Former Member
0 Kudos

Hi,

Try the following code in badi ME_PROCESS_PO_CUST.

METHOD IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM.

INCLUDE MM_MESSAGES_MAC.

DATA: LW_ITEM TYPE MEPOITEM.

DATA: LW_POSTED_ITEM TYPE MEPOITEM.

    • Get currently being modified data for the PO line item

CALL METHOD IM_ITEM->GET_DATA

RECEIVING

RE_DATA = LW_ITEM.

  • Get posted data for the PO line item

CALL METHOD IM_ITEM->GET_PERSISTENT_DATA

IMPORTING

EX_DATA = LW_POSTED_ITEM

EXCEPTIONS

NO_DATA = 1.

IF SY-SUBRC = 1.

CLEAR LW_POSTED_ITEM.

ENDIF.

IF LW_ITEM-MATNR = LW_POSTED-ITEM.

MMPUR_MESSAGE_FORCED 'E' 'ZTEST' '000' TEXT-002 '' '' ''.

ENDIF.

Endmethod.