Skip to Content

Issue with Maintenance plan read, MPLAN_READ


I am working on a program to call maintenance plans manually to generate an order using FM MPLAN_MANUAL_CALL. Using FM MPLAN_READ to fetch ZAEHL to pass to the manual call. MPLAN_READ is giving wrong results when executed in loop and in SE37. Below is the structure of the logic.

Loop at mplans.


EXPORTING mplan = warpl

no_buffer = 'X'

TABLES return = lt_return

strategy_cycles = lt_strat_cycles.

READ TABLE lt_strat_cycles INTO ls_strat_cycles INDEX 1.

lv_zaehl = ls_strat_cycles-zaehl.


EXPORTING warpl = warpl

manda = sy-datum

zaehl = lv_zaehl

IMPORTING return = lt_return.

REFRESH : lt_strat_cycles


Above logic is working fine and generating orders except few times.

Eg error: When looping on 3 mplans, for mplan3 the FM MPLAN_READ gave 2 strategy cycles in lt_strat_cycles. When i run FM MPLAN_READ with mplan3 in SE37 or if this mplan3 is the first in the loop then FM MPLAN_READ is returning only 1 strategy cycle.

Due to this issue of using wrong ZAEHL, order is not getting generated. I have also tried below FM before each MPLAN_READ but still no use.


EXPORTING plan = warpl

with_items = 'X'.

Need help to fix the issue why MPLAN_READ in SE37 gives only one strategy cycle where as in the loop it gives 2. If this mplan is first in the loop, then it gives only one strategy cycle.

Or else, is there any other way to get the ZAEHL for the mplan?



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Aug 24, 2017 at 06:33 AM
    Add comment
    10|10000 characters needed characters exceeded

    • Hi Peter,

      In the referred question, issue was related to locking issue of the same maintenance plan calling in the loop.

      My issue is not related to the locking nor calling same maintenance plan. My issue is the strategy cycles returned by the MPLAN_READ in LOOP vs SE37.



  • Aug 24, 2017 at 03:26 PM

    Have you tried a commit, before you clear the buffer?.

    Alternativey, you could read the package from the task list data (table PLWP).


    Add comment
    10|10000 characters needed characters exceeded