Skip to Content
0

I'm having some difficulties understanding the user-exit for transaction MD01.

Jul 19, 2017 at 10:08 AM

47

avatar image

Hello everyone,

I'm having some difficulties understanding the user-exit for transaction MD01. My colleague has created a new user exit key Z01, and now we would like to add to the user parameter a list of MRP's, not only one.

As stated in the code example, i can start by adding to the user-exit the following (for one MRP):

Copy Code

  1. CLEAR: NO_PLANNING, STOP_PLANNING.
  2. CASE USER_KEY.
  3. WHEN 'Z01'.
  4. UXPAR = USER_PAR.
  5. CONDENSE UXPAR.
  6. WRITE UXPAR+0(3) TO DISPO.
  7. IF DISPO IS INITIAL.
  8. EXIT.
  9. ENDIF.
  10. IF MT61D-DISPO <> DISPO.
  11. NO_PLANNING = 'X'.
  12. ENDIF.

I believe that in this piece of code, the MRP is passed to variable DISPO and that's it. But what if instead of choosing one MRP, i want 3 or 4, added to user parameter like this:

100,200,300,400

Can anyone help me ?

Thank you in advance to all.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Rashid Javed Jul 19, 2017 at 12:19 PM
0

From the code you posted, it seems like that if the user parameter (UXPAR) is not equal to MT61D-DISPO, you do not want to include this material in MRP run hence you put no_planning = 'X'.

Comming back to your question where you said that you want to give multiple values in User Parameter field, I assume that what you want is to check if MT61D-DISPO is equal to any of the value provided in the user parameter list (and if that is the case, set the no_planning flag to X). Check the following code snippet. I hope it answers your question.

DATA: lt_token TYPE TABLE OF mrpuserpar.
CLEAR: NO_PLANNING, STOP_PLANNING.
CASE USER_KEY.
WHEN 'Z01'.
UXPAR = USER_PAR.
CONDENSE UXPAR.
SPLIT UXPAR AT '.' INTO TABLE lt_token.
* You already have value in MT61D-DISPO, find it in this table
FIND FIRST OCCURRENCE OF MT61D-DISPO IN TABLE lt_token IN CHARACTER MODE.
IF sy-subrc = 0.
* Value is found! May be set no_planning to X   
ELSE.
* Value not find! what should we do here  
ENDIF
Share
10 |10000 characters needed characters left characters exceeded
Bertrand DELVALLEE Jul 19, 2017 at 10:48 AM
0

Hello,

You can do something like this:

CLEAR: NO_PLANNING, STOP_PLANNING.
CASE USER_KEY.
[...]
  WHEN OTHERS.
  DATA t_ukeys type table of string.
  FIELD-SYMBOLS <ukeys> like line of t_ukeys.
  SPLIT USER_KEY AT '.' INTO TABLE t_ukeys.
  LOOP AT t_ukeys assigning <ukeys>.
     CASE <ukeys>.
        WHEN '100'.
          [...]
     ENDCASE.
  ENDLOOP.
ENDCASE.

Best regards

Bertrand

Share
10 |10000 characters needed characters left characters exceeded