Schedule Jobs with multiple steps via ABAP Program

Hi,
I need to schedule multiple programs via background jobs on a daily basis. Since all these jobs are to be run as a single job, the various programs have to be run as steps in a major job.
I am however not very clear on how this can be done via an ABAP program ( the idea of a program is that various parameters to be passed to each program in the step can be entered dynamically rather than via variants).
I am using the JOB_OPEN and JOB_CLOSE functions and submitting the programs with selection screen parameters dynamically passed to create a job. I need to do this for various programs as a job step (WITHOUT Variants being defined).
Can anyone suggest any ideas for this? I have tried out JOB_SUBMIT Function but am not very confident I know what exactly it is for as it asks for a variant.
Thanks very much,
Preet

Hi Preet,
just to be sure: you know, that variants can be dynamical, too?
It's quite usual to assign dynamical current date, but it's also possible to add / subtract value and even define own functionality.
Maybe it's easier to implement a dynamical selection and handle static jobs.
If you try to plan a job (online or with JOB_SUBMIT), you have to use variants - you can create (or change) them dynamical in beforehand. Only SE38, F8, F9 is creating a temporary variant, so that no saved variant is necessary.
But if you end up creating variants dynamical, you can change one existing variant, too. Then you can use a static job definition (with periodical starting rule).
So: have a look, if dynamic variants are enough, otherwise change variants per job.
Regards,
Christian

