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.
Features
getUser
Returns the current user
Example:
public class testProgram extends ExtendM3Trigger {
private final ProgramAPI program
private final InteractiveAPI interactive
public testProgram(ProgramAPI program, InteractiveAPI interactive) {
this.program = program
this.interactive = interactive
}
public void main() {
if (program.getUser() != "CRIUBA36") {
return
}
interactive.showCustomInfo("Current User: " + program.getUser())
}
}
getTableRecord
To be able to retrieve a record from a specific table in the program
Example:
public class TestProgram extends ExtendM3Trigger {
private final ProgramAPI program
private final ExtensionAPI extension
private final InteractiveAPI interactive
public TestProgram(ProgramAPI program, ExtensionAPI extension, InteractiveAPI interactive) {
this.program = program
this.extension = extension
this.interactive = interactive
}
public void main() {
def mitwhl = program.getTableRecord("MITWHL")
def whlo = mitwhl.MWWHLO
if (program.getUser() != "CRIUBA36") {
return
}
interactive.showCustomInfo("Current Warehouse: " + whlo)
}
}
LDAZD
To be able to retrieve fields mapped in LDAZD
Example:
public class testProgram extends ExtendM3Trigger {
private final ProgramAPI program
private final ExtensionAPI extension
private final InteractiveAPI interactive
public testProgram(ProgramAPI program, ExtensionAPI extension, InteractiveAPI interactive) {
this.program = program
this.extension = extension
this.interactive = interactive
}
public void main() {
int currentCompany = (Integer)program.getLDAZD().CONO
if (program.getUser() != "CRIUBA36") {
return
}
interactive.showCustomInfo("Current Company: " + currentCompany)
}
}
LDAZZ
To be able to retrieve field mapped in LDAZZ
Example:
public class testProgram extends ExtendM3Trigger {
private final ProgramAPI program
private final ExtensionAPI extension
private final InteractiveAPI interactive
public testProgram(ProgramAPI program, ExtensionAPI extension, InteractiveAPI interactive) {
this.program = program
this.extension = extension
this.interactive = interactive
}
public void main() {
int orderNum = (Integer)program.getLDAZZ().ORNO
if (program.getUser() != "CRIUBA36") {
return
}
interactive.showCustomInfo("Order Number: " + orderNum)
}
}