Schedule a job by passing variant parameter

Hi,
We are trying to copy a job with it's all properties to another Job. In this process, 2nd job is schedule as per the following statement.
details:
called Prog name : Z_program1
variant : Zvaraint1
statement used here is " submit Z_program1 using selection-set Zvariant1 and return"  something similar to that. However after execution, we have noticed that 2nd job got created with different variant name like "&0000000014" . Although we submitted variant name as "Zvariant1" from above statement, why it was taken a different variant name during 2nd job creation? can any one help me out here. How to pass the original variant to 2nd Job?
P.S, I don't want to use variant table.
Thanks

SAP calls &0000000000000-&9999999999999 variants "temporary" or "internal".
Every time you use SUBMIT VIA JOB..., SAP creates an internal variant. This is explained in [ABAP documentation - SUBMIT - Job options|http://help.sap.com/abapdocu_70/en/ABAPSUBMIT_VIA_JOB.htm] :
> When the program is scheduled in the background task, the selections specified by the user or in the additions for filling the selection screen are stored in an internal variant...
Of course, it might be an issue if your program tests SY-SLSET variable, or have a program which analyzes the jobs based on the variant names (table TBTCP)
But I wondered why the variant is passed to the job step correctly when we submit a job manually.
By debug, I saw that SAP calls JOB_SUBMIT function module instead of SUBMIT ... VIA JOB ...
It seems it builds directly the steps of the job, with the right variant.
So, just replace SUBMIT ... with CALL FUNCTION 'JOB_SUBMIT' ... (and keep JOB_OPEN and JOB_CLOSE)

Similar Messages

  • Schedule background job using system variant

    Dear gurus,
    We're planning to schedule background job using system variant, for example, current fiscal year and current posting period (transaction AFAB). Is it possible? So for example, for this month, "Posting Period" value will be 6, and then next month will be 7.
    Can you tell me how to do this, if I want to set up the schedule only once?
    Thanks for your help.
    Best Regards,

    done using abap

  • Scheduling a job with different variants

    i have a program to be run daily for three company codes and different materials. If i give all the three company codes at a time then the program is taking a lot of time and giving a run time error 'time limit exceeded' .Can i create variants for that program and make it run sequentially with all the variants.

    hi Deepthi,
    Yes you can do that .. i even suggest to modify your select statements to reduce the processing time .
    Refer
    http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm
    Regards,
    Santosh
    Message was edited by:
            Santosh Kumar Patha

  • How to schedule a job for transaction CG36, incl. variant?

    Hi all,
    When you enter transaction CG36, you need to select a User Exist (EHS_DXSDB). After that you need to define a file path.
    I would like to schedule a job for transaction: CG36 > Define User Exit: EHS_DXSDB (Import Dok-X material Safety Data Sheets) > and define a path. With transaction SE93, I found program name: RC1RIMPS (program is allowed to be job scheduled), only I can't create a Variant (to define the user exit and file path, no selectionscreen), how to create a variant?
    The following programs can't be scheduled either (as they are not of type 1 or J):
    SAPLC131
    SAPLC1EO
    SAPLC3G
    Thank you in advance!
    Kind regards,
    Roy Derks

    Hello Roy
    I am sorry. To my knowledge up to ECC 6.0 Enhancement Pack 4 there is no SAP EH&S process available there you can do what you are requesting. The "problem" is that you need to "answer" the user dialog. Therefore you can not generate/prepare a variant which could be processed as a job according to my knowledge.
    Therefore in my opinion you have this option only: prepare a copy of the transaction (or only the report) using either "Z" or "Y (customer reports). Then you need to exclude some line in the code (which gives rise to the user dialog) and prepare some customer specific coding so that the resulting report can be used in such a way that a variant is possible, but you must make sure that the process later (the real upload process) is processed too in this "job" queue. IN any case: you need to check the log of the report and this must be done by an user. Therefore an automatic process does have some "risks"
    The topic of import of reports is used in most cases during a set up of EH&S, because of mergers/acustions but not in the daily work with EH&S and there I believe that SAP does not support this demand.
    With best regards
    C.B.

  • How to transport variants and scheduled background jobs

    Hi all
       Could anyone let me know if  variants be transported .
       also can scheduled background jobs transported.
    Thanks in advance

    Hi,
    Run the program RSTRANSP and give the name of the program and the variant name.
    It will create a transport request for the variant.
    the rest of the process is the same as is the case with all other transport requests.
    Regards,
    Raghu
    Message was edited by:
            Raghu Reddy

  • Script to stop running SQL Agent job without passing job name as a parameter

    Looking for script to stop running job and don’t want to pass job name as a parameter, any job which is in running state I want that to be stop/disable.
    I have script to disable all jobs however if any jobs are in running state my requirement is to stop that job immediately and gets disable.
    Rahul

    Try the below scripts and then apply script to disable all jobs.
    execute xp_cmdshell 'net stop sqlserveragent'
    execute xp_cmdshell 'net start sqlserveragent'
    Regards, RSingh

  • Schedule a job using dbms_job package

    SQL to schedule a job using DBMS_JOB.
    variable jobno number;
    variable status number;
    begin
    dbms_job.submit(:jobno, 'x(:status);', trunc(sysdate)+8/24,
    'trunc(sysdate)+1+8/24', null);
    commit;
    end;
    It fails and returns the following error ...
    ORA-01008: not all variables bound
    Is it possible to schedule a job to run a procedure with "IN OUT" parameter? I would appreciate any assistance.
    Proc runs if I execute it from command mode and there are no issues.

    You cannot pass parameters back from a job-- Oracle spawns a separate session to run your job, so that session would receive any OUT parameters and end immediately after the job finishes. Even if Oracle let you do this, you would lose the OUT value as soon as the job ended.
    If you want a job to return a status, you can-
    1) Store the status in a table
    2) Queue a status message in an Oracle Advanced Queue
    3) Use dbms_alert to alert another process
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Schedule Process Flow with sysdate input parameter

    Hi experts,
    I'm facing a problem trying to run a schedule in a job,
    The schedule is defined to run daily at 3am, and the job receive a sysdate parameter, when I start the schedule in the control center I put
    TO_CHAR (TRUNC (SYSDATE), 'DD / MM / YYYY') , and the JOB runs fine with the correct date, but the next day the schedule runs with the date from yesterday, i.e the sysdate is not working.
    Maybe I missing something here ?, or is there another way to pass a dinamyc parameter to a scheduled job.
    I´m using OWB 11.2.0.1
    Thanks.

    Chino -
    Once you start the job, do you have to leave the "Job Details" window open in order for teh scheduled task to run?
    thanks for the help ....
    txb

  • How to schedule a job in another system.

    Hi,
    Now i have an ABAP program, which run in system ABC, client 001. i want to schedule a job in the program, with the function modules JOB_OPEN, JOB_SUBMIT, and JOB_CLOSE. But this job should run in ABC/002.
    How to write code?
    Who can help me on the requirement, or provide me another new solution except event trigger?
    Thanks & Best Regards,
    Johnney

    Here is the code. It works fine..
    FUNCTION Z_F_TRIGGER_REPORT.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(I_PROG) TYPE  D010SINF-PROG
    *"     VALUE(I_VARIANT) TYPE  VARIS-VARIANT
    *"     VALUE(I_MODE) TYPE  CHAR01
    *"  EXPORTING
    *"     VALUE(E_SUBRC) TYPE  SYST-SUBRC
    *"     VALUE(E_MSG) TYPE  CHAR80
    Functio ID :  Z_F_TRIGGER_REPORT
    TITLE      :  Report Trigger Tool
    Create Date:  15.03.2004
    Author     :  Denis Vieira
    Ownership : For the exclusive use of the Procter & Gamble Company
    Description:
    The purpose of this function module is to trigger programs
    requested remotely.
    AUTHORIZATION CHECKS
    OBJECT               AUTHORITY FIELDS         ABAP FIELDS
                     |                       |
    CHANGE HISTORY                                                      *
      DATE      |  Name  | Description                       | Reference *
    29.Jun.2006 | BA4513 | Unicode conversion and upgrade    | SPK290606
                |        | to My SAP ERP                     |
    **eject.
    Check if selected program exists in the destination file
      SELECT SINGLE  SUBC
             FROM    D010SINF
             INTO    D010SINF-SUBC
             WHERE   PROG    EQ  I_PROG
             AND     R3STATE EQ  C_A.
      IF SY-SUBRC NE C_0.
        MOVE  C_2                                               TO E_SUBRC.
        MOVE 'Report does not exist in destination system'(M01) TO E_MSG.
        EXIT.
      ENDIF.
    Check if program request is an executable program
      IF D010SINF-SUBC NE C_1.
        MOVE  C_2                                               TO E_SUBRC.
        MOVE 'Report is not an executable program'(M02)         TO E_MSG.
        EXIT.
      ENDIF.
    Check if selected variant exists in the destination file
      SELECT COUNT( * )
           FROM  VARIS
           INTO  W_COUNT
           WHERE REPORT  EQ I_PROG
           AND   VARIANT EQ I_VARIANT
           AND   DYNNR   EQ C_1000.
      IF W_COUNT EQ C_0.
        MOVE  C_2                                                TO E_SUBRC.
        MOVE 'Variant does not exist in destination system'(M03) TO E_MSG.
        EXIT.
      ENDIF.
      IF I_MODE EQ C_B.
        PERFORM 0100_BACKGROUND USING     I_PROG I_VARIANT
                                CHANGING  E_MSG  E_SUBRC.
      ELSE.
        PERFORM 0200_FOREGROUND USING     I_PROG I_VARIANT
                                CHANGING  E_MSG  E_SUBRC.
      ENDIF.
    ENDFUNCTION.
    *eject
    *&      Form  0100_background
    Executes Selected program in BackGround Mode VIA JOB
    *Block commented from here SPK290606
    *FORM 0100_BACKGROUND USING     L_PROG L_VARIANT
                        CHANGING  L_MSG  L_SUBRC.
    *Block commented till here SPK290606
    *Block added from here SPK290606
    FORM 0100_BACKGROUND USING    L_PROG    LIKE D010SINF-PROG
                                  L_VARIANT LIKE VARIS-VARIANT
                         CHANGING L_MSG     TYPE  CHAR80
                                  L_SUBRC   TYPE  SYST-SUBRC.
    *Block added till here SPK290606
      CONCATENATE C_AREA
                  C_UND
                  L_PROG
                  C_UND
                  SY-DATUM
                  C_UND
                  SY-UZEIT
                  INTO W_JOBNAME.
    Create a JOB and Get the Number for further execution
      CALL FUNCTION 'JOB_OPEN'
           EXPORTING
                JOBNAME  = W_JOBNAME
           IMPORTING
                JOBCOUNT = W_JOBCOUNT.
      IF SY-SUBRC NE C_0.
        MOVE  C_2                       TO L_SUBRC.
        MOVE 'Error opening job'(M07)   TO L_MSG.
        EXIT.
      ENDIF.
    Submit program
      SUBMIT (L_PROG)
        USING SELECTION-SET L_VARIANT
        VIA JOB W_JOBNAME NUMBER W_JOBCOUNT
        AND RETURN.
      IF SY-SUBRC NE C_0.
        MOVE  C_2                        TO L_SUBRC.
        MOVE 'Error Submitting Job'(M06) TO L_MSG.
        EXIT.
      ENDIF.
    Closes job to start its processing
      CALL FUNCTION 'JOB_CLOSE'
           EXPORTING
                JOBCOUNT  = W_JOBCOUNT
                JOBNAME   = W_JOBNAME
                STRTIMMED = 'X'.
      IF SY-SUBRC NE C_0.
        MOVE  C_2                       TO L_SUBRC.
        MOVE 'Error closing job'(M08)   TO L_MSG.
        EXIT.
      ENDIF.
      MOVE  C_0                                          TO L_SUBRC.
      MOVE 'Program Submitted in Background Mode'(M09)   TO L_MSG.
    ENDFORM.
    *eject
    *&      Form  0200_foreground
    Executes Selected program in ForeGround Mode VIA Submit
    *Block commented from here SPK290606
    *FORM 0200_FOREGROUND USING     L_PROG L_VARIANT
                        CHANGING  L_MSG  L_SUBRC.
    *Block commented till here SPK290606
    *Block added from here SPK290606
    FORM 0200_FOREGROUND USING    L_PROG    LIKE D010SINF-PROG
                                  L_VARIANT LIKE VARIS-VARIANT
                         CHANGING L_MSG     TYPE  CHAR80
                                  L_SUBRC   TYPE  SYST-SUBRC.
    *Block added till here SPK290606
      SUBMIT (L_PROG) USING SELECTION-SET L_VARIANT
             EXPORTING LIST TO MEMORY AND RETURN.
      IF SY-SUBRC EQ C_0.
        MOVE  C_0                                 TO L_SUBRC.
        MOVE 'Report submitted successfully'(M04) TO L_MSG.
      ELSE.
        MOVE  C_2                                 TO L_SUBRC.
        MOVE 'Error submitting report'(M05)       TO L_MSG.
      ENDIF.
    ENDFORM.

  • Schedule Background Job :  Remove delivery Block in Sales order

    Hi Gurus,
    I have a requirement to select all sales orders as per a condition and remove delivery block at
    VA02-> Go to -> Header -> Status
    For that I have to write a program which will be run only in background and i have to schedule background job for the same.
    I have a parameter at selection - No of records
    If no of records = 500 , I have to submit 500 jobs ie one job each for each sales order for removing delivery block.
    I need to know
    1) Which function module/bapi I can use to remove delivery block at sales order header level.
        For blocked delivery the status is 'BSTK" . to remove block i need to change status to "RSTK".
    2) How to schedule a background job for my program and how to submit one job each for each sales   order.
    Regards
    Avi.

    Hi Avi,
    Would like to seek for your advice. I am facing the same scenario too which is to delete the delivery block but is deletion of the delivery block is done in the user exit MV45AFZZ. The subroutine which needs to have the extra logic of deleting the delivery block is USEREXIT_SAVE_DOCUMENT_PREPARE.
    Need your advice on how do you solve this scenario? Thanks in advance.

  • Scheduling background job on Logon group

    Hi All,
    We have 4  logon groups configured in SMLG, while scheduling the job  in SM36 ->Target server field i am able to see only one group and other indivdual servers not  all the Groups configured in SMLG.
    Is there any option i have to check to let all the groups configured in SLMG to diaply in  SM36 for scheduling so that i can select the Logon group. I tried giving the logon group names manually which are not listed in Target server field it's giving the error group not exist..
    Please suggest..how to make all the Groups configured in SMLG to get displayed in SM36  for scheduling jobs...
    Thanks,
    Subhash.G

    Target server field is Name of an SAP instance at which a background job should be run.  The name has the following format:  <host name>_<SAP System name>_<SAP System number>, where host name is the name of the server computer on which the instance is running, as specified in the system profile parameter SAPLOCALHOST.
    The name of each instance is specified in the system profile parameter rdisp/myname.
    Example:  hs0123_C11_55
    In programming:  As the table field EXECSERVER, shows the target instance selected by the user for running a job.  As the table field REAXSERVER, shows the SAP instance at which a job was actually run.
    Hope this is clear.
    Thank you,
    Shyam

  • Schedule Background jobs automatically -

    Hello Guys,
    I have the following requirement.
    I have a copy program in BPS-SEM(ABAP program).
    Users have to run the copy program for different combinations like
    variant:1
    costcenetr 100-200
    valuetype - 10
    user 1
    variant:2
    costcenetr 400-500
    valuetype - 10 to 20
    user 1
    variant:3
    costcenetr 1000 to 2000
    valuetype - 50 to 70
    user 2
    ...etc.maybe there will be 10 to 15 variants will be created by 4-5 different users .
    I have to schedule the above jobs in sequence. The user wants to determine
    variant 1 - seq 1
    variant 4 - seq 2 after completing variant 1
    variant3  - seq3 after completing variant 4
    so I have to schedule all the variants in sequence the user wants to schedule the job.
    After all the above jobs are done, I have to schedule a job with variant called - calculate all functions. This has to be last after running all the above variants.
    My question is
    4 users have created 10 variants.
    I want to schedule the above variants in sequence in which the user wants to do execute it.(Is there anyway user can choose the sequence )
    2.After running all the above variants I have one variant which I have to run after completing the above variants.
    Thanks for your help guys.

    Hi,
    While Scheduling jobs through SM36 you have to specifiy the start condition for a Job.
    You can specify the START CONDITION as 'AFTER JOB'. So the first JOB will be scheduled normally. For all the Other JOBS, we will specify the start condition as the Previous JOB.In this case the Job will run After the completion of the previous Job.
    So you can schedule all the JOBS in sequence for all the Variants. So every JOB will run one after other in sequence
    Go through the link below
    http://help.sap.com/saphelp_bw21c/helpdata/en/c4/3a7fae505211d189550000e829fbbd/content.htm
    Reward points if useful
    Regards,
    Abhishek

  • How to schedule a job Monday thru Friday only

    How can I schedule a job Monday thru Friday only?  I tried to use a Factory Calendar but we do not have any M-F calendars setup.  If I need to create a new factory calendar, how can I create on without any holidays?
    Thanks.
    Ryan

    Hi
    see this
    Create a Variant for the Program and
    Schedule JOB in background:
    Go to SM36 create a Job
    enter Program and Variant for that program in STEP..
    click on Start Condition
    Click on DATE and TIME enter date scheduled Start and END times
    click on Period Values
    Click on HOURLY/WEEKLY etc
    CLick on RESTRICTIONS also to use further criteria.
    so your job will be scheduled and run as per your requirement.
    and in SM37 Transaction check the status of that JOB
    Check this link for scheduling jobs..
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c4/3a7f87505211d189550000e829fbbd/content.htm
    Regards
    Anji

  • How to schedule a job in DBA_JOBS

    Hi All,
    I have to schedule a job called dwsp_mig_purordssku(sysdate,null) on every sunday at 8.00 PM.
    This procedure must take two parameter one is sysdate and another can be null.
    How shouls I do it with dbms_job.sumbit?
    Thanks
    Sid

    Why not using DBMS_SCHEDULER?
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB (
       job_name             => 'dwsp_mig_purordssku_sun',
       job_type             => 'PLSQL_BLOCK',
       job_action           => 'BEGIN dwsp_mig_purordssku(SYSDATE, NULL); END;',
       start_date           => SYSDATE,
       repeat_interval      => 'FREQ=WEEKLY; BYDAY=SUN; BYHOUR=20; BYMINUTE=0;BYSECOND=0',
       enabled              =>  TRUE,
       comments             => 'Run dwsp_mig_purordssku on Sunday');
    END;
    {code}
    Note: the start_date does not mean that the job will start on  SYSDATE because the repeat_interval is set to be executed on Sunday weekly.
    As soon as you enter the job you will see that the next schedule is on Sunday at 8am:
    {code:sql}
    SELECT job_name, last_start_date, next_run_date
      FROM dba_scheduler_jobs
    WHERE LOWER (job_name) = 'dwsp_mig_purordssku_sun';
    JOB_NAME                       LAST_START_DATE                      NEXT_RUN_DATE
    DWSP_MIG_PURORDSSKU_SUN                                             13-MAY-12 20.00.00.000000 AM +02:00
    {code}
    Regards
    Al
    Edited by: Alberto Faenza on May 9, 2012 5:34 AM
    Edited by: Alberto Faenza on May 9, 2012 6:47 AM
    Corrected the time from 8 to 20 (it was 8pm in the initial message)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Table name for background job with report, variant and step user id list.

    Hello All,
    I need to generate the list of scheduled backgroung job with the list of Report Name, Variant, Step User Id called. Please any one tell the SAP Table name from which I can get these data.
    Thanks in Advance,
    Amit

    Hi Rohit,
    Thanks for your reply. But from TBTCO, i can't find program/report name and variant. Just the list of background job i can see.
    Regards,
    Amit

