100% found this document useful (1 vote)
872 views21 pages

Sage Erp X3 V7: Development Part 1 Exercises Level 2

Développement_Part1_Exo2

Uploaded by

Yahya Chiguer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
872 views21 pages

Sage Erp X3 V7: Development Part 1 Exercises Level 2

Développement_Part1_Exo2

Uploaded by

Yahya Chiguer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

SAGE ERP X3 V7

Development Part 1

Exercises level 2

This manual addresses Version 7

Reference: X3DVP1v7.1p5EXMSA1.0

22 01 2014
© Sage 2015
This document is the exclusive property of Sage and/or all of the Sage Group affiliates and is
protected by the Intellectual property Code, copyright laws and international treaties.
Any partial or total reproduction of this document is strictly prohibited.
Anyone not complying with these provisions shall be guilty of copyright infringement and will
be liable to criminal penalties provided by the law.

SageX3 V7_Development Part 1-2_Exercises Page 2 sur 21


Table of contents

1.0 LEGEND 4

2.0 LAB 1 – X3 ACTION MANAGEMENT 5


2.1 Plugging a x3 action on an icon 5
2.1.1 Standard Dictionary Action 5
2.1.2 Optional: Bespoke Dictionary Action (Bespoke
Window Entry template) 5

3.0 LAB 2 – Window entry template 7


3.1 Creating the graphical structure 7
3.1.1 Screens 7
3.1.2 Window 8
3.2 Coding the PROCESS 8
3.2.1 X3 Dictionary Action 8
3.2.2 Action’s parameter 8

4.0 LAB 3 – STANDARD Process template 10


4.1 creating the graphical structure 10
4.1.1 Screens 10
4.1.2 Window 10
4.1.3 Action 10
4.1.4 Function 10
4.2 Interactive & batch mode 11
4.2.1 Process 11
4.2.2 Batch task 11

5.0 LAB 4 – Inquiry template 12


5.1 creating the graphical structure 12
5.1.1 Screens 12
5.1.2 Window 13
5.1.3 Inquiry 13
5.1.4 Action 13
5.1.5 Function 13
5.2 creating an inquiry Process 15

6.0 LAB 5 – Selection from table 16

7.0 LAB 6 – Selection from list 17

8.0 LAB 7 – Entry points 18

9.0 LAB 8 – Reports 19


9.1 Tracing print parameters 19
9.2 printing report twice 20

SageX3 V7_Development Part 1-2_Exercises Page 3 sur 21


1.0 LEGEND

The following elements are used in the exercise booklet as “interface” indicators:

Common Data > BPs > BPs


This shows directions to a function from the general X3 menu (X3 menu path from
standard Admin home page)

Preamble

In much of the processes where common data is created (such as Customers or


Products) the exercise notes mention XXX in the data codes or designations. Replace that
with your own initials. This is to distinguish your data from other delegate’s data in case
the servers are shared.

SageX3 V7_Development Part 1-2_Exercises Page 4 sur 21


2.0 LAB 1 – X3 ACTION MANAGEMENT

2.1 Plugging a x3 action on an icon

Requirement
We will use the exercises done during the fundamental training: Domain Name
management. We want to add an icon in the tab XDM1. When pressing this icon, it should
trigger a tunnel through the GESBPR function.

Objective
This exercise will enable us to experience the behavior of the X3 actions.

2.1.1 Standard Dictionary Action

Development > Script dictionary > Actions > Actions (GESACT)

An icon in the tab XDM1 should enable a tunnel through the GESBPR function.
a. Add an icon to the screen XDM1, in the bloc 1. You can choose whatever icon
you want.
Tips: Use the PowerPoint to see the list of available icons.
Or you can see them in the function GESAMK: Menu View>Icons

b. Plug a X3 an action to this icon. The action should trigger a tunnel through the
BPR object (GESBPR function), inquiring the business partner stored in the
field ID.
Tips: Use the existing action GOBJETC0 to trigger an object. Look how the
standard uses it on the screen SOH4, field NBLIG.
Specify the object and record you want to inquire.

