Skip to Content
author's profile photo Former Member
Former Member

Issue output type

Is there a function module I can use to issue output type and then extract the spool id generated

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 10:58 PM

    Hi,

    Check this sample code..to get the spool id after the job is completed.

    
    DATA: v_jobgroup LIKE  tbtcjob-jobgroup.
    DATA: v_jobname  LIKE  tbtcjob-jobname.
    DATA: v_jobcount LIKE tbtcjob-jobcount.
    DATA: v_status TYPE tbtco-status.
    DATA: v_spool  TYPE tbtcp-listident.
    
    
    
    v_jobgroup = 'Test'.
    v_jobname  = sy-repid.
    
    CALL FUNCTION 'JOB_OPEN'
         EXPORTING
              jobgroup         = v_jobgroup
              jobname          = v_jobname
         IMPORTING
              jobcount         = v_jobcount
         EXCEPTIONS
              cant_create_job  = 1
              invalid_job_data = 2
              jobname_missing  = 3
              OTHERS           = 4.
    
    SUBMIT z_test_program             " Change the program here
      VIA JOB v_jobname
      NUMBER  v_jobcount
      AND RETURN.
    
    *Close job to start immediately
    CALL FUNCTION 'JOB_CLOSE'
         EXPORTING
              jobcount             = v_jobcount
              jobname              = v_jobname
              strtimmed            = 'X'
         EXCEPTIONS
              cant_start_immediate = 1
              invalid_startdate    = 2
              jobname_missing      = 3
              job_close_failed     = 4
              job_nosteps          = 5
              job_notex            = 6
              lock_failed          = 7
              OTHERS               = 8.
    
    * Check the status.
    DO.
      SELECT SINGLE status FROM tbtco
            INTO v_status
            WHERE jobname = v_jobname
            AND   jobcount = v_jobcount.
    
      IF sy-subrc = 0 AND v_status = 'F'.
        EXIT.
      ENDIF.
    
    ENDDO.
    
    * Get the spool
    SELECT SINGLE listident FROM tbtcp
           INTO v_spool
           WHERE jobname = v_jobname
           AND   jobcount = v_jobcount.
    
    WRITE: / v_spool.
    
    

    Thanks

    Naren

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 30, 2007 at 03:44 PM

    Can you please expand on "issue output type"? You create or change documents, and the output types associated with that document are triggered and they go to NAST table along with the key (typically document number). Once the NAST entry is processed (immediately or batch), you will have to get the job ID and then can get the spool ID. Just having an output type will not be sufficient because the output type only holds the information about the FORM, processing program/routine and the print preferences. The actual output is what is assigned a spool id which is tied to the object for which it is created and the date/time it is created. If you just search by output type, you will find many entries in NAST (field KSCHL).

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 04:11 PM

    I have the following

    OBJKY (Object key from NAST)

    KSCHL (Output Type)

    KAPPL (Application)

    Normally, you trigger output type from the document which then creates NAST and then spoolid, else if there is a record in NAST already then it uses that to create another spoolid. This is done using program RSNAST00.

    I want to do something similar but in the background in a custom program. I need to use the 3 keys to triiger output type and generate a spool id.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 30, 2007 at 06:44 PM

    Hi,

    You can submit RSNAST00 from your custom program as suggested by Srinivas.

    Also you can submit these alternative standard programs.

    SD70AV1A (Output for Orders)

    SD70AV2A (Output for Deliveries)

    SD70AV3A (Output for Billing)

    Regards,

    Ferry Lianto

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 08:47 PM

    I am using RSNAST00 to do the output type. But how do I extract the spool id from it. I have been debugging it and the spool id is displayed in the message box that pops up. But otherwise I cant find any variable in the program for the spool id. Can you help me find the spool id generated. Thank you

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 09:42 PM

    how to submit rsnast00 via job and get spool id from job ?

    Add a comment
    10|10000 characters needed characters exceeded

    • Use JOB_OPEN to open the job with some name, and it returns JOBCOUNT. Do a SUBMIT VIA JOB (see help on SUBMIT) with JOBCOUNT and then finally do a JOB_CLOSE. This will create and start the job execution. To know if the job is completed or not, use BP_JOB_STATUS_GET in a DO loop and once the job is completed, exit the DO loop. You can read the job log using BP_JOBLOG_READ. You can use BAPI_XBP_JOB_SPOOLLIST_READ to get the spool of the job.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.