Skip to Content

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

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


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Jan 06, 2018 at 07:41 PM

    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[]',

    <l_rec> TYPE ANY.


    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.

    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.



    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 05, 2018 at 02:53 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 09, 2018 at 08:38 AM


    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.


    Add comment
    10|10000 characters needed characters exceeded

  • Jan 06, 2018 at 12:06 PM

    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.



    Add comment
    10|10000 characters needed characters exceeded