cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to get a VBA script to work for variable field?

0 Kudos
368

I have a requirement to change the date on work orders during Technical Completion and have written a script. The issue is with some work orders the field name is RIARCH-ADDAT & some other work orders use RIWO1-BEZDT for the close date.

How do I edit my script to work for either field name?

Session.findById("wnd[1]/usr/ctxtRIARCH-ADDAT").Text = B Session.findById("wnd[1]/usr/ctxtRIWO1-BEZDT").Text = B

Currently I run the script for 1 field, then change it and run it again. I just can't get it to work 😞

Thanks all!

Accepted Solutions (0)

Answers (1)

Answers (1)

peter_atkin
Active Contributor
0 Kudos

Dan,

For future reference; you will get a better response if you also tag your posts with: PLM Enterprise Asset Management (EAM)/Plant Maintenance (PM).

I think the difference is because of a maintenance plan assignment. So the system uses RIWO1-BEZDT if there is no maintenance plan, and RIARCH-ADDAT/RIARCH-NPLDA if a maintenance plan is assigned. THis difference in dates is triggered via IMG settings in node Set Maintenance Plan Categories - specifically the Completion Data checkbox.

So try adding an "IF" statement checking if the CAUFVD-WARPL field is populated (i.e. a plan is assigned), assuming all of the checkboxes in the above IMG node re active. If they aren't, then you will need to readt table T399W to determine the MPCONFDATE value.

.

PeteA