Job scheduling and printing

main logic is that - when i wil execute  main program then whatever output wil cme that time one text file has to b generate.
i want to do a program in which i have to use dynamic internal table and GUI_DOWNLOAD .
and this program i want to submit in main program. in which i have to use JOB_OPEN, CLOSE and SUBMIT.
what should i do. give me one referal code also. i am new in ABAP.
thnx in advance

Hi,
Check this code
ASSIGN A NAME TO A JOB
  CONCATENATE sy-uname sy-datum sy-uzeit INTO w_jobname .
OPEN THE JOB & GET THE JOBCOUNT
  CALL FUNCTION 'JOB_OPEN'
    EXPORTING
  DELANFREP              = ' '
  JOBGROUP               = ' '
      jobname                = w_jobname
  SDLSTRTDT              = NO_DATE
  SDLSTRTTM              = NO_TIME
  JOBCLASS               =
   IMPORTING
     jobcount               = w_jobcount
CHANGING
  RET                    =
EXCEPTIONS
   cant_create_job        = 1
   invalid_job_data       = 2
   jobname_missing        = 3
   OTHERS                 = 4
  IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
CLEAR : wa_seltab.
PARAMETER 'COMPANY CODE'
  wa_seltab-selname = 'KD_BUKRS'.
  wa_seltab-sign    = 'I'.
  wa_seltab-option  = 'EQ'.
  wa_seltab-kind    = c_s.
  wa_seltab-low =  po_code.
  wa_seltab-high = space.
  APPEND wa_seltab TO i_seltab.
  CLEAR wa_seltab.
RADIO BUTTON 'OPEN ITEMS'
IF NOT po_opsel IS INITIAL.
  wa_seltab-selname = 'X_OPSEL'.
  wa_seltab-sign    = 'I'.
  wa_seltab-option  = 'EQ'.
  wa_seltab-kind    = c_p.
  wa_seltab-low = po_opsel.
  APPEND wa_seltab TO i_seltab.
ENDIF.
  CLEAR wa_seltab.
PARAMETER 'OPEN AT KEY DATE'
  IF NOT po_stida IS INITIAL.
    wa_seltab-selname = 'PA_STIDA'.
    wa_seltab-sign    = 'I'.
    wa_seltab-option  = 'EQ'.
    wa_seltab-kind    = c_p.
    wa_seltab-low = po_stida.
ELSE.
   wa_seltab-low = space.
ENDIF.
    APPEND wa_seltab TO i_seltab.
  ENDIF.
  CLEAR wa_seltab.
RADIO BUTTON 'CLEARED ITEMS'
IF NOT po_clsel IS INITIAL.
  wa_seltab-selname = 'X_CLSEL'.
  wa_seltab-sign    = 'I'.
  wa_seltab-option  = 'EQ'.
  wa_seltab-kind    = c_p.
  wa_seltab-low     =  po_clsel.
  APPEND wa_seltab TO i_seltab.
ENDIF.
  CLEAR wa_seltab.
SELECT OPTIONS 'CLEARING DATE' - LOW & HIGH
  wa_seltab-selname = 'SO_AUGDT'.
  wa_seltab-kind    = c_s.
  IF NOT so_augdt-low IS INITIAL AND NOT so_augdt-high IS INITIAL.
    wa_seltab-option  = 'BT'.
    wa_seltab-sign    = 'I'.
    wa_seltab-low =  so_augdt-low.
    wa_seltab-high = so_augdt-high.
  ELSEIF so_augdt-low IS INITIAL AND NOT so_augdt-high IS INITIAL.
    wa_seltab-option  = 'BT'.
    wa_seltab-sign    = 'I'.
    wa_seltab-low =  '00000000'.
    wa_seltab-high = so_augdt-high.
  ELSEIF NOT so_augdt-low IS INITIAL AND so_augdt-high IS INITIAL.
    wa_seltab-option  = 'EQ'.
    wa_seltab-sign    = 'I'.
    wa_seltab-low =  so_augdt-low.
    wa_seltab-high = '00000000'.
  ENDIF.
  APPEND wa_seltab TO i_seltab.
  CLEAR wa_seltab.
  SUBMIT (c_fbl1n)
                 VIA SELECTION-SCREEN
                    TO SAP-SPOOL
                    VIA
                    JOB w_jobname              " JOBNAME
                    NUMBER w_jobcount          " UNIQUE ID OF JOB
                    DESTINATION c_print
                    IMMEDIATELY ' '
                    KEEP IN SPOOL c_prt_kspool
                    LAYOUT c_layout
                    WITHOUT SPOOL DYNPRO   "SKIP PRINT DIALOG SCREEN
                    WITH SELECTION-TABLE i_seltab " USER INPUT
                    AND RETURN.
