Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Deactivating maintenance plan via function module or method

Raxph
Participant
0 Likes
1,241

Hi together,

I am trying to deactivate a maintenance plan via a function module or method, such as: FM - MPLAN_DEACTIVATE or mplan_api->mplan_deactivate, but nothing is working. The status of the maintenance plan remains unchanged. Is there any function module or method that I can use to change the status of a maintenance plan from active to inactive?

Please find below a snippet of code that I used in FM and method:

DATA: lv_warpl TYPE mpla-warpl,
        table_l  TYPE bapirettab,
        me       TYPE REF TO mplan_api.
  lv_warpl = '1010000608'.
"FM
 CALL FUNCTION 'MPLAN_DEACTIVATE'
    EXPORTING
      warpl  = lv_warpl
    TABLES
      return = table_l.


"Method
  me = mplan_api=>get_reference( ).

  CALL METHOD me->mplan_deactivate
    EXPORTING
      warpl  = lv_warpl
*      dialog =
    IMPORTING
      return = table_l

Thank you all in advance!

Bests regards,

R

1 ACCEPTED SOLUTION
Read only

Dominik_Tylczynski
SAP Champion
SAP Champion
0 Likes
1,137

Hello tk_gerald

I guess you are missing commit work. Why don't you add the following after the call to MPLAN_DEACTIVATE:

    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.

Best regards

Dominik Tylczynski

2 REPLIES 2
Read only

Dominik_Tylczynski
SAP Champion
SAP Champion
0 Likes
1,138

Hello tk_gerald

I guess you are missing commit work. Why don't you add the following after the call to MPLAN_DEACTIVATE:

    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.

Best regards

Dominik Tylczynski

Read only

1,137

Many thanks for your help, it solved my issue!!