2.1.2 Optional: Bespoke Dictionary Action (Bespoke Window Entry template)

Development > Script dictionary > Actions > Actions (GESACT)

A new button in the window OXDM should enable to display the name of the
domain code in a new window.

SageX3 V7_Development Part 1-2_Exercises Page 5 sur 21


a. Add a button to the window OXDM.
b. Create an action XDISDOMCOD. This action is a “window entry” template.
c. Create a new window XDIS
i. Type: Miscellaneous
ii. Display: Message box

d. Then create your new screen XDIS1 as a dialog box. The screen should
contain the domain code.
Field Type Length Remarks : 1st block
DOMCOD ITM Domain code

e. Create a new window


f. Create a STD and SPE process. Use the SPE process in order to display the
domain code value from the XDM0 screen in the new XDIS1 screen.
Tips: Scan the events available to see which one you can use. Use the X3
help as well.
Copy the value from XDM0 to XDIS1 by code.
g. Do the same thing by passing the [XDM0]DOMCOD by parameter in the action
XDISDOMCOD.
Tips: Use the action parameters.

SageX3 V7_Development Part 1-2_Exercises Page 6 sur 21


3.0 LAB 2 – Window entry template

Requirement:
We want to create window template based program to view Purchase Order lines for an
item. This should be callable from a button in the OXDM window.
The user will enter a product code in the header and when presses the “OK” button, it
should display the purchase order information of this product.

Objectives:
We want to experience the logic behind the template Window entry and to see its
features.

3.1 Creating the graphical structure


3.1.1 Screens
We will create 2 new screens:

a. Header screen XVIEWP0 [XVP0]


- ITMREF Product
-
Field Types Length Dimension Normal title
ITMREF ? 1 Product code

b. Detail screen XVIEWP1 [XVP1]


- POHNUM Order number
- POHFCY Site
- BPSNUM Supplier
- EXTRCPDAT Expected receipt date
- QTYSTU Quantity
- RCPQTYSTU Already received
- INVQTYSTU Already invoiced
Field Types Length Dimension Normal title
POHNUM VCR 1 Purchase Order number
POHFCY FCY 1 Purchase Site
BPSNUM BPS 1 Partner's ID
EXTRCPDAT D 1 Expected receipt date
QTYSTU QTY 1 Quantity (stock Unit)
RCPQTYSTU QTY 1 Received Qty (Stock

SageX3 V7_Development Part 1-2_Exercises Page 7 sur 21


Unit)
INVQTYSTU QTY 1 Invoiced Qty (Stock Unit)

Tips: Try to figure out which table you need to use to find the fields.
Check the X3 help for the purchase data model for tables PORDER and
PORDERQ
VCR is a generic type that allows you to encapsulate strong types like “ITM”.
Check the parameters of this type.

3.1.2 Window
We will now create a new window XVIEWPO containing our previous screens.

a. Add the screens XVIEWP0 and XVIEWP1

b. On the window OXDM, add a button “View PO”. Identify this button with the
letter “z”.

3.2 Coding the PROCESS


3.2.1 X3 Dictionary Action

Development > Script dictionary > Action > Action (GESACT)

Create a X3 action XVIEWPO.

a. Template: Window entry


Main window: XVIEWPO
Standard process: XVIEWPO

b. Assign your action XVIEWPO to your button “z” in OXDM

When the action is set up, test you new button “View PO”.
You will see that something strange happen when pressing the OK button. How to prevent
this behaviour?

Tips: Check the X3 help and look for the event AVANT_BOUTON. Refer to the
PowerPoint for more explanation on the window entry events.
Be careful of the number of line for your screen. Not enough lines will result in an
error.

3.2.2 Action’s parameter


The field [M:XVP0]ITMREF should be initialized by a parameter of the action XVIEWPO.
It should contain the value stored in [M:XDM0]DOMCOD.
a. Create a new parameter: ITMREF

