Try OpenEdge Now
skip to main content
Managing ABL Applications
ABL and R-code Deployment and Management : Managing Print Devices : Setting up output-routing : Using an output-routing table
Using an output-routing table
More complex output-routing schemes, such as routing output based on the user ID, require the creation of several related ABL tables and an include file that can access these tables and select the proper output command for the particular user.
Just as you can use ABL tables (_User) to set up security for OpenEdge applications, you can also use ABL tables for output routing. If you want to route application output to different printers based on user ID, set up a table in the application database containing each of the valid user IDs and the corresponding print commands.
T shows a sample output-routing table.
Figure 9. Sample output-routing table
The database table shown in the figure contains records that have a userid field and an outdev field containing an operating system output device. The userid field is a unique primary index for the table. You have to keep the Usrprnt table up to date with a record for each new user on your system.
After setting up the database table, create an include file that determines the current user ID and then searches the Usrprnt table for a matching user ID and corresponding output device. For example:
FIND Usrprnt WHERE Usrprnt.userid = USERID NO-ERROR.
The include file searches the Usrprnt table for a record that has a user ID that matches the user ID established for the current application session. If there is no user ID match or established user ID for the application session, OpenEdge uses the default system printer. If there is a match, OpenEdge sends the application output to the output device contained in the corresponding outdev field.
The VALUE option of the OUTPUT THROUGH statement allows you to designate a substitutable output device. The USERID function allows you to capture system user IDs on UNIX. For more information about the _User table, see OpenEdge Data Management: Database Administration.
After creating an include file to route application output, replace all OUTPUT statements in your application with the include file. For example:
  PUT Customer.CustNum Customer.Name Customer.Address Customer.City     Customer.State Customer.PostalCode.