Skip to Content
0

How to read maintenance plan history MHIS on save of notification?

Jan 05 at 07:48 AM

80

avatar image

Dear Experts,

I want to read maintenance plan call date and due package from MHIS table when plan is scheduled in IP10. Actually IP10 internally creates notification.

So in the user exit for create notification EXIT_SAPLMCI1_001 I written my custom code. Here I need to fetch call date and due package for the current schedule call. I tried to query table MHIS but I don't find my entry in MHIS. I think MHIS is updated later.

Then how to get call date and package in this user exit?

Is there any FM to read MHIS from buffer?

thanks & Regards

Gopal

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

4 Answers

Best Answer
SAPEKSH GUPTA Jan 06 at 07:41 PM
0

Hi Gopal,

Yes, you are correct when you say that MHIS is not yet updated when this exit EXIT_SAPLMCI1_001 is called because update task hasn't been called yet. Therefore, current call will not be available in MHIS table until this point.

Therefore, to get the values of MHIS corresponding to current call (which will be updated in MHIS after COMMIT), you have to make use of stack variable. These are the variables which are the part of main program and present in memory stack but not visible in current FM but they can be accessed from memory using field symbols.

You can retrieve MHIS table in your exit as below (copy-paste below code in your exit as is):

CONSTANTS : lc_fnam TYPE bdcdata-fnam VALUE '(SAPLIWP3)AMHIS[]',

FIELD-SYMBOLS : <l_tab> TYPE ANY TABLE,
<l_rec> TYPE ANY.

DATA: lt_mhis TYPE TABLE OF MHIS,

lw_mhis TYPE mhis.

ASSIGN (lc_fnam) TO <l_tab>.
IF sy-subrc EQ 0.
LOOP AT <l_tab> ASSIGNING <l_rec>.
MOVE <l_rec> TO lw_mhis.
APPEND lw_mhis TO lt_mhis.
ENDLOOP.

Your MHIS is ready to be used as you need. This will have all the calls (old and new) for the Maintenance Plan. :)

Hope this helps. Please let me know if it worked and solved your query.

Regards,

Sapeksh

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jan 05 at 02:53 PM
0

Your requirement is not much clear. I assume, you are triggering Notification as call object from maintenance plan and want to derive the Plan date, call date (there is no field called plan call date as you mentioned) and due package for this notification. You should get the required data from MHIS table as explained below.

When the Notification is created, QMIH table will have Maintenance Plan, Maintenance Plan Call Number and Maintenance item (WARPL, ABNUM, WAPOS)

If you pass the above values to MHIS-WARPL and MHIS-ABNUM you will get the package (MHIS- ZAEHL) and "plan date" from (MHIS-NPLDA). If there are more than once entry for this means there are multiple packages due.

(ZAEHL is internal number, does not matter for single cycle, but for strategy plan, To get the text for package get strategy from MPLA-STRAT and from T351P table get the package text)

Note that "Call date" is notification created date (QMEL-ERDAT). You may not find the "call date" in (MHIS-HORDA) once the call object is called/created.

Hope this clarifies your doubt.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Please see my response below.

0
Peter Atkin Jan 09 at 08:38 AM
0

Gopal

User-exit MCI10001 (EXIT_SAPLMCI1_001) is for PMIS updates and therefore not really designed for IP10/MHIS data.

Have a look at user-exit IPRM0004 (SMOD) or BADI MPLAN_BADI_HEADER_SAVE (SE18) instead.

PeteA

Share
10 |10000 characters needed characters left characters exceeded
Gopalkrishna Baliga Jan 06 at 12:06 PM
0

Hi Gopalkrishna Bhat

I appreciate your response in answering my question. Let me explain with steps what I am facing.

I have followed below steps in IP10.

In IP10 I entered my plan number

I have put breakpoint in my user exit. At this stage when I check MHIS table i can't find my call number ending with 019 entry there. MHIS has the previous/old call number ending with 018.

This is the problem. I hope now its clear.

Now how to get my current/latest call details like call date and due package when its still not updated in MHIS?

Your help will be really appreciated.

Thanks

Gopal


img1.jpg (21.6 kB)
img01.jpg (25.4 kB)
img2.jpg (28.8 kB)
Share
10 |10000 characters needed characters left characters exceeded