PC12 Customizing 2022

Download as pdf or txt
Download as pdf or txt
You are on page 1of 176

Best Practices for Customizing

QAD Enterprise Application

Jan 2023
Prerequisites
• Knowledge of PROGRESS 4 GL
• Relational Database Experience
• Application Programming Experience
• Overview of QAD Enterprise Application
Topics
• Why customize QAD Enterprise Application
• Naming Conventions
• Environments
• Common Include Files
• Modifying QAD Enterprise Application
• Program Templates
• Compiling Code and Installing
Why Customize QAD Enterprise Application
• Business Needs
• Risks
Business Needs
• New Reports are needs
• Additional functionality needed
• Interfaces to other applications

The most basic reason that people customize is that


however broad and deep the functionality of any
application, including QAD Enterprise Application,
there are going to be some business needs that
aren’t completely met by a standard, “off the shelf”
application. Some examples are new reports that
may be needed, additional functionality necessary
to support unique business processes, and interfaces
to other applications that are needed to support
your business.
RISK: Support Implications
• QAD Supports standard QAD Enterprise
Application
• Plain “vanilla” QAD Enterprise Application
test environment
• You must filter support calls
• End-User Training
• Documentation
• On-Line Help
RISK: Upgrade Implications
• Invasive customizations
• Version specific customizations
• Why you pay maintenance
Naming Conventions
• Program File(s) Name
• Database File(s) Name
Program Naming Conventions
• Naming Source Code (.p)
• Naming Include File (.i)
• Naming Validation Procedure (.v)
Naming Source Code
• sosomt.p o cz 7.1 Sales Order Maintenance • m
05/06/03
• --------------------------------------------------------------------------------


|Order: Sold-To: Bill-To: Ship-To: |
--------------------------------------------------------------------------------
t
• ---------------- Sold-To ------------------------------- Ship-To --------------- • i
• | • sosoiq.p a || 7.2 Sales Order Inquiry | 05/06/03
• | • || | q
--------------------------------------------------------------------------------
• | • | Item Number: || Sales Order: |
Sold-To: |
• | • |Purchase Order: || Site: |
Output: |
• | • || |
• --------------------------------------------------------------------------------
• sosorp.p a 7.3.1 Sales Orders by Order Report
• r
--------------------------------------------------------------------------------

05/06/03
• --------------------------------------------------------------------------------
• | Order Date:• Price List: Release to Corp: | p
-------------------------------------------------------------------------------
• | Required Date:• | Sales Order:
Site: Confirmed: To: | |
• | Promise Date: • | Sold-To:
Channel: Currency: To:
Language: | |
• | Due Date:• | Order Date:
Project: / / Taxable: To: / / | |
• |Purchase Order:• | Salespsn: To:
Credit Terms: | |
• |Salesperson[1]:• |Purchase Order: Credit:
Mult: To:
Freight List: | |
• | Commission[1]:• | ActionG/L
Status:
Entity: To:
Allocations: | |
• | Remarks:• | Quote: To:
Comments: | |
• • |
-------------------------------------------------------------------------------- |

• .p


|Currency (Blank for All): Base
|
|
|
• • 4-End
F1-Go 2-Hlp 3-Ins | 6-Mnu 7-Rcl 8-Clr 9-Prev 10-Next 11-Buf |
Module + Function + Screen


|
|
Include Allocated: yes
Include Picked: yes
Display Features and Options: no
Display Comments: no
|
|

Name length is not more than 8 characters.

| Include Shipped: yes
| Include Unprocessed: yes Output:
|
|
• | Batch ID: |
• F1-Go 2-Hlp 3-Ins 4-End 6-Mnu 7-Rcl 8-Clr 9-Prev 10-Next 11-Buf
- ( For portability purpose)
• -------------------------------------------------------------------------------

• Enter data or press F4 to end.


Naming Include Files

.i
prefix + function
Module
Screen

mt

rp

iq

br
Screen
• Maintenance mt
• Inquiry iq
• Report rp
• Control File pm
• Archive/Delete up
• Power Browse br
• Lookup Browse lu
Database Files
• Name = Prefix + “_” + Subfix

- Each file has unique prefix name


- Each field and index in a file has same prefix as file
- All fields and indexes name in database are difference

• File : Module_Data

• Field : Module_Function

• Index : Module_Function[_Function…]
Data
• Control Data ctrl
• Static Data mstr
• Transaction Data mstr, det
• Historical Data hist
• Work File wkfl
Ex. Files
Ex. Fields
Operational New Financials
• cm_mstr ▪ Debtor
- cm_domain – Debtor_ID
- cm_addr – DebtorCode
- cm_type – BusinessRelation_ID
- cm_active – DebtorIsActive

• ad_mstr ▪ Address
- ad_domain – Address_ID
- ad_addr – AddressName
- ad_name – BusinessRelation_ID
- ad_address_id – AddressType_ID
- ad_bus_relation
Changing Standard Source File Names
• Renaming a customized version of a
standard QAD Enterprise Application
program file

• New custom code has been created


Customized QAD Enterprise Application
• Stand • Cust
ard om
• .p • .p
• module + function • a + n + standard filename

• sosomt.p • x1sosomt.p

• .i • .i
• prefix + function • a + n + standard filename

• solinfrm.i • x1solnfr.i

• .v • .v
• prefix + function • a + n + standard filename

• gpsite.v • x1gpsite.v
New Custom Source File Names
• .p
• a + n+ module + function
• x1dwmt.p

• .i
• a + n+ module + function
• x1trfrm.i

• .v
• a + n+ module + function
• x1trnbr.v
Naming Conventions - Customization
• Use “xx” prefix
- xx, x0 – x9

• Program Name
- Custom Prefix + Function + Screen
QAD : sosomt.p
Customize: xxsosomt.p (or x0 thru x9)

