Is there a way to execute a program from within Crystal Reports 2008?

 11 Replies
 0 Subscribed to this topic
 22 Subscribed to this forum
Sort:
Author
Messages
C Fritz
Advanced Member Send Private Message
Posts: 19
Advanced Member
Hello - I am trying to find out if its possiblet execute a Windows batch file from within Crystal Reports. Does Crystal reports have the capacity to make a system call to the OS and execute a command outside itself? If it does can you please explain the syntax or point me to a source that enables this? Thank you.
C Fritz
Advanced Member Send Private Message
Posts: 19
Advanced Member
I want to clarify - I do not want to execute Crystal Reports from a command line or as part of a batch file - I want Crystal Reports to call a script.
John Henley
Send Private Message
Posts: 3353
How are you going to be running the report? In Crystal itself, in Crystal Enterprise, LBI ?
Thanks for using the LawsonGuru.com forums!
John
C Fritz
Advanced Member Send Private Message
Posts: 19
Advanced Member
I am trying to find a way to get a *.cmd file to run that will reformat our PR160 file to ACH format. We want to do this with a portal shortcut. We tried to go the path of tokens and were told by Lawson that user defined tokens can only be called from a shortcut if you pay LPS to do this. Lacking the funding to do that, I am thinking I can make a shortcut or link on the LBI page to a "report" that shells out a command to execute the script. I have another Crystal Report that the user can run from her portal. I was hoping I could use Crystal Reports to design something like this that will call the cmd file I wrote (that works). I am very new to Lawson/Crystal Reports - so I get lost quickly with the Lawson-Latin that most directions seem to be couched in. Any suggestions?
Chris Martin
Veteran Member Send Private Message
Posts: 277
Veteran Member
Have you tried just publishing a dashboard link to the cmd file?
Greg Dey
Advanced Member Send Private Message
Posts: 23
Advanced Member
I know this is not an answer for your question but we have done what you wanted by: 1. Creating the script or cmd. 2. Create user token via tokendef which calls the cmd. 3. Create a job in jobdef which calls the token. The user will see the job in their job list via portal.
C Fritz
Advanced Member Send Private Message
Posts: 19
Advanced Member
I will outright confess I am so new to Lawson I am happy most days when I can spell it correctly. I have been through the fire with MyLawson not-always-helpful help desk support. I did create the token and it runs in LID - then was told we can not create portal links that call command files or user tokens. I have been trying to create a job in jobdef with disappointing results. I can't get the user defined tokens to show up with jobdef. I am certain it is user error - but I am what I am at this point and I am not having luck getting help from Lawson or understanding the manuals. If you have idiot ready directions I would very gratefully try them. I would also very happily try a dashboard link if I had instructions that I could understand. The user doesnt have access to the job queues, so if we can we are really looking for something like the report link she has (which is maybe a dashboard link) I am still trying to discern the names for all the parts. Anything you can offer I will happily try.
Greg Moeller
Veteran Member Send Private Message
Posts: 1498
Veteran Member
To get user-defined tokens available via Portal, you need to use LID.... Basically you are defining a program. If you are able to, copy existing src code files, ie $LAWDIR/'productline'/hrsrc/HR11* to new program names, ZZ11 or whatever you pick. edit the PD file, to contain ONLY the following 000100****************************************************************** 000200 050-EDIT-PARAMETERS SECTION 10. 000300****************************************************************** 000400 050-START. 000500 000600 050-END. 000700 000800****************************************************************** 000900 100-PROGRAM-CONTROL SECTION 10. 001000****************************************************************** 001100 100-START. 001200 001910 MOVE "/lawson/apps/prod/script/script-file.ksh" TO 001920 WS-CONVERT-SCRIPT. 001930 CALL "SYSTEM" USING WS-CONVERT-SCRIPT. 002000 002100 100-END. 002200 002300****************************************************************** 002400 1000-SEL-REPORT SECTION 50. 002500****************************************************************** 002600 1000-START. 005600 012500****************************************************************** 012600 1000-END. 012700****************************************************************** Then: pgmdef | select product line | select system code F6 to define. On option A -- Make sure you have 'Allow Generation For : Lawson 4GL" Trick to select it... F4 to select | Home key | then Enter Also put in 'In Production On' value... same tricks. After done, compile the program... and if it compiles, you should be able to access it from Portal.
Greg Dey
Advanced Member Send Private Message
Posts: 23
Advanced Member
You may be running into the "feature" of things that worked in LID but do not in Portal. Send me an email gdey@grenergy.com and I'll send the screen prints I have.
C Fritz
Advanced Member Send Private Message
Posts: 19
Advanced Member
Greg - I looked at your solution before, but wasnt able to discern where to put the code you pasted above. The script I wrote really isnt a product line - its just a windows batch file that calls the cnvexpr function and reformats a file. Our users dont have access to LID. They have some LBI access through a web portal that amounts to one button that runs a single Crystal report. I am sorry I cant explain better - sometimes the Lawson lingo just makes my head want to implode. I will try your steps again on Monday with pgmdef. I know your tokendef steps were helpful. I think when I ran the pgmdef stuff it either errored or couldnt get to the tokens I made. I think I am a few steps short a full build. =/ I know it will come eventually. Greg - will do. Thank you everyone and have a safe Holiday.
David Britton
Veteran Member Send Private Message
Posts: 53
Veteran Member
If you are referring to the "tape" file that is uploaded to your bank, the file can be properly formatted by changing the Work File Definition for the Tape file. See the attached screenshot for our setup. I tried to use cnvexp without success and got a completely nonsensical answer from Lawon support. Change to Workdef per Article 71213. Need to change File Media from Sequential to Tape for File Name TAPE. qcompile pr pr160 The KB article I reference may be obsolete but these are the steps we use in LSF 9.0.1.7 APPS 9.0.1.x
Attachments
C Fritz
Advanced Member Send Private Message
Posts: 19
Advanced Member
David - Thank you for instructions I can actually understand and follow. I made the changes in our test machine and we tested today. I have it set in PROD now and will wait for next weeks payroll. I think this is easiest solution to this immediate need. I really appreciate your help. If anyone else has ideas how to run a cmd or bat file from Crystal I would love to know in case we have other problems without such an elegant solution available.