COMMIT WORK.
CLOSE THE JOB
  CALL FUNCTION 'JOB_CLOSE'
    EXPORTING
  AT_OPMODE                         = ' '
  AT_OPMODE_PERIODIC                = ' '
  CALENDAR_ID                       = ' '
  EVENT_ID                          = ' '
  EVENT_PARAM                       = ' '
  EVENT_PERIODIC                    = ' '
      jobcount                          = w_jobcount
      jobname                           = w_jobname
  LASTSTRTDT                        = NO_DATE
  LASTSTRTTM                        = NO_TIME
  PRDDAYS                           = 0
  PRDHOURS                          = 0
  PRDMINS                           = 0
  PRDMONTHS                         = 0
  PRDWEEKS                          = 0
  PREDJOB_CHECKSTAT                 = ' '
  PRED_JOBCOUNT                     = ' '
  PRED_JOBNAME                      = ' '
  SDLSTRTDT                         = NO_DATE
  SDLSTRTTM                         = NO_TIME
  STARTDATE_RESTRICTION             = BTC_PROCESS_ALWAYS
     strtimmed                         = 'X'
  TARGETSYSTEM                      = ' '
  START_ON_WORKDAY_NOT_BEFORE       = SY-DATUM
  START_ON_WORKDAY_NR               = 0
  WORKDAY_COUNT_DIRECTION           = 0
  RECIPIENT_OBJ                     =
  TARGETSERVER                      = ' '
  DONT_RELEASE                      = ' '
  TARGETGROUP                       = ' '
  DIRECT_START                      =
IMPORTING
  JOB_WAS_RELEASED                  =
CHANGING
  RET                               =
EXCEPTIONS
   cant_start_immediate              = 1
   invalid_startdate                 = 2
   jobname_missing                   = 3
   job_close_failed                  = 4
   job_nosteps                       = 5
   job_notex                         = 6
   lock_failed                       = 7
   invalid_target                    = 8
   OTHERS                            = 9
  IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
CLEAR : w_spool_number.
  REFRESH : i_jobsteplist.
CHECK WHETHER STATUS OF JOB IS COMPLETED OR CANCELLED
  WHILE 1 = 1.
GET THE JOB STEPLIST WHICH HAS THE SPOOL NUMBER
    CALL FUNCTION 'BP_JOB_READ'
      EXPORTING
        job_read_jobcount           = w_jobcount
        job_read_jobname            = w_jobname
        job_read_opcode             = '35'
  JOB_STEP_NUMBER             =
     IMPORTING
       job_read_jobhead            = wa_jobhead
     TABLES
       job_read_steplist           = i_jobsteplist
CHANGING
  RET                         =
   EXCEPTIONS
     invalid_opcode              = 1
     job_doesnt_exist            = 2
     job_doesnt_have_steps       = 3
     OTHERS                      = 4
    IF sy-subrc <> 0.
     MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
IF STATUS OF JOB IS COMPLETED(F) OR CANCELLED(A)
READ THE JOBSTEPLIST & GET THE SPOOL NUMBER
    IF wa_jobhead-status =  c_a OR wa_jobhead-status = c_f.
      READ TABLE i_jobsteplist INTO wa_jobsteplist INDEX 1.
      CHECK wa_jobsteplist-listident <> space.
      w_spool_number = wa_jobsteplist-listident.
      EXIT.
    ENDIF.
  ENDWHILE.
Regards,
Pankaj

