Running Crystal Reports in 4GL

SOLVED

Good Morning Sage Community!

There was a request to run report code "ATB" on an automated basis and have it emailed, etc.  So the first part is to get the report to send to a network directory...

We currently run multiple reports through 4GL TRT files, and then automate those files on a batch basis.  I copied the 4GL down from another process, and this is what I came up with:

Local Char ETAT
Local Char FONCTION
Local Char TBPAR(150) (150)
Local Char TBVAL(150) (150)

If clalev([F:BPC])=0 : Local File BPCUSTOMER [BPC] : Endif
If clalev([F:BPR])=0 : Local File BPARTNER [BPR] : Endif
If clalev([F:DUD])=0 : Local File GACCDUDATE [DUD] : Endif
If clalev([F:HAE])=0 : Local File GACCENTRY [HAE] : Endif
If clalev([F:HAE])=0 : Local File GACCENTRY [HAE] : Endif
If clalev([F:DAE])=0 : Local File GACCENTRYD [DAE] : Endif
If clalev([F:TCU])=0 : Local File TABCUR [TCU] : Endif

Local Char ETAT
Local Char FONCTION
Local Char TBPAR(150) (150)
Local Char TBVAL(150) (150)

TBPAR(0) ="asofdate"
TBPAR(1) ="sitedeb"
TBPAR(2) ="sitefin"
TBPAR(3) ="coldeb"
TBPAR(4) ="colfin"
TBPAR(5) ="tiersdeb"
TBPAR(6) ="tiersfin"
TBPAR(7) ="datebase"
TBPAR(8) ="bprtype"
TBPAR(9) ="summary"
TBPAR(10) ="namesort"
TBPAR(11) ="txncur"
TBPAR(12) ="rptcur"
TBPAR(13) ="filnam"

TBVAL(0) = date$
TBVAL(1) = ""
TBVAL(2) = ""
TBVAL(3) = ""
TBVAL(4) = ""
TBVAL(5) = ""
TBVAL(6) = ""
TBVAL(7) = "1"
TBVAL(8) = "1"
TBVAL(9) = "1"
TBVAL(10) = "1"
TBVAL(11) = "1"
TBVAL(12) = GSYSCUR
TBVAL(13) = "\\10.10.9.208\comm\test\TESTTTT.PDF"

ETAT = "ZATB"

GSERVEUR = 1
GSILENCE = 1

Call ETAT(ETAT,"YNEW","eng",0,FONCTION,TBPAR,TBVAL) From AIMP3

I copied the canned "ATB" in both the Crystal Repot and Report Dictionary so that I could add the "filnam" parameter.

Here's a screenshot of the Report Dictionary:

Any advice would be greatly appreciated.  Thank you!

  • 0

    Hi Joe:

    Is there any error?

    In other words these are great details you have provided, but what is the issue.

    Is the process attached to the report in the report dictionary?

    Looking at this process, I see FONCTION has been declared but it's not been defined, also is YNEW a printer destination?

     

    Regards,  

  • 0
    verified answer

    All -

    I've figured out a solution to this issue.  The "filnam" parameter has to be handled in the Preprocesser of a report.  The below snippet of code placed in the preprocessor will allow the file to be written to a desired directory.

    Be sure when using the above code sample that you encapsulate ALL parameters in the crystal report.. including the beginning/ending paramters (i.e. 'invdatdeb' - 'invdatfin').

    Just wanted to pay it forward.  Thansk!

    <!----------------BEGIN CODE---------------->

    Subprog IMPRIME(NBPAR,PARAMETRE)

    Value    Integer NBPAR

    Variable Char    PARAMETRE()()

    Call EXEC(NBPAR,PARAMETRE)

    End

    $ACTION

    Case ACTION

    When "FICHIER" : Gosub FICHIER

    When Default :

    Endcase

    Return

    $FICHIER

    If  GSERVEUR = 1

       If dim(FICHIER)

       Local Integer YTEMP

           For YTEMP = 0 To 100

               If [M:AIP]TBPAR(YTEMP) ="filnam"

                   FICHIER = [M:AIP]TBVAL(YTEMP)

                   Break

               Endif

           Next

       If GUSER = "BATCH"

               Call ECR_TRACE("test FICHIER",0) From GESECRAN

                Call ECR_TRACE(num$(YTEMP),0) From GESECRAN

       Endif

       Endif

    Endif

    Return

    ######################################################################

    Subprog EXEC(NBPAR,PARAMETRE)

    Value Integer    NBPAR

    Variable Char    PARAMETRE()()

    End

    <!----------------END CODE---------------->

  • 0 in reply to Joe Pavicic
    In the ETAT call, is the YNEW a destination?
  • 0 in reply to Denise Hartman
    HI Denise,

    Yes, IMPRIMANTE, the 2nd variable name on the ETAT subprog within AIMP3, translated means Printer. It is the name of the printer.

    Cheers,
    Bob