SageX3 V7_Development Part 1-2_Exercises Page 8 sur 21


b. In the window OXDM, refresh your action and populate the parameter value
with the field DOMCOD from the screen XDM0
c. Find an event that allows you to initialize the ITMREF field with the value in
your new parameter.
Tips: Use PARAM(1)
Check the X3 help and the PowerPoint for the correct event.
In your X3 action, uncheck “Current field”.

SageX3 V7_Development Part 1-2_Exercises Page 9 sur 21


4.0 LAB 3 – STANDARD Process template

Requirement:
We want to create a standard process template based program to reset the version
number of the domain management. This should be called from a function and a batch
task.
The user will enter a range of product code to delete or an expiry date in a criteria screen,
before launching the process.

Objectives:
We want to experience the logic behind the standard process template and to see its
features.

4.1 creating the graphical structure


4.1.1 Screens
Create a screen to enter launch criteria:
- Tab screen XRTZVER1 [DIA]
Field Types Length Dimension Normal title
STRDOMCOD ? 1 Product code
ENDDOMCOD ITM 1
EXPDAT D 1 Expiry date

Tips: Pay attention to your layout.

4.1.2 Window
Create the window DRTZVER
- Assign your screen XRTZVER1 to this window

4.1.3 Action
Create your X3 action XRTZVER
a. Select the template “processing”
b. Assign your window DRTZVER as a criteria window.
Tips: Criteria or main window? You can try both to determine which option to use.

c. Assign a process XRTZVER

4.1.4 Function

SageX3 V7_Development Part 1-2_Exercises Page 10 sur 21


Assign your action to a function in order to make it appear in the XDEV Module.
a. Create the XRTZVER function.
b. Assign your XRTZVER action to it.

4.2 Interactive & batch mode


4.2.1 Process
Create the process XRTZVER.
a. Code the criteria selection part
b. Code the execution part
Tips: Use the X3 help.
Find the right events to use in your code.
Keep in mind that this function must be batch compliant.

c. Try your function in interactive mode.

Now that your function is working, we are going to batch it.

4.2.2 Batch task


Create a batch task XRTZVER

Usage > Batch server > Task management (GESABT)

a. Set it up a processing type.


b. Assign your function XRTZVER
c. Launch your batch task.

Usage > Batch server > Request Submission (EXERQT)

d. Check the result of your process:

Usage > Batch server > Request management (AREQUETE)

SageX3 V7_Development Part 1-2_Exercises Page 11 sur 21


5.0 LAB 4 – Inquiry template

Requirement:
Create an inquiry to view Purchase Orders according to the following criteria:
- Start Date and End Date: to filter the orders based on Expected receipt date.
- Suppliers (Start/End)
- Product
- Site
- PO number

Objective:
Experience the behavior and capacity of the template Inquiry.

5.1 creating the graphical structure


5.1.1 Screens
a. Create a new header screen CNSXPO1 [XPO1]:
Field Type Length Remarks : 1st block
EXPDATSTR D Date
EXPDATEND D
BPSNUMSTR BPS Supplier
BPSNUMEND BPS
ITMREF ITM Product
POHFCY FCY Site
POHNUM VCR PO number

Tips: When drawing the layout, don’t forget to place “range” fields on the same line.

Reference the tables PORDER and PORDERQ.

b. Create a new detail screen CNSXPO2 [XPO2]


st
Field Type Length Remarks : 1 block
NBLIG ABS
POHNUM VCR Order number
POHFCY FCY Site
BPSNUM BPS Supplier
EXTRCPDAT D Expected received date
ITMREF ITM Product
UOM UOM Purchase Unit

SageX3 V7_Development Part 1-2_Exercises Page 12 sur 21


STU UOM Stock Unit
QTYSTU QTY Quantity
RCPQTYSTU QTY Already received
INVQTYSTU QTY Already invoiced

Tips: Use a table block.

5.1.2 Window
Create a new Inquiry window FCNSXPO, as a full screen.
Assign your previous screens to this window.

