<?xml version="1.0" encoding="utf-8"?>
<ManualTopic ID="/baanerp/tt/EnterpriseStudio/onlinemanual/rpt_create_print_session_for_query_based_reports" xml:lang="en" UserLevel="Expert">
	<Header>
		<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">To create a print session for query-based reports</Title>
		<Keyword ContextSensitive="No"><Level1>Reporting</Level1>
			<Level2>query-based reports</Level2>
		</Keyword>
		<Keyword ContextSensitive="No"><Level1>Reporting</Level1>
			<Level2>print session</Level2>
		</Keyword>
		<Keyword ContextSensitive="No"><Level1>Reporting</Level1>
			<Level2>
                                    Reporting Studio
                                 </Level2>
		</Keyword>
	</Header>
	<ProcedureSection><ProcIntro><Paragraph class="Default">To create a print session that can print a query-based report, take the following steps:</Paragraph>
		</ProcIntro>
		<Steps><Step><StepTitle>Define a print session</StepTitle>
				<ProcedureList><ListItem>Start the <GUIRef href="/baanerp/tt/adv/ttadv2500m000" role="session">Sessions (ttadv2500m000)</GUIRef> session. Make sure you select the proper development VRC as your current package VRC.</ListItem>
					<ListItem>Click <GUIRef href="" role="command" Update="No">New</GUIRef>. The <GUIRef href="/baanerp/tt/adv/ttadv2100s000" role="session">Sessions (ttadv2100s000)</GUIRef> details session starts.</ListItem>
					<ListItem>Enter the module and session code and the description for the new session, and specify the following session properties: <List><ListItem><GUIRef href="/baanerp/tt/adv/ttadv2100s000#ttadv200.stsc" role="manual">Standard Script</GUIRef>: No</ListItem>
							<ListItem><GUIRef href="/baanerp/tt/adv/ttadv2100s000#gen.script" role="manual" Update="No">Generate Script</GUIRef>: No</ListItem>
							<ListItem><GUIRef href="/baanerp/tt/adv/ttadv2100s000#cpac" role="manual">Program Script</GUIRef>: &lt;The program script's code, consisting of package code, module code and the first 4 characters of the session code.&gt;</ListItem>
							<ListItem><GUIRef href="/baanerp/tt/adv/ttadv2100s000#ttadv200.mpac" role="manual" Update="No">Main Table</GUIRef>: &lt;Empty&gt;</ListItem>
							<ListItem><GUIRef href="/baanerp/tt/adv/ttadv2100s000#ttadv200.kses" role="manual">Session Type</GUIRef>: Print</ListItem>
							<ListItem><GUIRef href="/baanerp/tt/adv/ttadv2100s000#ttadv200.za_ztyp" role="manual">Window Type</GUIRef>: Dialog</ListItem>
							<ListItem><GUIRef href="/baanerp/tt/adv/ttadv2100s000#ttadv200.main" role="manual">Main Session</GUIRef>: Yes</ListItem>
							<ListItem><GUIRef href="/baanerp/tt/adv/ttadv2100s000#ttadv300.zj_sync" role="manual" Update="No">Synchronized Dialog</GUIRef>: &lt;Empty&gt;</ListItem>
						</List> For the other fields, use the default values.</ListItem>
					<ListItem>Save the new session and close the <GUIRef href="/baanerp/tt/adv/ttadv2100s000" role="session">Sessions (ttadv2100s000)</GUIRef> details session.</ListItem>
					<ListItem>In the <GUIRef href="/baanerp/tt/adv/ttadv2500m000" role="session">Sessions (ttadv2500m000)</GUIRef> overview session, click <GUIRef href="/baanerp/tt/adv/ttadv2500m000#compile.session" role="command">Compile</GUIRef>.</ListItem>
				</ProcedureList>
			</Step>
			<Step><StepTitle>Link a query-based report to the session</StepTitle>
				<ProcedureList><ListItem>In the <GUIRef href="/baanerp/tt/adv/ttadv2500m000" role="session">Sessions (ttadv2500m000)</GUIRef> session, select the new session and, on the <GUIRef href="" role="menu">Specific</GUIRef> menu, click <GUIRef href="/baanerp/tt/adv/ttadv2500m000#exec.user.2" role="command">Reports...</GUIRef>. The <GUIRef href="/baanerp/tt/adv/ttadv3530m000" role="session">Reports (ttadv3530m000)</GUIRef> session starts.</ListItem>
					<ListItem>Click <GUIRef href="" role="command">New</GUIRef>. The <GUIRef href="/baanerp/tt/adv/ttadv2112s000" role="session">Add Report to Session (ttadv2112s000)</GUIRef> session starts.</ListItem>
					<ListItem>Enter the report group and the serial number. Select the desired report and click <GUIRef href="" role="command">OK</GUIRef>.</ListItem>
					<ListItem>Save the changes and close the <GUIRef href="/baanerp/tt/adv/ttadv3530m000" role="session">Reports (ttadv3530m000)</GUIRef> session.</ListItem>
				</ProcedureList>
			</Step>
			<Step><StepTitle>Edit the session's UI script</StepTitle>
				<ProcedureList><ListItem>In the <GUIRef href="/baanerp/tt/adv/ttadv2500m000" role="session">Sessions (ttadv2500m000)</GUIRef> session, select the new session and, on the <GUIRef href="" role="menu">Specific</GUIRef> menu, click <GUIRef href="/baanerp/tt/adv/ttadv2500m000#exec.user.5" role="command">Program Scripts...</GUIRef>. The <GUIRef href="/baanerp/tt/adv/ttadv2530m000" role="session">Program Scripts / Libraries (ttadv2530m000)</GUIRef> session starts.</ListItem>
					<ListItem>Select the script and click <GUIRef href="/baanerp/tt/adv/ttadv2530m000#exec.user.4" role="command">Edit / View Script ...</GUIRef>. The script editor starts.</ListItem>
					<ListItem>Edit the script. For example: <List><ListItem>Declare the variables you want to use as input fields on the session's form. Note: the variable names must be identical to the variable names you defined in the Reporting Studio.</ListItem>
							<ListItem>Define defaults for the input fields on the form.</ListItem>
						</List> See the following sample UI script.</ListItem>
					<ListItem>Save the script and close the editor.</ListItem>
					<ListItem>Compile the script and close the <GUIRef href="/baanerp/tt/adv/ttadv2530m000" role="session">Program Scripts / Libraries (ttadv2530m000)</GUIRef> session.</ListItem>
				</ProcedureList>
				<Paragraph class="Default">Sample UI script:</Paragraph>
				<CodeBlock space-and-orientation="indented-estimated">
