Background job output

I schedule a job in backgroung proces(smartform).
Whwn i click on the spool  to see the output ,  there is  error  "NO FRONTEND AVAILABALE" .
how can i see my output of the back ground  job (smartforms).
i am executing the process  like 
1. tcode run
2. F9  ( FOR BACKGROUND PROCESS)
3. se37  to see the job proceesing
4. click on spool
5. but no  ouput i can see
i don't know why??

Hi Ajay,
Please search form with '
Mulitple Purchase order Print in SAP Script'
the thread shows below.
If your requirement is to print multiple PO's then i think you need to develop a Program .
In that in your final internal table you can loop it and print...
And also these setting need for background job.
If you have smartforms you can set following parameters
CALL FUNCTION LV_FM_NAME
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = CONTROL
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS = OUTPUT_OPTIONS
USER_SETTINGS = ' '
VEHICLE = VEHICLE
LV_BAR = LV_BAR
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
IT_FINAL = IT_FINAL
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CONTROL-PREVIEW = 'X'. "Preview the output of Smartform
CONTROL-NO_DIALOG = 'X'. "Don't show Dialog
OUTPUT_OPTIONS-TDDEST =  'X' or space. "Spool: Output device(depend on requirement)
OUTPUT_OPTIONS-TDNOPRINT = ' '. "No printing from print preview
OUTPUT_OPTIONS-TDCOPIES = 1. " number of print copies
OUTPUT_OPTIONS-TDIMMED = 'X'. " Print Immediately (Print Parameters)
OUTPUT_OPTIONS-TDDELETE = 'X'. " delete the request after printing
OUTPUT_OPTIONS-TDLIFETIME = '5'. " spool retention period
OUTPUT_OPTIONS-TDCOVER = ' '. " no cover print
If you want immediate output while setting background set printer property time of print "Immediate"
Hope this will help to you.
Thanks,
Hari

