RKL eSolutions Blog Trends and Insights

How to Call an External Program from Sage ERP X3

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.

Sage ERP X3 Help Screen

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

Sage ERP X3 Temp File Directory

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

Calling an External Program from Sage ERP X3 Action

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.

Calling an External Program from Sage ERP X3 Function

Calling an External Program from Sage ERP X3 Parameters

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

Tags: Sage X3
RKL Team

Written by RKL Team

Since 2001, RKL eSolutions has helped growing companies maximize their technology resources and investment. Over the years, we have helped hundreds of small and medium sized businesses as their strategic business partner. We specialize in the needs of Entertainment, Software & SaaS, Professional Services, Manufacturing, and Non Profit organizations. Our experienced consultants have a passion for making every facet of your business successful and are intent on building a long-term relationship with every client.