Similar Messages

  • Background job schedule and mail triggering

    Hi Experts,
    I schedule a background job to run a custom program for project closure.The job is running successfully. But,the mail I am getting from this job run is same all the time (means it's showing same project closure again and again though I am running job for different projects). Is it some bug in our custom program or any parameters required to be check in job schedule?
    Kindly suggest.
    Thanks & Regards
    Saurabh

    Yes. That is the point I am missing. Just one 'date' is checked and project is taken into account for the custom program and after its successful run the mail is sent to users.
    And when the same program I am assigning in SM36,it is actually running the program accurately for project/s but sending the same mail which it send for very first project earlier.
    Can you please guide me on the way to create these variants? 
    You will need to Save different variants for different projects and then assign the variants with your job.
    Will it be required to create variant again and again and assign different projects individually? As, we are not sure that which project is gonna be created in future. So, need guideline how these variants can help me to sort out the e-mail issue.
    Regards
    Saurabh

  • Multiply filter in illustrator with a 2 color job-pdf and print issues?

    Hi,
    Encountering a tricky problem and not sure if its an InDesign fix or an Illustrator fix.
    I am working on a 2 color job—pms color + black on a book cover. The cover needs to seperate into these 2 colors.
    Also, I need to make a high res and lowres pdf that look like the cover to send out to marketing, sales etc.
    WHAT's THE PROBLEM?...
    Well, I am creating a collage with black ink vector graphics on top of the pms background. I created this art in illustrator CS3. it is saved as an .eps file. The illos were done by someone who used a white fill to knock out black areas. There is also a wide 50% grey outline around the illustration.
    I like the idea of the line of the illo being black and the fill being red so that it looks seethrough on the red background. But the 50% grey outline causes a problem...I'd like the 50% outline to blend with the red color, so instead of appearing like there is white in the ink it overprints.
    The only way I could think of (and quickest way) was to apply the multiply filter in illustrator to the vector illo. This seemed to work great.
    I brought the illo into InDesign CS3 where I created my cover layout.
    Looks great, Prints great. Separations appear to be good, although it shows the yellow, cyan, and majenta layer they appear to be blank, so I think it will seperate nicely into 2 plates–PMS + black.
    BUT, when I make a pdf, using "smallest file size" or using "high quality print", the pdf it makes does not show the illustrations in the collage. They are kind of beige and dulled out. The publisher needs pdfs too.
    Does this at all indicate that this job will not print correctly using this multiply filter, or is it all well and good final product wise, but its just an issue making the pdf? I am slightly nervous I am going to send this off to the printer and they will have some issue.
    I am a professional designer of 10 years with lots of print experience, but I have never used multiply in illustrator so I just want to make sure there is no rule against doing this I should know about. Does multiply at all mess with the color separations or is it fine? And how do I get my pdf to come out right? I'm hoping there's some dumb thing I'm forgetting, or a simple fix.
    Thanks for any insight you may have!
    L.

    If you don't feel comfortable using Multiply you might want to communicate with the printer and ask if this is an issue for them to reproduce correctly. Some printers using older rips may have issues with transparency. If you can't speak directly with your printer you could mark up the file or make a PDF to accompany the working file with your comments about what prints at what percentage, and if it should overprint or knockout. Years ago I would get a file with transparency in it and have to make sure the designers intent was clear. This was in some cases due to the designer not understanding blend modes or what he/she wanted overprinting or knocking out in the printed piece. The other way you can confirm the separations are going to rip correctly is to print a PDF out of Indesign and open it in Acrobat pro. Under Advanced>Print Production>Output Preview you can turn on and off separations for the 2 spot colors in question. Because PDF acts as your rip in this case you should be seeing what separations your printer will be printing using your native Indesign file. Some print shops will require you to provide a PDF or a color laser print out for QA of your printed piece when sending files to prepress.
    Hope this is helpful.

  • Window oracle job scheduler and Oracle server scheduler relationship

    Hi Experts,
    We use oracle 10G R4 in window 2003 server.
    From window server panel,we can see OracleJobSchedulerORCAID server is disable. However, I check oracle Jobs from EM.
    I can saw schedule jobs are running in there.
    What relationship is between window scheduler server and Oracle Schdeler?
    As I know we can stop/start window Oracle database serve,r DBconsle EM server and Listener server in window server to control oracle
    .Why window oracle schedule does not affect Oracle schdule job?
    Thanks Experts to explaining?
    JIm

    10g R4 is not an existing Oracle version. 10.2.0.4 is.
    Oracle EM has three different schedulers:
    - dbms_job
    - dbms_scheduler
    - EM's own scheduler. Jobs submitted in the EM scheduler are spawned by the Management Agent.
    Sybrand Bakker
    Senior Oracle DBA

  • How to create a job scheduler and send a mail through this

    Hi All
    I working in oracle Apex,with oracle pl/sql
    Here there is one table named as AgreemenBusiness continuity and we are dealing with agreement.Here when we create new agreement With BUSINESSCONTINUITY "ANUALLY" then the agreement startdate is 10.3.2010 and enddate is 11.03.2011 so now i need to send mail to the specific contact person daily form 6-03-2011.
    Can any one give sample data and tell me how to do this
    Thanks & Regards
    Srikkanth.M

    Hi - there's example code in the docs for sending mail from plsql.
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_smtp.htm
    Doesn't Apex provide email functionality, I'd be surprised if it didn't include some kind of email mechanism for you to work with.

  • Best SAP Security Practices Print,file,job schedule, archiving

    Hello All, i would like to know in your experience which will be the best practices for Security  for this list below:
    - Printer security (especially check printing)
    - File path security for export/import
    - Best Practice for Job Schedule and Spool file
    - Archiving process (I can't think of any specific to security, other than Security Audit Logs)
    Are there any special transactions/system settings/parameters that must be on place in order to hard SAP Systems?
    Do you have any documentation related?
    I mean for example Job, spool i think user must just only run heir own jobs,and se their own works for printing, is there a paremeter to athenticate Prints/user, etc.
    Please let me know your comments about those related issues.
    I appreciate your help.
    Thanks a lot.
    Ahmed

    Hi,
    PFCG_TIME_DEPENDENCY
    This is best to run once a day mostly after 12.01 am as it removes the roles which are invalid for current date. As role assignment is on date basis there is no advantage of running it hourly.
    /VIRSA/ZVFATBAK
    This is for GRC 5.3, and this job is to collect FFID logs from backend to GRC repository, so if you have frequent FFID usage you can schedule it hourly or for every 30 min too, if you have enough bandwidth in your server to get the latest log report. or else you can have it scheduled for twice a day too, so it is purely based on your need.
    Hope this helps.
    BR,
    Mangesh

  • Mail Client Job Scheduled

    Hi,
    I have configured Mail sender adapter to read emails from exchange server
    imap://host:port/InBox
    In Communication channel monitoring I dont see any error message but  I see status message Mail Client Job Scheduled  and there is nothing in Moni
    Can any one please help me with this issue..
    Thanks in Advance..
    Regards
    Sri
    Edited by: sriram_Kan on Mar 7, 2012 9:47 PM
    Edited by: sriram_Kan on Mar 7, 2012 10:01 PM
    Edited by: sriram_Kan on Mar 7, 2012 10:10 PM

    Hi..
    the error showing occurs if the ports are not correctly opened with the mail server.
    check with your basis or IS team for opening the ports/access to the mail server.
    Once the connection is established after opening the ports, activate the channel once again and it should work!
    Cheers,
    Souvik

  • Delay between step in job scheduling

    Hi Experts,
          Can anyone give me a idea about steps in job scheduling,and how to set a delay between steps in job scheduling in Tcode SM36 metion if there is any settings available or i have to code it in SE38.
                                                Thanks in advance.

    Check this link:
    http://help.sap.com/saphelp_nw70/helpdata/en/c4/3a7f87505211d189550000e829fbbd/frameset.htm
    Regards,
    Ravi

  • How to see jobs scheduled, running etc...

    I need to see a list of all jobs scheduled and running in my Oracle database?

    view all running job
    SELECT a.sid, c.serial#, a.job, a.failures, to_char(a.this_date, 'mm/dd/yyyy hh:mi pm') startdatetime, b.what
    FROM dba_jobs_running a, dba_jobs b, v$session c
    WHERE a.job = b.job AND a.sid = c.sid order by a.this_date
    View all jobs
    SELECT job, to_char(last_date, 'mm/dd/yyyy hh:mi pm') lastdate, to_char(next_date, 'mm/dd/yyyy hh:mi pm') nextdate, failures, broken, what
    FROM dba_jobs
    ORDER BY next_date

  • Unable to execute Copy or Delete from Job Scheduler job

    I am executing a COPY command and also a DEL command via the job scheduler and am receiving an "ORA-27370: job slave failed to launch a job of type EXECUTABLE ORA-27300: OS system dependent operation:accessing execution agent failed with status 233 ORA-27301:OS failure message:No process is on the other end of the pipe.ORA-27302:failure occurred at:sjsec 9 ORA-27303:additional information:No process is on the other end of the pipe." Any idea what is happening here? I receive the same error on any DEL or COPY command.
    Thanks,
    Susan

    Hi Susan,
    There are two possible issues here.
    - first make sure the scheduler extjob service is running, and try restarting it. That may fix the problem.
    - the second possibility is that the DEL or COPY are built-in commands and cannot be called directly. The Scheduler can only execute Windows executables, not built-in commands or batch scripts. The job_action (or program_action) must be of the form c:\path\program.exe .
    If the second is the case, you may need to use c:\windows\...\cmd.exe as your job_action and then as arguments, use
    /q
    /c
    del
    filename
    An example using a batch file instead of a command is
    SQL> begin
    2 dbms_scheduler.create_job('t1',
    3 job_action=>'C:\WINDOWS\SYSTEM32\CMD.EXE',
    4 number_of_arguments=>3,
    5 job_type=>'executable', enabled=>false);
    6 dbms_scheduler.set_job_argument_value('t1',1,'/q');
    7 dbms_scheduler.set_job_argument_value('t1',2,'/c');
    8 dbms_scheduler.set_job_argument_value('t1',3,'c:\temp\test2.bat');
    9 dbms_scheduler.enable('t1');
    10 end;
    11 /
    Hope this helps,
    Ravi.

  • Batch job schedule in infoview

    Hi,
    we want to run the bunch of crystal reports at 8.30 am and at 2.00 pm in BO-Infoview.
    is there any option available to do batch job scheduling and run it at two different timings.
    thanks in advance
    Phani rayasam

    You cannot set tow different times on a single day.
    This option is not available. If you want you can schedule the same publication two times with two different times.
    Seems to be a good option but not available
    Regards
    Gowtham

  • Unable to schedule a report to email and print

    I have been working on a task to both print and email a report to recipients whose email addresses are obtained at runtime.  So far I am able to email the report as a PDF attachment, however, I am not able to get the report to print.  I have three thoughts as to why the report is not printing.
    1. The printer is in a subdomain under the domain where InfoView and the Enterprise server reside.
    2. It is not possible to schedule a report for both an SMTP and print destination simultaneously.
    3. The format is causing an issue in printing - the SDK API states "Printer is a report format specific destination and can only be used when the report object is a Crystal Report."
    I have looked at the scheduled report in InfoView and can see that the print settings I am passing are correctly set for the scheduled instance.  Does anyone know if there is a problem with trying to schedule printing and email at the same time, or if the report format must be .rpt?
    Below is my code. Thank you for your time.
    String query = "Select SI_ID, SI_NAME, SI_PROCESSINFO, SI_SCHEDULEINFO, SI_SCHEDULE_STATUS From CI_INFOOBJECTS Where SI_ID=" + reportId;
            IInfoObjects results = null;
            ISchedulingInfo schedulingInfo = null;
            try {       
               results = iStore.query(query);           
            } catch( SDKException sdke ){
               logger.error(sdke);
            if( !results.isEmpty() ){
                // get the actual report object from collection and set scheduling information
                IInfoObject report = (IInfoObject)results.get(0);
                schedulingInfo = report.getSchedulingInfo();
                schedulingInfo.setType(CeScheduleType.ONCE);
                schedulingInfo.setRightNow(true);
                schedulingInfo.setRetriesAllowed(3);           
                try {
                    Set<String> keys = destinations.keySet();
                    Iterator i = keys.iterator();
                    while( i.hasNext() ){
                        String dest = (String) i.next();
                        if(dest.equals(CrystalDestinations.EMAIL)){
                            // get the destination object and set it to SMTP plugin
                            List emailAddress = destinations.get(CrystalDestinations.EMAIL);
                            IDestination destinationObject = schedulingInfo.getDestination();
                            destinationObject.setName("CrystalEnterprise.SMTP");    
                            IDestinationPlugin smtpPlugin = (IDestinationPlugin) iStore.query("SELECT * FROM CI_SYSTEMOBJECTS WHERE SI_PARENTID = 29 AND SI_NAME='CrystalEnterprise.SMTP'").get(0);
                            ISMTPOptions smtpOptions = (ISMTPOptions) smtpPlugin.getScheduleOptions();
                            smtpOptions.setDomainName( emailDomain );
                            smtpOptions.setServerName( smtpHost );
                            smtpOptions.setSMTPUserName( smtpUser );
                            smtpOptions.setSMTPPassword( smtpPass );
                            smtpOptions.setSubject( "Email for report " + report.getTitle() );
                            smtpOptions.setMessage( "This is the message body" );
                            smtpOptions.setSenderAddress( smtpUser + "@cdrh.fda.gov" );
                            smtpOptions.setSMTPAuthenticationType( ISMTPOptions.CeSMTPAuthentication.LOGIN );
                            for(int j = 0; j < emailAddress.size(); j++ ){
                                smtpOptions.getToAddresses().add( emailAddress.get(j) );
                            destinationObject.setFromPlugin( smtpPlugin );                                                                               
    } else if ( dest.equals(CrystalDestinations.PRINT) ){
                            List printers = destinations.get( CrystalDestinations.PRINT );                   
                            IReportPrinterOptions printerOptions = ((IReport)report).getReportPrinterOptions();
                            printerOptions.setCopies(1);
                            printerOptions.setEnabled(false);
                            printerOptions.setPrinterName( (String)printers.get(0) );                   
                            printerOptions.setPageLayout(IReportPrinterOptions.CeReportLayout.USE_SPECIFIED_PRINTER_SETTING);
                    List reportPrompts = ((IReport)report).getReportParameters();
                    for(int j = 0; j < reportPrompts.size(); j++){
                        IReportParameter prompt = (IReportParameter) reportPrompts.get(j);                   
                        if(prompt.getParameterName().equals(mdrParamName)){
                          IReportParameterSingleValue v = prompt.getCurrentValues().addSingleValue();
                          v.setValue(reportParameters.get(mdrParamName));
                        } else if(prompt.getParameterName().equals(addressParamName)){
                            IReportParameterSingleValue v = prompt.getCurrentValues().addSingleValue();
                            v.setValue(reportParameters.get(addressParamName)); 
                    IReportFormatOptions format = ( (IReport) report).getReportFormatOptions();
                    format.setFormat(IReportFormatOptions.CeReportFormat.PDF);
                    iStore.schedule( results );

    Hi Jason,
    Based on your code, I could not tell if you were scheduling a Crystal Report or a WebI document.
    Regardless, what I would suggest is you try scheduling the report/document on InfoView.
    Once you schedule it on InfoView, you can retrieve the instance on Query Builder (or through code) and compare the properties that are being set through InfoView and the one you set through your code.
    This should indicate if you are missing some properies or have set some properties incorrectly.
    Hope this helps.
    Regards,
    Dan

  • Azure Scheduler Job Timeouts and Retries?

    We have a WEBAPI running outside of Azure and want to schedule one of the methods with Azure. It  loads data from SharePoint Online into an SQL database on-Prem.  It can take 15 minutes to complete.   I'm doing a GET call to the URI, but
    it reports it's FAILED timing out and retrying... from our SQL logs the job appears to complete, though not clear if it ran multiple times.  Any way to fix this?  No way to adjust timeout and retries in Azure job Scheduler?

    Hi,
    It looks like you are using the Azure Scheduler service, not the Azure Automation service. Is that correct? This forum is only for the Azure Automation service.
    If so, I will move this thread to the Scheduler forum.

  • Eventing and Print Jobs

    Hey all! I am attempting to write a script that will collect information about print jobs on a print server and write the data to a database. I am trying to get data on print job owner, printer name, whether it was color or grayscale, number of pages and
    number of copies.
     I am running into a problem finding a method to collect events for print jobs. I have attempted to subscribe to creation and modification events of the Win32_PrintJob class, which is ok but doesn't seem very accurate about details like pages printed
    and color/grayscale. I next attempted to respond to these events by using Get-WinEvent each time the event fires and then using the JobId property of the event to scan the PrintService log for matching 307 and 805 events. However, I have found that the Win32_PrintJob
    JobId does not seem to match the document id in the event log entries.
    I scrapped that idea and instead attempted to collect .NET events for the NTEventLog class but this only seems to work with the traditional logs such as system, security and application.
    I suppose I could just scan the event logs on a regular basis and collect print job information that way, but I was really looking to collect and log this info in real time rather than just looping every so often. Has anyone else tried eventing for any of
    these classes? Is it possible there is another .NET class I could subscribe to that would provide me with details of incoming print jobs? Am I going about this entirely the wrong way?
    Thanks!

    Hi Matt,
    Maybe you can try the .NET class for printing:
    Function Get-PrintJobs
    <#
    .SYNOPSIS
    Return the list of jobs on the current printer
    .DESCRIPTION
    This function returns a list of pending jobs on the specified print server for a given queue
    .PARAMETER ComputerName
    Name of the print sever
    .PARAMETER Name
    Name of the print queue
    .EXAMPLE
    Get-PrintJobs -ComputerName ps -Name HPLJ5000
    .LINK
    http://scripts.patton-tech.com/wiki/PowerShell/PrintServerManagement#Get-PrintJobs
    #>
    Param
    $ComputerName,
    $Name
    Begin
    $Host.Runspace.ThreadOptions = "ReuseThread"
    if ((Get-WmiObject -Class Win32_OperatingSystem).OSArchitecture -eq '64-bit')
    $SystemPrinting = Get-ChildItem "$($env:systemroot)\assembly\GAC_64\System.Printing"
    $SystemPrintingFile = Get-ChildItem -Name "*system.printing*" -Recurse -Path $SystemPrinting.FullName
    $SystemPrintingFile = "$($SystemPrinting.FullName)\$($SystemPrintingFile)"
    else
    $SystemPrinting = Get-ChildItem "$($env:systemroot)\assembly\GAC_32\System.Printing"
    $SystemPrintingFile = Get-ChildItem -Name "*system.printing*" -Recurse -Path $SystemPrinting.FullName
    $SystemPrintingFile = "$($SystemPrinting.FullName)\$($SystemPrintingFile)"
    $ErrorActionPreference = "Stop"
    Try
    Add-Type -Path $SystemPrintingFile
    $PrintServer = New-Object System.Printing.PrintServer("\\$($ComputerName)")
    $PrintQueue = $PrintServer.GetPrintQueue($Name)
    $PrintJobs = $PrintQueue.GetPrintJobInfoCollection()
    Catch
    Write-Error $Error[0].Exception
    Break
    Process
    End
    Return $PrintJobs
    Refer to:
    A print management library
    If there is anything else regarding this issue, please feel free to post back.
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna Wang

  • Printer Queue - How can I hide print job title and username?

    Hi,
    Does anyone know if it is possible to hide print job title and username in the printerqueue?
    Because of our privacy agreement we would like to hide this information, 
    Workstation OS: Windows 7 x64 
    Printserver : MS 2008 R2
    Thanks in advance
    Mark

    Not the user name but the job name is changed to Print Document when the print jobs are sent to Server 2012 and 2012R2.
    There is no Windows feature like this in 2008R2.  There are third party products that include job rename features for 2008R2
    Alan Morris formerly with Windows Printing Team

Maybe you are looking for

  • How can I add random mail signatures from a text file?

    I'm trying to add a different quote to every email that I write... is there a program or way for Mail to pluck and append a quote at random from a external file of quotes?  (I'm not talking about the standard "Random" feature built into Mail.) There

  • How can I email a video in iPhoto that has been uploaded from my iPad?

    How can I email a video in iPhoto that has been uploaded from my iPad?

  • Use of US Apple TV in Europe?

    Would an Apple TV purchased in the US work correctly in Europe? I specifically concerned about the power supply (i.e. 110v/60Hz vs 220v/50Hz) - can the US model handle 220v? I would buy one here, but the pricing is criminal - to buy an Apple TV in th

  • Dual Harddrives Mountain Lion

    Hi, how do I register my copy of mountain lion? I changed harddrives and I've been having permission problems with the harddrive that are stemming from the OS not being verified on my new harddrive. I purchased Mountain Lion from the App store on my

  • Old Photos - Unix Executable File

    Trying to help a friend - he has a bunch of photos on his Mac that are six years old. He can't open them. He sent me one - it shows up as a "Unix Executable File" (whatever that is?). The read/write accesses are OK. File is about the right size (350K