• Database
- Custom Prefix + Module + Data
QAD : pt_mstr
Customize: xxpt_mstr (or x0 thru x9)
Environment
• Directory Structure
• File Type
• Database
• Environment Variables and Commands
Directory Structure
/qond/apps/mfgpro/dist
• fin
- customcode/*.r
• ict
- us/??/*.[ri]
• ict-customizations
• mfg
- us/??/*.[ri]
• mfg-customizations
- us/xx/*.[ri]
• pro
- com/qad/shell/report/reports/*.[prixml]

24
Directory Structure (Custom)
/qond/apps/mfgpro/customizations
• fin
- customcode/*.p
• fin/work
- customcode/*.p
• mfg
- default/src/us/??/*.[pi]
- work/src/us/??/*.[pi]
• pro
- com/qad/shell/report/reports/*.[pixml]
• pro-work
- com/qad/shell/report/reports/*.[pixml]
• schema
- custom/*.df

25
File Type
• Object Code .r
• Databases .db, .bi, .lg
• Database Definitions .df
• Source Code (including encrypted) .p, .i, .v, .w, .t
• Data Files for Databases .d
• Files for PROGRESS Results .p, .i, .f
• Scripts, .bat DB Name (Unix) , bat (DOS)
• Database Dump & Load Procedures .r
• Bulk Load Description .fd
File Name Extension
.p Source Code Files
.i Include Files
.t Schema Trigger Files
.w Source Code Files Created in the UIB
.v Validation Routines
.r Executable Files
.st Multi-Volume Database Structure
.db Database Extent Directory
.d1/.d2 Database Data Extents
.bi Database Before-Image File
.lg Database Log File
.lk Database Lock File
.d Data Files
.df Database Definition Files
.fd Database Bulkload File
QAD Enterprise Application Database
• Database Components
• Database Definition
• Files Relationship
• Database Associations
Database Components
• Dictionary

• .db •

Data
Indexes

• mfg • mfg.db • Pending


transactions
• database • mfg.bi • .bi • Integrity check
• login

• mfg.lg •

logout
PROGRESS
• Errors and
• .lg activity

• Created when
database is in use.

• mfg.lk • .lk • Erase after a system


failure.
• Erase only if you are
certain database is
not in use.
Database Definition

https://documentlibrary.qad.com/documents/2370665/368290012/DatabaseDefinitions_TR_v2022EE.pdf
Database Definition

https://documentlibrary.qad.com/documents/2370665/368290012/DatabaseDefinitions_TR_v2022EE.pdf
Definition File

code_mst.df
ADD FIELD "code_fldname" OF "code_mstr" AS character
DESCRIPTION "The field for which this data applies."
FORMAT "x(32)"
INITIAL ""
LABEL "Field Name"
POSITION 2
MAX-WIDTH 80
ORDER 10

ADD INDEX "code_fldval" ON "code_mstr"


AREA "MFG_IDX"
UNIQUE
PRIMARY
INDEX-FIELD "code_domain" ASCENDING
INDEX-FIELD "code_fldname" ASCENDING
INDEX-FIELD "code_value" ASCENDING
File Relationship (Operational)

https://documentlibrary.qad.com/documents/2370665/368290012/EntityDiagrams_TR_v2022EE.pdf
File Relationship (Financial)

https://documentlibrary.qad.com/documents/2370665/368290012/EntityDiagrams_TR_v2022EE.pdf
Database Associations
• Logical name
• CRC
Logical Name
• Database reference
• Default is the physical database name
• Stored in the object code (.r) any
procedures that reference that database
• Used to resolve database references
[db name].[file name].[field name]
sosomt.r
Logical Database Name at Excution
Standard QAD Enterprise Application Logical
Name
• QAD EA Database mfgdb
• Help database hlpdb
• Admin Database admdb
• Customization Database custdb
CRC
• Cyclic Redundancy Check (CRC)
• Relevant schema attributes are stored in the
.r for comparison at execution time
CRC Check
• CRC in program must be the same as CRC
in database
• Progress checks CRC while running the
program
• Modify database definition cause CRC
change
- The program must be recompiled
CRC Components
• Files
- file-name, db-lang
• Field
- Field-name, data-type, dtype, sys-field, field-rpos,
decimals, order, extent, fld-stdtype, fld-stlen,
fld-stoff, fld-case
• Index
- Index-name, unique, num-comp, index-num
• Index-Field
- Field-name, ascending, abbreviate, unsorted
Lab #1.1 : Naming Convention
❑ By program name, Guess it’s function
▪ apvomt.p _______________________
▪ sosoiq.p _______________________
▪ icunis.p _______________________
❑ Screen type
▪ mt ________________________
▪ iq _________________________
▪ rp _________________________
▪ pm ________________________
▪ up ________________________
▪ br ________________________
Lab #1.2 : Naming Convention
❑ Data type
▪ mstr ________________________
▪ det _________________________
▪ ctrl _________________________
▪ hist ________________________
▪ wkfl ________________________
❑ Guess
▪ File : pod_det = ________________
▪ Field : Item code in Sales order detail
• _________________________
▪ Field : Item code in Purchase order detail
• _________________________
Customizing Environment
• Working Directory
• Propath
• PROGRESS Editor
• QAD Enterprise Application Release
Working Directory
• Store of your custom code
- /home/<userid>/<ticket number>
• us/xx/*.p
• reports/*.p
• custom/*.df
• QAD_Layouts/*.xml
Propath
• List of Directories
- PROGRESS searches when attempting to find
procedure files
• Default directories searched
Propath Setting
• Environment variable in start-up script
PROPATH=:dir1:dir2:…
export PROPATH

• PROGRESS statement in progress editor

set propath = “/home/<userid>/<ticket number>,” + propath


Propath Setting

propath = [:]{directory}[: ...]

• First colon = search working directory


• Sequential search
• Separate directories/variables with colon (UNIX)
• Procedure searching order when “Run”
- .r
- SCV (session Compiled Version – retain in memory)
- .p
PROGRESS Editor
Standard QAD Enterprise Application
Releases
• Version Identification
• ECO Process
• Revision Control
Version Identification
• eB3 SP21 eB3 is version
SP21 is Enhancement Code
• Version Control
- Version.mfg script indicates as of date

Example:
$ more /qond/apps/mfgpro/dist/mfg/version.mfg
"Release eB3 SP21 as of Jun 28 2021"
06/28/21
This line is no longer being used.
"QAD Enterprise Applications 2021 - Enterprise
Edition as of Jun 28 2021"
Revision Control
• Engineering Change Order
• Procedure Header
(when procedure filename has changed)
• Revision Log
Engineering Change Order (ECO)
• Reflects a functional unit
• Example: E-mail capability
• ECO number or patch number
- GTSCS or CVC ticket number (CVC0362)
Original Procedure Header
Revision Level
Using the ECO method
Comments
• Comments in source code are specified as

/* comments */
• Anything within markers is not active code
How to Modify QAD Enterprise Application
Programs
• Points to remember
- Define your program prefix code – ‘xx’
- Change source name, do not modify on
standard source
- Design your patch update code
- Put your patch update code
- Put your patch update code into the beginning
of every line you modify
- Comment unused code, do not delete them
- Work in development environment
- When finish ticket to promote in next environment
Step to Setup Customized Environmemt
• Create working directory
- /home/<userid>/<ticket number>/us/xx/*.p
• Modify/Customize your job in working
directory
• Use CVC tools to compile your programs

• Create Menu/Permission
Modifying QAD Enterprise Application
• Points to remember
- Change source name, do not modify on
standard source
- Design your patch update code
- Put your patch update code into the beginning
of every line you modify
- Comment un-used code, do not delete them
Lab #2.1: Custom Programming
❑ Program: Item Data Report (ppptrp11.p)
(1) Add 2 new criteria “Item Group” and
“Added”
(2) Extend format of “Description” to 48x
(3) Remove column “Design Group” and
“Size” in report
QAD Enterprise Application Common Routine
• Menu Structure
• Messages
• Printer Selection
• Batch Control
• Generalized Codes
• Others
Menu Function
• 36.4.4.1 Menu System Maintenance
Menu Function
• 36.3.6.5 Role Permissions Maintain
Menu Function: Files
Menu Function: Primary Fields
Messages Function
• 36.4.6.1 Message Maintenance
Messages Function : Primary Fields
• msg_lang Language Code
• msg_nbrMessage Number Assigned
- >>>9 format
• msg_desc Message itself
Messages Function : Access
• pxmsg.i
- &MSGNUM= Message Number Assigned
- &ERRORLEVEL= Error Level (1 thru 4)
- &MSGARG1= Optional. An argument which will be substituted.
- &CONFIRM= Optional. Indicates this is a confirmation message.

Example:
{us/bbi/pxmsg.i &MSGNUM=1 &ERRORLEVEL=1}
Adding new record
{us/bbi/pxmsg.i &MSGNUM=1 &ERRORLEVEL=2}
WARNING: ADDING NEW RECORD.
{us/bbi/pxmsg.i &MSGNUM=1 &ERRORLEVEL=3}
ERROR: ADDING NEW RECORD. Please re-enter.
{us/bbi/pxmsg.i &MSGNUM=1 &ERRORLEVEL=4}
ERROR: ADDING NEW RECORD.
Messages Function : Access
• pxmsg.i
- &MSGNUM= Message Number Assigned
- &ERRORLEVEL= Error Level (1 thru 4)
- &MSGARG1= Optional. An argument which will be substituted.
- &CONFIRM= Optional. Indicates this is a confirmation message.

Example:
define variable yn as logi.
{us/bbi/pxmsg.i &MSGNUM=11 &ERRORLEVEL=1 &CONFIRM=yn}

Please confirm delete no


Messages Function : Customization

• Reserved msg_nbr 9000-9999


(generic, multi-language)
• PROGRESS statement MESSAGE
(code specific, base language)
Printer Function
• 36.13 Printer Management Menu
Printer Function : Primary Fields
• 36.13.2 Printer Setup Maintenance

prd_dev prd_type

prd_path
Printer Function : Files
Printer Function : Access
• mfselprt.i
{1} default device type “terminal” or “printer”
{2} width 80 or 132
Optional Parameters :
{3} “nopage” for printing checks or labels
{4} stream name (also included in mfrtrail.i)
{5} “append” for disk files

Default pagesize is 60 unless parameter {3}


Example:
define variable b as char.
update b with frame a.
{us/mf/mfselprt.i “terminal” 80}
…..
{us/bbi/mfreset.i}
Printer Function : Access
• gpselout.i
{us/gp/gpselout.i
&printType = "printer"
&printWidth = 80
&pagedFlag = " "
&stream = " "
&appendToFile = " "
&streamedOutputToTerminal = " "
&withBatchOption = "yes"
&displayStatementType = 1
&withCancelMessage = "yes"
&pageBottomMargin = 6
&withEmail = "yes"
&withWinprint = "yes"
&defineVariables = "yes"}
Batch Processing Function
• 36.14 Batch Processing Menu
Batch Processing Function : Primary Fields
• 36.14.3 Batch Request Detail Maintenance

bcd_batch

bcd_userid

bcd_exec

bcd_parm

bcd_dev
Batch Processing Function : Files
Batch Processing Function : Primary Fields
Batch Processing Function : Access
• mfselbpr.i
{1} default device “terminal” or “printer”
{2} width 80 or 132

Optional parameters :
{3} “nopage”
{4} stream name
{5} “append”
Batch Processing Function : Access
• gpselout.i
- This file is a merge version of the following files
- mfselprt.i
- mfselbpr.i
• Purpose
- Allows selection of an output destination
- Validates the selected output destination
- Calls gpprsout.i to process output to the selected
destination
Batch Processing Function : gpselout.i
Code
/*ACCEPT PRINTER INFORMATION*/
/* {us/mf/mfselbpr.i "printer" "80"} */
/*CALL GENERIC DESTINATION SELECTION INCLUDE SPECIFYING THAT THE
VARIABLES batch_id AND dev SHOULD NOT BE DEFINED AS THEY HAVE
ALREADY BEEN DEFINED WITH A CALL TO mfsprtdf.i AT THE BEGINNING OF THIS
FILE. */
{us/gp/gpselout.i &printType = "printer"
&printWidth = 80
&pagedFlag = " "
&stream = " "
&appendToFile = " "
&streamedOutputToFile = " "
&withBatchOption = "yes"
&displayStatementType = 1
&withCancelMessage = "yes"
&pageBottomMargin = 6
&withEmail = "yes"
&withWinprint = "yes"
&defineVariables = "yes"}
............report code ..............
{us/bbi/mfreset.i}
Batch Processing Function : Access
• mfquoter.i
- After data statement of selection criteria
- Assigns global bcdparm variable double quotes
for quotation marks
Batch Processing Function : Access
• gpquote.p
- After data statement of selection criteria
- Assigns global bcdparm variable double quotes
for quotation marks
- Limit 20 passed parameter report criteria
variables
- All parameters must be string data type and
number of parameter must be 20. If report criteria
variables are less than 20, the remaining
parameter must be hard code to “null_char”
- replace mfquoter.i
Batch Processing Function : Example
ppptrp.p