Maybe you are looking for

  • My iphone 5s vibrates so loudly but my friend's iphone 5s vibrates just fine. can anyone tell me if it is any hardware problem?

    i have bought an iphone 5s few days ago and i noticed that vibration of my iphone is different from other iphones. my iphone's vibration is so loud and noisy it is kind of rattly noise whenever i recieve a call or a text message, So i checked one of

  • Required field dependent on another field in PDF form

    I understand how to make a field required. But client wants a series of fields to be required only if a different field is answered yes. IOW, form begins with the question "Do you want me to call you?" followed by yes/no radio buttons. If the yes but

  • External user report

    How can i create a report showing the where external users have been granted access to content in each of the sites in our tenant? Dean MCTS-SQL 2005 Business Intelligence, MCITP SharePoint 2010

  • Migrating CUA on SSM 3.1 to SSM 7.00

    Guys, We have a completely empty (ie no SSM related customising) SSM 3.1 system running Central User Admin. We want to move to the latest SSM incl EHP1. Rather than perform an upgrade (CU & UC conversion required I guess) I think it would be quicker

  • Printing of Correspondence

    Hi SAP Gurus, I am trying to take a print of Vendor Credit Memo using the correspondence type "SAPVD" through the tcodes FB12 - Request & F.64 - Maintain. However the Print Program:Document Extract is giving error that no output could be generated of