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

Running report in background job without variant

Hi Gurus,

We developed one report. In that report we have creation date field as select-option in the selection screen. But when we are creating variant there is no option for the default values which are coming from the report.

Ex: Creation date 01.05.2011 to 23.05.2011 (i.e. sy-datum).

We have n number of POs in our production system. So we are taking POs created after May 1st 2011(creation date-low it should be constant) and creation date-high should be sy-datum.

But when I am saving it as varaint, I am not able to get the exact dates in the field.

1. Is it necessary to run a report with varaint in background?

2. If variant is mandatory to run report in background, then how to get creation date-low as 01.05.2011 and date-high as sy-datum.

Kindly help me to sort out the problem facing.

Thanks,

Kiran.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on May 23, 2011 at 07:35 AM

    You always need a variant for background execution. You can do two things in the variant:

    - choose option "save field without values" in the variant attributes for the selection field where the default values should remain unchanged

    - try choosing a dynamic date calculation for the field, e.g. "current period"

    Thomas

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi ACC10583516 ;

      if you cant use variant in background process, You can use bellow code in your program.

      SELECT-OPTIONS : S_DATE FOR MKPF-BLDAT.
      
      INITIALIZATION.
        concatenate SY-DATUM+0(4) SY-DATUM+4(2) '01' into S_DATE-LOW.
        S_DATE-HIGH = SY-DATUM.
        APPEND S_DATE.
      

      Best regards.

  • author's profile photo Former Member
    Former Member
    Posted on May 23, 2011 at 10:10 AM

    Hi,

    You can call your report like this

    SUBMIT report_name AND RETURN

    WITH p_dats = your value

    USER v_user

    VIA JOB v_jobname

    NUMBER v_jobcnt

    USING SELECTION-SET v_variant.

    where v_variant is a dummy variant.

    Do your date calculations in the program and pass them as parameter while submitting the job.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 23, 2011 at 01:43 PM

    You must use a variant (else system will create and use a variant with a name &0000000000001....) When recording your variant, go to "Variant Attributes" there you can check the "Save field without values" box and/or select a "Selection variable" and then a "Name of variable" value. If you check the "Save field without values" box, then fill the value in the [INITIALIZATION|http://help.sap.com/abapdocu_70/en/ABAPINITIALIZATION.htm] part of your report. (Check [Variant Attributes|http://help.sap.com/saphelp_NW70EHP1core/helpdata/en/c0/98038ce58611d194cc00a0c94260a5/content.htm])

    Some remarks,

    1-Could you select from constants 01.05.2011 to 31.12.9999 (ddmmyyyy) as no order should have a creation in the future (if it is a system creation date and not a user-input one) ?

    2-In some months or years the selection will be very large, no ?

    Regards,

    Raymond

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 23, 2011 at 02:21 PM

    1. Is it necessary to run a report with varaint in background?

    No, not at all. But since you declared a selection screen, it is required as Thomas and Raymond have already told you. Since you are hardcoding everything you could easily remove the selection-screen, but then of course you'd lose control/flexibility. You can also use TVARVC in addition to what Thomas & Raymond suggested.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Brad Bohn wrote:

      1. Is it necessary to run a report with varaint in background?

      No, not at all. But since you declared a selection screen, it is required as Thomas and Raymond have already told you. Since you are hardcoding everything you could easily remove the selection-screen, but then of course you'd lose control/flexibility. You can also use TVARVC in addition to what Thomas & Raymond suggested.

      I would like to confirm that a variant is NOT mandatory for background processing.

      When you define a background job (T-code : SM36), you can just leave the "variant" field blank. If your report contains a selection screen, you can leave the "variant" field blank. If your report contains NO selection screen, you can leave the "variant" field blank, too.

      I tested both scenarios in SAP, and SAP triggered my background job on time. My version is SAP ECC 6.0, (SAP_ABA is release 700 update 12 and SAP_BASIS is release 700 update 25).

Before answering

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

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