How to pass layout variant in background job?

Dear Gurus,
I have set layout variant as PARAMETERS in my program.
The report will be executed successfully in front-end, but if I set it in background , it will pop up error msg: Program (IS_VARIANT-REPORT) not specified.
But the alv function I have check...
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_BYPASSING_BUFFER       = 'X'
      I_CALLBACK_PROGRAM       = W_REPID
      I_GRID_TITLE             = V_GRID_TITLE
      I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
*      I_CALLBACK_USER_COMMAND  = 'FORM_USER_COMMAND'
*      I_STRUCTURE_NAME         = 'ZSDS0005'
      I_SAVE                   = 'A'
      IS_LAYOUT                = I_LAYOUT
*      IS_VARIANT               = STRU_DISVAR
      IS_VARIANT               = DEF_VARIANTE_F4
      IT_FIELDCAT              = I_FIELDCAT_ALV[]
      IT_SORT                  = XT_SORT[]
    TABLES
      T_OUTTAB                 = IT_OUT
    EXCEPTIONS
      PROGRAM_ERROR            = 1
      OTHERS                   = 2
Jamie

Thank you so much, but the sample code have one bug, and  I have already modified the code.
The variant will be caught only after clicking F4 list, if there's already one default variant, system will ignore it.
AT SELECTION-SCREEN.
*  Validating selection screen fields
  PERFORM F_AT_SELECTION_SCREEN.
*&      Form  f_at_selection_screen
*       text
*  -->  p1        text
*  <--  p2        text
FORM F_AT_SELECTION_SCREEN .
* ALV Layout variant
  IF NOT P_VARI IS INITIAL.
    MOVE GX_VARIANT TO G_VARIANT.
    MOVE P_VARI          TO G_VARIANT-VARIANT.
    CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
      EXPORTING
        I_SAVE     = 'A'
      CHANGING
        CS_VARIANT = G_VARIANT.
    GX_VARIANT = G_VARIANT.
  ELSE.
    PERFORM F_INITIALIZE_VARIANT.
  ENDIF.
ENDFORM.                    " f_at_selection_screen
*&      Form  f_initialize_variant
*       text
*  -->  p1        text
*  <--  p2        text
FORM F_INITIALIZE_VARIANT .
*  CLEAR DEF_VARIANTE_F4.
*  gv_save           = 'X'.
  GX_VARIANT-REPORT = SY-REPID.
*  DEF_VARIANTE      = DEF_VARIANTE_F4.
  CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
      I_SAVE     = G_SAVE
    CHANGING
      CS_VARIANT = GX_VARIANT
    EXCEPTIONS
      NOT_FOUND  = 2.
  IF SY-SUBRC = 0.
    P_VARI = GX_VARIANT-VARIANT.
  ENDIF.
ENDFORM.                    " f_initialize_variant