update line line1 part part1 type type1 ptgroup group1


added added1 cmmts
et_report_curr
with frame a.

bcdparm = "".
{us/mf/mfquoter.i line }
{us/mf/mfquoter.i line1 }
{us/mf/mfquoter.i part }
{us/mf/mfquoter.i part1 }
{us/mf/mfquoter.i type }
{us/mf/mfquoter.i type1 }
{us/mf/mfquoter.i ptgroup}
{us/mf/mfquoter.i group1 }
{us/mf/mfquoter.i added }
{us/mf/mfquoter.i added1 }
{us/mf/mfquoter.i cmmts }
{us/mf/mfquoter.i et_report_curr}
Batch Processing Function : Example
ppptrp22.p
{us/bbi/gprun.i ""gpquote.p"" "(input-output bcdparm,
20,
site,
site1,
line,
line1,
part,
part1,
abc,
abc1,
loc,
loc1,
stat,
stat1,
ptstat,
ptstat1,
string(date1),
string(avguse_yn),
costset,
string(summary),
string(inclfirm),
string(inclplanned))"}
t001.i
• {us/t0/t001.i} equal with ‘To’
• Example:

form
line colon 15
line1 label {us/t0/t001.i} colon 45 skip
Drill Down/Lookup Functions
• 36.4.8.1 Drill-Down/Lookup Maitenance
Generalized Code Function
• 36.2.13 Generalized Codes Maintenance
Generalized Code Function : Primary Fields
Generalized Code Function : Customization
• Use code_mstr for a one-to-one relationship
• Utilize “xx” prefix for code_fldname for
version control
Common Include Files
▪ mfdtitle.i Global Variables & Revision
▪ mfdeclre.i Global Variables
▪ gprun.i Subroutine Execution
▪ mfselprt.i Printer Selection
▪ mfselbpr.i Printer with Batch Option
▪ gpselout.I Printer Selection (Merge Version)
▪ mfmsg.i Message Display
▪ window*.i Window Help
▪ mfnp.i Next / Previous Function
▪ mfphead.iReport Header
▪ mfrtrail.i Report Trailer
▪ mfrpexit.i Report End
▪ mfreset.i Inquiry_End
mf.p
• Creates alias qaddb for ldbname[1]
- logical qaddb was used at compilation
• Defines global variables
• Sets User Language Code
• Welcome screen
• Security
• Connect all available databases
- mgdcinit.p
• Primary general ledger entity
• Other start-up tasks
mfdtitle.i
• mfdtitle.i displays the title line at the top of the screen which
includes
- Program name
- Revision level
- Menu selection
- Date

