0% found this document useful (0 votes)
163 views2 pages

Applies To:: (API) (Code Example) EAM - PMDEF - PUB - CREATE - PM - DEF - How To Create A PM Schedule Name (Doc ID 2025230.1)

Uploaded by

herculean2010
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
163 views2 pages

Applies To:: (API) (Code Example) EAM - PMDEF - PUB - CREATE - PM - DEF - How To Create A PM Schedule Name (Doc ID 2025230.1)

Uploaded by

herculean2010
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

10/21/21, 5:12 PM Document 2025230.

1
  Last Login: October 21, 2021 3:22 PM IST sudhakar (Available) (0) Contact Us Help
PowerView is Off

 
Dashboard Knowledge Service Requests Patches & Updates Community

Give Feedback...
Copyright (c) 2021, Oracle. All rights reserved. Oracle Confidential.

[API][Code Example] EAM_PMDEF_PUB.CREATE_PM_DEF - How to Create a PM Schedule Name (Doc ID To Bottom


2025230.1)

  Was this document helpful?  

APPLIES TO: Yes


No
Oracle Enterprise Asset Management - Version 12.1.1 and later    

Information in this document applies to any platform.


  Document Details  

GOAL
Type:
HOWTO
Status:
How to create PM Schedule Definition? PUBLISHED
Last Major
 
08-Jul-2019
Update:
30-Sep-2020
Last Update:
SOLUTION    

  Related Products  
The script can be download from here.
Oracle Enterprise Asset
The below script can be used  
Management
 

/*   Information Centers  

$Header: mrm_epb_create_pm_def.sql 120.1 2012/03/17


Enterprise Asset Management (Product ID 1142) - Create PM Schedule Name Information Center: Oracle

[API][Code Example] EAM_PMDEF_PUB.CREATE_PM_DEF - How to Create a PM Schedule Name (Doc ID 2025230.1) Enterprise Asset Management
[1411394.2]
Copyright (c) 2010-2015, Oracle Corporation. All rights reserved.    

NAME

  Document References  
mrm_epb_create_pm_def.sql
[EAM] Enterprise Asset
DESCRIPTION Management Latest Patch Level f
Use API to

create a PM Schedule Name R12 (12.1.X/12.2.X) [1938936.1]

VERSIONS [API][Code Example]


strings -a $EAM_TOP/patch/115/sql/EAMPPMDB.pls | grep '$Header' EAM_PMDEF_PUB.UPDATE_PM_D
EAMPPMDB.pls, v 120.20.12010000.27
- How to Update a PM Schedule
Name [2025233.1]
EAMPPMDS.pls, v 120.8.12010000.1

[API][Code Example]
PARAMETERS EAM_PMDEF_PUB.CREATE_PM_D
None

- How to Create a PM Schedule


*/
Template [2227081.1]

-- set serveroutput on
   

declare

in_pm_schedule_rec eam_pmdef_pub.pm_scheduling_rec_type;   Recently Viewed  