5.1.3 Inquiry
Create a new Inquiry: XPO

Development > Script dictionary > Inquiries (GESACN)

a. Assign your previous window FCNSXPO as your main window.


b. Create 2 new processes
i. CNSXPOSTD: Standard process
ii. CNSXPOSPE: Specific process
Those processes will stay blank for now.

Tips: When validating the inquiry, X3 creates automatically the action and the
function linked to it. You just need to validate the menu.

If the action and the function are not created, use the following procedure.

5.1.4 Action
Create a new Inquiry action CONSXPO
Development > Script dictionary > Actions (GESACT)

Assign the Inquiry XPO to your action.

5.1.5 Function
Create the function CONSXPO

Development > Script dictionary > Functions (GESAFC)

a. Put it under the Module XDEV, after the functions GESXDM.

SageX3 V7_Development Part 1-2_Exercises Page 13 sur 21


b. Enter the title “PO Lines enquiry”
c. Set it up as a Process type and assign the action CONSXPO.

SageX3 V7_Development Part 1-2_Exercises Page 14 sur 21


5.2 creating an inquiry Process

Copy the code from CNSCPPSTD to CNSXPOSTD and adapt it. CPP is the original
standard enquiry for purchase lines. We are going to use it as a template to customize our
own enquiry.

a. Identify the tables that you will need and declare them in your inquiry.
Tips: Take a look at the “table” tab of your inquiry XPO
b. Identify the abbreviation of the header screen so you can replace it by the
abbreviation XPO1
Tips: Remember the codification rules for screens
Use the “replace” function via the shortcut: CTRL+H
c. Identify the abbreviation of detail screen so you can replace it by the
abbreviation XPO2
d. Comment everything linked to Criteria screen for now.
Tips: Criteria screens are named like this
C+XXX, where XXX is the enquiry code

e. Remove everything linked to X3 actions parameters


Tips: Scan the code for the use of the PARAM variable

f. Try to identify pieces of code that can be used for your own enquiry and
adapt it
E.G:
Line 229: DEBDAT= [F:POH] ORDDAT
Can become DEBDAT= [F:POQ] EXTRCPDAT
Indeed, we are using the “expected received date” from the lines table
PORDERQ.

g. Look for required criteria: Do you have them prepared in $LOAD_FILTER?

h. Remove the code linked to fields that don’t exist in your screens.

SageX3 V7_Development Part 1-2_Exercises Page 15 sur 21


6.0 LAB 5 – Selection from table

Requirement
As an example on how to use the selection templates “Selection from table”, we want to
display a list containing the following fields:
Table:
- XDOMMAG
Fields:
- DOMCOD
- DOMDES
- REGDAT
- STA

This list will allow us to select one record among and to load the value of this record in the
calling field.

Objective
This exercise will show you how to use the “selection on table” template in X3.

For this example, you need to create a X3 action, based on a template Selection on
table.

a. Create the action XSELTAB (Selection on table example)

b. Create a process XSELTAB. This process will contain the code for the
selection.

c. Code your own selection

Tips: Use the X3 help.

Find the right event to use in your code.

Use NBCOL, TIT, COL, DEFPAG and START.

d. Plug your new selection on the field [M:XDM0]DOMCOD, as a new selection.

SageX3 V7_Development Part 1-2_Exercises Page 16 sur 21


7.0 LAB 6 – Selection from list

Requirement
As an example on how to use the selection template “Selection on list”, we want to display
a list containing the following fields:
Table: Table:
- XDOMMAG - XDOMMAGD
Fields: Fields:
- DOMCOD - ID
- DOMDES
- REGDAT
- STA

This list will allow us to select one record among the list and to load the value of this
record in the calling field.

Objective
This exercise will show you how to use the “selection on list” template in X3.

For this example, you need to create a X3 action, based on a template Selection on
list.

a. Create the action XSELLIS (Selection on list example)

b. Create a process XSELLIS. This process will contain the code for the
selection.