• Must be included in every main program


• The revision level is passed as a parameter to mfdtitle.i
• The revision level of a custom program should be increased
every time a change is made to that custom program
• The {us/mf/mfdtitle.i} include file incorporates
{us/bbi/mfdeclre.i} as well
mfdeclre.i (1 of 2)
• mfdeclre.i defines global variables
• The parameter to pass to mfdeclre.i is one of
the following:
&NOSHARED 🡪 to suppress the shared variables
NEW 🡪 to define new shared variables
blank 🡪 to define shared variables

Example
{us/bbi/mfdeclre.i &NOSHARED} - TO SUPPRESS THE SHARED VARIABLES
{us/bbi/mfdeclre.i "NEW"} - TO DEFINE NEW SHARED VARIABLES
{us/bbi/mfdeclre.i} - TO DEFINE SHARED VARIABLES
mfdeclre.i (2 of 2)
• Just as mfdtitle.i must be included in all main
programs, mfdeclre.i should be included in
all subprograms
- mfdeclre.i need not be included in a main
program because it is included within mfdtitle.i
itself
- Can replace with mfglobal.i for a smaller subset
of the global variable definition contained in
mfdeclre.i
For example
arparp.p {us/mf/mfdtitle.i}
arparpa.p {us/bbi/mfdeclre.i}
Limits
• hi_char = chr (255)
• hi_date = 12/31/3999
• low_date = 01/01/1900
Limits
• Use for report range selection - all
ppptrp.p

form
line colon 15
line1 label {us/t0/t001.i} colon 49 skip
added colon15
added1 lable {us/t0/t001.i} colon 49 skip
with frame a side-labels width 80.
update line line1 part part1.
if line1 = ““ then line1 = hi_char.
if added = ? then added = low_date.
if added1 = ? Then added1 = hi_date.
gprun.i
• Input Parameters
{1} Program Name
{2} Optional Parameter to pass the program
{3} Optional [ PERSISTENT [set handle] ] parameter
for Progress v7

Example:

{us/bbi/gprun.i ""sosomt1.p"" "(input no)"}


gprunp.i (version 9.0 up)
Input Parameters
{1} External procedure name only w/o extension
{2} External procedure file extension (usually “p”)
{3} Internal procedure to run
{4} Parameters, if any, for internal procedure

