Quantcast
Channel: Sage X3 – Tips, Tricks and Components
Viewing all articles
Browse latest Browse all 1524

How to call a subroutine or methods in Sage X3 using instance

$
0
0

Like any other programming language, Sage X3 also supports functions/methods/subroutines. Though the syntax for defining these functions are different in all languages, the purpose is similar to perform actions and return (or not to return) any result.

But, there are certain subroutines which do not return any value as a result. In Sage X3, these subroutines are called as Subprograms and most of the times called using Call instruction.

Latest versions of Sage X3 provides another instruction to call the subroutines which is as follows:

Callmet INST.METHOD_NAME

Callmet INST.METHOD_NAME(param_list)

where,

INST -> Instance name

param_list -> parameters (if any) 

This instruction is similar to Call instruction. Callmet invokes a method on an instance. It is used to invoke methods that do not return any value.

It can contain parameters that can be transmitted as values or as references. The parameters transmitted by reference can be modified by the subroutine.

 

Snippet: 

# Example of SETERROR method call in a control event

If this.AMOUNT=0

Callmet this.SETERROR(“AMOUNT”,”Amount cannot be zero”,20,ASTATUS)

Elsif this.AMOUNT<0

Callmet this.SETERROR(“AMOUNT”,”Amount must be positive”,21,ASTATUS)

Endif

 

The above snippet will call method SETERROR which contains four parameters but does not return any value.

Here, this is an instance referencing to current object.

Hope this helps!

 

About Us:

Greytrix is one stop solution provider for Sage ERP and Sage CRM needs. We provide complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third party add-on development and implementation expertise.

Greytrix have some unique solutions of Sage X3’s integration with Sage CRM, Salesforce.com and Magento eCommerce. It also offers best-in-class Sage X3 customization and development services to Sage business partners, end users, and Sage PSG worldwide.

For more information on Sage X3 Integration and Services, please contact us at x3@greytrix.com . We will be glad to assist you.

 

Also Read:

  1. How to Call Function from Different File’s Using Single Call Statement and Encapsulation
  2. How to Call “Entry point” from the Code
  3. How to call specific file of an action through code
  4. Setting Parameters in Actionsfunction in Sage X3
  5. How to add Entry Point to the Patch File?

Viewing all articles
Browse latest Browse all 1524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>