Submit in report in Background job.

Hi, In a report trasaction MCBE is submitted. When this report is executed in back ground there is no spool list generated but in job log a selection version ID is shown. As a result submit ....exporting list to memory is failing.
Is there any way to export the data during background execution of the report to ABAp memory??
Thanks, Kapil,

Hi,
use submit to spool
Refer to the code below
CALL FUNCTION 'JOB_OPEN'
    EXPORTING
      jobname          = v_jobname
    IMPORTING
      jobcount         = v_jobcount
    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.
Submit Report
  SUBMIT rkaep000   TO SAP-SPOOL
                    VIA
                    JOB         v_jobname              " JOBNAME
                    NUMBER      v_jobcount             " UNIQUE ID OF JOB
                    IMMEDIATELY ' '
                    WITHOUT SPOOL DYNPRO               "SKIP PRINT DIALOG SCREEN
                    USING SELECTION-SCREEN 0100
                    WITH p_tcode = 'KSB1'
                    WITH kostl IN s_kostl
                    WITH kstgr = p_ksgru
                    WITH kstar IN s_kstar
                    WITH koagr = p_kagru
                    WITH r_budat IN s_budat
                    WITH p_disvar = v_layout
                    AND RETURN.
  COMMIT WORK.
CLOSE THE JOB
  CALL FUNCTION 'JOB_CLOSE'
    EXPORTING
  AT_OPMODE                         = ' '
  AT_OPMODE_PERIODIC                = ' '
  CALENDAR_ID                       = ' '
  EVENT_ID                          = ' '
  EVENT_PARAM                       = ' '
  EVENT_PERIODIC                    = ' '
      jobcount                          = v_jobcount
      jobname                           = v_jobname
  LASTSTRTDT                        = NO_DATE
  LASTSTRTTM                        = NO_TIME
  PRDDAYS                           = 0
  PRDHOURS                          = 0
  PRDMINS                           = 0
  PRDMONTHS                         = 0
  PRDWEEKS                          = 0
  PREDJOB_CHECKSTAT                 = ' '
  PRED_JOBCOUNT                     = ' '
  PRED_JOBNAME                      = ' '
  SDLSTRTDT                         = NO_DATE
  SDLSTRTTM                         = NO_TIME
  STARTDATE_RESTRICTION             = BTC_PROCESS_ALWAYS
     strtimmed                         = 'X'
  TARGETSYSTEM                      = ' '
  START_ON_WORKDAY_NOT_BEFORE       = SY-DATUM
  START_ON_WORKDAY_NR               = 0
  WORKDAY_COUNT_DIRECTION           = 0
  RECIPIENT_OBJ                     =
  TARGETSERVER                      = ' '
  DONT_RELEASE                      = ' '
  TARGETGROUP                       = ' '
  DIRECT_START                      =
IMPORTING
  JOB_WAS_RELEASED                  =
CHANGING
  RET                               =
  EXCEPTIONS
   cant_start_immediate              = 1
   invalid_startdate                 = 2
   jobname_missing                   = 3
   job_close_failed                  = 4
   job_nosteps                       = 5
   job_notex                         = 6
   lock_failed                       = 7
   invalid_target                    = 8
   OTHERS                            = 9
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
regards
Pankaj