Example:
{us/gp/gprunp.i "mcpl" "p" "mc-chk-valid-curr"
"(input et_report_curr, output mc-error-number)"}
gprunpdf.i
• Input Parameters
{1} External procedure name only w/o extension
{2} External procedure file extension (usually “p”)

• Description
This file defines variables used for running a persistent procedure via
gprunp.i.

• Example
{us/gp/gprunpdf.i "mcpl" "p"}

define new global shared variable runp_h_{1}_{2} as handle no-undo.


Multi-Currency Include files
mcpl.p - Multi-Currency procedure library (non-interface routines)

This routine encapsulates all of the functions required for


Multi-Currency processing, excluding those requiring user
interface. Each function is implemented below as an internal
procedure.
This procedure library routine is intended to be run PERSISTENT
within any application that requires Multi-Currency functionality.
The application may then call individual internal procedures
within the persistent routine as necessary. The recommended
method for instantiating the persistent procedure and calling the
various internal procedures is through use of gprunp.i.

For more detail see program txtx2drp.p


Multi-Currency Include files
mcui.p - Multi-Currency procedure library (user interface routines)

This routine encapsulates all of the functions required for


multi-Currency Processing that require user interface. Each
function is implemented below As an internal procedure. This
Procedure library routine is intended to be Run PERSISTENT within
any application that requires Multi-Currency Functionality. The
application may then call individual internal procedures Within
the persistent routine as necessary. The recommended method
for Instantiating the persistent procedure and calling the various
internal Procedures is through use of gprunp.i.

For more detail see program sqqorp08.p


Multi-Currency Include files
• Internal Procedures – Non-Interface Routines(mcpl.p)
▪ mc-archive-ex-rate-usage
▪ mc-chk-valid-curr
▪ mc-combine-ex-rates
▪ mc-copy-ex-rate-usage
▪ mc-create-ex-rate-usage
▪ mc-curr-conv
▪ mc-curr-rnd
▪ mc-delete-ex-rate-usage
▪ mc-get-ex-rate
▪ mc-get-rnd-mthd
For more detail see program txtx2drp.p
Multi-Currency Include files
• Internal Procedures – User Interface
Routines(mcui.p)
▪ mc-ex-rate-input
▪ mc-ex-rate-output
▪ ip-build-disp-line
▪ getUsageData
▪ calcNewWorkingRate
▪ validateEnteredRates

For more detail see program sqqorp08.p


Multi-Currency Include files
mcpl.p & mcui.p
Must include gprunpdf.i in the main block of the program so that calls to
gprunp.i from any of the internal procedures skips definition of shared vars
of gprunpdf.i for further info refer to header comments in gprunp.i

Example:
{us/gp/gprunpdf.i "mcpl" "p"}
{us/gp/gprunpdf.i "mcui" "p"}

/* GET ROUNDING METHOD FROM CURRENCY MASTER */


{us/gp/gprunp.i "mcpl" "p" "mc-get-rnd-mthd"
"(input base_curr,
output rndmthd,
output mc-error-number)"}

For more detail see program sqqorp08.p


Message Include Files
• mfmsg.i – Message Display
- {mfmsg.i MsgNum ErrorLevel}
• mfmsg01.i – Message with Update
- {mfmsg01.i MsgNum ErrorLevel UpdateVar}
• pxmsg.i (eB2 up)
- These include file (mfmsg.i & mfmsg01.i) have been replaced
by pxmsg.i
Message Include Files
Replace calls as follow:

{us/bbi/pxmsg.i &MSGNUM=MsgNum &ERRORLEVEL=ErrorLevel}


{us/bbi/pxmsg.i &MSGTEXT=STRTEXT &ERRORLEVEL=ErrorLevel}
{us/bbi/pxmsg.i &MSGNUM=MsgNum &ERRORLEVEL=ErrorLevel
- &CONFIRM=UpdateVar}
Example:

{us/bbi/pxmsg.i &MSGNUM=1 &ERRORLEVEL=1} /* Adding New Record */


{us/bbi/pxmsg.i &MSGTEXT=“’Data Complete’” &ERRORLEVEL=1 }
{us/bbi/pxmsg.i &MSGNUM=11 &ERRORLEVEL=1 &CONFIRM=del-yn}
{us/bbi/pxmsg.i &MSGNUM=2685 &MSGARG1= “’Print Label?’”
&ERRORLEVEL=1 &CONFIRM=del-yn}
wbrp01.i
• Description
Report include file for web-enablement. Include to Build WEB
Page Spec and WEB Page Data. This versions is for menu-level
programs (top level).

• Note
Put this include file before repeat loop if you want to showing
report on the web.

• Example
{us/wb/wbrp01.i}
repeat:
wbrp04.i
• Input Parameters
{1} Optional (Input frame)

• Description
Report include file for web-enablement. Procedures to get the
handle of the input frame (frame a) and the main output
frame, used in Web processing. These procedures have to be
at the bottom of the program, because the frames may not
be defined until late in the program.

• Example
{us/wb/wbrp04.i &frame-spec = a}
wbrp06.i
• Description
Report include file for web-enablement. Handles incoming
selection criteria, and starts the appropriate replies when in
web mode.
• Syntax
{us/wb/wbrp06.i &command = … &field = … &frm = ..}
• Input Parameters:
&command should be “update”
&field variable set in criteria screen within quote
&frm input frame name such as “a”