Similar Messages

  • Download alv report using layout variant in background

    Hi All,
    I want to download an Alv report using layout varaint in background job.
    can any one please help me.
    i.e...
    I am facing a problem in downloading a text file to the Application server.
    My requirement is, when the user downloads a file with the layout variant, the file should have only the columns which was selected in the variant.
    Will rewards to helpfull ans
    regards
    Chetan

    hey seshu,
    I am facing a problem in downloading a text file to the Application server.
    My requirement is, when the user downloads a file with the layout variant, the file should have only the columns which was selected in the variant.

  • How to find process chain using background job in sm37

    How to find process chain using background job in sm37

    Better is to select the job.
    Select (Define) Step (s) or F6.
    Select the line and Menu Goto>Variant.
    The variant contains the name of the CHAIN and its VARIANT.
    Success
    We faced an old job and via job monitoring we were informed about a cancelled job every 'interval'.
    We noticed that the related chain was deleted but still the job was scheduled each interval again and was cancelled because an event was missing
    We could not find the scheduled job via SM37.
    Via view V_OP, view over tbtco abd tbtcp, we find the related entry.
    We delete these entries via function BP_JOB_DELETE....
    Edited by: Jack Otten on Jul 9, 2010 2:50 PM

  • Regarding Variants for Background jobs

    Hi Folks
    Can you please let me know the procedure how we can create the variants for Background jobs.
    Points are assured for correct answers.
    Regards,
    kumar

    Hi Sree Ram,
    Check this info.
    If you have any selection screen parameters for your program you need to enter the values for those fields in runtime. So, if you schedule your program in background to execute then there is no one to do this job. Here comes the concept of Variant.
    With variant you define what are the selection field values in the runtime. During runtime the program picks this values and runs the program.
    When you execute your program which has selection fields, you enter the values and then you click on 'GO TO ' tab and 'SAVE AS VARIANT'.
    When you schedule your program in background, give this variant also. Then it will run automatically.
    Hope this resolves your query.
    Reward all the helpful answers.
    Regards

  • Performace tuning: how to pass data between different batch job programs?

    Hi everyone,
        now i have one problem about performance tuning using threading in SAP programs: split one big program into two programs - one is main program and the other is sub program. using batch jobs, we can submit multi jobs of sub program at the same time.
        does anybody know how to pass data between different batch jobs? I don't want to use temp files. can ABAP memory can implement this?
        thanks!

    Wei,
    Yes we can transfer the data by using
    SAP Memory OR ABAP Memory.
    Ex:  V_count TYPE i.
      V_count = 100.
    LOOP AT  itab.
    IF v_count EQ 25.
    Here For every batch job
      EXPORT data TO MEMORY ID 'ABC'
       Function module
        JOB_OPEN
       JOB_SUBMIT
       JOB_CLOSE.
      ENDIF.
    ENDLOOP .
    IN your 2nd program.
    INITIALIZATION.
    IMPORT data FROM MEMORY IF 'ABC'.
    FREE memory if .---When you free the memory you will get recent data.
    Don't forget to reward if useful.

  • SAP threading-how to pass data between different batch job programs?

    Hi everyone,
        now i have one problem about performance tuning using threading in SAP programs: split one big program into two programs - one is main program and the other is sub program. using batch jobs, we can submit multi jobs of sub program at the same time.
        does anybody know how to pass data between different batch jobs? I don't want to use temp files. can ABAP memory can implement this?
        thanks!

    Passing Data Between Programs
    [http://help.sap.com/saphelp_47x200/helpdata/en/9f/db9df735c111d1829f0000e829fbfe/frameset.htm|http://help.sap.com/saphelp_47x200/helpdata/en/9f/db9df735c111d1829f0000e829fbfe/frameset.htm]

  • How to delete variant form background job

    Hi,
    I have one background job with 5 variants associated with iy.
    Now i want to remove 2 variant from that background job.
    is it posible???
    if yes then how to do that?
    Thanks,

    Hi.
    Go to SM37, execute report to see it, click on modify, and change steps.
    If you have problems, delete job, and create a new one.
    Best regards.
    Valter Oliveira.

  • Report layout - ME2N - Automatic background job

    HI all
    We are using the above report for Pending PO-RElease ie., dynamic selection - release indicator "B"  thru automatic background programme schedueld thru SM36 (after setting the variant) for the relevant/concerned users.
    The issue is, the report layout be default standard sap layout is taking, actually i have saved layout as PO no & date, but always, whenever background job is run, default sap report is taken in HTML.
    request kindly help how i can ensure my our report layout for backgrounds jobs thru ME2N or is there any other report which can give the pending PO-Release report for my requirement.
    thanks in advance
    regards
    srihari

    I am doing same as suggested by you for all other reports, but i am not successful with ME2N, because after having your own default layout, but for background it is default taking sap report. even i have tried to delete the sap - std report format but not allowed.
    if any one knows how to change the sap-default std report layout then also it's okay for us, as default report as 15 columns whereas we need only max 5 columns in report layout
    thanx in advance
    regards
    srihari

  • How to select server in which background job should run

    Hi,
    I want to run my program as background job. I want the user to select the server, in which background job should be run, in the selection screen of my program. When it is sheduled in background the job should run in the selected server.
    How to do this?
    Regards,
    Sriram

    Hi,
    please write the code like as below.
    DATA : D_GROUP like TBTCJOB-JOBGROUP.
    use the function moulde JOB_OPEN.
      D_JOBNAME = SY-REPID.
      D_GROUP- BTCSYSREAX =  " pass the target server name Here
         CALL FUNCTION 'JOB_OPEN'
            EXPORTING
                 JOBNAME          = D_JOBNAME
                 JOBGROUP       =  D_GROUP
            IMPORTING
                 JOBCOUNT         = D_JOBNO
            EXCEPTIONS
                 CANT_CREATE_JOB  = 1
                 INVALID_JOB_DATA = 2
                 JOBNAME_MISSING  = 3
                 OTHERS           = 4.
    submit   <Program name>
                  USER SY-UNAME VIA JOB D_JOBNAME NUMBER D_JOBNO
                  USING SELECTION-SET '  var1 '   " Give varient name
                  AND RETURN.
    CALL FUNCTION 'JOB_CLOSE'
               EXPORTING
                    JOBCOUNT             = D_JOBNO
                    JOBNAME              = D_JOBNAME
                    STRTIMMED            = 'X'
               IMPORTING
                   JOB_WAS_RELEASED     = D_REL
               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.
    Hope this will helps you
    Regards
    Kiran

  • How to fill selection screen in background job

    Hi experts,
    I use FM BP_JOB_CREATE to create background job. This job is program with one parameter on selection screen - production order number.
    This job is created when production order is saved.
    How can I fill production order number on selection screen? Do I need to create variant for every production order number?
    Thanks&regards,
    Jirka

    To create variants you can use !
    RS_CREATE_VARIANT
    You can also use
    JOB_OPEN
    JOB_SUBMIT
    JOB_CLOSE.
    to create a job.
    Regards,
    Lalit Mohan Gupta.

  • How to Execute WebDynpro Applications as Background Job ?

    Hi Gurus,
    We have developed a lot of WDJ applications with component reusage; ie,
    quite a lot of business logic are wrapped in WDJ Components which are
    re-used by other WD UIs.
    Now we'd like to automate some of the processes with background jobs
    and faced with a few problems :
    #1. How can we write a background WD application which can be
    triggered by external mechanism and without presenting any UI?
    #2. If we write the background program in a Java DC, how can we
    invoke existing methods in WD components ?
    Anyone got a clue ??
    Ying-Jie Chen

    Hello Amit,
    > Well I can think of a workaround in this case.If you are aware
    > of the suspend-resume functionality of the WD application then
    > its possible to run the WD application virtually in background.
    [ stuffs deleted ...]
    It sounds like a possible alternative to our requirement, I'll
    spend some time to investigate on the WD suspend-resume mechanism !
    > Also let me know why are you preffering the WD if you dont
    > require its UI
    Our application requires the process to be performed with UI interaction;
    with some instances it should be run as a background job. Either case involves
    RFC calls to backend SAP R/3 and it's easy for RFC access with WD
    Component.  Though it's also possible to use CAF application service for
    RFC access; due to some technical constrains, we did not use CAF
    framework. Therefore it ends up where we are now ...
    Thanks for your tip!
    Ying-Jie Chen

  • How to submit the report in Background job.

    Hello Friends,
    In the selection screen I have 2 radio buttons one for background Process & other for foreground processing. if the user selects the background processing the program should execute in background and output need to be sent to SAP Inbox.
    Issues:
    1) If I am using the JOB_Submit FM or Report Submit the program is going to infinite loop and many continiously jobs are are being scheduled. How to avoid.
    2) Is there any best possible way to send the mail to SAP Inbox.
    Note: I am using OOALV in my program....
    Thanks,
    Ravi

    Hi,
    the first problem looks like you have an infinite recursion. You just need to avoid background scheduling again. There is a system field sy-batch. So if this field is equal to 'X' then you are already in background mode and you don't need to schedule your background job again. Another way is to split your program in two programs. The first will be responsible for scheduling or executing the second one.
    You can use FM SO_NEW_DOCUMENT_SEND_API1 to send message to workflow inbox. You need to user receiver type B. There are so many posts on this forum about sending emails from ABAP which may help you with implementing this requirement.
    Cheers

  • How to run the program in background job,program should run in 3 days.

    Dear Gurus,
    i have a program , that program should run approximately 3 days to get the result.
    i scheduled this program as a background job.
    how can i run sto5 t-code for this same program.
    i that case how we can trace the output.
    Experts please help me out.
    Thank u very much.
    Regards
    sudheer

    Hello Sudheer,
    The trace can be set on background jobs by using ST12 transaction. Please make sure that the trace is activated for only few minutes in production environment.
    Contact your basis team to activate trace on background job and the transaction used is ST12.
    Thanks

  • Variants for background jobs

    You need to schedule and automate batch jobs in an organisation. There will be multiple variants and multiple steps within same batch jobs. The variants are date dependent and needs to change every day. You need to automatically change the variants every day and schedule the jobs. Also check for the failures in the jobs. Apart from that Once the jobs in one server example : R/3 server ends the jobs in BW servers should be triggered automatically. Explain all steps with proper T codes and also provide a dry run example. Also provide all the table used for the variants purpose.
    Please help on this,thanks
    Narendra

    Hi Narendra,
    The background jobs are scheduled depending on the requirement with specific variants which are both date specific and even specific sometimes. These variants are created for the programs or reports which are run in the background job ,These variants are stored in VARID table for client specific variants and
    VARID_CI for client independent. For most of the times all these jobs are maintained in some job scheduling tools so that they automatically inform about job failures and processes can be automated.In our organisation we use UC4 for background job schedulign and it controls the process as you are looking for.
    Please award points accordingly
    With Regards,
    Junaid
    Message was edited by:
            muhammed junaid

  • Passing data from a background job to RFC calls in different App server

    The program i am working on can be explained in the following steps:
    Step A- We use a standard program that is executed as a background job and the standard program obtains some data for a particular scenario.
    Step B - The job(standard program) during its execution creates many RFCs executed as dialog work processes on various application servers and processes data.In the RFCs various exits are executed.
    We currently write data to database(Z table) in Step A and retreive data in exits in Step B to access the information written to DB(Z table). We want to eliminate writing to database since it consumes time.
    Is there any solution apart from writing data to database and retreiving the same.
    I am not sure if we can use ABAP memory or SAP memory to access the information in the exits since they are executed on different App servers.

    We have not been able to arrive at a solution to the below, any solutions / inputs will be rewarded.

