cancel
Showing results for 
Search instead for 
Did you mean: 

Number Range for Purchase Requisition

Former Member
0 Kudos

Dear Experts,

While saving the PR, based on the plant i need to control the number range. Eg. if plant is '1000', the range should be 'Z1'.

i found a User exit EXIT_SAPLMEREQ_009 for PR but i dont know whether i can achive the above with this.

Please advise.

Thanks in advance,

Chintu

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

HI,

The EXIT what you have mentioned will work. If you want to Check it just write a BREAK-POINT and rise a message in the EXIT,

AND RUN the transaction enter the plant and wrong number if it risess the message what you have writen in the EXIT.

Then it will be the right EXIT to write the IF CONDITIONS FOR RESTRICTING THE NUMBER RANGES for the selected Plants.

The Answer what i have given may help you.

Thanks & Regards,

Anvesh Gummadapu.

Former Member
0 Kudos

Hello Experts,

Thanks for your replies. The exit is working while saving the PR but how should i retrieve the plant and document type

Thanks in advance,

Chintu

Former Member
0 Kudos

Hi

DATA PR_HEADER TYPE MEREQ_HEADER.
DATA PR_ITEMS TYPE MMPUR_REQUISITION_ITEMS.
DATA PR_ITEM TYPE MMPUR_REQUISITION_ITEM.
DATA: L_ITEM  TYPE MEREQ_ITEM.

CALL METHOD me->get_items
  receiving
    re_items      = PR_ITEMS.

READ TABLE PR_ITEMS INTO PR_ITEM INDEX 1.

CALL METHOD PR_ITEM->get_data
  receiving
    re_data = L_ITEM.

CHECK L_ITEM-WERKS = '1000'.

CALL METHOD IM_REQ_HEADER->GET_DATA
        RECEIVING RE_DATA = PR_HEADER.

SELECT SINGLE * INTO L_T161
   WHERE BSART = PR_HEADER-BSART
        AND BSTYP = PR_HEADER-BSTYP.

IF L:T161-NUMKI NE 'Z1'.
  EX_RANGE = 'Z1'.
ENDIF.

.

Max

Former Member
0 Kudos

Thanks Max for your quick reply.

The header data is getting populated but the item data (plant) is not getting populated. please suggest

Thanks in advance,

Chintu

Former Member
0 Kudos

Hi

Any item data or plant only?

Max

Former Member
0 Kudos

Hi Max,

all the item data

Chintu

Former Member
0 Kudos

Hi

I've tried this in my system and it works fine

DATA PR_HEADER TYPE MEREQ_HEADER.
DATA PR_ITEMS  TYPE MMPUR_REQUISITION_ITEMS.
DATA PR_ITEM   TYPE MMPUR_REQUISITION_ITEM.
DATA: L_ITEM   TYPE MEREQ_ITEM.
DATA: L_T161    TYPE T161.

CALL METHOD IM_REQ_HEADER->GET_ITEMS
  RECEIVING
    RE_ITEMS = PR_ITEMS.

READ TABLE PR_ITEMS INTO PR_ITEM INDEX 1.

CALL METHOD PR_ITEM-ITEM->GET_DATA
  RECEIVING
    RE_DATA = L_ITEM.

CHECK L_ITEM-WERKS = '1000'.

CALL METHOD IM_REQ_HEADER->GET_DATA
  RECEIVING
    RE_DATA = PR_HEADER.

SELECT SINGLE * INTO L_T161
   FROM T161
   WHERE BSART = PR_HEADER-BSART
        AND BSTYP = PR_HEADER-BSTYP.

IF L_T161-NUMKI NE 'Z1'.
  EX_RANGE = 'Z1'.
ENDIF.

Max

Former Member
0 Kudos

Hi

The number range depends on PR document type, so you should check only certain document types are used for that plant

Max

Former Member
0 Kudos

Hi

The number range depends on PR document type, so you should check only certain document types are used for that plant

In order to get th range u need to read the table T161, if the assigned range is Z1 you don't nothing else you set Z1:

The exit is Ok, because you can change the range there

Max