in_pm_activities_tbl eam_pmdef_pub.pm_activities_grp_tbl_type;
in_pm_day_interval_rules_tbl eam_pmdef_pub.pm_rule_tbl_type;
[API][Code Example]
in_pm_runtime_rules_tbl eam_pmdef_pub.pm_rule_tbl_type;
EAM_PMDEF_PUB.UPDATE_PM_
a PM Schedule Name [2025233
in_empy_pm_list_date_rules_tbl eam_pmdef_pub.pm_rule_tbl_type;
API eam_pmdef_pub.update_p
out_msg_count NUMBER; [2561339.1]

out_msg_data VARCHAR2(5000); Updating WO Material Issue Re


out_return_status VARCHAR2(1); [2418798.1]

msg_index NUMBER; Apps.wip_eam_workrequest_pu



API Does Not Work After Patch
temp_err_mesg VARCHAR2(2000);
[2712394.1]
err_create_pm_def_failure EXCEPTION; API Required To Add Material A
Association In Work Order [275
out_pm_schedule_id NUMBER; Show More
begin
   

fnd_global.apps_initialize(user_id => 1068,


resp_id => 23118,

resp_appl_id => 426);

-- in_pm_schedule_rec.pm_schedule_id := 7290;
in_pm_schedule_rec.name := 'MRM_API_PM_01';

in_pm_schedule_rec.from_effective_date := TO_DATE('01/07/2015', 'DD/MM/YYYY');


in_pm_schedule_rec.rescheduling_point := 2;

in_pm_schedule_rec.set_name_id := 2002;

in_pm_schedule_rec.source_code := 'EAM';
in_pm_schedule_rec.source_line := '1';

in_pm_schedule_rec.type_code := 10;

in_pm_schedule_rec.scheduling_method_code := 10;
in_pm_schedule_rec.whichever_first := 'Y';

in_pm_schedule_rec.generate_wo_status := 1;

'N';
in_pm_schedule_rec.generate_next_work_order:=

in_pm_schedule_rec.maintenance_object_id := 3333000;
in_pm_schedule_rec.maintenance_object_type := 3;

in_pm_schedule_rec.non_scheduled_flag := 'Y';

in_pm_schedule_rec.interval_per_cycle := 1;

in_pm_schedule_rec.current_cycle := 1;

in_pm_schedule_rec.current_seq := 0;

in_pm_schedule_rec.auto_instantiation_flag := 'N';
in_pm_schedule_rec.day_tolerance := 3;

in_pm_schedule_rec.default_implement := 'Y';

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=370246940402834&id=2025230.1&displayIndex=36&_afrWindowMode=0&… 1/2
10/21/21, 5:12 PM Document 2025230.1
in_pm_day_interval_rules_tbl(1).rule_type := 1;
in_pm_day_interval_rules_tbl(1).day_interval := 7;
in_pm_day_interval_rules_tbl(1).meter_id := NULL;

--in_pm_activities_tbl(1).pm_schedule_id := 7290;

50925;
in_pm_activities_tbl(1).activity_association_id :=
in_pm_activities_tbl(1).interval_multiple := 1;


'Y';
in_pm_activities_tbl(1).allow_repeat_in_cycle :=

in_pm_activities_tbl(1).next_service_start_date := null;
in_pm_activities_tbl(1).next_service_end_date := null;

in_pm_activities_tbl(2).activity_association_id := 85925;
in_pm_activities_tbl(2).interval_multiple := 7;


'Y';
in_pm_activities_tbl(2).allow_repeat_in_cycle :=

in_pm_activities_tbl(2).next_service_start_date := null;
in_pm_activities_tbl(2).next_service_end_date := null;

eam_pmdef_pub.create_pm_def
(

p_api_version => 1.0,


p_init_msg_list => fnd_api.g_true,


p_commit => fnd_api.g_false, -- G_FALSE is not COMMITing to the system directly. Manual COMMIT is
needed. G_TRUE does direct COMMIT

p_validation_level => fnd_api.g_valid_level_full,


p_pm_schedule_rec => in_pm_schedule_rec,

p_pm_activities_tbl => in_pm_activities_tbl,


p_pm_day_interval_rules_tbl => in_pm_day_interval_rules_tbl,


p_pm_runtime_rules_tbl => in_pm_runtime_rules_tbl,

p_pm_list_date_rules_tbl => in_empy_pm_list_date_rules_tbl,


x_return_status => out_return_status,

x_msg_count => out_msg_count,

x_msg_data => out_msg_data,

x_new_pm_schedule_id => out_pm_schedule_id


);

DBMS_OUTPUT.PUT_LINE('Return Status: ' || out_return_status);


DBMS_OUTPUT.PUT_LINE('Return Message Count: ' || out_msg_count);


DBMS_OUTPUT.PUT_LINE('Return Message Data: ' ||

replace(out_msg_data, chr(0), ' '));

out_msg_count := fnd_msg_pub.count_msg;

if (out_return_status <> 'S') then


RAISE err_create_pm_def_failure;

end if;

DBMS_OUTPUT.PUT_LINE('Create PM Schedule ID ' || out_pm_schedule_id ||


' Successfully!');

IF (out_msg_count > 0) THEN


msg_index := out_msg_count;

FOR i IN 1 .. out_msg_count
LOOP

fnd_msg_pub.get(p_msg_index => FND_MSG_PUB.G_NEXT,


p_encoded => 'F',

p_data => temp_err_mesg,


p_msg_index_out => msg_index);


dbms_output.put_line('Error:'

|| msg_index || ':' || temp_err_mesg);


END LOOP;

END IF;

EXCEPTION

WHEN err_create_pm_def_failure THEN


DBMS_OUTPUT.PUT_LINE('Create PM Schedule Failed! STATUS: ' ||


out_return_status || ' MSG: ' || out_msg_data);

WHEN OTHERS THEN

DBMS_OUTPUT.PUT_LINE('Create PM Schedule Unexpected Failed!' ||


SQLERRM);

end;

REFERENCES

NOTE:1938936.1 - [EAM] Enterprise Asset Management Latest Patch Level for R12 (12.1.X/12.2.X)
NOTE:2025233.1 - [API][Code Example] EAM_PMDEF_PUB.UPDATE_PM_DEF - How to Update a PM
Schedule Name
NOTE:2227081.1 - [API][Code Example] EAM_PMDEF_PUB.CREATE_PM_DEF - How to Create a PM Schedule Template

Didn't find what you are looking for? Ask in Community...

Attachments
Create PM Schedule (5.75 KB)

Related
Products

Oracle E-Business Suite > Asset Lifecycle Management > Asset Lifecycle Management > Oracle Enterprise Asset Management > PM > PM Engine

Keywords
API; DBMS_OUTPUT; EAM_PMDEF_PUB; FND_API; FND_GLOBAL; FND_MSG_PUB; SQLERRM; SYSTEM

Back to Top
 
Copyright (c) 2021, Oracle. All rights reserved. Legal Notices and Terms of Use Privacy Statement
   

https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=370246940402834&id=2025230.1&displayIndex=36&_afrWindowMode=0&… 2/2

You might also like