Link

Program API

Table of contents

  1. Description
  2. Methods
    1. Indicator(get)
    2. LDAZD(get)
    3. LDAZZ(get)
    4. getProgramName
    5. getMarket
    6. getUser
    7. getProgramType
    8. getNumberOfInputParameters
    9. getJobNumber
    10. getTableRecord
    11. getMessageId
    12. getMessageData
    13. getMessage
    14. getTenantId
    15. existsInCallStack
    16. isShutdownInProgress
    17. exitFlag
    18. existsError
  3. Considerations and Guidelines

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.

Methods

Indicator(get)

Retrieve value of indicators.

Returns: boolean

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.

Parameter: String 'key'
Returns: value of the field, null if get fails

Example:

public class testProgram extends ExtendM3Trigger {
  private final ProgramAPI program;
  
  public testProgram(ProgramAPI program) {
    this.program = program;
  }
  
  public void main() {
    int currentCompany = (Integer)program.getLDAZD().CONO;

    ...
  }
} 

LDAZZ(get)

Retrieve fields mapped in LDAZZ.

Parameter: String 'key'
Returns: value of the field, null if get fails

Example:

public class testProgram extends ExtendM3Trigger {
  private final ProgramAPI program;
  
  public testProgram(ProgramAPI program) {
    this.program = program;
  }
  
  public void main() {
    int orderNum = (Integer)program.getLDAZZ().ORNO;

    ...
  }
} 

getProgramName

Retrieve the name of the current program.

Returns: String 'currentProgram'

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”.

Returns: String 'market'

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.

Returns: String 'user'

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).

Returns: String 'programType'

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.

Returns: int 'numberOfInputParameters'

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.

Returns: int 'jobNumber

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.

Parameter: String 'table'
Returns: 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).

Returns: String 'messageID'

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

Retrieve message data.

Returns: String 'messageData

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

Retrieve message.

Returns: String '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.

Returns: String 'tenantID

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.

Parameters: String program
Returns: boolean

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.

Returns: boolean

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.

Returns: boolean

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)).

Returns: boolean

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