Maybe you are looking for

  • How do I submit PDF Form data as an XML file rather than as an XFDF file?

    Can anyone tell me what I need to do to make this statement work? var cSubLine = this.getField("SurnameInits").value; var cBody1 = "Main Instruction data file attached"; var cDest = this.getField("DestEmail").value; var cEmailURL = "mailto:" + cDest

  • Iphone only sending 10 second voice messages in apps?

    Hello, I have tried searching the internet of course; but only turned up a bunch of people having the same problem as me but no solution. I have an iphone 5s and for some reason when I use any App that allows me to send voice messages it stops record

  • How to save groupwise files

    well im going to get a new server pc and install my hard drive from my old server to the new one. i have been reading that if you put a HD from another computer with windows it will not start. so im was thinking how can i save all groupwise messages

  • Trying to compile HP / Emulex 10GbE Driver with OVM 2.2.2 SDK

    Hi I am trying to compile AN HP/EMULEX driver using the ovm 2.2.2 SDK. The driver seems to be included in OVM 3.0 by default. Card is not recognised in 2.2.2. I need a 2.2.2 driver to connect our older VM servers to a new 10GbE network. The diver is

  • Hi, my itune U and podcast videos disappeared after ios 6 upgrade. where can i find them?

    hi my itune U videos and podcast can no longer be viewed by "video" app after iOS 6 upgrade. they are there when i search for them. but just won't start. there is a new podcast app but i can't see my old podcast video from its library. does anyone kn