Step 5. Create Form iiiFRM08 – Test PDF Output for Employees

1.  Create form iiiFRM08 – Test PDF Output for Employees.

2.  Replace its code with the following:

Function Options(*DIRECT)

Begin_Com Role(*EXTENDS #PRIM_FORM) Clientwidth(608) Clientheight(232) Componentversion(2) Left(614) Top(179)

Define_Com Class(#STD_FLAG.Visual) Name(#STD_FLAG) Componentversion(1) Displayposition(1) Height(21) Left(20) Parent(#COM_OWNER) Tabposition(1) Top(20) Usepicklist(False) Width(194) Caption('Report Type') Labeltype(Caption)

Define_Com Class(#EMPNO.Visual) Name(#EMPNO) Componentversion(1) Displayposition(2) Height(21) Left(20) Parent(#COM_OWNER) Tabposition(2) Top(55) Usepicklist(False) Width(251)

Define_Com Class(#SURNAME.Visual) Name(#SURNAME) Displayposition(3) Left(20) Parent(#COM_OWNER) Tabposition(3) Top(85)

Define_Com Class(#DEPTMENT.Visual) Name(#DEPTMENT) Displayposition(4) Left(20) Parent(#COM_OWNER) Tabposition(4) Top(115)

Define_Com Class(#PRIM_LABL) Name(#Label1) Caption('E = Employee, S = Surname, D = Department') Displayposition(5) Ellipses(Word) Height(21) Left(272) Parent(#COM_OWNER) Tabposition(5) Tabstop(False) Top(20) Verticalalignment(Center) Width(289)

Define_Com Class(#PRIM_STBR) Name(#StatusBar1) Displayposition(6) Height(23) Left(0) Messageposition(1) Parent(#COM_OWNER) Tabposition(6) Tabstop(False) Top(209) Width(608)

Define_Com Class(#PRIM_PHBN) Name(#Button1) Caption('Create Report') Displayposition(7) Left(20) Parent(#COM_OWNER) Tabposition(7) Top(160) Width(90)

 

Evtroutine Handling(#com_owner.CreateInstance)

Set Com(#com_owner) Caption(*component_desc)

Endroutine

 

Evtroutine Handling(#Button1.Click)

Begincheck

Valuecheck Field(#STD_FLAG) With_List('E' 'D' 'S') Msgtxt('Report Type must be E, D or S')

Case Of_Field(#STD_FLAG)

When Value_Is('= E')

Filecheck Field(#EMPNO) Using_File(pslmst) Msgtxt('Employee not found')

When Value_Is('= D')

Filecheck Field(#DEPTMENT) Using_File(deptab) Msgtxt('Department not found')

When Value_Is('= S')

If Cond('#SURNAME = *blanks')

Set_Error For_Field(#SURNAME)

Message Msgtxt('Surname may not be blank')

Endif

Endcase

Endcheck

Exchange Fields(#EMPNO #DEPTMENT #SURNAME #STD_FLAG)

Call Process(*DIRECT) Function(IIIFN15) Exit_Used(*NEXT) Menu_Used(*NEXT)

Endroutine

End_Com

3.  Change the called function name using your initials.

4.  Test function iiiFN15 by executing form iiiFRM08.

6.  Check that the PDF document produced when selecting by employee number, by surname and by department.