mfg_newbie
Member
I want to integrate .w program into mfg/pro how can I do?
thank in advance!
thank in advance!
I want to integrate .w program into mfg/pro how can I do?
thank in advance!
Your mean i have to create ODBC connection? this is my codeIf you compile the program you have written then you should be able to run it from a shortcut on the Desktop. Don't forget you have to connect to the database using -N -H -S parameters and this may have licensing ramifications.
thank you in advance!/* KSV Editor Copyright: (C) 2000-2006 Serguey Klimoff (bulklodd) Filename: TEST.P Comment: Parameters: Uses: Used by: Created: 01.03.2007 12:19 ADMINIST Modified: 01.03.2007 12:19 ADMINIST */ &ANALYZE-SUSPEND _VERSION-NUMBER AB_v10r12 GUI ADM2 &ANALYZE-RESUME &Scoped-define WINDOW-NAME wWin {adecomm/appserv.i} &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS wWin /*------------------------------------------------------------------------ File: Description: from cntnrwin.w - ADM SmartWindow Template Input Parameters: Output Parameters: History: New V9 Version - January 15, 1998 ------------------------------------------------------------------------*/ /* This .W file was created with the Progress AB. */ /*----------------------------------------------------------------------*/ /* Create an unnamed pool to store all the widgets created by this procedure. This is a good default which assures that this procedure's triggers and internal procedures will execute in this procedure's storage, and that proper cleanup will occur on deletion of the procedure. */ CREATE WIDGET-POOL. /* *************************** Definitions ************************** */ /* Parameters Definitions --- */ /* Local Variable Definitions --- */ {src/adm2/widgetprto.i} /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK /* ******************** Preprocessor Definitions ******************** */ &Scoped-define PROCEDURE-TYPE SmartWindow &Scoped-define DB-AWARE no &Scoped-define ADM-CONTAINER WINDOW &Scoped-define ADM-SUPPORTED-LINKS Data-Target,Data-Source,Page-Target,Update-Source,Update-Target,Filter-target,Filter-Source /* Name of designated FRAME-NAME and/or first browse and/or first query */ &Scoped-define FRAME-NAME fMain /* Custom List Definitions */ /* List-1,List-2,List-3,List-4,List-5,List-6 */ /* _UIB-PREPROCESSOR-BLOCK-END */ &ANALYZE-RESUME /* *********************** Control Definitions ********************** */ /* Define the widget handle for the window */ DEFINE VAR wWin AS WIDGET-HANDLE NO-UNDO. /* Definitions of handles for OCX Containers */ DEFINE VARIABLE CtrlFrame AS WIDGET-HANDLE NO-UNDO. DEFINE VARIABLE chCtrlFrame AS COMPONENT-HANDLE NO-UNDO. /* ************************ Frame Definitions *********************** */ DEFINE FRAME fMain WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY SIDE-LABELS NO-UNDERLINE THREE-D AT COL 1 ROW 1 SIZE 176.6 BY 28.62 WIDGET-ID 100. /* *********************** Procedure Settings ************************ */ &ANALYZE-SUSPEND _PROCEDURE-SETTINGS /* Settings for THIS-PROCEDURE Type: SmartWindow Allow: Basic,Browse,DB-Fields,Query,Smart,Window Container Links: Data-Target,Data-Source,Page-Target,Update-Source,Update-Target,Filter-target,Filter-Source Other Settings: APPSERVER */ &ANALYZE-RESUME _END-PROCEDURE-SETTINGS /* ************************* Create Window ************************** */ &ANALYZE-SUSPEND _CREATE-WINDOW IF SESSIONISPLAY-TYPE = "GUI":U THEN CREATE WINDOW wWin ASSIGN HIDDEN = YES TITLE = "Report Preview" HEIGHT = 28.62 WIDTH = 176.6 MAX-HEIGHT = 28.81 MAX-WIDTH = 178.2 VIRTUAL-HEIGHT = 28.81 VIRTUAL-WIDTH = 178.2 RESIZE = no SCROLL-BARS = no STATUS-AREA = no BGCOLOR = ? FGCOLOR = ? THREE-D = yes MESSAGE-AREA = no SENSITIVE = yes. ELSE {&WINDOW-NAME} = CURRENT-WINDOW. /* END WINDOW DEFINITION */ &ANALYZE-RESUME &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB wWin /* ************************* Included-Libraries *********************** */ {src/adm2/containr.i} /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME /* *********** Runtime Attributes and AppBuilder Settings *********** */ &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES /* SETTINGS FOR WINDOW wWin VISIBLE,,RUN-PERSISTENT */ /* SETTINGS FOR FRAME fMain FRAME-NAME */ IF SESSIONISPLAY-TYPE = "GUI":U AND VALID-HANDLE(wWin) THEN wWin:HIDDEN = yes. /* _RUN-TIME-ATTRIBUTES-END */ &ANALYZE-RESUME /* ********************** Create OCX Containers ********************** */ &ANALYZE-SUSPEND _CREATE-DYNAMIC &IF "{&OPSYS}" = "WIN32":U AND "{&WINDOW-SYSTEM}" NE "TTY":U &THEN CREATE CONTROL-FRAME CtrlFrame ASSIGN FRAME = FRAME fMain:HANDLE ROW = 1.24 COLUMN = 2 HEIGHT = 28.33 WIDTH = 174 WIDGET-ID = 2 HIDDEN = no SENSITIVE = yes. PROCEDURE adm-create-controls: CtrlFrame:NAME = "CtrlFrame":U . /* CtrlFrame OCXINFO:CREATE-CONTROL from: {460324E8-CFB4-4357-85EF-CE3EBFE23A62} type: CrystalActiveXReportViewer */ END PROCEDURE. &ENDIF &ANALYZE-RESUME /* End of _CREATE-DYNAMIC */ /* ************************ Control Triggers ************************ */ &Scoped-define SELF-NAME wWin &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL wWin wWin ON END-ERROR OF wWin /* Report Preview */ OR ENDKEY OF {&WINDOW-NAME} ANYWHERE DO: /* This case occurs when the user presses the "Esc" key. In a persistently run window, just ignore this. If we did not, the application would exit. */ IF THIS-PROCEDUREERSISTENT THEN RETURN NO-APPLY. END. /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL wWin wWin ON WINDOW-CLOSE OF wWin /* Report Preview */ DO: /* This ADM code must be left here in order for the SmartWindow and its descendents to terminate properly on exit. */ APPLY "CLOSE":U TO THIS-PROCEDURE. RETURN NO-APPLY. END. /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME &UNDEFINE SELF-NAME &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK wWin /* *************************** Main Block *************************** */ /* Include custom Main Block code for SmartWindows. */ {src/adm2/windowmn.i} run viewreport. /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME /* ********************** Internal Procedures *********************** */ &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-create-objects wWin _ADM-CREATE-OBJECTS PROCEDURE adm-create-objects : /*------------------------------------------------------------------------------ Purpose: Create handles for all SmartObjects used in this procedure. After SmartObjects are initialized, then SmartLinks are added. Parameters: ------------------------------------------------------------------------------*/ END PROCEDURE. /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE control_load wWin _CONTROL-LOAD PROCEDURE control_load : /*------------------------------------------------------------------------------ Purpose: Load the OCXs Parameters: Notes: Here we load, initialize and make visible the OCXs in the interface. ------------------------------------------------------------------------------*/ &IF "{&OPSYS}" = "WIN32":U AND "{&WINDOW-SYSTEM}" NE "TTY":U &THEN DEFINE VARIABLE UIB_S AS LOGICAL NO-UNDO. DEFINE VARIABLE OCXFile AS CHARACTER NO-UNDO. OCXFile = SEARCH( "wwin.wrx":U ). IF OCXFile = ? THEN OCXFile = SEARCH(SUBSTRING(THIS-PROCEDURE:FILE-NAME, 1, R-INDEX(THIS-PROCEDURE:FILE-NAME, ".":U), "CHARACTER":U) + "wrx":U). IF OCXFile ? THEN DO: ASSIGN chCtrlFrame = CtrlFrame:COM-HANDLE UIB_S = chCtrlFrame:LoadControls( OCXFile, "CtrlFrame":U) . RUN initialize-controls IN THIS-PROCEDURE NO-ERROR. END. ELSE MESSAGE "wwin.wrx":U SKIP(1) "The binary control file could not be found. The controls cannot be loaded." VIEW-AS ALERT-BOX TITLE "Controls Not Loaded". &ENDIF END PROCEDURE. /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI wWin _DEFAULT-DISABLE PROCEDURE disable_UI : /*------------------------------------------------------------------------------ Purpose: DISABLE the User Interface Parameters: Notes: Here we clean-up the user-interface by deleting dynamic widgets we have created and/or hide frames. This procedure is usually called when we are ready to "clean-up" after running. ------------------------------------------------------------------------------*/ /* Delete the WINDOW we created */ IF SESSIONISPLAY-TYPE = "GUI":U AND VALID-HANDLE(wWin) THEN DELETE WIDGET wWin. IF THIS-PROCEDUREERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE. END PROCEDURE. /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable_UI wWin _DEFAULT-ENABLE PROCEDURE enable_UI : /*------------------------------------------------------------------------------ Purpose: ENABLE the User Interface Parameters: Notes: Here we display/view/enable the widgets in the user-interface. In addition, OPEN all queries associated with each FRAME and BROWSE. These statements here are based on the "Other Settings" section of the widget Property Sheets. ------------------------------------------------------------------------------*/ VIEW FRAME fMain IN WINDOW wWin. {&OPEN-BROWSERS-IN-QUERY-fMain} VIEW wWin. END PROCEDURE. /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE exitObject wWin PROCEDURE exitObject : /*------------------------------------------------------------------------------ Purpose: Window-specific override of this procedure which destroys its contents and itself. Notes: ------------------------------------------------------------------------------*/ APPLY "CLOSE":U TO THIS-PROCEDURE. RETURN. END PROCEDURE. /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE viewreport wWin PROCEDURE viewreport : /*------------------------------------------------------------------------------ Purpose: Parameters: Notes: ------------------------------------------------------------------------------*/ DEFINE VARIABLE chApplication AS COM-HANDLE NO-UNDO. DEFINE VARIABLE chReport AS COM-HANDLE NO-UNDO. DEFINE VARIABLE chConnProps AS COM-HANDLE NO-UNDO. CREATE 'CrystalRuntime.Application' chApplication. CREATE 'CrystalRuntime.Report' chReport. /* Insert full path to the Crystal report */ chReport = chApplication:OpenReport("e:\test\Test.rpt"). /* Set the Connection Info to Connection Properties of the table object */ chConnProps = chReportatabase:Tables(1):ConnectionProperties. /* Clear the ConnectionProperties collection */ chConnPropseleteAll. Add the ODBC DSN chConnProps:ADD("DSN", "fov"). /* Add the database level User ID if required */ chConnProps:ADD("sysprogress", "fov"). /* Add the database level password if required */ chConnProps:ADD("fov", "fov"). /* Use either of the following statements to override the Catalog name if the report has been created using OpenEdge 10.1B or later - see P122620 for more information*/ /* chReportatabase:Tables(1):Location = "". */ /* chReportatabase:Tables(1):SetTableLocation("","",""). */ /* Example of some adjustable parameters */ chCtrlFrame:CrystalActiveXReportViewer:EnableNavigationControls = TRUE. /* Enables the CRViewer's Navigation Controls */ chCtrlFrame:CrystalActiveXReportViewer:EnableExportButton = TRUE. /* Enables the CRViewer's Export button */ chCtrlFrame:CrystalActiveXReportViewer:EnableSearchControl = FALSE. /* Disables the CRViewer's Search control */ /* Set the report source */ chCtrlFrame:CrystalActiveXReportViewer:ReportSource = chReport. /* View the report */ chCtrlFrame:CrystalActiveXReportViewer:ViewReport(). RELEASE OBJECT chConnProps. RELEASE OBJECT chReport. RELEASE OBJECT chApplication. ASSIGN chConnProps = ? chReport = ? chApplication = ?. END PROCEDURE. /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME
DEFINE VARIABLE chApplication AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE chReport AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE chConnProps AS COM-HANDLE NO-UNDO.
run p_debug ("Create Application").
CREATE 'CrystalRuntime.Application' chApplication.
run p_debug ("Create Report").
CREATE 'CrystalRuntime.Report' chReport. /* Insert full path to the Crystal report */
run p_debug ("Open Report").
chReport = chApplication:OpenReport("e:\test\Test.rpt").
/* Set the Connection Info to Connection Properties of the table object */
run p_debug ("Connection Properties").
chConnProps = chReportatabase:Tables(1):ConnectionProperties.
/* Clear the ConnectionProperties collection */
chConnPropseleteAll. Add the ODBC DSN
run p_debug ("Add DSN FOV").
chConnProps:ADD("DSN", "fov").
/* Add the database level User ID if required */
run p_debug ("ADD sysprogress FOV").
chConnProps:ADD("sysprogress", "fov").
/* Add the database level password if required */
run p_debug ("ADD fov fov").
chConnProps:ADD("fov", "fov"). /* Use either of the following statements to override the Catalog name if the report has been created using OpenEdge 10.1B or later - see P122620 for more information*/
/* chReportatabase:Tables(1):Location = "". */
/* chReportatabase:Tables(1):SetTableLocation("","",""). */
/* Example of some adjustable parameters */
run p_debug ("Enable Navigation Controls").
chCtrlFrame:CrystalActiveXReportViewer:EnableNavigationControls = TRUE.
/* Enables the CRViewer's Navigation Controls */
run p_debug ("Enable Export Button").
chCtrlFrame:CrystalActiveXReportViewer:EnableExportButton = TRUE.
/* Enables the CRViewer's Export button */
run p_debug ("Enable Search Control").
chCtrlFrame:CrystalActiveXReportViewer:EnableSearchControl = FALSE.
/* Disables the CRViewer's Search control */ /* Set the report source */
run p_debug ("Report Source").
chCtrlFrame:CrystalActiveXReportViewer:ReportSource = chReport.
/* View the report */
run p_debug ("View Report").
chCtrlFrame:CrystalActiveXReportViewer:ViewReport().
run p_debug ("Release Objects").
RELEASE OBJECT chConnProps.
RELEASE OBJECT chReport.
RELEASE OBJECT chApplication.
ASSIGN
chConnProps = ?
chReport = ?
chApplication = ?.
END PROCEDURE.
/* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME
procedure p_debug:
def input param inp_message as char no-undo.
message inp_message view-as alert-box.
end procedure.