6

BADI for Maintenance Plan Due Date updating

 1 year ago
source link: https://blogs.sap.com/2022/11/07/badi-for-maintenance-plan-due-date-updating/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
November 7, 2022 3 minute read

BADI for Maintenance Plan Due Date updating

Introduction:

Hello everyone!! In this blog, I am going to explain how the next due date of Maintenance plan can be updated with the implementation of BADI “BADI_EAM_EXIT_IPRM002“.

What is Usage Decision:  

In QM, Usage Decision is used to decide whether you want to accept or reject the goods in the inspection lot based on the result of the inspection. As per inspection results the process is marked as completed in T-code QA32.

Purpose:

When we perform the calibration activity using Inspection lot once after performing Usage decision(UD) for the inspection lot the next due date against the Maintenance plan is not updating the table MHIO “Bas. start date (GSTRP)” field instantly.

Bas.start%20Date%20is%20not%20updated%20when%20UD%20was%20done%2001.02.2022

Bas.start Date is not updated when UD was done 01.02.2022

The due date will be updated only on the next day when background job runs or when the user manually go to t-code IP10 and save the Maintenance plan.

Due%20date%20got%20updated%20as%2001.02.2022%20when%20user%20executed%20IP10

Due date got updated as 01.02.2022 when user executed IP10

Requirement:

Business need was to automate this process without changing the frequency of background job which executes the API “MPLAN_UPDATE_SCHEDULING” and also by avoiding the  manual execution in IP10 transaction.

Solution Approach:

In our custom program logic which performs the Usage Decision of Maintenance Plan, we have made a call to the API “MPLAN_UPDATE_SCHEDULING” to update the MHIO table.

3.1.jpg

After above code changes the MHIO table got updated correctly

API%20execution%20in%20the%20custom%20program%20updated%20Bas.start%20date%20in%20MHIO%20table%20as%2001.02

API execution in the custom program updated Bas.start date in MHIO table as 01.02

Issues faced:

  1. MHIS table was not updated with the new date and also wrong dates were visible in IP03 t-code because the FM “MPLAN_UPDATE_SCHEDULING” updates date only after order is set in TECO status.

To avoid this, found and implemented the below BADI “EXIT_SAPLIPM5_002

5-1.jpg
BADI%20to%20update%20Next%20Due%20date

BADI to update Next Due date

2. As we change only MMDD in the above BADI, we faced another problem when different Calibration cycles used i.e., MON, DAY, YR.

Updated Custom logic for UD, to avoid problem for different Calibration cycles used.

Result:

After implementing the BADI and code changes in our custom program, we were able to achieve the requirement which updates the Due date correctly.

MHIO%20GSTRP%20updated%20as%20UD%20date

MHIO GSTRP updated as UD date

MHIS%20Planned%20date%20updated%20as%20UD%20date

MHIS Planned date updated as UD date

IP03%20Plandate%20also%20updated%20as%20UD%20date

IP03 Plan date also updated as UD date

I hope this blog will be helpful for technical consultants who has a similar requirement of updating Plan Due date in Maintenance plan after Usage Decision is saved in QA32 transaction.

Please share your valuable feedback and thoughts in the comments section.

For related topics please follow the below link and read other posts on the topic:

https://answers.sap.com/tags/484135010855456218597016630642366

Please follow my profile for related information. Thanks Everyone 🙂


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK