RKL eSolutions | Insights, Tips and Trends from a top Sage Reseller and Technology Specialist

How to Call an External Program from Sage ERP X3

Written by RKL Team | Nov 20, 2014 4:49:38 AM

It is sometimes useful to be able to access external programs, such as .exe files, from the Sage ERP X3 menu. Below are instructions for adding a menu item to Sage X3 that references a .Net .exe.

Copy the .exe File to the Sage X3 Directory

The example used here uses the Callui function in the Sage X3 code to call OpenFile, and references the .exe program using the parameter UILocalDir. The program being executed must reside in a pre-defined list of directories available to this function.

Depending on the parameter used for UILocalDir, the .exe should be copied to one of the 3 directories below.

  • Temp
  • Report
  • RtsTemp

Below is an excerpt from the X3 Help, which defines where each of these directories resides within the Sage ERP X3 client installation.

In this example, the Temp directory is used. Below is a snapshot of the directory where the .exe was copied.

NOTE: The .exe must reside in the X3 client installation directory, so if a local client is used, the .exe must be copied to each workstation accessing the .exe.

Create the Process

Go to the Process editor (Development > Processes > Processes > Process editor), and create a process to call the external program.

Copy the code below to the process editor. The .exe file name will need to be modified to match the name of the .exe being called. Compile the code.

##########################################################
# Processing Name - ZSLSUPD
# Description - Used to call salesperson utility
# Created By - D. Hartman, RKL
# Date Created - 10/28/2014
##########################################################

$ACTION
Case ACTION
When "TRT_DIV" : Gosub TRT_DIV
When default
Endcase
Return

$TRT_DIV

Local Char RETOUR : RETOUR = ""

Callui RETOUR="" With "UIAction="+chr$(1)+"OpenFile",
& "UILocalDir="+chr$(1) + "Temp",
& "UILocalFile="+ chr$(1) +"SalespersonUtility.exe"

Return

Create an Action

The next step is to create an action in Sage ERP X3 that will call the process code referenced above (Development > Processes > Actions > Actions).

Create a Function

The next step is to create a Function to call the action created above (Development > Processes > Functions).

The Parent menu value should match the name of the menu where the function call should appear.

Validate the Menu

If the function is added to a menu, the menu profile(s) will have to be validated (Development > Utilities > Dictionary > Validation > Menus) for the item to appear.

Related Posts

Sage ERP X3 Data Import Misplaced Indicators Error
Using Entry Points in Sage ERP X3
Creating a Business Partner as a Supplier and Customer in Sage ERP X3