Administration > System initialization > Report settings > Macros > Macro definition > Event sequence - robinfeng/beashelp GitHub Wiki
This chapter describes the exact event sequence in a macro. All green entries can be manipulated directly.
Start macro Saving the environment (variables) Variable macroid with the macro number Variable macrostartas with the macro type (fax, email, preview, print, Word, PDF ..) Setting the 4 possible parameters as per the window object description (for definition of sales/purchase documents) Deleting the global header functions Window definition object: Call window-related script Macro start script. Cancellation option with return failure. Among other things, the global functions can be set here, which are then called. If API is stored: API script (e.g. creation of entry in beas_document_header/line)
user-definable function reportscript_report_preinit() reportscript_report_init()
Loop SQL header query execute - as per macro setting (any SQL instruction). This can also have been defined in advance using the variable report_loopscript Variable query as per macro header. Variable query as per API
reportscript_post_variable()
LOOP SQL header query Transfer of all results of the SQL instruction to the variable system, prefix is e_, e.g. the result column "itemcode" is stored in variable e_itemcode
reportscript_macro_loop()
Loop macrostep resetting of global macro step functions Active script. "return failure can be used for canceling Start Script. "return failure can be used for canceling The global macro step function can also be defined here, for example. Definition MacrostepSQL query reportscript_step_prevariable() Variable query as per macrostep reportscript_step_postvariable() If Crystal setting variables: parameterrequest, externreport, connectverify as per macrostep setting Open Report set database connection If beas form Setting all variables. Variable s_parm1, s_parm2 ..., c_parm1, c_parm2 .. are transferred to the structure variable str_parm.s_parm1, s_parm2 ... . Variable beginning with "var_" are transferred to the variable system without "var_" to the target window. Open window. Continue to next macrostep. END
Loop macrostep SQL query
Transfer of all results of the SQL instruction to the variable system, prefix is e_,
e.g. the result column "itemcode" is stored in variable e_itemcode
reportscript_step_preinloop()
If SQL query
Replacement of placeholders in query
Generate report
If current window (only beas form)
as per variable sys_printdw cache the corresponding DataWindow in $$tempdwcopy.psr,
reload and remove graphics.
END
Loop macrooutput
Variable query as per macooutput
If Crystal
query missing parameters
Set parameters
Determine Excel path
Determine filename (if fax/email, then "yyyy/mm/ddhhmmssffff")
otherwise "preview" or as per specification
Determine output type, if not specified
Determine extension depending on format
Preview? Depending on type and specification
Crystal - disconnect for max. 4 seconds
If printing: set printer driver, print - (the "retrieve" is only performed here)
Otherwise export (the "retrieve" is performed here)
If Current Window, SQL query
find directory, if EXCEL, then the Excel directory,
otherwise the attachment directory.
Determine output type, filename and extension.
If printing: Set printer driver, print
Otherwise export according to data type
END
If FAX
Determine fax number
If via SAP: generate and send SAP message
If via Windows: send the document to Windows API (only specific data formats are permitted)
If email
If subject starts with $, get text module, replace placeholders
Determine email address
CC1 and CC2 - where applicable also determine using script. Return script must be in variable "value".
Determine attachments. Scripts must return attachments in variable "value".
Open email window where necessary
Send email depending on type.
If Novaline
novaline_init()
Transfer of Novaline parameters (novaline_param1,...5)
Call of Novaline API.
END
reportscript_step_postinloop()
end Loop macrooutput
end Loop macrostep SQL Query
reportscript_step_prinzkz() - but only if "set print ID" has been activated
If Crystal: Disconnect
end Loop macros end LOOP SQL header query
reportscript_prinzkz() - as header function - but only if "set print ID" has been activated Reset the variable environment, which has been saved in advance.
返回 主页