Similar Messages

  • 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

  • RE: Report for Background jobs

    Hi SAP Guru's,
    I need to create a report on Background Job status , please tell me is there any standard reports ? or How to create a report on Background Jobs Status?
    Thanks in Advance,
    Krishna.

    Dear Raja,
    In std report this is not possible, talk to ur ABAPer to fetch the feild PLNUM from AFPO table with respect to the AUFNR field. This can be added to the std report itself. use this logic it will work
    sree

  • 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

  • Setting layout to a report in background job

    Hi.
    Does anybody knows how I set layouts dynamically to a report output, given that such report is scheduled to run once a day in a background job?
    It would work for me, either: through SM36 or coding JOB_OPEN / JOB_SUBMIT / JOB_CLOSE (or any other option, if available).
    My requirement is to execute every night few reports, each with their corresponding variants and layouts.
    Something like:
    RUN <report1> VARIANT <variant1> LAYOUT <layout1> JOB <job>. (it would output and xls file).
    RUN <report2> VARIANT <variant2> LAYOUT <layout1> JOB <job>. (it would output another xls file).
    RUN <report3> VARIANT <variant3> LAYOUT <layout2> JOB <job>. (it would output a 3rd xls file).
    How should I do to inform variant and layout parameters?
    Thank you.
    Rafael.

    I think I didn't make myself clear in my explanation. Sorry about that.
    My question is, I can create a new field in selection-screen specifically to layout and it would work. However, as I'm running it in background, the ALV will not be shown and the output file must be the export of the ALV with the layout (if in XLS, it'd be even better, but in .CSV would work as well). I just don't think it would work with a .TXT output, because there's no way to reflect the layout in a .TXT file.
    Is there any way of having the ALV inside the output file (saved in the server, in background processing)?
    Thank you so much!
    Edited by: rvsilvax on Nov 30, 2011 3:45 PM

  • Reports in Background JOb

    Hi All,
        I have a report executes in background.
       Report when generated in background does not display ICONS in the report instead they display some characters for those icons. eg:- RED icon, Yellow Icon, Green ICons.
    i have not used ALV report for display

    We have used WRITE... AS ICON and the report generates icons in background as well.
    Probably check at your end once more. You could also try assigning some other output device to your background job spool request.

  • ALV report in Background Job

    Hi,
    We have an report in which we are using FM :- REUSE_ALV_LIST_DISPLAY.
    In forgroud the Report Header is getting displayed only Once.
    When we run the report in background, we are getting in spool in which there are "Page Break and Header" in every page.
    Downloading the report to MS Excel from Spool is creating setting problem.
    Please tell me "how can we do so while running the report in background, "Page break and header dosen't create i.e only One Header and One Page"
    Waiting for reply..
    Saurabh Garg

    Hi Saurabh ,
    Use TOP-OF-LIST instead of TOP-OF-PAGE.
    Please check this sample with different events in ALV-GRID.
    report zbnstest.
    * TABLES AND DATA DECLARATION.
    *TABLES: mara,makt.",marc.
    data syrepid like sy-repid.
    data sydatum(10). " LIKE sy-datum.
    data sypagno(3) type n.
    * WHEN USING MORE THAN ONE TABLE IN ALV WE NEEED TO DECLARE THE TYPE
    * GROUP (TYPE-POOLS--------->SLIS)
    type-pools : slis.
    * INTERNAL TABLE DECLARATION.
    * INTERNAL TABLE TO HOLD THE VALUES FROM THE MARA TABLE
    data: begin of t_mara occurs 0,
    matnr like mara-matnr,
    meins like mara-meins,
    mtart like mara-mtart,
    matkl like mara-matkl,
    end of t_mara.
    * INTERNAL TABLE TO HOLD THE CONTENTS FROM THE EKKO TABLE
    data : begin of t_marc occurs 0,
    matnr like mara-matnr,
    werks like marc-werks,
    minbe like marc-minbe.
    data: end of t_marc.
    * INTERNAL TABLE TO HOLD THE VALUES FROM MAKT TABLE.
    data : begin of t_makt occurs 0,
    matnr like mara-matnr,
    maktx like makt-maktx,
    spras like makt-spras,
    end of t_makt.
    * INTERNAL TABLE WHICH ACTUALLY MERGES ALL THE OTHER INTERNAL TABLES.
    data: begin of itab1 occurs 0,
    matnr like mara-matnr,
    meins like mara-meins,
    maktx like makt-maktx,
    spras like makt-spras,
    werks like marc-werks,
    minbe like marc-minbe,
    end of itab1.
    * THE FOLLOWING DECLARATION IS USED FOR DEFINING THE FIELDCAT
    * AND THE LAYOUT FOR THE ALV.
    * HERE AS slis_t_fieldcat_alv IS A INTERNAL TABLE WITHOUT A HEADER LINE
    * WE EXPLICITELY DEFINE AN INTERNAL TABLE OF THE SAME STRUCTURE AS THAT
    * OF slis_t_fieldcat_alv BUT WITH A HEADER LINE IN THE DEFINITION.
    * THIS IS DONE TO MAKE THE CODE SIMPLER.
    * OTHERWISE WE MAY HAVE TO DEFINE THE STRUCTURE AS IN THE NORMAL SAP
    * PROGRAMS.
    * IN THE FIELDCATALOG TABLE WE ACTUALLY PASS THE FIELDS FROM ONE OR
    * MORE TABLES AND CREATE A STRUCTURE
    * IN THE LAYOUT STRUCTURE WE BASICALLY DEFINE THE FORMATTING OPTIONS
    * LIKE DISPLAY IN THE ZEBRA PATTERN ,THE HOTSPOT OPTIONS ETC.
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
    fieldlayout type slis_layout_alv.
    * DECLARING THE EVENTTABLE INTERNL TABLE FOR USING EVENTS LIKE
    * TOP-OF-PAGE ETC.
    data : eventstab type slis_t_event with header line.
    * DECLARING AN INTERNAL TABLE TO HOLD THE DATA FOR THE TOP-OF-PAGE
    data : heading type slis_t_listheader with header line.
    data : heading1 type slis_t_listheader with header line.
    data : heading2 type slis_t_listheader with header line.
    data : heading3 type slis_t_listheader with header line.
    data : heading4 type slis_t_listheader with header line.
    data : heading5 type slis_t_listheader with header line.
    data : heading6 type slis_t_listheader with header line.
    data : heading7 type slis_t_listheader with header line.
    data : heading8 type slis_t_listheader with header line.
    * STRUCTURE TO PASS THE COLOR ATTRIBUTES FOR DISPLAY.
    data : colorstruct type slis_coltypes.
    * INITIALIZATION. *
    initialization.
    syrepid = sy-repid.
    sypagno = sy-pagno.
    clear fieldcatalog.
    * START-OF-SELECTION. *
    start-of-selection.
    * SUBROUTINE TO POPULATE THE COLORSTRUCT
    perform fill_colorstruct using colorstruct.
    * SUBROUTINE TO POPULATE THE FIELDS OF THE FIELD CATALOGUE
    perform populate_fieldcatalog.
    * SUBROUTINE TO SELECT DATA FROM VARIOUS TABLES AND POPULATE IT IN THE
    * INTERNAL TABLE.
    perform selectdata_and_sort.
    * SUBROUTINE TO POPULATE THE LAYOUT STRUCTURE.
    perform populate_layout using fieldlayout.
    * SUBROUTINE TO CALL THE FUNCTION MERGE TO ENSURE PROPER DISPLAY.
    perform merge_fieldcatalog.
    * SUBROUTINE TO POPULATE THE EVENTSTAB.
    perform fill_eventstab tables eventstab.
    * SUBROUTINE TO POPULATE THE HEADING TABLES.
    perform fill_headingtable tables heading using 'HEADING'.
    perform fill_headingtable tables heading1 using 'HEADING1'.
    perform fill_headingtable tables heading2 using 'HEADING2'.
    perform fill_headingtable tables heading3 using 'HEADING3'.
    perform fill_headingtable tables heading4 using 'HEADING4'.
    perform fill_headingtable tables heading5 using 'HEADING5'.
    perform fill_headingtable tables heading6 using 'HEADING6'.
    perform fill_headingtable tables heading7 using 'HEADING7'.
    perform fill_headingtable tables heading8 using 'HEADING8'.
    * SUBROUTINE TO DISPLAY THE LIST.
    perform display_alv_list.
    * FORMS
    * IN THIS SUBROUTINE WE POPULATE THE FIELDCATALOG TABLE WITH THE NAMES
    * OF THE TABLE,FIELDNAME,WHETHER IT IS KEY FIELD OR NOT,HEADING AND
    * COLUMN JUSTIFICATION.
    form populate_fieldcatalog.
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MATNR' 'X' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MEINS' ' '.
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MAKTX' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MTART' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MATKL' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'SPRAS' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'WERKS' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MINBE' ' ' .
    endform. " POPULATE_FIELDCATALOG
    * FORM FILL_FIELDS_OF_FIELDCATALOG *
    * --> FIELDCATALOG *
    * --> P_TABNAME *
    * --> P_FIELDNAME *
    * --> P_KEY *
    * --> P_KEY *
    form fill_fields_of_fieldcatalog tables fieldcatalog
    structure fieldcatalog
    using p_tabname
    p_fieldname
    p_key.
    * p_no_out.
    fieldcatalog-tabname = p_tabname.
    fieldcatalog-fieldname = p_fieldname.
    fieldcatalog-key = p_key.
    fieldcatalog-emphasize = '1234'.
    *fieldcatalog-no_out = p_no_out.
    append fieldcatalog.
    endform. " FILL_FIELDSOFFIELDCATALOG
    * FORM POPULATE_LAYOUT *
    * --> FIELDLAYOUT *
    form populate_layout using fieldlayout type slis_layout_alv.
    fieldlayout-f2code = '&ETA' .
    fieldlayout-zebra = 'X'.
    * FOR THE WINDOW TITLE.
    fieldlayout-window_titlebar = 'ALV with Events'.
    fieldlayout-colwidth_optimize = 'X'.
    fieldlayout-no_vline = ' '.
    *fieldlayout-no_input = 'X'.
    fieldlayout-confirmation_prompt = ''.
    fieldlayout-key_hotspot = 'X'.
    * This removes the column headings if the flag is set to 'X'
    fieldlayout-no_colhead = ' '.
    *fieldlayout-hotspot_fieldname = 'MAKTX'.
    fieldlayout-detail_popup = 'X'.
    * fieldlayout-coltab_fieldname = 'X'.
    endform. " POPULATE_LAYOUT
    * FORM SELECTDATA_AND_SORT *
    form selectdata_and_sort.
    select matnr meins mtart matkl from mara
    into corresponding fields of t_mara
    up to 500 rows .
    select matnr maktx spras from makt
    into corresponding fields of t_makt
    where matnr = t_mara-matnr and
    spras = sy-langu.
    select matnr werks minbe from marc
    into corresponding fields of t_marc
    where matnr = t_mara-matnr.
    append t_marc.
    endselect.
    append t_makt.
    endselect.
    append t_mara.
    endselect.
    perform populate_itab1.
    sort itab1 by matnr.
    endform. " SELECTDATA_AND_SORT
    * FORM MERGE_FIELDCATALOG *
    form merge_fieldcatalog.
    call function 'REUSE_ALV_FIELDCATALOG_MERGE'
    exporting
    i_program_name = syrepid
    i_internal_tabname = 'ITAB1'
    * i_structure_name = 'COLORSTRUCT'
    * I_CLIENT_NEVER_DISPLAY = 'X'
    i_inclname = syrepid
    changing
    ct_fieldcat = fieldcatalog[]
    exceptions
    inconsistent_interface = 1
    program_error = 2
    others = 3.
    endform. " MERGE_FIELDCATALOG
    * IN THIS FUNCTION THE MINIMUM PARAMETERS THAT WE NEED TO PASS IS AS
    * FOLLOWS:-
    * i_callback_program --> CALLING PROGRAM NAME
    * i_structure_name --> STRUCTURE NAME.
    * is_layout --> LAYOUT NAME.
    * it_fieldcat ---> BODY OF THE FIELD CATALOGUE INTERNAL TABLE
    form display_alv_list.
    call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
    * I_INTERFACE_CHECK = ' '
    i_callback_program = syrepid
    * I_CALLBACK_PF_STATUS_SET = ' '
    * I_CALLBACK_USER_COMMAND = ' '
    i_structure_name = 'ITAB1'
    is_layout = fieldlayout
    it_fieldcat = fieldcatalog[]
    * IT_EXCLUDING =
    * IT_SPECIAL_GROUPS =
    * IT_SORT =
    * IT_FILTER =
    * IS_SEL_HIDE =
    * I_DEFAULT = 'X'
    * THE FOLLOWING PARAMETER IS SET AS 'A' INORDER TO DISPLAY THE STANDARD
    * TOOL BAR
    i_save = 'A'
    * IS_VARIANT = ' '
    it_events = eventstab[]
    * IT_EVENT_EXIT =
    * IS_PRINT =
    * I_SCREEN_START_COLUMN = 0
    * I_SCREEN_START_LINE = 0
    * I_SCREEN_END_COLUMN = 0
    * I_SCREEN_END_LINE = 0
    * IMPORTING
    * E_EXIT_CAUSED_BY_CALLER =
    * ES_EXIT_CAUSED_BY_USER =
    tables
    t_outtab = itab1
    exceptions
    program_error = 1
    others = 2.
    endform. " DISPLAY_ALV_LIST
    *& Form POPULATE_ITAB1
    * text
    * --> p1 text
    * <-- p2 text
    form populate_itab1.
    loop at t_mara.
    loop at t_makt where matnr = t_mara-matnr.
    loop at t_marc where matnr = t_mara-matnr.
    move-corresponding t_mara to itab1.
    move-corresponding t_makt to itab1.
    move-corresponding t_marc to itab1.
    append itab1.
    endloop.
    endloop.
    endloop.
    endform. " POPULATE_ITAB1
    *& Form FILL_EVENTSTAB
    * text
    * -->P_EVENTSTAB text *
    form fill_eventstab tables p_eventstab structure eventstab.
    * WHEN THE FOLLOWING FUNCTION IS CALLED THE SYSTEM POPULATES THE
    * INTERNAL TABLE EVENTSTAB WITH A LIST OF EVENTS NAME.
    * AS SHOWN BELOW WHEN USING I_LIST_TYPE = 0 THE FUNCTION RETURNS 14
    * EVENTS NAME.
    call function 'REUSE_ALV_EVENTS_GET'
    exporting
    i_list_type = 0
    importing
    et_events = p_eventstab[]
    exceptions
    list_type_wrong = 1
    others = 2.
    * BY CALLING THE ABOVE FUNCTION WE FIRST POPULATE THE EVENTSTAB WITH
    * THE PREDEFINED EVENTS AND THEN WE MOVE THE FORM NAME AS SHOWN BELOW.
    * WE ASSIGN A FORM NAME TO THE EVENT AS REQUIRED BY THE USER.
    * FORM NAME CAN BE ANYTHING.THE PERFORM STATEMENT FOR THIS FORM
    * IS DYNAMICALY CALLED.
    read table p_eventstab with key name = slis_ev_top_of_page.
    if sy-subrc = 0 .
    move 'TOP_OF_PAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_top_of_coverpage.
    if sy-subrc = 0 .
    move 'TOP_OF_COVERPAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_end_of_coverpage .
    if sy-subrc = 0 .
    move 'END_OF_COVERPAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_foreign_top_of_page.
    if sy-subrc = 0 .
    move 'FOREIGN_TOP_OF_PAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_foreign_end_of_page.
    if sy-subrc = 0 .
    move 'FOREIGN_END_OF_PAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_list_modify.
    if sy-subrc = 0 .
    move 'LIST_MODIFY' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_top_of_list.
    if sy-subrc = 0 .
    move 'TOP_OF_LIST' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_end_of_page.
    if sy-subrc = 0 .
    move 'END_OF_PAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_end_of_list .
    if sy-subrc = 0 .
    move 'END_OF_LIST' to p_eventstab-form.
    append p_eventstab.
    endif.
    endform. " FILL_EVENTSTAB
    *& Form FILL_HEADINGTABLE
    * text
    * -->P_HEADING text *
    form fill_headingtable tables p_heading structure heading
    using tablename.
    case tablename.
    when 'HEADING'.
    p_heading-typ = 'H'.
    concatenate
    ' REPORT NAME:-' syrepid
    ' ABB Industry Pte Ltd' into p_heading-info.
    append p_heading.
    write sy-datum using edit mask '__/__/____' to sydatum.
    concatenate
    ' DATE:-' sydatum ' USER: ' sy-uname 'PAGE NO:' sypagno
    into p_heading-info.
    append p_heading.
    when 'HEADING1'.
    p_heading-typ = 'H'.
    p_heading-info = 'TOP-OF-COVER-PAGE'.
    append p_heading.
    when 'HEADING2'.
    p_heading-typ = 'H'.
    p_heading-info = 'END-OF-COVER-PAGE'.
    append p_heading.
    when 'HEADING3'.
    p_heading-typ = 'H'.
    p_heading-info = 'FOREIGN-TOP-OF-PAGE'.
    append p_heading.
    when 'HEADING4'.
    p_heading-typ = 'H'.
    p_heading-info = 'FOREIGN-END-OF-PAGE'.
    append p_heading.
    * WHEN 'HEADING5'.
    * P_HEADING-TYP = 'H'.
    * P_HEADING-INFO = 'LIST-MODIFY'.
    * APPEND P_HEADING.
    when 'HEADING6'.
    p_heading-typ = 'H'.
    p_heading-info = 'END-OF-PAGE'.
    append p_heading.
    when 'HEADING7'.
    p_heading-typ = 'H'.
    p_heading-info = 'END-OF-LIST'.
    append p_heading.
    when 'HEADING8'.
    p_heading-typ = 'H'.
    p_heading-info = 'TOP-OF-LIST'.
    append p_heading.
    endcase.
    endform. " FILL_HEADINGTABLE
    * FORM TOP_OF_PAGE *
    form top_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading[]
    exceptions
    others = 1.
    endform.
    *& Form FILL_COLORSTRUCT
    * text
    * -->P_COLORSTRUCT text *
    form fill_colorstruct using p_colorstruct type slis_coltypes .
    p_colorstruct-heacolfir-col = 6.
    p_colorstruct-heacolfir-int = 1.
    p_colorstruct-heacolfir-inv = 1.
    endform. " FILL_COLORSTRUCT
    * FORM TOP_OF_COVERPAGE *
    form top_of_coverpage.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading1[]
    exceptions
    others = 1.
    endform.
    * FORM END_OF_COVERPAGE *
    form end_of_coverpage.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading2[]
    exceptions
    others = 1.
    endform.
    * FORM FOREIGN_TOP_OF_PAGE *
    form foreign_top_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading3[]
    exceptions
    others = 1.
    endform.
    * FORM FOREIGN_END_OF_PAGE *
    form foreign_end_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading4[]
    exceptions
    others = 1.
    endform.
    * FORM LIST_MODIFY *
    *FORM LIST_MODIFY.
    * CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    * EXPORTING
    * IT_LIST_COMMENTARY = HEADING5[]
    * EXCEPTIONS
    * OTHERS = 1.
    *ENDFORM.
    * FORM END_OF_PAGE *
    form end_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading6[]
    exceptions
    others = 1.
    endform.
    * FORM END_OF_LIST *
    form end_of_list.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading7[]
    exceptions
    others = 1.
    endform.
    * FORM TOP_OF_LIST *
    form top_of_list.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading8[]
    exceptions
    others = 1.
    endform.
    *--- End of Program
    Regards,
    Raghav

  • Submit  ALV report in Background & exporting list to memory and return

    Dear all,
    I created one Z program (ZPROGRAM2). 
    Here i use SUBMIT ZPRORAM1_ALV exporting list to memory and return.
    call function 'LIST_FROM_MEMORY'.
    call function 'TABLE_COMPRESS' .
    ZPRORAM1_ALV output i send mail.
    This all are working in foreground.
    If i schedule ZPROGRAM2 in background. that SUBMIT ZPRORAM1_ALV statement not working.
    Please give me the Solution.
    Thanks,
    Durai.V

    It is because of the ALV output that you are using. Check the condition sy-batch = 'X' (background processing) and then display a classical report. It will work then.
    Thanks,
    Jayant

  • CRYSTAL REPORTS AS BACKGROUND JOBS

    Hi Experts,
    We are running some Crystal reports that extract data from our SAP BI System. These Crystal report jobs run on a regular basis to populate the crystal reports.
    The Problem is that whenever these jobs run in the BI system, they block most of the DIALOG processes available ( 5 out of 7 available) leading to very LOW system performance in terms of response and execution.
    The Solution what we are seeking is whether we can somehow set these Crystal jobs as BACKGROUND processes, so that the overall system performance is improved. So kindly suggest any means by which we can set these crystal report jobs as BACKGROUND processes in SAP BI when they are executed from crystal server.
    Thanks in Advance,
    Uday

    Hi,
    Crystal Reports is NOT an ETL tool. For those kind of activities we have a product called Data Integrator.
    ingo

  • Alv report in background job - Unable to see all columns

    Dear Gurus,
      I tried to run an ALv report in the foreground and it works perfectly fine and shows 42 columns. But when i run it in the background, the resultset only contains 12 columns. Is there a particular reason why this is happening. What steps can i take to remedy this.
    ~thanks, appreciate it.

    You do it like this...
    REPORT zdummy_sandbox NO STANDARD PAGE HEADING line-SIZE 255.
    Where LINE-SIZE is the size of your report screen and 255 is the max size (Maybe more or less..not sure)...basically, the ABAP standard line size for reports is kinda short...so if your ALV got 42 columns, you need to extends the size of the report output to make everything fit -:)
    Greetings,
    Blag.

  • Exception ( in Reporting Agent ) background job runs indefinitely

    Hi
    I created an Exception setting under reporting agent (to send out a mail in the SAP Office inbox, on a specific exception) and assigned it under a scheduling package.
    I have assigned a proper query variant to the exception setting also.
    When I exeucte the job, it goes indefinitely.
    I highly appreciate if somebody can help what needs to be done to fix this.
    Thanks
    KC

    Hi,
    If you choose the Precalculate by User option, all the data and HTML pages for the Reporting Agent setting are precalculated for each of the selected users in a single job. This applies in both the cases: Roles or users. When you specify a role after selecting the option 'Precalculate by User', the precalculation will be done for all the users assigned to that role and not the role.
    Roles/Users is just 2 different ways of giving the user restriction. If you specify the roles, the system will precalculate for all the users assigned to the role. If you have few users for whom you want the precalculation to be done, then you can specify the user IDs. If you have many users assigned to a particular role for whom you want the precalculation to be done, then you can specify the role.
    Regards,
    Shilpa

  • Submit background job for a report

    Hai Friends,
    I want to submit a report in background which should run on first monday of every month. otherthen SM36 and SM37. Because we cant give date and time like this.
    If any coding required Pl give me the code.
    regards,
    vamsykrishna.

    This is the Basic code to Achieve that.
    Call Function 'JOB_OPEN'
    SUBMIT RSBDCBTC
    via background Job <Job info>
    With QIE = <QID Returned by BDC_OPEN_Group FM>
    AND RETURN.
    Call Function 'JOB_CLOSE'
    2) Also go through this
    DATA: lv_job_name LIKE tbtco-jobname,
    lv_job_nr LIKE tbtco-jobcount,
    lv_job_released TYPE c,
    lv_job_start_sofort TYPE c,
    lv_print_parameters TYPE pri_params.
    lv_job_name = 'Z_BGPROGRAM'.
    CALL FUNCTION 'JOB_OPEN'
    EXPORTING
    jobname = lv_job_name
    IMPORTING
    jobcount = lv_job_nr
    EXCEPTIONS
    cant_create_job = 1
    invalid_job_data = 2
    jobname_missing = 3
    OTHERS = 4.
    IF syst-subrc = 0.
    " submit job with all the selection screen params...
    SUBMIT (lv_job_name)
    WITH applfile = applfile " these are the parameters of the background program
    WITH p_lines = p_lines
    USER syst-uname " you must use this
    VIA JOB lv_job_name NUMBER lv_job_nr AND RETURN.
    IF sy-subrc = 0.
    CALL FUNCTION 'JOB_CLOSE'
    EXPORTING
    jobcount = lv_job_nr
    jobname = lv_job_name
    strtimmed = 'X'
    IMPORTING
    job_was_released = lv_job_released
    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 syst-subrc <> 0.
    MESSAGE i162(00) WITH
    'An error occured while closing the background job.'.
    STOP.
    ENDIF.
    ENDIF.
    ENDIF.
    SKIP 1.
    WRITE: / 'Background process', lv_job_name , 'called successfully' NO-GAP.
    WRITE: / 'You can check the job in transaction SM37'.

  • No result  when I submit in background job a Z transaction

    Hi,
    I design a screen with the screen painters for my Z report instead of using SELECTION-SCREEN command to build my screen of selection. In the PAI process, I launch the same report in backgound with JOB_OPEN,SUBMIT, JOB_CLOSE and nothing happens. I go to SM50 and no job is found and SM37 confirm me thatt the job has been launch and terminate without error.
    My report, when the background checkbox is checked, launch it-self in background to insert rows in 2 Z tables. Theses 2 tasks take time and are not possible to process in foreground and the user can't wait after the result. That is why I Submit my report in background.
    I made it in another program with a selection screen built with SELECTION-SCREEN command and I never had this problem.
    It is possible to do a selection screen with the screenpainters and launchable in background or it is only possible with SELECTION-SCREEN command.

    JOB_OPEN,SUBMIT, JOB_CLOSE and nothing happens. I go
    to SM50 and no job is found and SM37 confirm me thatt
    the job has been launch and terminate without error.
    In SM50 you can see the jobs only while they are running. Since there is an entry in SM37, it means that the job has been initiated, so something did happen. Check the job log for the details (I strongly advise to add some messages in your program to track the progress).
    You might also want to take a look at the FM SUBST_START_REPORT_IN_BATCH. Here is a code example that I've just written recently to force the report execution in the background (a message is displayed to the user but the report runs in a backrgound job):
    PARAMETERS: p_vkorg TYPE tvko-vkorg OBLIGATORY MEMORY ID vko.
    DATA: rspar TYPE TABLE OF rsparams,
          wa_rspar LIKE LINE OF rspar.
    START-OF-SELECTION.
    IF sy-batch IS INITIAL.
      wa_rspar-selname = 'P_VKORG'.
      wa_rspar-kind = 'P'.
      wa_rspar-low  = p_vkorg.
      APPEND wa_rspar TO rspar.
      CALL FUNCTION 'SUBST_START_REPORT_IN_BATCH'
        EXPORTING
          iv_repname                          = sy-repid
        TABLES
          tt_reportparam                      = rspar
       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 ‘Report started in background’ TYPE ‘I’.
      ELSE.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ELSE.
    <do stuff here>
    ENDIF.
    SUBST_START_REPORT_IN_BATCH actually calls JOB_OPEN, JOB_CLOSE but I just find it easier to use one FM instead of 2-3.

  • Submit report in background

    Hai friends,
    Requirement is " I need to submit the report in background and program should execute only on every monday of the week.
    Pl do the needful and clarify with hard coding.
    Good answers expect good points.
    Regards,
    Vamsykrishna.

    Hi Vamshy,
    Execute Program with some values in selection-screen and save the selection screen values as some variant.
    Goto SM36 tcode and give some job name,job class ..etc.Then Press
    Start_Conidtion Button in Application tool bar.Here you choose Date/Time button and select Period_Values button in the same screen after choosing some coming Monday's date selected_start option.
    here you can provide Weekly option in period_values option.
    dont forget to save all those values you entered.
    Execute the job in SM37 tcode
    If its not solved your problem feel free to ask further.
    You can achieve the same thing thru function modules like job_submit,job_close..
    Reward if it useful to you
    Thanks
    Sivaparvathi

  • Pass parameter to background job from report

    Hi All,
    I have following requirement.
    I am executing a Report. At end of report I am executing an event.
    On the bases of event a background job runs.
    Problem is that, I want to pass one field data from report to background job.
    I already tested SET PARAMETER/GET PARAMETER is not working.
    Is there any way any one can suggest, without using Tables.
    Regards

    Hi,
    If you submit via job it will not be executing the program ..After SUBMIT statement the control will come to the program immediately..
    Check this example..
    DATA: p_jobcnt LIKE tbtcjob-jobcount,
          l_release(1) TYPE c.
    Open the job
    CALL FUNCTION 'JOB_OPEN'
         EXPORTING
              jobname          = 'ZMY_OBJ'
         IMPORTING
              jobcount         = p_jobcnt
         EXCEPTIONS
              cant_create_job  = 1
              invalid_job_data = 2
              jobname_missing  = 3
              OTHERS           = 4.
    Submit the job.
    SUBMIT ztest_program VIA JOB 'ZMY_OBJ' NUMBER p_jobcnt
           TO SAP-SPOOL WITHOUT SPOOL DYNPRO
           WITH destination = 'LOCL'
           WITH immediately = space
           WITH keep_in_spool = 'X' AND RETURN.
    Close the job.
    CALL FUNCTION 'JOB_CLOSE'
         EXPORTING
              jobcount             = p_jobcnt
              jobname              = 'ZMY_OBJ'
              strtimmed            = 'X'
              prdmins              = 15
         IMPORTING
              job_was_released     = l_release.
    Thanks,
    Naren

Maybe you are looking for

  • MDB and XA

     

  • EJB 3.0 Stateful session bean shared between Servlet's

    Hello I have a bit of a noob question regarding Stateful sessions beans. I am wanting to know if there is a way that I can share an instance of a session bean between multiple HttpServlet instances? I am sending XML messages from a mobile J2ME applic

  • Users from an external organization authenticating to a Remote Dekstop App

    Hi, We have set up Remote Desktop Apps using Remote Desktop Services The apps are permissioned with AD user accounts in our forest When an external company that has network access (i.e. routable addresses) tries to log in (with credentials in our AD)

  • Why does it take so long to render a quicktime and/or wmv file?

    I hope you can help with this! It's taking me forever to save a project as a qt file. I'm saving in expert settings with LAN/Intranet or broadband-high as the setting. In Imovie 4.0.1 I could usally render a 6+ minute project in under 10 minutes with

  • Jsp - classes and import

    Hello, i got some problems with a jsp - file: i have to write a class and then import it onto a server i would appreciate quick answers - if someone could help me - i`ll pay i`ll also go into more details - but i think thats some basic stuff for you