You are on page 1of 6

How To Guide

Adding an Office Document to a Screen


Define the new Screen ................................................................................................................................ 1
Add the new Tab to the Window ................................................................................................................ 4
Add some code ........................................................................................................................................... 5

This document describes the steps for adding an office document to a screen. Note that Development
Training is necessary to complete this task.

Define the new Screen


Go to Development / Processes / Screens.

In this example, were creating a new screen to add an Office Docs tab to the Sales Order Maintenance
function. To add an office document block to the screen, the block type should be set as Office and a
parameter will be required. This parameter must correspond to the field name for the office document on
the Fields tab, as shown below.

February 2009 Sage Page 1 of 6


Adding an Office Document to a Screen

Once the block line is entered, right-click anywhere one the line and select Definition of Office sections.
This is where the desired type of office document is chosen. Word is the default value. Excel,
PowerPoint, and Universal are the other options.

February 2009 Sage Page 2 of 6


Adding an Office Document to a Screen

Two fields are required for the office document.


1. OFFDOC defines the actual blob to hold the data. Type should be ABB.
2. OFFTYP holds the type of document being displayed/saved

Dont forget to validate the screen.

February 2009 Sage Page 3 of 6


Adding an Office Document to a Screen

Add the new Tab to the Window


Go to Development / Processes / Windows.

Add the newly created screen as a tab line and revalidate the window. Remember to include an activity
code. If this object has entry transactions (e.g. Sales Orders, Shipments, Invoices, etc), the entry
transactions must also be revalidated.

February 2009 Sage Page 4 of 6


Adding an Office Document to a Screen

Add some code


Go to Development / Processes / Process Editor.

Some code must be added to the SPE program associated with the new screen. If you are unsure of the
program name, look at the Specific Processing field in screen Maintenance.

The following code must be integrated into the SPE process. Care is required so as to not overwrite
anything currently there.

$ACTION
Case ACTION
When "LIENS" : Gosub LIENS
When "RAZCRE" : Gosub RAZCRE
When "INICRE" : Gosub INICRE
When "INIMOD" : Gosub INIMOD
When "ANNULE" : Gosub ANNULE
When default
Endcase
Return

############################################################################
$LIENS
# Read the office document
Call LECBLOB ("SOH",[M:SOH0]SOHNUM,"","",[M]OFFTYP,[M]OFFDOC) From SUBAON
Return

############################################################################
$ANNULE
# Deletion of the office document
Call SUPBLOB ("SOH",[F:SOH]SOHNUM,"","") From SUBAON
Return

############################################################################
$RAZCRE
# Set document type - should match up with block definition

February 2009 Sage Page 5 of 6


Adding an Office Document to a Screen

# 4 = Universal
# 5 = Word
# 6 = Excel
# 7 = PowerPoint
[M]OFFTYP=4
Return

############################################################################
$INICRE
Gosub CHARGENETTE
Return

############################################################################
$INIMOD
Gosub CHARGENETTE
Return

############################################################################
$CHARGENETTE

Gosub ACTION From =PROGSUB

# Save the office document to AOBJBUR table


If len([M]OFFDOC)<>0
Call MAJBLOB ("SOH",[M:SOH0]SOHNUM,"","",[M]OFFTYP,[M]OFFDOC) From SUBAON
Endif

GPE=1

Return

February 2009 Sage Page 6 of 6