<?xml version="1.0" encoding="utf-8"?>
<ManualTopic ID="/baanerp/tt/EnterpriseStudio/onlinemanual/functions" xml:lang="en" TopicType="Overview">
	<Header>
		<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">Functions</Title>
		<Keyword ContextSensitive="No"><Level1>
                                    Infor ERP LN Development Tools
                                 </Level1>
			<Level2>function</Level2>
		</Keyword>
	</Header>
	<GeneralSection><Paragraph class="Default">Functions allow you to perform a programming task many times with different values.</Paragraph>
		<Paragraph class="Default">A function is declared in the functions section of a script, or in a library, or in a separate function script (include).</Paragraph>
		<List><ListIntro>The possibilities for calling a function depend on how the function is declared:</ListIntro>
			<ListItem>If a function is declared in the declaration section of a script, you can only call the function within that script.</ListItem>
			<ListItem>If a function is declared in a library, or in a separate function script, you can call the function in multiple scripts and libraries.</ListItem>
		</List>
		<Paragraph class="Default">For more information, refer to "Functions" in the "3GL Language Features" section in the <DocRef>ERP LN 6.1 Programmer's Guide</DocRef>.</Paragraph>
		<ExampleSection><SectionTitle>
                                    Example
                                 </SectionTitle>
			<Paragraph class="Default">The supplier session calculates the cumulative order volume within the last 30, 60 and 90 days. You declare a function that can perform this calculation for any range of days. The function has a type so that it can be used in an expression.</Paragraph>
			<CodeBlock space-and-orientation="indented-estimated">function domain cxquan supplier_volume(long day1,long day2)
{
    ... commands here ...
return( ... ) 
}

</CodeBlock>
			<Paragraph class="Default">If the function is declared as a type, it must provide a return value. You call this function using the syntax:</Paragraph>
			<CodeBlock space-and-orientation="indented-estimated">vol_30 = supplier_volume(0,30)
vol_60 = supplier_volume(30,60)
</CodeBlock>
		</ExampleSection>
	</GeneralSection>
	<GeneralSection><SectionTitle>To create functions</SectionTitle>
		<Paragraph class="Default">To create a function in a program script or in a library, you must edit the script/library via the <GUIRef href="" role="manual">Program Scripts / Libraries (ttadv2530m000)</GUIRef> session. If you define a function in a library, you must link that library to the scripts and libraries where you want to call the function.</Paragraph>
		<Paragraph class="Default">To create a function in a separate function script:(include), you must create the function script through the <GUIRef href="" role="manual">Functions (ttadv2560m000)</GUIRef> session. You must include this function script (through an "#include" statement) in the scripts and libraries where you want to call the function.</Paragraph>
	</GeneralSection>
</ManualTopic>