Similar Messages

  • Background job output to Presentation server

    Hi,
    I am executing report as Background job.
    after job gets completed output should be in excel format in front end or presentation server.
    Regards
    Naga

    Hi,
    We cannot perform any action on the presentation server in a program that is being execcuted in background. What you can do is to write the output on to the app server, and after wards move the file on to the Pres. server using CG3Y transaction.
    Regards,
    Ravi
    Note : Please mark the helpful answers

  • Download Background job output to Excel automatically

    Dear Experts,
    Hi there... Please note the following scenarion and give me your expert solutions on the same...
    I have created a SALES QUANTITY REPORT for exports... In this there are many conditions applied to achieve data in many of the columns of this report. If we run it for 2-3 months it is not a problem... The output comes at a marginal wait time... But the moment it is run for a whole year then it just goes on and on.... I cannot fine tune also.... because of the conditions... For better performance and fast retrieval i have used views in this report to achieve quick output...
    The thing is when i put it to execute in Background it comes within an hour or so... But the output is not readable.... so here is what i want:
    1. First of all why report executes so quickly when put in background, whereas in foreground it takes more than 4 hours and also no guarantee of output.. This is to satisfy my curiosity...
    2. I want the output to get automatically converted into excel and get stored in a specific folder the moment the job is finished in background without any format getting disturbed. The report is prepared in ALV...
    Please gurus help me out.
    Thanks...
    Jitesh

    It is giving me the following error: -
    17.02.2009 11:24:41 Job started                                                                             00           516          S
    17.02.2009 11:24:41 Step 001 started (program Z_SD_SQR_EXPORT, variant &0000000000007, user ID JBABAP)      00           550          S
    17.02.2009 11:24:45 Incorrect Print Parameter                                                               0K           091          I
    17.02.2009 11:24:45 Spool request (number 0000014520) created without immediate output                      SY           355          S
    17.02.2009 11:24:45 Excel file c:\sqr\sqrexport.xls cannot be processed                                     UX           893          E
    17.02.2009 11:24:45 Job cancelled after system exception ERROR_MESSAGE                                      00           564          A
    form DOWNLOAD .
    CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
      EXPORTING
    *   I_FIELD_SEPERATOR          =
    *   I_LINE_HEADER              =
        i_filename                 = 'c:\sqr\sqrexport.xls'
    *   I_APPL_KEEP                = ' '
      tables
        i_tab_sap_data             = it_final
    * CHANGING
    *   I_TAB_CONVERTED_DATA       =
    * EXCEPTIONS
    *   CONVERSION_FAILED          = 1
    *   OTHERS                     = 2
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endform.                    " DOWNLOAD
    Please reply..
    Thanks,
    Jitesh

  • How to view background job output

    Hi experts,
      I excecuted one of my Z report in background mode, its finished successfully, i want to view the output. How to view this output.
      Otherwise to view this ourput only in Basis people or what? if its so i will contact the basis person. Otherwise give some idea how to view this output.
    Thnx,
    Mohana

    Mohana,
    Go to sm37
    give the job name or *
    give the username
    give the program name
    execute it
    now tick the program that you had executed in the background
    click on the spool button on the top
    You will get a ABAP list under the field type
    click it.
    You wil be able to see the output of the program that you  had executed in the background.When a program is executed in the background mode you will be able to see the output in the List Display mode and moreover you will be able to see at the max only 19 fields when a report is executed in the background.
    You can check the jobs that are running in the background and their status in the table TBTCO.
    Thanks,
    K.Kiran.

  • Background job output to file on desktop

    Hi All,
    my requirement is, query(SQ01)created with infoset and user group.
    in the query we have selection option file store, when the user gave path(can be shared drive or application server or desktop)
    and run in background file should save, which is not happening.
    currently foreground we can save the file at required location, the problem is when i run in background not able to save the file.
    logic: got the spool request, conver to itab using FM after that OPEN DATASET .......
    if any one come accros the situation, please let me know the solution.
    thank you in advance.
    Regards,
    Madhavi

    Hi,
    Please check below options "
    To open a file for reading, use the FOR INPUT addition to the OPEN DATASET statement.
    To open a file for writing, use the FOR OUTPUT addition to the OPEN DATASET statement.(If the file does not already exist, it is created automatically.)
    Try using below logic .
    lv_filename = <input file path>
    open dataset lv_filename for input in text mode encoding default.
        if sy-subrc = 0.
          do.
            read dataset lv_filename into gs_input-wa_string.
            if sy-subrc eq 0.
              append gs_input to gt_input.
            else.
              exit.
            endif.
          enddo.
          close dataset lv_filename.
        endif.
    Please revert for Further Qs.
    Thanks and Regards,
    P.Bharadwaj

  • Background job downloading missing some rows in sm37

    Hi,
    I am downloading background job output through spool request in excel format. Out of 2000 records some 50 records in the middle are not displayed.But those 50 records are there in the spool output.
    When downloaded in text format means all 2000 records are downloaded correctly..
    Give me a solution please...
    Thanks and Regards,
    Jenifer

    Jenifer,
    When you download a spool in "Spreadsheet", SAP really downloads the data in tab delimited text format, even thought the file extension is .XLS.
    So, just open the Excel file in notepad (or any other text editor) and see if the missing rows are present. If there are, then you have to figure out how to import the file properly into Excel file without losing the rows.

  • SPOOL data gets truncated when bckground job output sent to spool recepient

    Hi All,
    I am facing a strange problem.
    I have a background job scheduled. Have specified a distribution list as the spool recipients.
    Background jobs output is sent to the recipients as attachment but data is not complete.
    When I check the spool request for that background job it contains 80 pages but the attachment in the recipients inbox contains just 17 pages.
    SP01/SP02 will display settings to display the range of pages but the emaill attachment doest show.
    Can anyone please help me with this?
    We are on ECC 6.0 (Windows2003/MSSQL2005 SP3)
    Regards,
    Yatin

    Hi,
    When the spool content is sent immediately after the background job its size is 14KB.
    I tested by sending spool content via mail using transaction SP01. I mean after the jobs is completed, I go to SP01 and send the SPOOL content manually. This time recipients receive the correct content of 80 pages and size of the document this time is 73KB.
    Regards,
    Yatin

  • Background job list output

    hi friends,
    i have a report that i submit to run as background job...in this report there are outputs, e.g. "WRITE" statements...how can i make those visible on screen ?
    regards,
    clemens

    Hi,
    When you run the job in the Background, the Output will be generated in the Spool, so you can look at this from SE37 or From Spool SP01, from there you can see that value,
    You can use the below function modules to read the Spool
    BAPI_XBP_JOB_SPOOLLIST_READ    Read the Spool List of an ABAP Job Step
    BAPI_XBP_JOB_SPOOLLIST_READ_20 Read the spool list for an ABAP job step (XBP Version 2.0)
    BAPI_XBP_JOB_SPOOLLST_READ_RW  Read ABAP Job Step Spool List (Raw Format)
    Regards
    Sudheer

  • ALV list display in a Background job - Spool output

    Hi,
    We are currently working on a report scheduled to be run in the background job, and the ALV list is displayed in the spool output.
    ALV list in the spool does not look the same as front run job, the column headers are all crowded together, and there is no grid in-between different columns or rows. It's hard to read.
    Is there a way to add grid for this kind of output?
    Thanks!

    Hi Deepak:
    I expanded your report into two rows display, and the grid in the spool display simply gone!
    report zzscratch line-size 120 no standard page heading.
    type-pools slis.
    tables pa0001.
    data : li_field type standard table of slis_fieldcat_alv,
    gi_events type standard table of slis_alv_event,
    gr_layout_bck type slis_layout_alv,
    gr_save like disvariant,
    gr_events type slis_alv_event.
    types : begin of gtt_emp,
    pernr type persno,
    ename  like pa0001-ename,
    uname  like pa0001-UNAME,
    end of gtt_emp.
    data : lr_field type slis_fieldcat_alv.
    data : lc_rep like syst-repid.
    data : li_emp type standard table of gtt_emp,
    lr_emp type gtt_emp.
    data : gv_ref_table type lvc_rtname.
    gv_ref_table = 'CATSDB'.
    lr_field-fieldname = 'PERNR'.
    lr_field-ref_tabname = gv_ref_table.
    lr_field-inttype = 'N'.
    lr_field-outputlen = 8.
    lr_field-seltext_l = 'EMPLOYEE Number'.
    append lr_field to li_field.
    lr_field-fieldname = 'ENAME'.
    lr_field-ref_tabname = 'PA0001'.
    lr_field-inttype = 'C'.
    lr_field-outputlen = 40.
    lr_field-seltext_l = 'EMPLOYEE Name'.
    append lr_field to li_field.
    lr_field-fieldname = 'UNAME'.
    lr_field-ref_tabname = 'PA0001'.
    lr_field-inttype = 'C'.
    lr_field-outputlen = 12.
    lr_field-seltext_l = 'User Name'.
    lr_field-row_pos = 2.
    lr_field-col_pos = 1.
    append lr_field to li_field.
    lc_rep = sy-repid.
    gr_layout_bck-edit_mode = 'D'.
    gr_save-report = sy-repid.
    lr_emp-pernr = '00000001'.
    lr_emp-ename = 'abc'.
    lr_emp-uname = 'testus'.
    append lr_emp to li_emp.
    lr_emp-pernr = '00000002'.
    lr_emp-ename = 'def'.
    append lr_emp to li_emp.
    lr_emp-pernr = '00000003'.
    append lr_emp to li_emp.
    lr_emp-pernr = '00000004'.
    append lr_emp to li_emp.
    lr_emp-pernr = '00000005'.
    append lr_emp to li_emp.
    lr_emp-pernr = '00000006'.
    append lr_emp to li_emp.
    lr_emp-pernr = '00000007'.
    append lr_emp to li_emp.
    lr_emp-pernr = '00000008'.
    append lr_emp to li_emp.
    end-of-selection.
    Function module for ALV grid display
      call function 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_buffer_active    = 'X'
                i_callback_program = lc_rep
                is_layout          = gr_layout_bck
                it_fieldcat        = li_field
                i_save             = 'A'
                is_variant         = gr_save
                it_events          = gi_events
           TABLES
                t_outtab           = li_emp[]
           EXCEPTIONS
                program_error      = 1
                others             = 2.
      if sy-subrc <> 0.
    clear gr_messages.
    message e023 into gr_messages.
    append gr_messages to gi_messages.
      endif.

  • Page-break in alv background job for alv output variant not coming correctl

    Hi,
    I have created an ALV grid report. When i run the report in background i get the output with correct page-break on FIELD1. Now when i run the report in background with an "ALV output variant" (its the ALV variant that controls the fields display in the output; this is not the program variant), i do not get the page-break on FIELD1.  I have already build the sort criteria and using:
    gs_sort-group = '* '.     "New-Page
    Please let me know what could be reason for not getting the page-break in background when i am using the alv output variant and how do i correct this problem.
    Regards,
    Rakesh

    Hello Everyone,
    I have solved the problem. While running the program in background, we get the page-breaks when we use the below part of code in the sort catalogue with the condition that the program variant should not use any ALV layout variant.
    gs_sort-group = '* '.     "New-Page
    If you are using the ALV layout variant in the program variant then we can check the ROWPOS, COLPOS, and NO_OUT for that ALV layout variant and pass them along in the fieldcatalog table. You should be careful with not to pass the layout variant in the DISVARIANT. You can notice that i have cleared it and simply passing the program name into that.
    *C-- Process separately for jobs running in Background. Actually
    *C-- sortcat-group solves the problem only in Foreground. In background
    *C-- when ALV layout variant is not selected then it works otherwise it
    *C-- fails. So for background jobs we are reading the fieldcat and then
    *C-- passing the same in the display FM.
      IF sy-batch = 'X'.
        CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'
          EXPORTING
           i_dialog                  = ' '
           i_user_specific           = ' '
           i_default                 = ' '
    *   I_TABNAME_HEADER          =
    *   I_TABNAME_ITEM            =
            it_default_fieldcat       = gt_fieldcat
            i_layout                  = gs_layout
    *   I_BYPASSING_BUFFER        =
    *   I_BUFFER_ACTIVE           =
         IMPORTING
    *   E_EXIT                    =
           et_fieldcat               = lt_fieldcat
    *     et_sort                   = gt_sort[]
    *   ET_FILTER                 =
    *     es_layout                 = gs_layout
         CHANGING
           cs_variant                = gs_disvariant
         EXCEPTIONS
           wrong_input               = 1
           fc_not_complete           = 2
           not_found                 = 3
           program_error             = 4
           OTHERS                    = 5
        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 gs_fieldcat.
        LOOP AT gt_fieldcat INTO gs_fieldcat.
    *C-- Transfer all position changes to gt_fieldcat from lt_fieldcat
          CLEAR ls_fieldcat.
          READ TABLE lt_fieldcat
                INTO ls_fieldcat
                WITH KEY fieldname = gs_fieldcat-fieldname.
          IF sy-subrc = 0.
            gs_fieldcat-row_pos = ls_fieldcat-row_pos.
            gs_fieldcat-col_pos = ls_fieldcat-col_pos.
            gs_fieldcat-no_out = ls_fieldcat-no_out.
            MODIFY gt_fieldcat FROM gs_fieldcat INDEX sy-tabix.
            CLEAR gs_fieldcat.
          ENDIF.
        ENDLOOP.
    *C-- Clear the disvariant for the background job as it contains the ALV
    *C-- layout varinat
        CLEAR gs_disvariant.
        gs_disvariant-report = 'ZGPPMP0001'.
    Then pass gt_fieldcat to 'REUSE_ALV_GRID_DISPLAY'.
    The reason i'm doing it this way is that when we pass the layout variant name, the contents in gt_fieldcat were getting modified.
    One more thing i'd like to point out is that that, i tried to delete the fields with no_out = 'x'. Now when i ran the program in background with all the fields in sort catalog (suppose there are 2 fields field1 and field2) also in fieldcatalog it ran fine. In the next run in background i removed one of the fields in sort catalog from the fieldcatalog (delete the fields with no_out = 'x') and i got dump. Basically i had hidden field1 and so the code which was deleting fields with no_out = 'x' deleted this field from gt_fieldcat. So basically we should not delete fields with no_out = 'x'.
    I was getting ABAP runtime errors    MESSAGE_TYPE_X in the following part of the standard code.
    000310     LOOP AT CT_SORT INTO LS_SORT.
    000320
    000330       READ TABLE IT_FIELDCAT ASSIGNING <LS_FIELDCAT>
    000340            WITH KEY FIELDNAME = LS_SORT-FIELDNAME BINARY SEARCH.
    000350       IF SY-SUBRC NE 0.
         >         MESSAGE X000(0K).
    000370       ENDIF.
    000380
    000390       LS_SORT-SELTEXT = <LS_FIELDCAT>-SELTEXT.
    i have just mentioned this part because when i checked the forum many people were getting such errors "MESSAGE_TYPE_X". This could also be one of the reasons.

  • Sending output to a printer in a background job

    I did a quick search on this issue and found a few suggestions.  One suggestion was to use something like this:
    SUBMIT RSFLFIND ... TO SAP-SPOOL DESTINATION 'LT50'.
    I looked at the SAP help for SUBMIT and it was quite helpful however it raised a few questions.  The program that am writing will be run in the background.  I want to create a simple report that will print at several different printers when it is done.  Looking at the help section (specifically this part):
    "The SUBMIT statement accesses an executable program rep. The executable program is executed as described under Calling Executable Reports.
    The program name rep can either be specified directly or as the content of a character-like data object name. The data object name must contain the name of the program to be accessed in block capitals. If the program specified in name is not found, an irretrievable exception is generated.
    The selscreen_options additions can be used to determine the selection screen for the program accessed and to supply it with values.
    The list_options additions allow you to influence the output medium and the page size in the basic list for the program accessed.
    You can schedule the program for background processing by specifying job_options. "
    It seems like I would create a simple program like this:
    DATA: number TYPE tbtcjob-jobcount,
          name TYPE tbtcjob-jobname VALUE 'JOB_TEST',
          print_parameters TYPE pri_params.
    CALL FUNCTION 'JOB_OPEN'
      EXPORTING
        jobname          = name
      IMPORTING
        jobcount         = number
      EXCEPTIONS
        cant_create_job  = 1
        invalid_job_data = 2
        jobname_missing  = 3
        OTHERS           = 4.
    IF sy-subrc = 0.
      SUBMIT submitable TO SAP-SPOOL
                        SPOOL DESTINATION 'LT50'.
                        VIA JOB name NUMBER number
                        AND RETURN.
      IF sy-subrc = 0.
        CALL FUNCTION 'JOB_CLOSE'
          EXPORTING
            jobcount             = number
            jobname              = name
            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.
        IF sy-subrc <> 0.
        ENDIF.
      ENDIF.
    ENDIF.
    That will then call the background job and the output will go to the print spool.  I have a few reservations about this.  The print spool will not be determined until the background job.  The background job creates sales orders and the material group, in the sales order, determines the printer that the final report will go to.  Also, if this is the way to do it, do I just do simple write statements in the background job?

    Hi,
    Please try this ... perhaps it may help.
    SUBMIT submitable TO SAP-SPOOL
                      SPOOL DESTINATION 'LT50'.
                      IMMEDIATELY 'X'           "Add here
                      VIA JOB name NUMBER number
                      AND RETURN.
    OR
    SUBMIT submitable TO SAP-SPOOL
                      SPOOL DESTINATION 'LT50'.
                      IMMEDIATELY 'X'           "Add here
                      WITHOUT SPOOL DYNPRO      "Add here
                      VIA JOB name NUMBER number
                      AND RETURN.
    Regards,
    Ferry Lianto

  • Background job not showing full output of Report

    Dear Experts
    we have created zpgm for stad report and try to take output as mail to particular user for future analysis bcaz stad gives only 2 days report only we need keep report for months together so when we run job in foreground it shows proper output but when same thing when we run from background it shows only some part of report in mail (we are unable to get full output through background job )
    we send mail through spool receipts we have created folder and maintain user for getting mails through so15 distribution list
    we need some input to come out of this major issue
    if there is any other workaround let me know
    Regards

    Hello,
    If a job is defined by transaction SM36, the print format parameters will only be taken into account, if they are saved as user specific print parameters of the batch user. If no user specific print format
    is defined,  the ALV standard logic will be processed adjusting the print format to the actual line size of the report.
    For example, the list line size is about 132 characters, the widest available format of the chosen printer will be selected X_65_132.
    The problem would be solved by defining a device type which is no format assigned to print, or by defining user specific print format parameters for the batch user, who creates the jobs in SM36 (see
    SAP note 1179399, item 6).
    Regards,
    David

  • Background job  step - Printer - Output device  table

    Hi,
    When creating background job, printer- output device also specified for every step. Which table to check for job name and output device combination ?
    Thanks.

    Hi Raj check table TBTCP

  • Background Job result output should be displayed in Email body

    Hi Friends,
    One of our user is scheduling background job, He need the output to his external Email ID.
    user required that Job result output should be displayed in Email body, Not in attachment.
    We have tried but job result received in email as HTML (or) PDF file attachment, But he wants output  in Email body itself.
    Please help.
    Regards,
    Karthickbabu G.G

    Hi,
    Displaying report output in email body is not available as a standard feature. Also doing a custom development would be very cumbersome .
    Regards,
    Deepak Kori

  • Scheduling a background job depending on the output lenght.

    Hi every one,
    I have a small requirement. My client want me to run a program in a foreground if the output is small and should the program in background if the output is large.This has to be achieved through coding. The program downloads the netprices of products. The downloaded file is of .dat format. It is an urgent requirement.
    Guys you would throughly rewarded for your help.
    Thanks,
    Kumar.9886185040.

    Hi Nag
    that is not possible with codeing. To create a schedule a background job for the same program depending on its output is not possible.
    being a programmer you need to decide, how long the code will take to execute.. accordingly you can either schedule or run in foreground. You can make some mandatory fields in the selection screen, so that the output is big mostly.
    see the sample code for the Job scheduling using the fun modules
    IF p_bjob = 'X'.
    CONCATENATE sy-cprog sy-datum sy-uzeit
    INTO jobname SEPARATED BY '_'.
    CALL FUNCTION 'JOB_OPEN'
    EXPORTING
    jobname = jobname
    IMPORTING
    jobcount = jobcount
    EXCEPTIONS
    cant_create_job = 1
    invalid_job_data = 2
    jobname_missing = 3
    OTHERS = 4.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
    IMPORTING
    out_archive_parameters = arc_params
    out_parameters = print_params
    valid = valid
    EXCEPTIONS
    archive_info_not_found = 1
    invalid_print_params = 2
    invalid_archive_params = 3
    OTHERS = 4.
    IF valid = chk.
    SUBMIT yREP WITH s_kunnr IN s_cust
    AND RETURN
    USER sy-uname
    VIA JOB jobname
    NUMBER jobcount
    TO SAP-SPOOL
    SPOOL PARAMETERS print_params
    ARCHIVE PARAMETERS arc_params
    WITHOUT SPOOL DYNPRO.
    CALL FUNCTION 'JOB_CLOSE'
    EXPORTING
    jobcount = jobcount
    jobname = 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
    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.
    ELSE.
    MESSAGE i029 WITH jobname.
    ENDIF.
    ELSE.
    MESSAGE s000 WITH text-003.
    STOP.
    ENDIF.
    ENDIF.
    Also,
    Yes you can use job functions:
    JOB_OPEN
    JOB_SUBMIT
    JOB_CLOSE
    * You can add multiple steps into one job by using JOB_SUBMIT.
    Regards
    JJ

Maybe you are looking for