• Example
{us/wb/wbrp06.i &command = update &fields = "line line1 part part1"
&frm = "a”}
mfphead.i
• Finds tables ls_mstr & ad_mstr for company
title
- where ls_addr = “~report” and ls_type =
“company”
• View 132 column standard form header

sosorp.p e 7.3.1 Sales Orders by Order Report Date: 09/16/92


page: 1 QUALITY PENCIL COMPANY Time: 13:06:22
mfphead2.i
• View 80 column form header
• “no-attr-space” with form phrase
form header
• Re-evaluates all expressions at each new
page or view

Example: page number


mfphead.i/mfphead2.i
• {1} “STREAM stream-name”
- optional, must include STREAM keyword
• {2} “stream-name”
- required if {1} without STREAM keyword

Example:
{us/bbi/mfphead.i}
or {us/bbi/mfphead.i "stream rport" "(rport)"}
mfrtrail.i
mfrtrail.i
• Displays 132 column report criteria
• Closes output stream
• Executes reset command
- prd_rset_pro
mfrtl080.i
• Displays 80 column report criteria
mfrpchk.i
• Executes maximum page limit
- prd_max_page

{&label} Block to exit


{&warn} “false” Do not display messages
{&stream} Optional output stream

Example
{us/mf/mfrpchk.i &loop="soloop"}
or {us/mf/mfrpchk.i}
mfrpexit.i
• Shows “Report Terminated”
{1} “false” Do not display message

Example
{us/mf/mfrpexit.i "false"}

Note:
Put this include file anywhere in FOR Each Loop
when retrieving record take long time and allow
user to terminate report.
mfreset.i
• Executes scrolled output
- prd_scoll_only
• Closes output stream
• Executes printer reset command if selected
- prd_rset_pro
Status Line
• Present uniform function key usage to the
user

• Use the status lines contained in stline[ ]


- stline[] is a global variable defined in
mfdeclre.i
- The values of stline are set in mf1a.p
- Restricted to 63 characters
Status Statement
• Specifies the text on the terminal’s status line
• Defaults
- Blanks while executing a procedure
- “Enter data or press F4 to end.” while updating
field
- “Press space bar to continue” when PAUSE
Statement
Status Line
• stline[1] = “F1-Go 2-Hlp 3-Ins 4-End 6-Mnu 7-Rcl 8-Clr 9-Prev 10-Next
11-Buf”

• stline[2] = “F1-Go 2-Hlp 3-Ins 4-End 5-Delete 6-Mnu 7-Rcl 8-Clr 11-Buf”

• stline[3] = “F1-Go 2-Hlp 3-Ins 4-End 6-Mnu 7-Rcl 8-Clr 11-Buf”


Status Line
• Do:
ststatus = stline[1].
status input ststatus.
• Don’t:
status input off.
status default "F1=Go F2=Help F3=Ins F4=End" +
"F6=Menu F7=Recall F8=Clear F9=Prev F10=Next".
Status Line
• stline[1] is used with the mfnp#.i include files

• stline[2] & stline[3] are used in maintenance


programs

• stline[10] is used in sosgadup.p

• stline[12] is used in apvomtc1.p


• stline[13] is used in rcctwbb.p, rcmbmta.p and
rcshwbb.p
• stline[4], stline[5] and stline[6] were used in the
old scrolling windows (there are some of these
still in the product)
Implementation
• Display for mode of transaction
mfnp.i
• Input Parameters
{1} File name
{2} First Input Variable
{3} First Field
{4} Second Input Variable
{5} Second Field
{6} Index
Example

/* FIND NEXT/PREVIOUS RECORD */


{us/mf/mfnp.i pt_mstr part " pt_mstr.pt_domain = global_domain and pt_part"
part pt_part pt_part}

Note: usually used in maintenance program.


mfnp.i
Searches through {1} where {3} > input {2}
and {5} >= input {4}
use-index {6}
no-lock no-error.
mfnp.i
mfnp06.i
• Description
This version allows the use of a conditional relationship and two
variables that are not necessarily input.
• Input Parameters
{1} the name of the file
{2} the name of the index
{3} a conditional relationship for the search
{4} #1 index field
{5} #1 variable for #1 index
{6} #2 index field
{7} #2 variable for #2 index search
• Note:
- if the starting variables are input variables, then they must be
passed as "input variable name".
- Usually used in maintenance program.
Editing Phase
• Monitors keystrokes during data statements
- prompt-for
- set
- update
• Phrase (block) iterates until end of data
statement
Example:
update pt_part with frame a editing:

end.
Readkey
editing :
...
else do :
status
input.
Readkey.
apply
lastkey.
end.
end.
Frame-Field
• Returns the name of the input field the
cursor in on during data entry statements.
• Other FRAME functions
- frame-value
- frame-name
- frame-db
- frame-file
- frame-index
- frame-row
- frame-column
QAD Enterprise Application Variable: mfguser

• The variable mfguser should always be set by


initialization during the QAD Enterprise
Application login process
• Use it as a unique value across sessions
• Do not assign it a new value
• Do:
create usrw_wkfl.
assign usrw_key1 = mfguser
usrw_key2 = counter.
• Don’t:
assign mfguser = usrw_key1.
Accessing _File, _Field, and Sequence
Attributes
• Do not directly access the meta schema
- PROGRESS only searches the first connected database
• gpfile.i, gpfield.i, gpseq.i
- Searches ALL the connected databases to get the
attributes of a given schema object
Available
• Do: Information:
{us/bbi/gpfilev.i} /*define needed variables*/ file_found
{us/bbi/gpfile.i &file_name=so_mstr}
file_desc
if file_found then ...
file_valexp
• Don’t: file_valmsg
find _file WHERE _file-name = "so_mstr". file_frozen
if available _file then ... file_dump_name
PAUSE 0 Statement
• Avoid using the BEFORE-HIDE option.
Pause 0 is preferred
- PAUSE 0 BEFORE-HIDE sets a global PROGRESS
condition that causes problems for field and
procedure help, and multi-page inquiries that
rely on the default behavior of hiding frames

• Do:
pause 0.

• Don’t:
pause 0 before-hide.
Definition and Acceptable Values for Logical
Variables

Correct:

define variable valid_acct like mfc_logical


initial yes no-undo.

define variable summary like mfc_logical


format "Summary/Detail”
initial yes no-undo.
Incorrect Definition for Logical Variables
Wrong:

define variable valid_acct like mfc_logical


initial “yes” no-undo.
Note: "yes" would be translated

define variable summary like mfc_logical


format "Summary/Detail“
initial "Summary” no-undo.
Note: "Summary" would need to be translated.
Lab # 3.1: Using QAD Include Files
❑ Comparison
▪ mfdtiltle.i - mfdeclre.i
• ___________________________________________
▪ mfmsg.i - mfmsg01.i
• ___________________________________________
▪ mfselprt.i - mfselbpr.i – gpselout.i
• ___________________________________________
▪ mfphead.i - mfphead2.i
• ___________________________________________
▪ mfreset.i - mfrtrail.i
• ___________________________________________
Lab #3.2: Using QAD Include Files
❑ Comparison
▪ mfrtrail.i - mfrtl080.i
• ___________________________________________
▪ mfrpexit.i - mfrpchk.i
• ___________________________________________
▪ mfnp.i - mfnp06.i
• ___________________________________________
PROGRESS Commands (report)
• Searching & Get Record
- Find Statement <first, last, prev ,next >
• Looping:
- Repeat:… End.
- For each … End.
• Display … With frame …
• Report Total
- Accumulate
- Accum Total
- Break by
Customizing Style QAD Enterprise Application

• Report Program
• Inquiry Program
• Maintenance Program
The Report Template
{us/mf/mfdtitle.i “..” }
form definition [selection criteria]
{us/wb/wbrp01.i}
repeat :
data statements [selection criteria]
{us/wb/wbrp06.i …}
{us/mf/mfquoter.i [selection criteria]} or {us/bbi/gprun.i “”gpquote.p””}
{us/gp/gpselout.i &printType = "printer“…..}
{us/bbi/mfphead.i} or {us/bbi/mfphead2.i}

for each...
display
{us/mf/mfrpchk.i} or {us/mf/mfrpexit.i}
end.

{us/mf/mfrtrail.i} or {us/mf/mftrl080.i} or {us/bbi/mfreset.i}


end.
{us/wb/wbrp04.i &frame-spec = a}
The Repeat Block
• Data read within
• Iterate the prompt for another report
• Exit to main menu
Report Selection Criteria

• hi_char = (depends on the character set)


ASSIGN hi_char = CHR(1).
DO i = 2 TO 255: hi_char is set at
IF CHR(i) > hi_char THEN start-up
ASSIGN hi_char = CHR(i). depending on
END. what the high
character is for
• hi_date = 12/31/3999 the chosen
character set
• low_date = 01/01/1900
Selection Form
• ... with frame a
{us/gp/gpselout.i &printType = "printer”…}

Example
Form
part colon 20
part1 label {us/t0/t001.i} colon 45
with frame a width 80 side-label.
Reports – Mandated Program Structure
Every report program must:
• Use mfrpchk.i in all programs
- mfrpchk.i cannot exist within the same block
level as mfreset.i, mfrtrail.i, or mftrl080.i
The Inquiry Template
{us/mf/mfdtitle.i “..”}
form definition [selection criteria]
{us/wb/wbrp01.i}
repeat :
data statements [selection criteria]
{us/mf/mfnp.i …..}
{us/wb/wbrp06.i …}
{us/mf/mfselprt.i “terminal” 80}

for each [selection criteria]


display...
{us/mf/mfrpchk.i} (max page)
end.

{us/bbi/mfreset.i} (scroll output)


{us/bbi/mfmsg.i 8 1}
end.
{us/wb/wbrp04.i &frame-spec = a}
Maintenance Program Template (1 of 3)
/*samplemt.p - Sample Maintenance Program */
/*V8:ConvertMode= Maintenance*/
/*REVISION: x.x LAST MODIFIED MM/DD/YY BY: XXX *ECOX**/
{us/mf/mfdtitle.i “g”}
DEFINE parameter/variable/form definitions
Mainloop: REPEAT:

PROMPT-FOR fields… WITH EDITING:


{us/mf/mfnp.i} /*NEXT/PREV logic*/ Find an existing
END. record or create a
new one

/* ADD/MODIFY/DELETE SECTION */
Explained on next
slide

END. /* MAINLOOP */
STATUS INPUT.
Maintenance Program Template (2 of 3)
Add/Modify/Delete Section
/*ADD/MODIFY/DELETE*/
FIND table1 WHERE key1 = … NO-LOCK NO-ERROR.
IF NOT AVAILABLE table1 THEN DO:
{us/bbi/mfmsg.i 1 1} /* ADDING NEW RECORD */ If the record is not
Create New Record. found, create it!
END.
Ststatus = stline[2].
STATUS INPUT ststatus.
DISPLAY fields.
Setloop: ON ENDKEY UNDO blockx, RETRY blocky: Update status
SET fields… GO-ON (F5 CTRL-D).
line and display
If LASTKEY = KEYCODE(F5) OR ... /*DELETE*/:
del_yn = YES. fields
{us/bbi/mfmsg01.i 11 1 del_yn}
IF del_yn = YES THEN DO:
DELETE table1. NEXT mainloop.
END.
END.
VALIDATIONS ...
END. /* SETLOOP */
The Maintenance Template (3 of 3)
{us/mf/mfdtitle.i “..”}
define variables
form with frame a
mainloop :
repeat :
prompt-for..editing :
{us/mf/mfnp.i}
end.
ADD/MOD/DELETE
find..
if not available..
{us/bbi/mfmsg.i 1 1}
create..
assign..
end.
status-stline[2]
update … go-on (F5 or CTRL-D)
if F5 or CTRL-D then do :
del-yn=yes
{us/mf/mfmsg01.i 11 1 del-yn}
...if del-yn then delete
end.
end.
status input.
QAD .NET UI

• This section is not a HOW TO (at this point)


but is meant to make you aware of what
you will see in the code

• Some reports and inquiries have been “web


enabled”
- New include files
- New procedures
- Coding practices
- Tags
QAD .NET UI: New Include Files
QAD .NET UI : New Procedure Files
QAD .NET UI : Sample Inquiry Program
/* Sample Inquiry Program */
{us/wb/wbrp01.i}
REPEAT:
IF c-application-mode <> “web”:U THEN
[Get selection criteria (update, set or prompt-for)]
{us/wb/wbrp06.i &command=[update,set, or prompt-for]
&fields=“[Selection criteria]”
&frm=“[Frame name]”}
{us/mf/mfselprt.i terminal 80}

FOR EACH…
DISPLAY…
{us/mf/mfrpchk.i}
END.
{us/bbi/mfreset.i} Every inquiry program must follow
END. this structure
QAD .NET UI : Sample Report Program
/* Sample Report Program */
REPEAT:
IF c-application-mode <> “web”:U THEN
[Get selection criteria (update, set or prompt-for)]
{us/wb/wbrp06.i &command=[update,set, or prompt-for]
&fields= “[Selection criteria separated by a space] ”
&frm= “[Frame name]”}
[Assign variable from selection criteria]
{us/mf/mfquoter.i [selection criteria]} /*if batch runable*/
{us/mf/mfselprt.i terminal 132}
{us/bbi/mfphead.i}
FOR EACH ...
DISPLAY ...
{us/mf/mfrpchk.i}
END.
{us/mf/mfrtrail.i}
END.
Every report program must follow
this structure
QAD .NET UI : Another Sample Report
/* Sample Inquiry Program */
{us/wb/wbrp01.i}
REPEAT:
IF c-application-mode <> “web”:U THEN
[Get selection criteria(update, set or prompt-for)]
{us/wb/wbrp06.i &command=[update,set, or prompt-for]
&fields=“[Selection criteria]”
&frm=“[Frame name]”}
IF (c-application-mode <> 'web':u) OR
(c-application-mode = 'web':u AND
(c-web-request begins 'data':u)) THEN DO:
[Assign variable from selection criteria]
{us/mf/mfquoter.i [selection criteria]}
END.
{us/mf/mfselbpr.i terminal 132}
{us/bbi/mfphead.i}

FOR EACH…
DISPLAY…
{us/mf/mfrpchk.i}
END.
{us/bbi/mfreset.i}
END.

After frame input, setup the input


variables to run report!
Customization
• Compiling & Installing
- Compile your own program using cvc tools
- Add your own program on MFG/PRO menu
• Create customized module
- Customized Database
- The maintenance program
- Release your module
Compilation
• Use the CVC tools
cvc command step by step
• New custom
- cvc add -t <ticket> -m <module> -l <list>
- cvc dc
- cvc ci -t <ticket> -n <note> -l <list>
• Modified existing
- cvc co -t <ticket> -l <list>
- cvc dc
- cvc ci -t <ticket> -n <note>
• New custom from standard (Auto)
- cvc so -t <ticket> -m <module> <file> -a
• confirm to change program prefix to “xx”
- cvc co -t <ticket> <file>
- cvc dc
- cvc ci -t <ticket> -n <note>
cvc command step by step
• New custom from standard (Copy)
- cvc so -t <ticket> -m <module> <file> -cl
• need to change program name to “xx” by manual
- cvc add -t <ticket> -m <module> <file>
- cvc dc
- cvc ci -t <ticket> -n <note>
• Delete existing
- cvc co -t <ticket> -l <list>
- cvc delete <file> -t <ticket> -n <note>
Install Your Programs
• Install your program into MFG/PRO menu
- You can create new menu item for your program
or modify existing menu

- Use 36.4.4.1 Menu System Maintenance


- Use 36.3.6.5 Role Permission Maintain
Customized Database
• User fields per file
• User permanent work file
• Generalized Codes
Create Customized Database
• Try to use user fields and file that MFG/PRO
provides
• Do not modify MFG/PRO database definition
• If extra files or fields is needed, create them on
“side” DB

*** Notes *** Please contact QAD I&I before using user fields and
file.
User Fields Naming Conventions
Example

• pt_mstr
- pt__chr01 thru pt__chr10
• format x(8)
- pt__dec01 and pt__dec02
• format >>>,>>>,>>9.99
- pt__log01 and pt__log02
• yes/no

module + “_” + “_” + format


User Workfile
usrw_wkfl is a table that available for users

• Six key fields


• Three compounded indexes, each with two key
fields
• Arrays of following formats
- Character
- Date
- Decimal
usrw_wkfl
usrw_wkfl Workfile (Available for Users)

Field Name Format Dec

usrw_charfld[15] x(8)
usrw_ datefld[4] 99/99/99
usrw_decfld[15] ->>, >>9.99 10
usrw_key1 x(8)
usrw_key2 x(8)
usrw_key3 x(8)
usrw_key4 x(8)
usrw_key5 x(8)
usrw_key6 x(8)
usrw_user1 x(8)
usrw_user2 x(8)
usrw__qadc01 x(8)

Index Name Unique Field - Name


*usrw_index1 yes usrw_key1
usrw_key2
*usrw_index2 no usrw_key3
usrw_key4
*usrw_index3 no usrw_key5
usrw_key6
Ex: usrw_wkfl
create usrw_wkfl.
usrw_key1 = “sod_det”
usrw_key2 = string(sod_nbr,”x(8)”) +
string (sod_line, “999”)
usrw_key3 = “sod_det”
usrw_key4 = alternate_index_data
usrw_charfld[1] = transportation info
usrw_charfld[2] = transportation info
Generalized Code

code_mstr code _fldname Field Name


code _value Value
code _desc Description
code _cmmt Comments

Note:
Think of code_mstr how it fit your requirement before
you create new table.
Setup Validation in Database
code_mstr
• Utilize for custom one-to-one relationship
• Cannot be used if standard product
validation
- PROGRESS Data Dictionary validation
• Example
- create code_mstr.
- code_fldname = “pt_part”.
- code_value = item number.
- code_cmmt = alt-item number.
Example Extra File on Side Database
• xxpt_mstr (Extra information for item
master)
- xxpt_part (key field)
- xxpt_user1
- xxpt_user2
- xxpt_user3
- ...
• Files Relationship
xxpt_mstr
pt_mstr
Extra Info.
Item Master
Item Master xxpt_part=pt_part
Record Locks
Report & Inquiry Programs
▪ Always Specify “NO-LOCK” Type for Report & Inquiry
▪ Ex.
For each pt_mstr no-lock.
.......
.......
End.
Q&A

You might also like