Running report in background using parameters

Hi friends,
i have an abap report that needs to run in background because it runs longer than profile timeout parameter allows to. now my question is:
if this report uses dynpro with parameters, how do i have to modify it to run in background and to pass those parameters to ? ( SUBMIT ? ).
Thanks for your help!
Clemens

Hi,
DATA: seltab type table of rsparams,
      seltab_wa like line of seltab.
  seltab_wa-selname = 'PNPPERNR'.
  seltab_wa-sign    = 'I'.
  seltab_wa-option  = 'EQ'.
load each personnel number accessed from the structure into
parameters to be used in the report
  loop at pnppernr.
    seltab_wa-low = pnppernr-low.
    append seltab_wa to seltab.
  endloop.
  SUBMIT zreport with selection-table seltab
                                via selection-screen.
Reward points if useful....

Similar Messages

  • Run report in background using transaction launcher

    Hi ,
    I need to run my zreport using transaction launcher in background....
    anybody please help.
    Ruchi

    Hello
    I agree with Andrei. Transaction Launcher is intended for front office operations with agents, not for basis tasks which must be performed by consultants with SAPGui access.
    Anyway, you can launch your transaction and try to see if it works with background processing, but that is not what transaction launcher is intended for.
    Regards
    Joaquin

  • Running reports in background?

    hi,
    is it possible to run reports in background? i'm trying to find a way where in i can run / submit a process/procedure/report then go back to it after its done. this will help me allow do some other things while waiting for a report to finish.
    has anyone done this?
    thanks
    allen

    I didn't read the full article you linked to Tony, but you can just use one of the functions available in the apex_util package. (apex_util.get_print_document) - which returns the report into a blob variable.
    See: http://download.oracle.com/docs/cd/E17556_01/doc/apirefs.40/e15519/apex_util.htm#CHDDECIA
    Ta,
    Trent

  • How to run report from form using run_object_report

    I AM USNING FORMS9I/REPORTS 9I , HOW TO RUN REPORT FROM FROM USING RUN_REPORT_OBJECT AND HOW
    TO PASS PARAMETER AS WE DID IN RUN_REPORTS PLEASE HELP ME

    here an example !
    I hope this example you can use it
    PROCEDURE pr_reporte IS
    BEGIN
    DECLARE
         repid REPORT_OBJECT;
    v_rep VARCHAR2(100);
    rep_status Varchar2(20);
    d1 DATE;
    d2 DATE;
    BEGIN
         d1 := :GLOBAL.DIA_INI;
         d2 := :GLOBAL.DIA_FIN;
         repid := find_report_object('rep_lab02');
         SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER,'p_fec_uno='||to_char((add_months(last_day(d1),-1) +1),'DD/MM/YYYY')||' '||
         'p_fec_dos='||to_char(d2,'DD/MM/YYYY'));
         SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'pdf');
         v_rep := RUN_REPORT_OBJECT(repid);
         rep_status := report_object_status(v_rep);
         WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED') LOOP
              rep_status := report_object_status(v_rep);
         END LOOP;
         IF rep_status = 'FINISHED' then
              WEB.SHOW_DOCUMENT('/reports/rwservlet/getjobid'||substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server=repserver','_blank');
         ELSE
              ventana('E','error reporte no encontrado','S');
         END IF;
    END;
    END;
    The 'rep_lab02' is the name of the report that you give in the node reports
    p_fec_uno and p_fec_dos they are the parameters in the report
    repserver is the name of server created with rwserver
    Greetings

  • Run report on background and save to file

    Hi all,
    I have a development suite 10g.
    I have created simple paper report with one parameter.
    And I want to run this report on background from forms and get it
    saved to file (PDF or RTF). The parameter for report should be passed from
    my form.
    Thanks for any suggestions.
    Brano.

    Hi,
    I use the following progam unit to generate a pdf file:
    if RUN_PRODUCT does not work on 10g check out the built-in RUN_REPORT_OBJECT.
    PROCEDURE create_pdf_report IS
    l_pl_id ParamList;
    v_report_from_date date;
    v_report_to_date date;
    /* PDF file name */
    v_file_name varchar2(150);
    /* network location where to save the pdf file*/
    v_output_path varchar2(100):= :control.report_dir;
    begin
    v_report_from_date := :control.from_date;
    v_report_to_date := :control.to_date;
    v_file_name := v_output_path||'\your_pdf_filename.pdf';
    L_pl_id := Get_Parameter_List ('REPORT_PARAMS');
    If Not ID_NULL (l_pl_id) then
    Destroy_Parameter_List (l_pl_id);
    End if;
    L_pl_Id := Create_Parameter_List ('REPORT_PARAMS');
    /* Parameters to send output to pdf file*/      
    Add_Parameter(L_pl_id, 'DESTYPE' ,TEXT_PARAMETER, 'FILE');
    Add_Parameter(L_pl_id, 'DESFORMAT' ,TEXT_PARAMETER, 'PDF');
    Add_Parameter(L_pl_id, 'DESNAME' ,TEXT_PARAMETER, v_file_name);
    Add_Parameter(L_pl_id, 'PARAMFORM' ,TEXT_PARAMETER, 'NO');
    Add_Parameter(L_pl_id, 'BACKGROUND' ,TEXT_PARAMETER, 'YES');
    /* Addtional data parameters */
    Add_Parameter(L_pl_id, 'P_other_param' ,TEXT_PARAMETER, :CONTROL.MY_ITEM);
    Add_Parameter(L_pl_id, 'P_FROM_DATE' ,TEXT_PARAMETER, to_char(v_report_from_date,'DD-MON-YYYY') );
    Add_Parameter(L_pl_id, 'P_TO_DATE' ,TEXT_PARAMETER, to_char(v_report_to_date,'DD-MON-YYYY') );
    -- call the report synchronously
    Run_Product(REPORTS
    ,'YOUR_REPORT_NAME'
    ,SYNCHRONOUS
    ,RUNTIME
    ,FILESYSTEM
    ,L_pl_id
    ,NULL
    exception
    when others then
    message('Error running report. '||sqlerrm, acknowledge);
    end;
    Regards,
    Hugo

  • Running report in background

    Hi,
    1.  I am running a report in background, while running if system encounters any error then i want to download this error log to the presentation server, is there any function module to do this if not please suggest another possible solution to download the error log to presentation server.
    2. In the above scenario when we are running a program in background, is it necessary to save the error log file on application server or we can download the error log directly to presentation server.
    please suggest the possible solutions.
    Regards,
    Amol

    Hi,
    While running your program in backgorund mode genrally you can not download any data to prsentation server
    there r 2 ways you can solve your problem.
    1. Populate the error log and upload it to application server file Download the error log file from the appplication server by Using the command CG3Y.
    2. Populate the error log and display it, doing so will create a spool when executed in backgoround now you can go to spool display it and download it to your local system.
    These are the simplest ways to do it.
    But if you still want your system to transfer error log to local system at the time it is executing in background you can do it by configuring RFC destination in SM59 detail documentation for RFC configuration can be found in the SDN.
    Hope this helps.
    Regards
    Bikas

  • Report in  background using cl_gui_frontend_services= gui_download Method

    Hello all,
    I'm trying to run a report that uses the method cl_gui_frontend_services=>gui_download in background mode, to export data from an internal table to a xml file.
    In foreground everything works fine, but when I try to run the report in background the execution stops when the method is called. Does anyone know how to avoid this problem and run the report in background mode?
    Thanks in advance,
    Nuno A.

    Hi,
    For background processing you need to use syntax
    OPEN DATASET
    ld_file = p_infile.
    OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-subrc NE 0.
    ELSE.
      DO.
        CLEAR: wa_string, wa_uploadtxt.
        READ DATASET ld_file INTO wa_string.
        IF sy-subrc NE 0.
          EXIT.
        ELSE.
          SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
                                          wa_uploadtxt-name2
                                          wa_uploadtxt-age.
          MOVE-CORRESPONDING wa_uploadtxt TO wa_upload.
          APPEND wa_upload TO it_record.
        ENDIF.
      ENDDO.
      CLOSE DATASET ld_file.
    ENDIF.
    aRs

  • Not able to Submit CJI5 report in background using Variant

    Hi Experts,
    Is it possible to fill the multiple screens through FM rs_create_variant.
    Reagrds,
    Nava

    Hi Ramesh,
    I am trying to submit the CJI5 report in back ground through variant. The varaint was created using FM RS_CREATE_VARIANT. it's throughing an error .
    IF I create variant directly via selectin screen then it's working fine.
    FYI.
    REPORT z_co99_cji5
           NO STANDARD PAGE HEADING
           MESSAGE-ID 00
           LINE-SIZE 290.
    PROGRAM      : Z_CO99_CJI5                                           *
    TITLE        : CJI5 In Background                                    *
    AUTHOR.      : Raja Nesanoor                                         *
    DATE WRITTEN : 27-Feb_2007                                           *
    REVTRAC      : xxxxxx                                                *
    PROGRAM FUNCTION:                                                    *
    To DISPLAY CJI5 Report in background                                 *
    PROGRAM TYPE : Executable  program                                   *
    DEV. CLASS   : XXXXXX                                                *
    LOGICAL DB   : NA                                                    *
    AUHTORIZATION CHECKS                                                 *
    Object           Authorization Fields             ABAP Fields        *
    S_TCODE                                                              *
                        BUKRS                          v_BUKRS           *
    CHANGE HISTORY                                                       *
    Date         Id        Name      Indicator   Description             *
    DATA : v_repid LIKE sy-repid VALUE 'ZRKPEP005' ,
    v_variant LIKE varid-variant VALUE 'V_CJI5' .
    DATA: BEGIN OF w_varid.
            INCLUDE STRUCTURE varid.
    DATA: END OF w_varid.
    DATA: BEGIN OF i_rsparams OCCURS 10.
            INCLUDE STRUCTURE rsparams.
    DATA: END OF i_rsparams.
    DATA: BEGIN OF i_rsparams1 OCCURS 10.
            INCLUDE STRUCTURE rsparams.
    DATA: END OF i_rsparams1.
    DATA: BEGIN OF i_varit OCCURS 2.
            INCLUDE STRUCTURE varit.
    DATA: END OF i_varit.
    DATA: BEGIN OF i_vscreens OCCURS 2.
            INCLUDE STRUCTURE rsdynnr.
    DATA: END OF i_vscreens.
    start-of-Selection
    START-OF-SELECTION.
      SET PARAMETER ID 'CAC' FIELD 'GC10'.
      SET PARAMETER ID 'PDB' FIELD '000000000001'.
      PERFORM populate_var_table.
      PERFORM create_variant.
      PERFORM submit_cji5.
    *& Form POPULATE_VAR_TABLE
    text
    --> p1 text
    <-- p2 text
    FORM populate_var_table .
      CLEAR w_varid .
      REFRESH i_varit .
      REFRESH i_rsparams .
      i_rsparams-selname = 'CN_NETNR'.
      i_rsparams-kind = 'S'.
      i_rsparams-sign = 'I'.
      i_rsparams-option = 'EQ'.
      i_rsparams-low = '90273536'.
      i_rsparams-high = space.
      APPEND i_rsparams.
      CLEAR : i_rsparams .
      i_rsparams-selname = 'CN_NETNR'.
      i_rsparams-kind = 'S'.
      i_rsparams-sign = 'I'.
      i_rsparams-option = 'EQ'.
      i_rsparams-low = '90274010'.
      i_rsparams-high = space.
      APPEND i_rsparams.
      CLEAR : i_rsparams .
      i_rsparams-selname = 'R_OBDAT'.
      i_rsparams-kind = 'S'.
      i_rsparams-sign = 'I'.
      i_rsparams-option = 'BT'.
      i_rsparams-low = space .
      i_rsparams-high = space.
      APPEND i_rsparams.
      CLEAR : i_rsparams .
      i_rsparams-selname = 'P_DISVAR'.
      i_rsparams-kind = 'P'.
      i_rsparams-sign = 'I'.
      i_rsparams-option = 'EQ'.
      i_rsparams-low = '1SAP' .
      APPEND i_rsparams.
      CLEAR : i_rsparams .
      i_rsparams-selname = 'P_USEDB'.
      i_rsparams-kind = 'P'.
      i_rsparams-sign = 'I'.
      i_rsparams-option = 'EQ'.
      i_rsparams-low = SPACE.
      APPEND i_rsparams.
      w_varid-mandt = sy-mandt.
      w_varid-report = v_repid.
      w_varid-variant = v_variant.
      w_varid-flag1 = space.
      w_varid-flag2 = space.
      w_varid-transport = space.
      w_varid-environmnt = 'A'. "Variant for batch and online
      w_varid-protected = space.
      w_varid-secu = space.
      w_varid-version = '0'.
      w_varid-ename = sy-uname.
      w_varid-edat = sy-datum.
      w_varid-etime = sy-uzeit.
      w_varid-aename = space.
      w_varid-aedat = space.
      w_varid-aetime = space.
      w_varid-mlangu = sy-langu.
      i_varit-mandt = sy-mandt.
      i_varit-langu = sy-langu.
      i_varit-report = w_varid-report.
      i_varit-variant = w_varid-variant.
      i_varit-vtext = 'CO99-OUTPUT'.
      APPEND i_varit.
    ENDFORM. " POPULATE_VAR_TABLE
    *& Form CREATE_VARIANT
    text
    --> p1 text
    <-- p2 text
    FORM create_variant .
    data: h_rc like sy-subrc.
    *Check variant exists.
      CALL FUNCTION 'RS_VARIANT_EXISTS'
           EXPORTING
                report              = v_repid
                variant             = v_variant
           IMPORTING
                R_C                 = h_rc
             EXCEPTIONS
                not_authorized      = 01
                no_report           = 02
                report_not_existent = 03
                report_not_supplied = 04.
      IF h_rc = 0.
        CALL FUNCTION 'RS_CHANGE_CREATED_VARIANT'
             EXPORTING
                  curr_report               = v_repid
                  curr_variant              = v_variant
                  vari_desc                 = w_varid
             TABLES
                  vari_contents             = i_rsparams
                  vari_text                 = i_varit
             EXCEPTIONS
                  illegal_report_or_variant = 01
                  illegal_variantname       = 02
                  not_authorized            = 03
                  not_executed              = 04
                  report_not_existent       = 05
                  report_not_supplied       = 06
                  variant_doesnt_exist      = 07
                  variant_locked            = 08
                  selections_no_match       = 09.
        COMMIT WORK.
      ELSE.
        CALL FUNCTION 'RS_CREATE_VARIANT'
             EXPORTING
                  curr_report               = v_repid
                  curr_variant              = v_variant
                  vari_desc                 = w_varid
             TABLES
                  vari_contents             = i_rsparams
                  vari_text                 = i_varit
             EXCEPTIONS
                  illegal_report_or_variant = 1
                  illegal_variantname       = 2
                  not_authorized            = 3
                  not_executed              = 4
                  report_not_existent       = 5
                  report_not_supplied       = 6
                  variant_exists            = 7
                  variant_locked            = 8
                  OTHERS                    = 9.
        COMMIT WORK.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ENDIF.
    ENDFORM. " CREATE_VARIANT
    *& Form submit_cji5
    text
    --> p1 text
    <-- p2 text
    FORM submit_cji5 .
      CALL FUNCTION 'SUBST_START_REPORT_IN_BATCH'
           EXPORTING
                iv_jobname                    = 'TEST_JOB'
                iv_repname                    = v_repid
                iv_varname                    = v_variant
                iv_authcknam                  = sy-uname
                iv_language                   = sy-langu
                iv_varianttext                = 'CO99-OUTPUT'
           TABLES
                tt_reportparam                = i_rsparams
           EXCEPTIONS
                variant_exist_check_failed    = 1
                variant_update_failed         = 2
                variant_update_not_authorized = 3
                variant_update_no_report      = 4
                variant_update_no_variant     = 5
                variant_update_variant_locked = 6
                variant_insert_failed         = 7
                variant_insert_not_authorized = 8
                variant_insert_no_report      = 9
                variant_insert_variant_exists = 10
                variant_insert_variant_locked = 11
                variant_write_failed          = 12
                no_batch_service              = 13
                no_server_list                = 14
                batch_scheduling_failed       = 15
                OTHERS                        = 16.
      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.
    Thanks
    Nava

  • Export and save a Crystal Report in PDF using parameters

    Hi @all!
    Is it possible to suppress the output of an Crystal Report in a window using parameters? Instead of that I want to save the pdf in a specified folder without using the publication-function.
    Fot the parameter I use these link:
    [http://devlibrary.businessobjects.com/businessobjectsxir2/en/en/boe_sdk/boesdk_dotnet_doc/doc/boesdk_net_doc/html/Report_Linking13.html]
    Best regards,
    Dirk

    Hi,
    this is the forum for the SAP Integration Kit. I would suggest you post your question into the Crystal Reports forum.
    the answer - yes you can use OpenDocument to show the report right away as PDF.
    Ingo

  • Run Report Object and Lexical Parameters

    Hi all,
    I am trying to pass a value for a lexical parameter in a report. The report query is as follows:
    SELECT EMP.EMPNO, EMP.ENAME,
    EMP.JOB, EMP.MGR, EMP.HIREDATE, EMP.SAL, EMP.COMM, EMP.DEPTNO
    FROM EMP
    &Where_St
    The Where_St is a lexical parameter which will hold the Where Statement the end user need it to be executed.
    I build a form on the EMP table in order to let the user get benefit from the Enter Query/Execute Query functionality in forms. Like this, he/she can query the data he likes with the condtions he wish to have.
    I created a button to call the report I did before from the form
    The Button has the following code in the trigger
    WHEN-BUTTON-PRESSED
    declare
    rep_id report_object;
    rep_status varchar2(30);
    Where_Pos number(3);
    Where_Statement varchar2(200);
    begin
    Where_Pos := InStr(:System.Last_Query, 'WHERE');
    if Where_Pos > 0 then
    Where_Statement := SubStr(:System.Last_Query,
    Where_Pos);
    end if;
    rep_id := Find_Report_Object('emp_rep');
    Set_Report_Object_Property(rep_id, REPORT_EXECUTION_MODE, RUNTIME);
    Set_Report_Object_Property(rep_id, REPORT_COMM_MODE, ASYNCHRONOUS);
    Set_Report_Object_Property(rep_id, REPORT_DESTYPE, PREVIEW);
    Set_Report_Object_Property(rep_id, REPORT_OTHER, 'MAXIMIZE=YES Where_St=' &#0124; &#0124; Where_Statement);
    rep_status := Run_Report_Object(rep_id);
    end;
    Whenever I run the report it did not show up at all. I doubt the value I am passing, so I deleted the line that pass the value for the Lexical parameter to the report. The report worked just fine.
    Moreover, I passed this value using Run_Product to the reports and the report is working fine with the forms. But I would like to use Run_Report_Object to pass this value to the reports.
    Any ideas??
    Thanks

    PROCEDURE PROC_test IS
    repid REPORT_OBJECT;
    v_rep VARCHAR2(100);
    rep_status VARCHAR2(100);
    v_server_length NUMBER;
    REP_SERV VARCHAR2(100);
    paramlist_id ParamList;
    paramlist_name VARCHAR2(10):='tmplist';
    Begin
    repid := find_report_object('HIST_DISPENSE');
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_EXECUTION_MODE,RUNTIME);
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_COMM_MODE,SYNCHRONOUS);
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESTYPE,CACHE);
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'HTML');
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_SERVER,'REP_ORACLEWEB');
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER,'paramform=no R_ST_DT='||:BLK_A_NUM_GT7_NO_HIS_DISP.FROM_DATE 'paramform=no R_END_DT='||:BLK_A_NUM_GT7_NO_HIS_DISP.TODATE);
    v_rep := RUN_REPORT_OBJECT(repid,paramlist_id);
    message('vrep is '||v_rep);
    rep_status := REPORT_OBJECT_STATUS(v_rep);
    message('status is'||rep_status);
    v_server_length := LENGTH(GET_REPORT_OBJECT_PROPERTY(repid,REPORT_SERVER));
    message('server length is '||v_server_length );
    WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')
    LOOP
    rep_status := report_object_status(v_rep);
    message('REP STATUS IS'||rep_status);
    END LOOP;
    IF rep_status = 'FINISHED' THEN
    /*Display report in the browser*/
    WEB.SHOW_DOCUMENT('http://10.20.56.20:7778/reports/rwservlet/getjobid'||
    substr(v_rep,v_server_length + 2)||'?'||'server=REP_ORACLEWEB','_blank');
    ELSE
    message('Error when running report');
    message('SQLERRM ' ||SQLERRM);
    END IF;
    end;
    Hi
    I'm having problem passing two paramters, Pl helpme by correcting the syntax.
    Thx

  • Export Jasper Report Through JSP(using parameters)

    Hi All ;
    Please I need A help ;
    I need to use a Jasper Report in my jsp pages using parameters ;
    can some one tell me how i can do it by steps & with example ;
    note that i use Oracle Data Base;
    Regards;

    I would start off reading a JasperReports tutorial.
    Here is a list of all JasperReports tutorials available on the world wide web:
    http://www.google.com/search?q=jasperreports+tutorial

  • Running report in background getting runtime error.

    Hi,
    I am getting run time error , when I execute the report in background .
    When I debug it I am getting error - when it is executing
    CALL METHOD cl_ppegihdr_cntl=>exppe_read .
    In ST22 I get error on "
    SET HANDLER event_rec_tool_at1->on_function_selected FOR
      mr_toolbar_at1."
    ABAP Runtime error is
    SET_HANDLER_FOR_NULL
    Thanks and regards ,
    Rohit.

    Hi,
    Are you getting this error in foreground? What is the subrc?
    Please can you post a screenshot, or more detail on the runtime error.
    In the meanwhile here is the help docu for this which may help you, http://help.sap.com/abapdocu_70/en/ABAPSET_HANDLER.htm

  • Running the ALV report in Background using layout variant

    Hello Everyone,
    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.
    Can anybody give me a optimized solution for this issue.
    Regards,
    Vasanth

    Hi,
    How are you downloading the file to the app server, using which internal table? How are you building that internal table?
    What you need to do is to build a internal table dynamically with only those columns that are a part of the layout variant. Then move the data from the original internal table into this and then download the dynamica internal table to the app server.
    Regards,
    Ravi
    Note : Please mark the helpful answers

  • Dump while running report in background

    Hi Experts,
    I have created one report to create the conditions record by using BDC. The program is uploading the data from file which is located at local server and at selection screen, path of file is defined.
    When i run the report in foreground it works fine, first it uploaded that data and then created BDC and record saved successfully.  But if i run the program in background and check the job status through SM37 , job get canceled due to the dump. The dump message is "Exception condition "NO_BATCH" raised."
    The FM which i am using currently in my code to upload the data is "GUI_UPLOAD", i tried the same thing with FM "ALSM_EXCEL_TO_INTERNAL_TABLE" as well, but same dump is coming.
    Please advice if anyone have some solution.
    Thanks & Regards,
    Swati

    Hi,
    The FM GUI_UPLOAD, wont work in the background jobs. This is the reason for the dump.
    As the backround job runs at the application server, the program cannot identidy the presentation server (local system) file path.
    To avoid this store and read file from application server.
    Thanks & Regards,
    Navneeth K.

  • Run report in background

    I have a report that run in background.Now my aim is to save the data in excel on my desktop.
    Please guide me how to do so.I have used this function module
    SAP_CONVERT_TO_XLS_FORMAT
    and many more but still i'm not able to save data in excel.

    You cannnot use any of these function modules in Background. There is no easy way of interacting with the presentation server in backgorund, Instead you could do background processing and store the file in app server and then transfer it from app server to presentation server.
    This is one of the complicated way to do it:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9831750a-0801-0010-1d9e-f8c64efb2bd2

Maybe you are looking for