Similar Messages

  • Schedule a Job with multiple steps via ABAP Program

    Hi Friends,
    I want to create a report(Ex: ZREP) that will run another program(Ex: ZPGM) in background. What I need to do is, when I execute the report ZREP it should run the ZPGM automatically in background. This background execution should happen through JOB with multiple steps.
    Why i am mentioned steps is, i have 1000 records in ZTABLE and need to execute 100 records each in one step and need to proecess in ZPGM with selection parameters. So in my case my job should create with 10 steps and need to execute in sequential manner.
    FYI, In the ZREP selection screen i need to enter the records count/ interval to derive the job steps.
    Please guide how to go ahead? Thanks in advance for all the help.
    Regards,
    Raghu.

    Hi Raghu,
    You can try the following pieces of code:
    Loop at gt_table.   "This table contains 100 records previously appended
    w_jobname = c_job_emision   "Job Name.
        CALL FUNCTION 'JOB_OPEN'
          EXPORTING
            jobname          = w_jobname
          IMPORTING
            jobcount         = w_jobacount
          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.
    * Perform or create T_SELTAB with parameters options
    PERFORM Create_seltab_table.
    *Call second program.
    SUBMIT ZREP WITH  SELECTION-TABLE t_seltab AND RETURN.
    *Close Job.
        CALL FUNCTION 'JOB_CLOSE'
          EXPORTING
            jobcount             = w_jobacount
            jobname              = w_jobname
            strtimmed            = c_x  "Immediate Start
         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.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    ENDLOOP.
    Hope this helps.
    Regards
    Ernesto
    PS: Raymond Giuseppi was faster.
    Edited by: Ernesto Caballero on Mar 10, 2010 1:57 PM

  • Defining Job with multiple steps

    This is a general question on SM36.
    I have 4 programs that need to run as part of a job. I do not want this as a periodic job because these 4 steps needs to be done by the user when needed.
    I defined a job and created 4 steps and saved. system showed the job is scheduled and then I released it. All the 4 steps ran successfully.
    Now if I want to run again the same job, system is prompting me to create the steps again. I do not want to do that every time i want to run the job. how can I save this 4 steps under a job and just call the job name to schedule immediately on demand/when needed?

    Swathi,
    Create the job, leave the job with a status of  'scheduled' (no start conditions).
    When the user wishes to run the job:  SM37 > select your job; then Job > repeat scheduling. The user will have to determine the trigger; presumably it will be 'Immediate'; however, any of the normal selections are possible.
    This activity will start a copy of your scheduled job.  Your job remains with a status of scheduled.
    Since it is so easy for a user to make a mistake and inadvertently release your job, you might want to create a backup copy.  SM37 > select your job; then Job > copy.  This will give you a screen where you can create a copy of your job, but with a new name, such as <yourjobname>_BAK.
    Best Regards,
    DB49

  • Job with multiple event schedules

    Is it possible to create a job with multiple schedules? Can you have multiple schedule names?
    DBMS_SCHEDULER.CREATE_JOB (
    job_name => 'my_new_job2',
    job_type => 'PLSQL_BLOCK',
    job_action => 'BEGIN SALES_PKG.UPDATE_SALES_SUMMARY; END;',
    schedule_name => 'my_saved_schedule, my_saved_schedule2'); <------------------ like this?
    END;
    thanks.

    I am using oracle 10g and have installed the file arrival package. I want my job to run when multiple files arrive. I have created the file arrival event schedules. I know i can create chain event steps to respond, but my chain has to be running for the steps to respond to the events. I want the chain (or rather the job that starts the chain) to kick off when 2 or more files arrive.
    thanks.

  • Send a mail via ABAP program

    Hello Experts,
    I want to send mail via ABAP program with the following requirements :
    1. Recipient is OUTLOOK email -id
    2. Sender address has to be an external email-id
    3. Send mail as CC and BCC also to other email-id.
    Is there any function module which can satisfy all the above requirements.
    Regards,
    Mansi.

    hi,
    this code will definately help you just go through it:
    firstly  exported the data to memory using the FM LIST_FROM_MEMORY.
    CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
    listobject = t_listobject
    EXCEPTIONS
    not_found = 1
    OTHERS = 2.
    IF sy-subrc 0.
    MESSAGE e000(su) WITH text-001.
    ENDIF.
    then i converted it into ASCII using LIST_TO_ASCI,
    CALL FUNCTION 'LIST_TO_ASCI'
    TABLES
    listasci = t_xlstab
    listobject = t_listobject
    EXCEPTIONS
    empty_list = 1
    list_index_invalid = 2
    OTHERS = 3.
    IF sy-subrc NE 0.
    MESSAGE e003(yuksdbfzs).
    ENDIF.
    This gives the data in ASCII format separated by '|' and the header has '-', dashes. If you use this internal table directly without any proccesing in SO_NEW_DOCUMENT_ATT_SEND_API1, then you will not get a good excel sheet attachment. To overcome this limitation, i used cl_abap_char_utilities=>newline and cl_abap_char_utilities=>horizontal_tab to add horizontal and vertical tabs to the internal table, replacing all occurences of '|' with
    cl_abap_char_utilities=>horizontal_tab.
    Set the doc_type as 'XLS', create the body and header using the packing_list and pass the data to be downloaded to SO_NEW_DOCUMENT_ATT_SEND_API1 as contents_bin.
    This will create an excel attachment.
    Sample code for formatting the data for the attachment in excel format.
    u2022     Format the data for excel file download
    LOOP AT t_xlstab INTO wa_xlstab .
    DESCRIBE TABLE t_xlstab LINES lw_cnt.
    CLEAR lw_sytabix.
    lw_sytabix = sy-tabix.
    u2022     If not new line then replace '|' by tabs
    IF NOT wa_xlstab EQ cl_abap_char_utilities=>newline.
    REPLACE ALL OCCURRENCES OF '|' IN wa_xlstab
    WITH cl_abap_char_utilities=>horizontal_tab.
    MODIFY t_xlstab FROM wa_xlstab .
    CLEAR wa_xlstab.
    wa_xlstab = cl_abap_char_utilities=>newline.
    IF lw_cnt NE 0 .
    lw_sytabix = lw_sytabix + 1.
    u2022     Insert new line for the excel data
    INSERT wa_xlstab INTO t_xlstab INDEX lw_sytabix.
    lw_cnt = lw_cnt - 1.
    ENDIF.
    CLEAR wa_xlstab.
    ENDIF.
    ENDLOOP.
    Sample code for creating attachment and sending mail:
    FORM send_mail .
    u2022     Define the attachment format
    lw_doc_type = 'XLS'.
    u2022     Create the document which is to be sent
    lwa_doc_chng-obj_name = 'List'.
    lwa_doc_chng-obj_descr = w_subject. "Subject
    lwa_doc_chng-obj_langu = sy-langu.
    u2022     Fill the document data and get size of message
    LOOP AT t_message.
    lt_objtxt = t_message-line.
    APPEND lt_objtxt.
    ENDLOOP.
    DESCRIBE TABLE lt_objtxt LINES lw_tab_lines.
    IF lw_tab_lines GT 0.
    READ TABLE lt_objtxt INDEX lw_tab_lines.
    lwa_doc_chng-doc_size = ( lw_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
    lwa_doc_chng-obj_langu = sy-langu.
    lwa_doc_chng-sensitivty = 'F'.
    ELSE.
    lwa_doc_chng-doc_size = 0.
    ENDIF.
    u2022     Fill Packing List For the body of e-mail
    lt_packing_list-head_start = 1.
    lt_packing_list-head_num = 0.
    lt_packing_list-body_start = 1.
    lt_packing_list-body_num = lw_tab_lines.
    lt_packing_list-doc_type = 'RAW'.
    APPEND lt_packing_list.
    u2022     Create the attachment (the list itself)
    DESCRIBE TABLE t_xlstab LINES lw_tab_lines.
    u2022     Fill the fields of the packing_list for creating the attachment:
    lt_packing_list-transf_bin = 'X'.
    lt_packing_list-head_start = 1.
    lt_packing_list-head_num = 0.
    lt_packing_list-body_start = 1.
    lt_packing_list-body_num = lw_tab_lines.
    lt_packing_list-doc_type = lw_doc_type.
    lt_packing_list-obj_name = 'Attach'.
    lt_packing_list-obj_descr = w_docdesc.
    lt_packing_list-doc_size = lw_tab_lines * 255.
    APPEND lt_packing_list.
    u2022     Fill the mail recipient list
    lt_reclist-rec_type = 'U'.
    LOOP AT t_recipient_list.
    lt_reclist-receiver = t_recipient_list-address.
    APPEND lt_reclist.
    ENDLOOP.
    u2022     Finally send E-Mail
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = lwa_doc_chng
    put_in_outbox = 'X'
    commit_work = 'X'
    IMPORTING
    sent_to_all = lw_sent_to_all
    TABLES
    packing_list = lt_packing_list
    object_header = lt_objhead
    contents_bin = t_xlstab
    contents_txt = lt_objtxt
    receivers = lt_reclist
    EXCEPTIONS
    too_many_receivers = 1
    document_not_sent = 2
    document_type_not_exist = 3
    operation_no_authorization = 4
    parameter_error = 5
    x_error = 6
    enqueue_error = 7
    OTHERS = 8.
    Hope it will help you
    regards
    Rahul sharma

  • How to extract data from BPC InfoCube via ABAP program?

    Hi experts!!
    I tried to extract data from a BPC InfoCube via ABAP program, but I did'n have succeed.
    I used the function 'RSDRI_INFOPROV_READ' to extract data from standard InfoCubes such as '0COPC_C07' and it run OK! However, when I change the InfoCube name to '/CPMB/WAIX8NE' (BPC InfoCube), everything goes wrong...
    Is there any difference between extracting data from BPC and standard InfoCubes?
    Thank you all!

    Moderator message - Welcome to SCN.
    But please do not cross and duplicate post.
    Thread locked.
    Rob

  • How can I see all scheduled jobs which have steps of a given user?

    Hello,
    I like to see all scheduled jobs which have steps of a given user. It is not importent which user has planned the job, I just want to check the usernames wich are used for accomplishing the respective step (-> field "AUTHCKNAM").
    In table " tbtcp" I can see the AUTHCKNAM for the jobsteps, but these table just contains the jobs which are in the state "finished/completed".
    In table "tbtcs" I can see the scheduled jobs, but there I can't see the AUTHCKNAM
    Do you know a table where I can see ALL Jobs or the scheduled ones and the AUTHCKNAM?
    Thanks for your help!
    Kind Regards
    Lisa

    Hi,
    thanks for your answers.
    I also tried the table "tbtco". There I can see all jobs, but there arent entrys in the column "AUTHCKNAM". Its empty....
    Maybe there is an other table?
    Kind Regards,
    Lisa

  • Job with multiple variant

    Dear Friends,
    I have some jobs which has many variants. So it possible to create a job with multiple variants or only option is to create job chain.
    Please suggest.
    Thanks in advance.
    Regards,
    Jiggi

    Hi,
    You can submit the same job with different variant, but that is your runtime.
    Limitation is that you can't migrate all these runtime jobs.
    It is better you create different jobs with different variants, so that you have frexibility to run them independently, monitor and troubleshoot them, also migrate them to next environment (QA or PRD). And you can still create a job chain using all these independent jobs if require.
    Only creating Job Chain would be useful only if you want to run them in parallel or in sequence. (Not if you want to run them independently).
    Hope this help.
    regards,
    Sunil Rohit

  • Export scheduler job but chain step and chain rule failed with ORA-24150 ORA-06512 during executed sql script.

    Hi Folks,
    I used expdp utility to export all Oracle scheduler jobs and chains with below method, after that generate sql script by impdp, later on executing sql script encountered some errors.
    Only chain step and chain rule for executing script. Does anyone bright me some light? Thanks!
    My env: Oracle 11g + Oracle Linux 5.5
    My steps as below:
    1. export(expdp) oracle scheduler job(chain)
    2. generate sql script by impdp.
    3. remove orginal scheduler job(chain)
    4. execute sql script
    5. job with no chain well but job with chain failed
    [oracle@linux1 ~]$ expdp scott/tiger directory=db_dump_dir dumpfile=scott_job.dmp include=procobj:\" in \(select \
    > name from sys.obj$ where type\# in \(46,59,66,67,68,69,72,74,79\)\)\"  schemas=scott
    Export: Release 11.2.0.1.0 - Production on Tue Dec 3 17:42:31 2013
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    With the Partitioning, Real Application Clusters, OLAP, Data Mining
    and Real Application Testing options
    Starting "SCOTT"."SYS_EXPORT_SCHEMA_01":  scott/******** directory=db_dump_dir dumpfile=scott_job.dmp include=procobj:" in (select name from sys.obj$ where type# in (46,59,66,67,68,69,72,74,79))" schemas=scott
    Estimate in progress using BLOCKS method...
    Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 0 KB
    Processing object type SCHEMA_EXPORT/POST_SCHEMA/PROCOBJ
    Master table "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
    Dump file set for SCOTT.SYS_EXPORT_SCHEMA_01 is:
      /u03/database/usbo/BNR/dump/scott_job.dmp
    Job "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully completed at 17:42:54
    [oracle@linux1 ~]$ impdp scott/tiger sqlfile=scott_job.sql directory=db_dump_dir dumpfile=scott_job.dmp logfile=imp_scott_job.log
    Import: Release 11.2.0.1.0 - Production on Tue Dec 3 17:43:04 2013
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    With the Partitioning, Real Application Clusters, OLAP, Data Mining
    and Real Application Testing options
    Master table "SCOTT"."SYS_SQL_FILE_FULL_01" successfully loaded/unloaded
    Starting "SCOTT"."SYS_SQL_FILE_FULL_01":  scott/******** sqlfile=scott_job.sql directory=db_dump_dir dumpfile=scott_job.dmp logfile=imp_scott_job.log
    Processing object type SCHEMA_EXPORT/POST_SCHEMA/PROCOBJ
    Job "SCOTT"."SYS_SQL_FILE_FULL_01" successfully completed at 17:43:07
    [oracle@linux1 ~]$ more /u03/database/usbo/BNR/dump/scott_job.
    scott_job.dmp  scott_job.sql 
    [oracle@linux1 ~]$ more /u03/database/usbo/BNR/dump/scott_job.sql
    -- CONNECT SCOTT
    ALTER SESSION SET EVENTS '10150 TRACE NAME CONTEXT FOREVER, LEVEL 1';
    ALTER SESSION SET EVENTS '10904 TRACE NAME CONTEXT FOREVER, LEVEL 1';
    ALTER SESSION SET EVENTS '25475 TRACE NAME CONTEXT FOREVER, LEVEL 1';
    ALTER SESSION SET EVENTS '10407 TRACE NAME CONTEXT FOREVER, LEVEL 1';
    ALTER SESSION SET EVENTS '10851 TRACE NAME CONTEXT FOREVER, LEVEL 1';
    ALTER SESSION SET EVENTS '22830 TRACE NAME CONTEXT FOREVER, LEVEL 192 ';
    -- new object type path: SCHEMA_EXPORT/POST_SCHEMA/PROCOBJ
    BEGIN
    BEGIN
    dbms_rule_imp_obj.import_rule('"SCOTT"','"CHAIN_RULE_1"','1=1',NULL, 'First link in the chain.',0,NULL);
    END;
    COMMIT;
    END;
    BEGIN
    BEGIN
    dbms_rule_imp_obj.import_rule('"SCOTT"','"CHAIN_RULE_2"',':"CHAIN_STEP_1".COMPLETED = ''TRUE''',NULL, 'Second link in the chain.',0,NULL);
    END;
    COMMIT;
    END;
    BEGIN
    BEGIN
    dbms_rule_imp_obj.import_rule('"SCOTT"','"CHAIN_RULE_3"',':"CHAIN_STEP_2".COMPLETED = ''TRUE''',NULL, 'Third link in the chain.',0,NULL);
    END;
    COMMIT;
    END;
    BEGIN
    BEGIN
    dbms_rule_imp_obj.import_rule('"SCOTT"','"CHAIN_RULE_4"',':"CHAIN_STEP_3".COMPLETED = ''TRUE''',NULL, 'End of the chain.',0,NULL);
    END;
    COMMIT;
    END;
    BEGIN
    BEGIN
    dbms_rule_imp_obj.import_rule_set('"SCHED_RULESET$1"','"SCHED_EV_CTX$1"',NULL, 0);
    END;
    COMMIT;
    END;
    BEGIN
    dbms_scheduler.create_program('"TEST_PROC_1"','PLSQL_BLOCK',
    'BEGIN
                             INSERT INTO tb_schduler (id, descr, cr_date)
                             VALUES (tb_schduler_seq.NEXTVAL, ''test_proc_1'', SYSDATE);
                             COMMIT;
                           END;'
    ,0, TRUE,
    'Program for first link in the chain.'
    COMMIT;
    END;
    BEGIN
    dbms_scheduler.create_program('"TEST_PROC_3"','PLSQL_BLOCK',
    'BEGIN
                             INSERT INTO tb_schduler (id, descr, cr_date)
                             VALUES (tb_schduler_seq.NEXTVAL, ''test_proc_3'', SYSDATE);
                             COMMIT;
                           END;'
    ,0, TRUE,
    'Program for last link in the chain.'
    COMMIT;
    END;
    BEGIN
    dbms_scheduler.create_program('"TEST_PROC_2"','PLSQL_BLOCK',
    'BEGIN
                             INSERT INTO tb_schduler (id, descr, cr_date)
                             VALUES (tb_schduler_seq.NEXTVAL, ''test_proc_2'', SYSDATE);
                             COMMIT;
                           END;'
    ,0, TRUE,
    'Program for second link in the chain.'
    COMMIT;
    END;
    BEGIN
    dbms_scheduler.create_chain('"TEST_CHAIN_1"', evaluation_interval=>NULL, comments=>'A test chain.'
    , rule_set_name=>'"SCHED_RULESET$1"   '
    dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_1"', program_name=>'"TEST_PROC_1"');
    dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_2"', program_name=>'"TEST_PROC_2"');
    dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_3"', program_name=>'"TEST_PROC_3"');
    COMMIT;
    END;
    BEGIN
    dbms_scheduler.create_job('"TEST_CHAIN_1_JOB"',
    job_type=>'CHAIN', job_action=>
    'test_chain_1'
    , number_of_arguments=>0,
    start_date=>TO_TIMESTAMP_TZ('03-DEC-2013 05.38.56.718161000 PM +08:00','DD-MON-RRRR HH.MI.SSXFF AM TZR','NLS_DATE_LANGUAGE=english'), repeat_interval=>
    'freq=minutely; interval=2'
    , end_date=>TO_TIMESTAMP_TZ('03-DEC-2013 06.08.56.000000000 PM +08:00','DD-MON-RRRR HH.MI.SSXFF AM TZR','NLS_DATE_LANGUAGE=english'),
    job_class=>'"DEFAULT_JOB_CLASS"', enabled=>FALSE, auto_drop=>TRUE,comments=>
    NULL
    COMMIT;
    END;
    [oracle@linux1 ~]$ export ORACLE_SID=usbo
    [oracle@linux1 ~]$ sqlplus / as sysdba
    SQL*Plus: Release 11.2.0.1.0 Production on Tue Dec 3 17:44:43 2013
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    With the Partitioning, Real Application Clusters, OLAP, Data Mining
    and Real Application Testing options
    sys@USBO> show parameter db_name
    NAME                                 TYPE                              VALUE
    db_name                              string                            usbo
    sys@USBO> conn scott/tiger;
    Connected.
    --remove job and chain.
    scott@USBO> EXEC DBMS_SCHEDULER.drop_job(job_name => 'test_chain_1_job');
    EXEC DBMS_SCHEDULER.drop_chain (chain_name  => 'test_chain_1');
    EXEC DBMS_SCHEDULER.drop_program (program_name  => 'test_proc_1');
    EXEC DBMS_SCHEDULER.drop_program (program_name  => 'test_proc_2');
    EXEC DBMS_SCHEDULER.drop_program (program_name  => 'test_proc_3');
    PL/SQL procedure successfully completed.
    scott@USBO> @/u03/database/usbo/BNR/dump/scott_job.sql
    Session altered.
    Session altered.
    Session altered.
    Session altered.
    Session altered.
    Session altered.
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    BEGIN
    ERROR at line 1:
    ORA-24150: evaluation context SCOTT.SCHED_EV_CTX$1 does not exist
    ORA-06512: at "SYS.DBMS_RULEADM_INTERNAL", line 28
    ORA-06512: at "SYS.DBMS_RULE_IMP_OBJ", line 40
    ORA-06512: at line 3
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    BEGIN
    ERROR at line 1:
    ORA-24141: rule set SCOTT.SCHED_RULESET$1 does not exist
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
    ORA-06512: at "SYS.DBMS_ISCHED", line 1694
    ORA-01403: no data found
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 1638
    ORA-06512: at line 5
    PL/SQL procedure successfully completed.

    Thanks all of you!
    Hi DK2010,
    I took some test that the data dict(dba_rule_sets/dba_evaluation_contexts) no any data returned after I had removed the job.
    So I tried to create evaluation context and re-executed script(only exception setion.) the first error has gone. For the second still have some issue.
    ---->no any returned
    scott@USBO> select * from dba_rule_sets where rule_set_owner='SCOTT';       
    no rows selected
    scott@USBO> select * from dba_evaluation_contexts WHERE evaluation_context_owner='SCOTT';
    no rows selected
    -->add new EVALUATION CONTEXT
    scott@USBO> exec DBMS_RULE_ADM.CREATE_EVALUATION_CONTEXT('SCOTT.SCHED_EV_CTX$1');
    PL/SQL procedure successfully completed.
    --->now it looks fine
    scott@USBO> BEGIN
      2  BEGIN
      3  dbms_rule_imp_obj.import_rule_set('"SCHED_RULESET$1"','"SCHED_EV_CTX$1"',NULL, 0);
      4  END;
      5 
      6  COMMIT;
      7  END;
      8  /
    PL/SQL procedure successfully completed.
    --->add new rule set, it prompt aleady exists
    scott@USBO> exec DBMS_RULE_ADM.CREATE_RULE_SET('SCOTT.SCHED_RULESET$1') 
    BEGIN DBMS_RULE_ADM.CREATE_RULE_SET('SCOTT.SCHED_RULESET$1'); END;
    ERROR at line 1:
    ORA-24153: rule set SCOTT.SCHED_RULESET$1 already exists
    ORA-06512: at "SYS.DBMS_RULEADM_INTERNAL", line 28
    ORA-06512: at "SYS.DBMS_RULE_ADM", line 138
    ORA-06512: at line 1
    -->chain rule still could not find.
    scott@USBO> @job_chain_rules.sql
    no rows selected
    -->rerun
    scott@USBO> BEGIN
      2  dbms_scheduler.create_chain('"TEST_CHAIN_1"', evaluation_interval=>NULL, comments=>'A test chain.'
      3  , rule_set_name=>'"SCHED_RULESET$1"   '
      4  );
      5  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_1"', program_name=>'"TEST_PROC_1"');
      6  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_2"', program_name=>'"TEST_PROC_2"');
      7  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_3"', program_name=>'"TEST_PROC_3"');
      8  COMMIT;
      9  END;
    10  /
    BEGIN
    ERROR at line 1:
    ORA-27477: "SCOTT.TEST_CHAIN_1" already exists 
    ORA-06512: at "SYS.DBMS_ISCHED", line 1148
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 1598
    ORA-06512: at line 2
    -->drop chain
    scott@USBO> exec dbms_scheduler.drop_chain('TEST_CHAIN_1');
    BEGIN dbms_scheduler.drop_chain('TEST_CHAIN_1'); END;
    ERROR at line 1:
    ORA-27479: Cannot drop "SCOTT.TEST_CHAIN_1" because other objects depend on it
    ORA-06512: at "SYS.DBMS_ISCHED", line 1319
    ORA-06512: at "SYS.DBMS_ISCHED", line 1222
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 1854
    ORA-06512: at line 1
    scott@USBO> exec dbms_scheduler.drop_chain('TEST_CHAIN_1',force=>TRUE);
    PL/SQL procedure successfully completed.
    scott@USBO> BEGIN
      2  dbms_scheduler.create_chain('"TEST_CHAIN_1"', evaluation_interval=>NULL, comments=>'A test chain.'
      3  , rule_set_name=>'"SCHED_RULESET$1"   '
      4  );
      5  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_1"', program_name=>'"TEST_PROC_1"');
      6  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_2"', program_name=>'"TEST_PROC_2"');
      7  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_3"', program_name=>'"TEST_PROC_3"');
      8  COMMIT;
      9  END;
    10  /
    BEGIN
    ERROR at line 1:
    ORA-24141: rule set SCOTT.SCHED_RULESET$1 does not exist   --->still returned no rule set
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
    ORA-06512: at "SYS.DBMS_ISCHED", line 1694
    ORA-01403: no data found
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 1638
    ORA-06512: at line 5
    scott@USBO> exec DBMS_RULE_ADM.CREATE_RULE_SET('SCOTT.SCHED_RULESET$1')
    PL/SQL procedure successfully completed.
    scott@USBO> BEGIN
      2  dbms_scheduler.create_chain('"TEST_CHAIN_1"', evaluation_interval=>NULL, comments=>'A test chain.'
      3  , rule_set_name=>'"SCHED_RULESET$1"   '
      4  );
      5  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_1"', program_name=>'"TEST_PROC_1"');
      6  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_2"', program_name=>'"TEST_PROC_2"');
      7  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_3"', program_name=>'"TEST_PROC_3"');
      8  COMMIT;
      9  END;
    10  /
    BEGIN
    ERROR at line 1:
    ORA-27477: "SCOTT.TEST_CHAIN_1" already exists
    ORA-06512: at "SYS.DBMS_ISCHED", line 1148
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 1598
    ORA-06512: at line 2
    scott@USBO> exec dbms_scheduler.drop_chain('TEST_CHAIN_1',force=>TRUE);
    PL/SQL procedure successfully completed.
    scott@USBO> BEGIN
      2  dbms_scheduler.create_chain('"TEST_CHAIN_1"', evaluation_interval=>NULL, comments=>'A test chain.'
      3  , rule_set_name=>'"SCHED_RULESET$1"   '
      4  );
      5  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_1"', program_name=>'"TEST_PROC_1"');
      6  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_2"', program_name=>'"TEST_PROC_2"');
      7  dbms_scheduler.define_chain_step('"TEST_CHAIN_1"', step_name=>'"CHAIN_STEP_3"', program_name=>'"TEST_PROC_3"');
      8  COMMIT;
      9  END;
    10  /
    BEGIN
    ERROR at line 1:
    ORA-24141: rule set SCOTT.SCHED_RULESET$1 does not exist
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
    ORA-06512: at "SYS.DBMS_ISCHED", line 1694
    ORA-01403: no data found
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 1638
    ORA-06512: at line 5
    Would you like to give me more clue?
    Thanks again.

  • Schedule Job with Abap

    Hi Experts
    Im executing jobs thru abap program, but now I need schedule this job.  Does anybody know how can I do it?  Can you show me the abap code or function module?
    Thank you in advance!

    Hi Ram,
    I have a front-end screen where the end-user select date &time for schedule this job. Now Im using
    FUNCTION 'JOB_SUBMIT',
    EXPORTING
            authcknam = sy-uname
            jobcount  = p_job
            jobname   = 'BUNDLE_EXECUTE'
            report    = 'UPC_BUNDLE_EXECUTE'
            variant   = l_seq.
    but I dont know how send the date and time in order to schedule the job.  
    Does I need use other function?
    Thank you!

  • Job with Multiple Schedule of same time & only one is executed, Why

    Hi ALL,
    I've Created a package to notify report in email  as excel, which is using a path to render report and save it as excel.
    This package was need to be schedule every first day of month and on every Friday even at morning 7 AM.
    So logically these are two events.
    But if we see on 1 May 2015 we have Friday and plus first day of month
    So technically this should fail.
    either for IO operation for render &
    storing data over same location with same file name.
    To replicate this i created two three schedule
    Below is the job history, job is invoked by only one schedule
    Question-
    1) Why one one schedule execute?
    2) why "sched2" only , it could be "sched3" only or "DentalOperationStackAndRank-Sched1" Only?
    Another this i result into error if different job executing same package at same schedule.
    FYI- package is deployed at database level
    HS

    Hi HS,
    As described in this
    article, more than one job can run on the same schedule, and more than one schedule can apply to the same job.
    And I make a test about your scenario, when configuring a SQL Server job with three schedules that reference same dates and times, my job behaves as yours that only one schedule is executed, but the job is invoked by schedule2 or schedule 3 in my environment.
    It is a normal behavior of SQL Server job in my opinion. For more details about such scenario, you can track the job following this
    blog.
    However, when I configure three jobs that run on the same schedule, everything works well and the three jobs all run successfully.
     I recommend you configure three different jobs that execute same package at same schedule .
    Thanks,
    Lydia Zhang
    Lydia Zhang
    TechNet Community Support

  • Schedule/Execute POWL Query in Background or via ABAP Program

    Hi all,
    I would like to know if there is any chance/possibilities to schedule/execute the POWL Query for example the Query ID
    "SAPSSRM_R_CENTRALCONFIRM_01_01" Confirmations Pending in the background to output report.
    Or perhaps there is anyway I can make use of the logic within the Query ID above in an ABAP program?
    The main reason is that I need create a Confirmations Pending report and sent out to relevant SC Creator and the quickest way is to make use of the existing query of above.
    Many thanks and regards,
    Hon Leong

    Hi Hon Leong,
    please first check POWL - Web Dynpro ABAP - SCN Wiki to understand, how POWL works.
    You need to find a Feeder Class of your query and execude GET_OBJECTS Method to get the result list.
    For example you can check report POWL_WLOAD or function module POWL_QUERY_REFRESH.
    Regards
    Konstantin

  • One job with two steps - how to create one single spool?

    Hello experts,
    I have created two queries in SQVI. One is based on the table BSIK, the other on on BSAK.
    The report layout is the same in both queries.
    Now I schedule one job in SM36/SM37 with two steps corresponding to my queries.
    I want my second step to append the spool created in the first step. Is that possible?
    In order to do this I unchecked "New spool request" in the request attributes for the second step of the job.
    I use the same printer, the same format (X_65_80), but it doesnt work.
    The help on the field says
    ".... name, output device, number of prints and the format must match..." - What "name" do they mean?
    "In addition, the existent spool order must not already be competed. This can occur if a spool is released for output...." - I use "send to SAP spooler only" option, is that what thay mean? How cen you have an "uncompleted spool" in the job.
    If anybody knows ho to do this (without development!), please advise
    Best regards,
    Fatima

    Hi,
    Please do following steps :
    1. Go to transaction code SM36
    2. Do as per below screen shots
    You can see Job steps is empty
    Click on (Check and Save)
    Next Screen
    You can see one step created
    Click on Create
    You can see above it is showing as Step 2
    Give again program name and variant
    Click on (Check and Save)
    You can see two steps are created
    Go back (green arrow)
    You can see know SAP is showing 2 Step(s) successfully defined which was earlier blank
    Click on
    Next Screen
    Now schedule job as per your requirement.
    Prerequisite create variants for both the programs as we need to mention the same .
    Hope, this solves your issue else revert.
    Regards,
    Tejas

  • Schedule Job with Job_close after successful job doesn't work

    Hi guys,
    I'm using FM CLOSE_JOB with parameters : 
                JOBCOUNT             = w_JobId
                JOBNAME              = w_JobName
                PREDJOB_CHECKSTAT    = 'X'
                PRED_JOBCOUNT        = w_oldJobId
                PRED_JOBNAME         = w_oldJobName
    I have about 9 jobs wich must run the one after the others. The first start without PRED* parameters, but the 8 others one are filled with CHECKSTAT, and previous job name and id.
    It works fine for the side "the one after the others", BUT, wathever the previous job give as result (cancelled or finished), the next one starts whereas I pass the parameter CHECKSTAT to X.
    Any ideas of the problem and how to solve it?
    Thanks in advance for your answers.

    Here my code with explanation :
    REPORT  YCOMJ023.
    start-of-selection.
    "Initialization of my vars
    w_StepCount = 0. >> number of steps maxi in a job
    w_jobCount = 1.  >> number to see easier in SM37 the job order
    CONCATENATE pe_name '_STEPS' w_jobCountC INTO w_JobName. (example : TOTO_STEP1)
    CONDENSE w_JobName NO-GAPS.
    "I open my first job
      CALL FUNCTION 'JOB_OPEN' (OPEN job TOTO_STEP1)
        EXPORTING
          jobname          = w_JobName
        IMPORTING
          jobcount         = w_JobID
        EXCEPTIONS
          cant_create_job  = 1
          invalid_job_data = 2
          jobname_missing  = 3
          OTHERS           = 4.
    "We keep in memory first job IDs to close it at the end of the prg
      w_firstjobName = w_JobName.
      w_firstjobID = w_JobID.
    "imagine you do the bellow code in a loop and it makes several jobs TOTO_STEP2 TOTO_STEP3 TOTO_STEP4...
    ADD 1 TO w_StepCount.
    IF w_StepCount GT 250.
        "I call close job eatch time I reach 250 steps
         PERFORM fx_jobclose.
    ENDIF.
    submit RKGALKEUB to sap-spool and return
                                       without spool dynpro
                                       spool parameters print_parameters
                                            VIA JOB w_JobName NUMBER w_JobID
    "End of the programmI close the current Job and the first one :
    "Current
            CALL FUNCTION 'JOB_CLOSE'
              EXPORTING
                JOBCOUNT             = w_JobId
                JOBNAME              = w_JobName
                PREDJOB_CHECKSTAT    = 'X'
                PRED_JOBCOUNT        = w_oldJobId
                PRED_JOBNAME         = w_oldJobName.
    "First one + launch with STRIMMED
            CALL FUNCTION 'JOB_CLOSE'
            EXPORTING
              JOBCOUNT             = w_firstjobId
              JOBNAME              = w_firstjobName
              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.
    *&      Form  fx_jobclose
    *       text
    FORM fx_jobclose.
      "Step to zero to do a new loop after this form
      w_StepCount = 0.
      DATA : w_job_released TYPE CHAR1.
      "If the flag IsFirst, we don't do nothing, because it's the first JOb, and it should not be closed
      IF w_IsFirst = 'X'.
        "Flag is set to blank
        w_IsFirst = ''.
      ELSE.
          "Else it mean we are closing a job with predecessor :
          CALL FUNCTION 'JOB_CLOSE'
            EXPORTING
              JOBCOUNT             = w_JobId
              JOBNAME              = w_JobName
              PREDJOB_CHECKSTAT    = 'X'
              PRED_JOBCOUNT        = w_oldJobId
              PRED_JOBNAME         = w_oldJobName
              "SDLSTRTDT            = sy-datum
              "SDLSTRTTM            = sy-timlo
            IMPORTING
              JOB_WAS_RELEASED = w_job_released.
      ENDIF.
      "Vars get the value of current job, witch will become the older one
      w_oldJobId = w_jobID.
      w_oldJobName = w_JobName.
    "I make the new TOTO_STEPX job name
      ADD 1 TO w_jobCount.
      w_jobCountC = w_jobCount.
      CONCATENATE pe_name '_STEPS' w_jobCountC INTO w_JobName.
      CONDENSE w_JobName NO-GAPS.
      "I open the new job
      CALL FUNCTION 'JOB_OPEN'
        EXPORTING
          jobname          = w_JobName
        IMPORTING
          jobcount         = w_JobId
        EXCEPTIONS
          cant_create_job  = 1
          invalid_job_data = 2
          jobname_missing  = 3
          OTHERS           = 4.
    ENDFORM.                    "fx_jobclose
    I hope my code is clear enought, I tried to delete the superfluities code.

  • Create a DDic sturcture via ABAP program

    Hello,
    is it possible to create a DDic structure via a ABAP program? I've got the components and component type of the new structure in a table.
    I want to create a DDic structure with this information. Is there function module or a method, with this functionality?
    Thanks for help!
    Matthias

    I need a DDic structure to use this in the exporting parameters of an remote-enabled function module.  Thier isn't it posible to use an none typed parameter, because of the remote.
    I want to create an admin-screen for an tool calls DocFinder. For this tool you need for every DocuSpace an extra structure to return the values.
    We use this tool in an shared systemlandscape so its nessessary to use an remode-enabled function module.
    In the admin-screen it should be able to create an new DocuSpace with its structures and other generatet coding.
    But I've got no idea how to create an structure via programm.

Maybe you are looking for