Program API
Table of contents
Since: 0.1.0
Context: Any
Category: Generic
—
Description
The Program API contains APIs that can be used to get information from the current program, such as market, program type and more.
Methods
Indicator(get)
Retrieve value of indicators.
Returns boolean value of the indicator.
Example:
public class testProgram extends ExtendM3Trigger {
private final ProgramAPI program
public testProgram(ProgramAPI program) {
this.program = program;
}
public void main() {
boolean indicatorValue = program.indicator.get(60);
...
}
}
LDAZD(get)
Retrieve fields mapped in LDAZD.
Takes a String ‘key’ as parameter and returns the value of the field.
Example:
public class testProgram extends ExtendM3Trigger {
private final ProgramAPI program;
public testProgram(ProgramAPI program) {
this.program = program;
}
public void main() {
int currentCompany = program.LDAZD.get("CONO");
...
}
}
LDAZZ(get)
Retrieve fields mapped in LDAZZ.
Takes a String ‘key’ as parameter and returns the value of the field.
Example:
public class testProgram extends ExtendM3Trigger {
private final ProgramAPI program;
public testProgram(ProgramAPI program) {
this.program = program;
}
public void main() {
String orderNum = program.LDAZZ.get("ORNO");
...
}
}
getProgramName
Retrieve the name of the current program.
Example:
public class exampleProgram extends ExtendM3Trigger {
private final ProgramAPI program;
public exampleProgram(ProgramAPI program) {
this.program = program;
}
public void main() {
String currentProgram = program.getProgramName();
...
}
}
getMarket
Retrieve the market of the current job. Will always return a valid system component, will never be “ALL”.
Example:
public class exampleProgram extends ExtendM3Trigger {
private final ProgramAPI program;
public exampleProgram(ProgramAPI program) {
this.program = program;
}
public void main() {
String currentMarket = program.getMarket();
if(currentMarket != "MSE") {
return;
}
...
}
}
getUser
Retrieves the current username.
Example:
public class exampleProgram extends ExtendM3Trigger {
private final ProgramAPI program;
public exampleProgram(ProgramAPI program) {
this.program = program;
}
public void main() {
if (program.getUser() != "CRIUBA36") {
return;
}
...
}
}
getProgramType
Retrieves the current program type(e.g. interactive).
Example:
public class exampleProgram extends ExtendM3Trigger {
private final ProgramAPI program;
public exampleProgram(ProgramAPI program) {
this.program = program;
}
public void main() {
String currentProgramType = program.getProgramType();
...
}
}
getNumberOfInputParameters
Retrieves the programs’ number of input parameters.
Example:
public class exampleProgram extends ExtendM3Trigger {
private final ProgramAPI program;
public exampleProgram(ProgramAPI program) {
this.program = program;
}
public void main() {
int numberOfInputParameters = program.getNumberOfInputParameters();
...
}
}
getJobNumber
Retrieves the current job number.
Example:
public class exampleProgram extends ExtendM3Trigger {
private final ProgramAPI program;
public exampleProgram(ProgramAPI program) {
this.program = program;
}
public void main() {
int currentJobNumber = program.getJobNumber();
...
}
}
getTableRecord
Retrieves records from a specific table in the program.
Takes String ‘table’ as parameter and returns the table as type ‘TableRecordAPI’.
Example:
public class exampleProgram extends ExtendM3Trigger {
private final ProgramAPI program;
public exampleProgram(ProgramAPI program) {
this.program = program;
}
public void main() {
TableRecordAPI mitwhl = program.getTableRecord("MITWHL");
String whlo = mitwhl.MWWHLO;
...
}
}
getMessageId
Retrieves the current message ID(program heading).
Example:
public class exampleProgram extends ExtendM3Trigger {
private final ProgramAPI program;
public exampleProgram(ProgramAPI program) {
this.program = program;
}
public void main() {
String messageID = program.getMessageId();
...
}
}
getMessageData
Retrieves program message data.
Example:
public class exampleProgram extends ExtendM3Trigger {
private final ProgramAPI program;
public exampleProgram(ProgramAPI program) {
this.program = program;
}
public void main() {
String messageData = program.getMessageData();
...
}
}
getMessage
Retrieves program message.
Example:
public class exampleProgram extends ExtendM3Trigger {
private final ProgramAPI program;
public exampleProgram(ProgramAPI program) {
this.program = program;
}
public void main() {
String message = program.getMessage();
...
}
}
getTenantId
Retrieve the current tenant ID.
Example:
public class exampleProgram extends ExtendM3Trigger {
private final ProgramAPI program;
public exampleProgram(ProgramAPI program) {
this.program = program;
}
public void main() {
String tenantID = program.getTenantId();
...
}
}
existsInCallStack
Checks if the given program is in the current call stack.
Takes String ‘program’ as parameter and returns true if the program exists in the call stack, else false.
Example:
public class exampleProgram extends ExtendM3Trigger {
private final ProgramAPI program;
public exampleProgram(ProgramAPI program) {
this.program = program;
}
public void main() {
boolean programExists = program.existsInCallStack(String program);
...
}
}
isShutdownInProgress
Checks if program shutdown is in progress.
Example:
public class exampleProgram extends ExtendM3Trigger {
private final ProgramAPI program;
public exampleProgram(ProgramAPI program) {
this.program = program;
}
public void main() {
boolean programShutdown = program.isShutdownInProgress(String program);
...
}
}
exitFlag
Checks if the exit flag is active.
Example:
public class exampleProgram extends ExtendM3Trigger {
private final ProgramAPI program;
public exampleProgram(ProgramAPI program) {
this.program = program;
}
public void main() {
boolean exitFlagActive = program.exitFlag();
...
}
}
existsError
Checks if the error flag is true(alternative to program.indicator.get(60)).
Example:
public class exampleProgram extends ExtendM3Trigger {
private final ProgramAPI program;
public exampleProgram(ProgramAPI program) {
this.program = program;
}
public void main() {
boolean existsError = program.existsError();
...
}
}
Considerations and Guidelines
It is considered a good practice to learn about the program you’re extending first, to understand the full potential of the Program API.