c. Code your own selection

Tips: Use the X3 help.

Find the right event to use in your code.

Use TIT, NBTEX, TEX and TEXTE.

d. Plug your new selection on the field [M:XDM0]DOMCOD, as a new selection.

SageX3 V7_Development Part 1-2_Exercises Page 17 sur 21


8.0 LAB 7 – Entry points

Requirement
We want to enhance the control on our domain management function GESXDM. We want
to allow the access to only “ADMIN” user. All other users will be access denied. Among all
the possible ways to do so, we will use an entry point. This entry point will allow you to
take control when the function is launched, just before it is displayed. Then you will be
able to check the user and potentially deny the access to the function.

Objective
This exercise will show you how to manage entry points.

Development > Script Dictionnary> Processes> Entry points (GESAPE)

First you need to identify a way to take control on the function.

a. Try to find an entry point that allows you to have control just before the function
is launched.
Tips: Search in the help file for an entry point on the process EXEFNC.
b. Identify how to prevent access:
Variable: …
Value: …
c. Create an entry point on the process EXEFNC. This entry point will use the
code stored in the process XUSRMAG.
Tips: Logout and log back in to activate the entry point
d. In the source file XUSRMAG, control the user :
If the user is ADMIN: allow access
If the user is not ADMIN: deny access
Tips: don’t forget to identify the function you are trying to launch.
e. Test your access management by logging in with the user TRAIN.
Tips: Use the GUSER

SageX3 V7_Development Part 1-2_Exercises Page 18 sur 21


9.0 LAB 8 – Reports

Requirement
As an example on how to use pre-process. We want 2 features:
- Display the printing parameters in a trace file
- Trigger 2 reports in a row. We want to trigger the report ARCCLIENT2, then the
report ARCTTC2.
ARCCLIENT2 is tax excluded
ARCTTC2 is tax included

Objective
This exercise will show you how to use pre-processes in X3.

9.1 Tracing print parameters


For this exercise, we will use the pre-process of the report ARCCLIENT2 to trace the
printing parameters and display them in a trace file.

Development > Script Dictionnary > Reports

a. Open the report description for ARCCLIENT2

b. Create a specific pre-process named XARCCLIENT

We will use the subprog IMPRIME to host our code.


c. Create the subprog IMPRIME
Tips: Look into the standard pre-process ARCCLIENT for examples

d. Open a trace file in your subprog


The variable PARAMETRE hosts the printing parameters as a string array following the
format below:
‘ParameterTitle=ParameterValue’

e. Scan the string array PARAMETRE to read all parameters and their values
into the trace file
Tips:
Use the NBPAR variable
Use the intructions Instr$, left$ and right$.

f. Allow the user to stop the printing if required.


Tips: Use the GOK variable

g. Close and read the trace file.

SageX3 V7_Development Part 1-2_Exercises Page 19 sur 21


9.2 printing report twice

For this example, we need to use an entry point on the printing processes in order to
launch reports one after another.

Development > Script Dictionnary > Scripts> Entry points

a. Try to find an adequate entry point.

Tips: Search in the help file for an entry point on the process AIMP1.

b. Identify how to launch a report when the first one finishes.

c. Create an entry point on the process AIMP1. This entry point will use the code
stored in the process XREPMAG.

d. In the source file XREPMAG:

a. Identify the report that just finishes

b. Launch the second report

e. Test your customization by trying to print a sales order in

Sales > Orders > Orders (GESSOH)

SageX3 V7_Development Part 1-2_Exercises Page 20 sur 21


Thank you

© Sage 2015
This document is the exclusive property of Sage and/or all of the Sage Group affiliates and is
protected by the Intellectual property Code, copyright laws and international treaties.
Any partial or total reproduction of this document is strictly prohibited.
Anyone not complying with these provisions shall be guilty of copyright infringement and will
be liable to criminal penalties provided by the law.

SageX3 V7_Development Part 1-2_Exercises Page 21 sur 21

You might also like