User Exit Templates
Lawson delivers the user exit template in the SAMPLESRC file in the Lawson Environment library.
PR15B User Exit Template
The PR15B user exit template provides a starting point for creating user exits. It is easiest to use this template if you are creating a beginning user exit for a header/detail form, but you can modify the template for other user exits and form types as well. For other user exit types, you must change the last letter to M or E, and, for forms without detail lines, you must delete the detail sections.
PR15B User Exit Template
* ++++++++++
* Change the program name to the desired User Exit name:
* %%%%%%%%%%
*
H/TITLE EMPLOYEE DEDUCTION SPEED ENTRY
H/COPY COMRPGSRC,PROGRAMH
H ACTGRP(*CALLER) BNDDIR('LARPGRTS')
H*
H****************************************************************
*
*This is a sample User Exit program which has an added edit to
* insure that a User Name entered on PR15 2 is ANELSON or
* MOLSON. All areas of this template User Exit program
* that may be changed are documented with comments below.
* The purpose of the changes for each section is identified,
* and each section is delimited by "* ++++++++++" to begin
* the section and "* %%%%%%%%%%" to end the section.
*
D/COPY COMRPGSRC,LAWSOND
* ++++++++++
* Change the screen definition copy member and source file to
* the name of the screen that will be using this User Exit:
* %%%%%%%%%%
D/COPY PRRPGSRC,PR15DSD
D S2@TRANSACT PR
D S2@EDTTRN PR
D S2@EDTACC PR
D S2@EDEDDT PR
D S2@EDTDTL PR
D S2@PRCTRN PR
D S2@A410 PR
D S2@C420 PR
D S2@L422 PR
D S2@D430 PR
D S2@I480 PR
D S2@MVSCRN PR
D S2@MVDTLD PR
D S2@ADCTGR PR
D S2@CHNCTG PR
D S2@UPDMXB PR
C******************************************************************
C* M A I N P R O G R A M
C******************************************************************
C*
*
* ++++++++++
* As a rule, scan for and replace "GL05 2" with the
* <program name> <space> <screen number> of the program
* which will invoke this User Exit (e.g. "PR15 2" for <PR15>
* <screen 2>). Also, replace "GL052" with <program name>
* <screen number> (no space) even when appended with an "A"
* or an "S" (e.g. "GL052" becomes "Pr152", again for <PR15>
* <screen 2>). See other comments (below) for more info.
* %%%%%%%%%%
*
C *ENTRY PLIST
C PARM E@ENTRY@CNTRL
C PARM E@ENTRY@SCREEN
C*
C EVAL E@SCREENDATA@P = %ADDR(E@ENTRY@SCREEN)
C EVAL E@CONTROL@P = %ADDR(E@ENTRY@CNTRL)
C*
C IF E@SCRNCODE = 'PR152'
C CALLP S2@TRANSACT
C ELSE
C EVAL E@CRTMESSAGE = 'TRANSACTION NOT FOUND'
C EVAL E@REQUEST = E@SNDMESSAGE
C GOTO G0@@EXIT
C ENDIF
C*
C G0@@EXIT TAG
C RETURN
C/COPY COMRPGSRC,LAWSONC *
C******************************************************************
C* S2@TRANSACT - PR15 SCREEN 2 TRANSACTION PROCESSOR
C******************************************************************
P S2@TRANSACT B
D S2@TRANSACT PI
C*
C CALLP S2@EDTTRN Edit Tran
C*
P S2@TRANSACT E
C******************************************************************
C* S2@EDTTRN - Edit Tran
C******************************************************************
P S2@EDTTRN B
D S2@EDTTRN PI
C*
C IF F2@FC = 'A'
C OR F2@FC = 'C'
C CALLP S2@EDEDDT Edit Data
C RETURN
C ENDIF
C*
P S2@EDTTRN E
C******************************************************************
C* S2@EDEDDT - Edit Data
C******************************************************************
P S2@EDEDDT B
D S2@EDEDDT PI
C*
C* ++++++++++++++++++++++ *
C* This area can be used to perform user edits on the
C* header record area of the screen.
C* %%%%%%%%%%%%%%%%%%%%%% *
C IF E@USERNAME <>'ANELSON'
C AND E@USERNAME <> 'MOLSON'
C EVAL E@ERRORNBR = 914
C ENDIF
C EVAL I1 = 1
C DOW I1 <= 11
C AND E@ERRORNBR = *ZEROS
C CALLP S2@EDTDTL Edit Dtl Tran
C ADD 1 I1
C ENDDO
C*
P S2@EDEDDT E
C******************************************************************
C* S2@EDTDTL - Edit Dtl Tran
C***************************************************************
P S2@EDTDTL B
C*
C IF F2@LINEFC(I1) = *BLANKS
C RETURN
C ENDIF
C*
*
* ++++++++++
* The following is an example user edit. Change the field
* names to those of the program that invokes this User Exit.
* Change the logic to perform the edit (or edits) that you
* desire. This example edit insures that the deduction %
* is not greater than 50%.
* %%%%%%%%%%
C IF F2@LINEFC(I1) = 'A'
C OR F2@LINEFC(I1) = 'C'
C IF F2@EDNXAM (I1) > 50
*
* ********** NOTE: Error messages are defined by moving a number
* (in this case, 915) to "E@ERRORNBR". Lawson starts standard
* error numbers at 1 and goes up. To prevent conflicts,
* User Exit error numbers should start at 998 and go down.
* *** IMPORTANT: DO NOT USE '999' FOR AN ERROR NUMBER. ***
* Add text for the error number by using program LA10 in
* Universe, using the catagory of the program name (in this
* case "PR15"):
* %%%%%%%%%%
C EVAL E@ERRORNBR = 915
*
* ********** NOTE: Z-ADDing the "Field Number" (N1...) field to
* "E@FIELDNBR" causes the cursor to move to that field
* (as in the case of an error):
* %%%%%%%%%%
C EVAL E@FIELDNBR = F2FN@EDNXAM (I1)
C ENDIF
C ENDIF
C*
P S2@EDTDTL E
C******************************************************************
P/COPY COMRPGSRC,LAWSONP
****************** End of data ************************************