In all code examples in this chapter, we created codeunits that contained functions used locally by codeunits themselves. But a codeunit is a code library that could contain common functionality available to other objects. The following section will show how to invoke functions from code libraries in C/AL:
LOCAL ExportPriceList(FileName : Text) XMLDoc := XMLDoc.XmlDocument; XMLDOMManagement.AddRootElement(XMLDoc,'PriceList',RootNode); IF Item.FINDSET THEN REPEAT XMLDOMManagement.AddElement(RootNode,'Item',Item."No.",'',ItemNode); XMLDOMManagement.AddAttribute(ItemNode,'Description',Item.Description); XMLDOMManagement.AddAttribute(ItemNode,'Price',FORMAT(Item."Unit Price")); UNTIL ...