declaration:
	extern	domain ttaad.pacc 	pack_from	fixed
	extern	domain ttaad.pacc 	pack_to		fixed
	extern	domain ttyeno		incl_pack	| print packages y/n

|**************************** field sections ***********************************

field.pacc_from:
before.zoom:
	ttaad120.pacc = ""

when.field.changes:
	pack_to	= pack_from
	display("pack_to")					|#icc2.6.n

field.pacc_to:
before.zoom:
	ttaad120.pacc = pack_from
</CodeBlock>
				<List><ListIntro>The sample script belongs to a session that prints the package combinations, and optionally, the corresponding package VRCs. Points of attention:</ListIntro>
					<ListItem>The pack_from and pack_to variables are used as input fields in the form, to enter the selection range. In the report design in Reporting Studio, pack_from and pack_to are mapped to parameters "1" and "2" that are used in the query's between statement ( <Code>between :1 and :2</Code> ).</ListItem>
					<ListItem>The incl_pack variable is used as an input field on the form. The value entered by the user (Yes or No) determines whether the packages are printed. In Reporting Studio, the incl_pack variable is used in a print condition. Based on the value of incl_pack, the detail that contains the package VRCs is printed or suppressed.</ListItem>
				</List>
			</Step>
			<Step><StepTitle>Design the session's form</StepTitle>
				<ProcedureList><ListItem>In the <GUIRef href="/baanerp/tt/adv/ttadv2500m000" role="session">Sessions (ttadv2500m000)</GUIRef> session, select the new session and click <GUIRef href="/baanerp/tt/adv/ttadv2500m000#edit.form" role="command">Edit Form ...</GUIRef>. The Dynamic Form Editor starts.</ListItem>
					<ListItem>Edit the form: Add form fields for the input variables you defined in the UI script, and customize the structure of the form until it matches the requirements. See the following figure for an example.</ListItem>
					<ListItem>Save the form and close the editor.</ListItem>
					<ListItem>In the <GUIRef href="/baanerp/tt/adv/ttadv2500m000" role="session">Sessions (ttadv2500m000)</GUIRef> session, click <GUIRef href="/baanerp/tt/adv/ttadv2500m000#compile.session" role="command">Compile</GUIRef>.</ListItem>
				</ProcedureList>
				<Figure space-and-orientation="indented-estimated"><HTML:IMG height="239" width="364" SRC="../images/nt_screen_rpt_create_print_session_for_query_based_reports1.gif" path="/enterpriseserver/tools/tt/enterprisestudio/onlinemanual" btb-count="1" btb-count2="1" btb-image-name="nt_screen_rpt_create_print_session_for_query_based_reports1.gif" btb-source-path="C:\SVN\docnl\Technology\EnterpriseServer~8.5\EnterpriseServer" btb-image-path="/enterpriseserver/tools/tt/enterprisestudio/images/nt_screen_rpt_create_print_session_for_query_based_reports1.gif" ID="IDABH0AC" alt="[...]" xmlns:HTML="http://www.w3.org/TR/REC-html40"/><FigCaption>Sample form</FigCaption>
				</Figure>
			</Step>
		</Steps>
	</ProcedureSection>
	<RelatedTopics><SectionTitle>
                                 Related topics
                              </SectionTitle>
		<RelTopic><Link href="/baanerp/tt/EnterpriseStudio/onlinemanual/rpt_run_query_based_reports" role="manual">To run query-based reports</Link>
		</RelTopic>
		<RelTopic><Link href="/baanerp/tt/EnterpriseStudio/onlinemanual/rpt_create_query_based_reports" role="manual">To create query-based reports</Link>
		</RelTopic>
		<RelTopic><Link href="/baanerp/tt/EnterpriseStudio/onlinemanual/rpt_query_based_reporting" role="manual">Query-based Reporting</Link>
		</RelTopic>
	</RelatedTopics>
</ManualTopic>
