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

Similar Messages

  • Running the alv report  in  background and sending it thro email

    hi,
          i have to run the  alv report in background and send the output through email

    Hi
    Many a times there is a requirement to display ALV Grid (not ALV List) in the background Job. I have checked the SDN Forum for the same and it has been mentioned that ALV Grid cannot be displayed in Background, but the list output of ALV is possible. So user won’t have the actual Grid interface but the List interface.
    There is a workaround to display ALV Grid in Background Job. The only restriction is you can’t schedule the job through SM36. You need to execute the transaction of the report program, fill in the selection screen data and hit Execute.
    The job would be executed in background. User will be able to see the Job Log and Job Status after executing the program. User doesn’t have to go to SM37 to view the job status/log. Once the Job Status is changed to “COMPLETED”, user can click on “DISPLAY SPOOL” to view the ALV Grid.
    Limitations:
    Can’t schedulea background job
    The session should be active until the background job is completed. If the session is closed, then user won’t be able to check the output in ALV Grid. User would be able to check the output through spool or SM37
    Advantages:
    If the spool width is greater than 255 characters, then the entire width could be seen in the output because the output is directed to an ALV Grid and not to spool
    Interface of ALV Grid is available instead of ALV List even though it’s a background job.
    Program won’t give the TIME OUT error
    Steps Required:
    1. Once you execute the program, the following screen would be displayed
    2. Click “Display Job Status” to check the Status of the Background Job
    3. Click on “Display the Job Log” to check the Log
    4. Click on “Display Job Status” to check the Job Status
    5. Click on “DISPLAY SPOOL” to check the spool content once the Job Status is changed to “COMPLETED”. Output is displayed in ALV Grid
    Programs:
    1.  Two different programs needs to be created
    ZPROGRAM_ONE: This is the 1st program, where the selection screen and all the data validations would be done. Error handling for invalid data should be done in this program.
    Once the data validation is done, this program would call the 2nd program ZPROGEAM_TWO. Build the logic to display ALV Grid in this program. The logic will only display ALV in foreground and it won’t be reflected in the spool.
    ZPROGRAM_TWO: This program would fetch all the data and do all the processing. If you want the spool output along with ALV Grid output, then build the logic in this program to display ALV Grid.
    *& Report  ZPROGRAM_ONE                                                *
    REPORT  zprogram_one                            .
    PRASHANT PATIL
    TABLES : mara,
             tsp01.
    type-pools:slis.
    TYPES : BEGIN OF t_mara,
              matnr   TYPE mara-matnr,
              ersda   TYPE mara-ersda,
              ernam   TYPE mara-ernam,
              laeda   TYPE mara-laeda,
            END OF t_mara.
    DATA : i_mara       TYPE STANDARD TABLE OF t_mara,
           wa_mara      TYPE t_mara,
           wa_index     TYPE indx,        " For Index details
           wa_index_key TYPE indx-srtfd VALUE 'PRG_ONE',
           i_jobsteplist     TYPE STANDARD TABLE OF tbtcstep, " For spool number
           wa_params         TYPE pri_params,  " To Get Print Parameters
           wa_jobhead        TYPE tbtcjob,     " To know the status of job
           wa_jobsteplist    TYPE tbtcstep,    " To know the spool
           w_jobname         TYPE tbtco-jobname,  " Job name for bckgrnd job
           w_jobcount        TYPE tbtco-jobcount, " Unique id for bckgrd job
           w_path            TYPE string,         " Upload path
           w_lsind           TYPE sy-lsind,       " Index
           wa_seltab         TYPE rsparams,
           i_seltab          TYPE STANDARD TABLE OF rsparams,
           wa_index1         TYPE indx,        " For Index details
           wa_index_key1     TYPE indx-srtfd VALUE 'PRG_TWO',
           i_fieldcat        TYPE slis_t_fieldcat_alv,
           wa_fieldcat       LIKE LINE OF i_fieldcat.
            CONSTANTS DECLARATION                                        *
    CONSTANTS :
             c_a(1) TYPE c VALUE 'A',
             c_m(1) TYPE c VALUE 'M',
             c_l(1) TYPE c VALUE 'L',
             c_c(1) TYPE c VALUE 'C',
             c_zfdr(4) TYPE c VALUE 'ZFDR',
             c_x(1)    TYPE c VALUE 'X',
             c_locl(4) TYPE c VALUE 'LOCL', " Destination is LOCAL
             c_f(1)    TYPE c VALUE 'F',   " Job Status - Failed
             c_s(1)    TYPE c VALUE 'S',
             c_p(1)    TYPE c VALUE 'P'.
    SELECTION SCREEN PARAMETERS
    SELECT-OPTIONS : s_matnr FOR mara-matnr.
    START-OF-SELECTION.
    Before the export, fill the data fields before CLUSTR
      wa_index-aedat = sy-datum.
      wa_index-usera = sy-uname.
      EXPORT s_matnr
           TO DATABASE indx(st) FROM wa_index ID wa_index_key.
    To Open the Job for background processing
      PERFORM open_job.
    To get the print parameters
      PERFORM get_print_parameters.
    Submit the job in background
      PERFORM job_submit.
    Close the background job
      PERFORM job_close.
    This is the output screen with the buttons ********
    Create 3 buttons DISPLAY SPOOL, STATUS, JOBLOG
      SET PF-STATUS 'ZS001'.
      WRITE: / 'The program is submitted in Background'.
      WRITE: / 'Press DISPLAY SPOOL to see the spool'.
      WRITE: / 'Press STATUS to see the status of the background'.
    AT USER-COMMAND.
    If user presses the 'BACK' button
      IF sy-ucomm = 'BAK'.
        IF  wa_jobhead-status = c_f OR
            wa_jobhead-status = c_a.
          LEAVE TO SCREEN 0.
        ENDIF.
      ENDIF.
    If the user presses the 'DISPLAY SPOOL' Button
      IF sy-ucomm = 'DISPLAY'.
        PERFORM display_spool.
      ENDIF.
    If the user presses the 'JOB STATUS' Button
      IF sy-ucomm = 'STATUS'.
        PERFORM display_status.
      ENDIF.
    If the user presses the 'JOB LOG' Button
      IF sy-ucomm = 'JOBLOG'.
        PERFORM display_job_log.
      ENDIF.
    *&      Form  open_job
          text
    -->  p1        text
    <--  p2        text
    FORM open_job .
    This is to Create a new job which is to be submitted in background to
    process sales order/delivery/invoice
    Here we would get a unique id ( Jobcount ) which identifies our job
    along with the job name which we have assigned to our job
      CONCATENATE sy-uname
                  sy-datum
                  sy-uzeit
                          INTO w_jobname .  " Assign unique jobname
      CALL FUNCTION 'JOB_OPEN'
       EXPORTING
      DELANFREP              = ' '
      JOBGROUP               = ' '
        jobname                = w_jobname
      SDLSTRTDT              = NO_DATE
      SDLSTRTTM              = NO_TIME
      JOBCLASS               =
      IMPORTING
       jobcount                = w_jobcount
    CHANGING
      RET                    =
    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.
    ENDFORM.                    " open_job
    *&      Form  get_print_parameters
          text
    -->  p1        text
    <--  p2        text
    FORM get_print_parameters .
      DATA : l_valid TYPE c.
    This is to get the Print Parameters for the job which is to be
    submitted in background to process sales order/delivery/invoice
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
       EXPORTING
      ARCHIVE_ID                   = C_CHAR_UNKNOWN
      ARCHIVE_INFO                 = C_CHAR_UNKNOWN
      ARCHIVE_MODE                 = C_CHAR_UNKNOWN
      ARCHIVE_TEXT                 = C_CHAR_UNKNOWN
      AR_OBJECT                    = C_CHAR_UNKNOWN
      ARCHIVE_REPORT               = C_CHAR_UNKNOWN
      AUTHORITY                    = C_CHAR_UNKNOWN
      COPIES                       = C_NUM3_UNKNOWN
      COVER_PAGE                   = C_CHAR_UNKNOWN
      DATA_SET                     = C_CHAR_UNKNOWN
      DEPARTMENT                   = C_CHAR_UNKNOWN
          destination                  = c_locl " LOCL
      EXPIRATION                   = C_NUM1_UNKNOWN
          immediately                  = space
      IN_ARCHIVE_PARAMETERS        = ' '
      IN_PARAMETERS                = ' '
      LAYOUT                       = C_CHAR_UNKNOWN
      LINE_COUNT                   = C_INT_UNKNOWN
      LINE_SIZE                    = C_INT_UNKNOWN
      LIST_NAME                    = C_CHAR_UNKNOWN
      LIST_TEXT                    = C_CHAR_UNKNOWN
      MODE                         = ' '
          new_list_id                  = c_x
      PROTECT_LIST                 = C_CHAR_UNKNOWN
          no_dialog                    = c_x
      RECEIVER                     = C_CHAR_UNKNOWN
      RELEASE                      = C_CHAR_UNKNOWN
      REPORT                       = C_CHAR_UNKNOWN
      SAP_COVER_PAGE               = C_CHAR_UNKNOWN
      HOST_COVER_PAGE              = C_CHAR_UNKNOWN
      PRIORITY                     = C_NUM1_UNKNOWN
      SAP_OBJECT                   = C_CHAR_UNKNOWN
      TYPE                         = C_CHAR_UNKNOWN
          user                         = sy-uname
      USE_OLD_LAYOUT               = ' '
      UC_DISPLAY_MODE              = C_CHAR_UNKNOWN
      DRAFT                        = C_CHAR_UNKNOWN
      ABAP_LIST                    = ' '
      USE_ARCHIVENAME_DEF          = ' '
      DEFAULT_SPOOL_SIZE           = C_CHAR_UNKNOWN
      PO_FAX_STORE                 = ' '
      NO_FRAMES                    = C_CHAR_UNKNOWN
       IMPORTING
      OUT_ARCHIVE_PARAMETERS       =
          out_parameters               = wa_params
       valid                        = l_valid
       EXCEPTIONS
         archive_info_not_found       = 1
         invalid_print_params         = 2
         invalid_archive_params       = 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.
    ENDFORM.                    " get_print_parameters
    *&      Form  job_submit
          text
    -->  p1        text
    <--  p2        text
    FORM job_submit .
    The job which we have created & the unique id ( jobcount ) which we
    have got identifies our job. Hence those parameters are passed along
    with the name of the background program "ZPROGRAM_TWO"
    The job is submitted in background.
      CALL FUNCTION 'JOB_SUBMIT'
        EXPORTING
      ARCPARAMS                         =
        authcknam                         = sy-uname
      COMMANDNAME                       = ' '
      OPERATINGSYSTEM                   = ' '
      EXTPGM_NAME                       = ' '
      EXTPGM_PARAM                      = ' '
      EXTPGM_SET_TRACE_ON               = ' '
      EXTPGM_STDERR_IN_JOBLOG           = 'X'
      EXTPGM_STDOUT_IN_JOBLOG           = 'X'
      EXTPGM_SYSTEM                     = ' '
      EXTPGM_RFCDEST                    = ' '
      EXTPGM_WAIT_FOR_TERMINATION       = 'X'
        jobcount                          = w_jobcount
        jobname                           = w_jobname
      LANGUAGE                          = SY-LANGU
        priparams                         = wa_params
        report                            = 'ZPROGRAM_TWO'
      VARIANT                           = ' '
    IMPORTING
      STEP_NUMBER                       =
       EXCEPTIONS
         bad_priparams                     = 1
         bad_xpgflags                      = 2
         invalid_jobdata                   = 3
         jobname_missing                   = 4
         job_notex                         = 5
         job_submit_failed                 = 6
         lock_failed                       = 7
         program_missing                   = 8
         prog_abap_and_extpg_set           = 9
         OTHERS                            = 10
      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.                    " job_submit
    *&      Form  job_close
          text
    -->  p1        text
    <--  p2        text
    FORM job_close .
    Once the job is submitted in background then the job is closed
      CALL FUNCTION 'JOB_CLOSE'
        EXPORTING
      AT_OPMODE                         = ' '
      AT_OPMODE_PERIODIC                = ' '
      CALENDAR_ID                       = ' '
      EVENT_ID                          = ' '
      EVENT_PARAM                       = ' '
      EVENT_PERIODIC                    = ' '
        jobcount                          = w_jobcount
        jobname                           = w_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                         = c_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.
    ENDFORM.                    " job_close
    *&      Form  display_spool
          text
    -->  p1        text
    <--  p2        text
    FORM display_spool .
    To Read the Job to get the spool details
      DATA : l_rqident TYPE tsp01-rqident, " Spool Number
             l_spoolno TYPE tsp01_sp0r-rqid_char.
      CLEAR : l_rqident,
              w_lsind,
              wa_jobsteplist.
      REFRESH : i_jobsteplist.
      SET PF-STATUS 'ZAR02'.
    Get the Spool Number
      CALL FUNCTION 'BP_JOB_READ'
        EXPORTING
          job_read_jobcount           = w_jobcount
          job_read_jobname            = w_jobname
          job_read_opcode             = '20'
        JOB_STEP_NUMBER             =
       IMPORTING
         job_read_jobhead            = wa_jobhead
       TABLES
         job_read_steplist           = i_jobsteplist
    CHANGING
       RET                         =
       EXCEPTIONS
         invalid_opcode              = 1
         job_doesnt_exist            = 2
         job_doesnt_have_steps       = 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.
    Read the Job Step list to get the spool number
      READ TABLE i_jobsteplist INTO wa_jobsteplist INDEX 1.
      CHECK wa_jobsteplist-listident <> space.
    Spool Number
      l_rqident = wa_jobsteplist-listident.
      MOVE l_rqident TO l_spoolno.
    Check the spool in TSP01
      SELECT SINGLE * FROM tsp01 WHERE rqident = l_rqident.
      IF  sy-subrc = 0.
        LEAVE TO LIST-PROCESSING.
        CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
          EXPORTING
            spoolid       = l_spoolno
        IMPORTING
          RC            =
          STATUS        =
        PERFORM show_alv.
      ENDIF.
      w_lsind = sy-lsind.
      IF sy-lsind GE 19.
        sy-lsind = 1.
      ENDIF.
    ENDFORM.                    " display_spool
    *&      Form  show_alv
          text
    -->  p1        text
    <--  p2        text
    FORM show_alv .
    Before the import, fill the data fields before CLUSTR.
      wa_index1-aedat = sy-datum.
      wa_index1-usera = sy-uname.
    To Import the selection screen data from Calling Program
      IMPORT i_mara
      FROM DATABASE indx(st) ID wa_index_key1 TO wa_index1.
      FREE MEMORY ID wa_index_key1.
    This prepares the field-catalog for ALV.
      PERFORM prepare_fieldcatalog.
    This displays the output in  ALV format .
      PERFORM display_alv.
    ENDFORM.                    " show_alv
    *&      Form  display_status
          text
    -->  p1        text
    <--  p2        text
    FORM display_status .
    To Display the STATUS of the JOB which is exectued in background
      CLEAR : wa_jobsteplist.
      REFRESH : i_jobsteplist.
      WRITE:/ 'DISPLAYING JOB STATUS'.
      CALL FUNCTION 'BP_JOB_READ'
        EXPORTING
          job_read_jobcount           = w_jobcount
          job_read_jobname            = w_jobname
          job_read_opcode             = '20'
        JOB_STEP_NUMBER             =
       IMPORTING
         job_read_jobhead            = wa_jobhead
       TABLES
         job_read_steplist           = i_jobsteplist
    CHANGING
       RET                         =
       EXCEPTIONS
         invalid_opcode              = 1
         job_doesnt_exist            = 2
         job_doesnt_have_steps       = 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.
    To Display the status text as per the status type
      CASE wa_jobhead-status.
        WHEN 'S'. WRITE: / 'Scheduled'.
        WHEN 'R'. WRITE: / 'Released'.
        WHEN 'F'. WRITE: / 'Completed'.
        WHEN 'A'. WRITE: / 'Cancelled'.
        WHEN OTHERS.
      ENDCASE.
      IF sy-lsind GE 19.
        sy-lsind = 1.
      ENDIF.
    ENDFORM.                    " display_status
    *&      Form  display_job_log
          text
    -->  p1        text
    <--  p2        text
    FORM display_job_log .
    To display the log of the background program
      LEAVE TO LIST-PROCESSING.
      CALL FUNCTION 'BP_JOBLOG_SHOW_SM37B'
        EXPORTING
          client                    = sy-mandt
          jobcount                  = w_jobcount
          joblogid                  = ' '
          jobname                   = w_jobname
        EXCEPTIONS
          error_reading_jobdata     = 1
          error_reading_joblog_data = 2
          jobcount_missing          = 3
          joblog_does_not_exist     = 4
          joblog_is_empty           = 5
          joblog_show_canceled      = 6
          jobname_missing           = 7
          job_does_not_exist        = 8
          no_joblog_there_yet       = 9
          no_show_privilege_given   = 10
          OTHERS                    = 11.
      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.                    " display_job_log
    *&      Form  prepare_fieldcatalog
          text
    -->  p1        text
    <--  p2        text
    FORM prepare_fieldcatalog .
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname    = 'MATNR'.
      wa_fieldcat-tabname      = 'I_MARA'.
      wa_fieldcat-reptext_ddic = 'Material no.'.
      wa_fieldcat-outputlen    = '18'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname    = 'ERSDA'.
      wa_fieldcat-tabname      = 'I_MARA'.
      wa_fieldcat-reptext_ddic = 'Creation date'.
      wa_fieldcat-outputlen    = '10'.
      APPEND  wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname    = 'ERNAM'.
      wa_fieldcat-tabname      = 'I_MARA'.
      wa_fieldcat-reptext_ddic = 'Name of Person'.
      wa_fieldcat-outputlen    = '10'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname    = 'LAEDA'.
      wa_fieldcat-tabname      = 'I_MARA'.
      wa_fieldcat-reptext_ddic = ' Last Change'.
      wa_fieldcat-outputlen    = '10'.
      APPEND  wa_fieldcat TO i_fieldcat.
    ENDFORM.                    " prepare_fieldcatalog
    *&      Form  display_alv
          text
    -->  p1        text
    <--  p2        text
    FORM display_alv .
    Call ABAP List Viewer (ALV)
      call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
          it_fieldcat  = i_fieldcat
        tables
          t_outtab     = i_mara.
    ENDFORM.                    " display_alv
    •     ZPROGRAM_TWO: This is the 2nd program which would be called from program ZPROGRAM_ONE.
    *& Report  ZPROGRAM_TWO                                                *
    REPORT  zprogram_two                            .
    PRASHANT PATIL
    TABLES : mara.
    TYPE-POOLS:slis.
    TYPES : BEGIN OF t_mara,
              matnr   TYPE mara-matnr,
              ersda   TYPE mara-ersda,
              ernam   TYPE mara-ernam,
              laeda   TYPE mara-laeda,
            END OF t_mara.
    DATA : i_mara        TYPE STANDARD TABLE OF t_mara,
           wa_mara       TYPE t_mara,
           wa_index      TYPE indx,        " For Index details
           wa_index_key  TYPE indx-srtfd VALUE 'PRG_ONE',
           wa_index1     TYPE indx,        " For Index details
           wa_index_key1 TYPE indx-srtfd VALUE 'PRG_TWO',
           i_fieldcat        TYPE slis_t_fieldcat_alv,
           wa_fieldcat       LIKE LINE OF i_fieldcat.
    SELECT-OPTIONS : s_matnr FOR mara-matnr.
    Before the import, fill the data fields before CLUSTR.
    wa_index-aedat = sy-datum.
    wa_index-usera = sy-uname.
    To Import the selection screen data from Calling Program
    IMPORT s_matnr
    FROM DATABASE indx(st) ID wa_index_key TO wa_index.
    FREE MEMORY ID wa_index_key.
    SELECT matnr
           ersda
           ernam
           laeda
           FROM mara
           INTO TABLE i_mara
           WHERE matnr IN s_matnr.
    PERFORM prepare_fieldcatalog.
    PERFORM display_alv.
    Before the export, fill the data fields before CLUSTR
    wa_index1-aedat = sy-datum.
    wa_index1-usera = sy-uname.
    EXPORT i_mara
    TO DATABASE indx(st) FROM wa_index1 ID wa_index_key1.
    *&      Form  prepare_fieldcatalog
          text
    -->  p1        text
    <--  p2        text
    FORM prepare_fieldcatalog .
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname    = 'MATNR'.
      wa_fieldcat-tabname      = 'I_MARA'.
      wa_fieldcat-outputlen    = '18'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname    = 'ERSDA'.
      wa_fieldcat-tabname      = 'I_MARA'.
      wa_fieldcat-outputlen    = '10'.
      APPEND  wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname    = 'ERNAM'.
      wa_fieldcat-tabname      = 'I_MARA'.
      wa_fieldcat-outputlen    = '10'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname    = 'LAEDA'.
      wa_fieldcat-tabname      = 'I_MARA'.
      wa_fieldcat-outputlen    = '10'.
      APPEND  wa_fieldcat TO i_fieldcat.
    ENDFORM.                    " prepare_fieldcatalog
    *&      Form  display_alv
          text
    -->  p1        text
    <--  p2        text
    FORM display_alv .
    Call ABAP List Viewer (ALV)
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          it_fieldcat = i_fieldcat
        TABLES
          t_outtab    = i_mara.
    ENDFORM.                    " display_alv
    its possible to display ALV Grid using OO ALV. Following code can be used instead of FM.
    In the PBO, add following code
    SET PF-STATUS 'ZSTAT'.
    If program is executed in background
    CALL METHOD cl_gui_alv_grid=>offline
    RECEIVING
    e_offline = off.
    IF off IS INITIAL.
    IF container1 IS INITIAL.
    CREATE OBJECT container1
    EXPORTING
    container_name = 'CC_ALV1' .
    ENDIF.
    ENDIF.
    CREATE OBJECT g_grid1
    EXPORTING
    i_parent = container1.
    CALL METHOD g_grid1->set_table_for_first_display
    EXPORTING
    I_BUFFER_ACTIVE =
    I_BYPASSING_BUFFER =
    I_CONSISTENCY_CHECK =
    I_STRUCTURE_NAME =
    IS_VARIANT =
    i_save = 'A'
    i_default = ' '
    is_layout =
    is_print =
    IT_SPECIAL_GROUPS =
    it_toolbar_excluding =
    IT_HYPERLINK =
    IT_ALV_GRAPHICS =
    IT_EXCEPT_QINFO =
    CHANGING
    it_outtab = i_output
    it_fieldcatalog = i_fieldcatalog
    IT_SORT =
    IT_FILTER =
    EXCEPTIONS
    invalid_parameter_combination = 1
    program_error = 2
    too_many_lines = 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.
    Reward points if useful
    Regards
    Anji

  • Running ALV REPORT in background

    Hi Experts ,
    Before writing this query , i went through all the threads related to ALV report in background . But found none of them satisfactory .
    I am running a alv report in background . I am not using OO ALV . I am using " REUSE_ALV_GRID_DISPLAY" .
    This report is schedules through a background job . It is creating a spool .
    But I am getting a error message : *" FRONT END NOT AVIALABLE "*
    What i have found so far :
    I am planning to use sy-batch variable to check whether it is running in background or not , Then I am planning to read  the spool and if the spool is created , i will display the ALV .
    Is this the correct approach or some other way to generate the ALV REPORT .
    Also by this way will the error message *" FRONT END NOT AVIALABLE "* go .
    Please advice .
    Regards,
    Abhishek

    Hello Everyone ,
    Thanks for your replies .
    I have the spool generated . But it is waiting status .
    The issue here is how I am going to say that the spool is in " Completed " status . Because only after when my spool is in completed status , I want to display the status .
    Is there way for this ?
    Regards ,
    Abhishek

  • How to display the alv report blocks wise with out using the blocked alv

    Hi
    How to display the alv report with out using the blocked alv function module.
    Thanks
    Chinnu

    see this Standard Program
    RPR_ABAP_SOURCE_SCAN

  • Scheduling of ALV Reports in Background

    I have schedule a Report in the Back ground and also entered the spool list so that the mail can be sent to the said users but when the Report is recvd in the mail box it is recvd as html and there are many columnns in my report that are not visible.
    can i schedule the report and send the report as an excel attchement in the background processing if so then how can i do that
    you early reponse will be appreciated
    abhishek

    Hi,
    Once you schedule the ALV report in background you will not get the entire list as it is. The output lenght of the ist generated in the background is set to 255 characters and generally data exceeding this lenght will be turncated.
    You cannot download a report in excel in background. The FM's GUI_download will not work in backgorund. You will have to write the data on the application server and then write an additional program to read that data or alternatively use some of the std tcodes to fetch that data to the presentation system.
    CHeers
    VJ

  • Using Layout Variant in jobs that are scheduled to run in background

    Hi Guys,
    I have an issue in using the "layout variant" in running a report in the background. Here is what i do to run a report.
    I select a "selection Variant" and at the bottom of the Report input screen, I choose an User- Specific "Layout Variant" which i have saved with few columns only to show in the report.
    When i run this in foreground, i am able to get the report with my "Layout variant" with only my selected columns. I could also export this output and it looks fine in excel.
    When i run the same report with the same "Layout Variant" in background and save it to my local desktop as an excel file, my "Layout Variant" doesn't seem to work and i am getting all the columns and fields of the reports as such.
    Is this the way, the "Layout variants" will work? Whether this will not work in background jobs? Is this the way standard SAP work?
    Please guide me...
    Good rating points will be given for useful inputs..
    Anand Viswanathan

    Standard SAP functionality

  • Is it possible to run ALV report in background if Yes how?

    is it possible to run ALV report in background if Yes how?

    Hi,
    Why not?Through se38 only you create ALV report. there you can give your report name and go to program on menu bar - click - execute buton- click-Background . You will get new screen there you can choose Execute immediate or schedule.
    <REMOVED BY MODERATOR>
    Cheers,
    Chandra Sekhar.
    Edited by: Alvaro Tejada Galindo on Mar 4, 2008 2:12 PM

  • How to get header in the ALV report

    Hi
    I want to print header in the ALV report.But i am not getting that.Plz see my program it is getting error and also not printing header.If there is any error means plz give me the solution.In this program there is an error.
    REPORT  ZREPORT_ALV .
    TYPE-POOLS : slis.
    tables:vbak,vbap.
    DATA:  report_id LIKE sy-repid.
    DATA: I_LAYOUT TYPE SLIS_LAYOUT_ALV.
    data: heading        TYPE slis_t_listheader,
          wa_header      TYPE slis_listheader,
         events         TYPE slis_t_event.
    data: l_string type c.
    data: ivariant(1) type c,
          itvariant like disvariant,
          w_variant like disvariant.
    initialization.
    REPORT_ID = SY-REPID.
    PERFORM pgm. "F1000_LAYOUT_INIT. "using I_LAYOUT.
    ivariant = 'A'.
    *PERFORM init.
    itvariant = w_variant.
    select-options:so_vbeln for vbap-vbeln.
    data:itab like vbak occurs 0 with header line.
    data:itab1 like vbap occurs 0 with header line.
    start-of-selection.
    select * from vbak into table itab where vbeln in so_vbeln.
    if not itab[] is initial.
    select * from vbap into table itab1
    for all entries in itab
    where vbeln = itab-vbeln.
    endif.
    data:ls_fieldcat TYPE slis_fieldcat_alv,
    lt_fieldcat1  TYPE slis_t_fieldcat_alv.
    ****For alv display
    IF NOT itab1[] IS INITIAL.
       DEFINE ls_fieldcat.
       add 1 to ls_fieldcat-col_pos.
        ls_fieldcat-fieldname    = &1.
        ls_fieldcat-outputlen    = &2.
        ls_fieldcat-seltext_l    = &3.
         ls_fieldcat-emphasize  = &4.
        append ls_fieldcat to lt_fieldcat1.
        clear ls_fieldcat.
      END-OF-DEFINITION.
        ls_fieldcat 'VBELN'           '10'     'Sales Order Number'.
       ls_fieldcat 'POSNR'           '6'        'SO Item'.
        ls_fieldcat 'MATNR'           '13'      'Material No'.
    m_fieldcat1 'NETWR'           '13'        'Amount'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
      I_CALLBACK_PROGRAM                = sy-repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
    I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
       IS_LAYOUT                         =  I_LAYOUT
       IT_FIELDCAT                       =  lt_fieldcat1
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =   ITVARIANT
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      TABLES
        T_OUTTAB                          =  itab1
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
    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.
    CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
       I_SAVE              = ivariant
      CHANGING
       CS_VARIANT          = itvariant
    EXCEPTIONS
      WRONG_INPUT         = 1
      NOT_FOUND           = 2
      PROGRAM_ERROR       = 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.
    FORM  pgm. "F1000_LAYOUT_INIT. "USING I_LAYOUT TYPE SLIS_LAYOUT_ALV.
    CLEAR I_LAYOUT.
    i_layout-colwidth_optimize = 'X'.
    I_LAYOUT-key_hotspot = u2018Xu2019.
    I_LAYOUT-hotspot_fieldname =  MATNR.
    ENDFORM.
    *regarding logo and header,,,,
    *first store the logo in T-code OAOR, then call that in your report.....
    *data: heading        TYPE slis_t_listheader,
         wa_header      TYPE slis_listheader,
        events         TYPE slis_t_event.
    To display TOP_OF_PAGE.
    FORM top_of_page.
      DATA : text(40),txtdt(40).
      CLEAR l_string.
      l_string = 'JCB India Limited'(hd2).
      wa_header-typ  = 'H'.
      wa_header-info = l_string.
      APPEND wa_header TO heading.                              " index 1.
      CLEAR l_string.
      WRITE :'Number of records:' TO text,'dbcnt' TO text+20 LEFT-JUSTIFIED.
      wa_header-typ  = 'S'.
      wa_header-info = text.
      APPEND wa_header TO heading.
    CLEAR l_string.
    wa_header-typ  = 'S'.
    WRITE : 'Report Run Date  :' TO txtdt,sy-datum TO txtdt+20 DD/MM/YY.
    WRITE sy-datum TO dat DD/MM/YY.
    wa_header-info = txtdt.
    APPEND wa_header TO heading.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
         i_logo             = 'ENJOYSAP_LOGO'
          it_list_commentary = heading.
      CLEAR heading.
    ENDFORM.                    "top_of_page
    *to execute top-of-page you have to create events.
    *for ex......
    FORM create_event USING p_events TYPE slis_t_event.
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = p_events.
      READ TABLE p_events WITH KEY name = slis_ev_top_of_page
                             INTO ls_event.
      IF sy-subrc = 0.
        MOVE formname_top_of_page TO ls_event-form.
        APPEND ls_event TO p_events.
      ENDIF.
    ENDFORM.                    " create_event

    Hi,
       Find below code for your question, you may get some idea,,
    *& Report  ZACTIONGRIDPRACTICE
    REPORT  ZACTIONGRIDPRACTICE.
    *data declarations.....
    TYPE-POOLS SLIS.
    TABLES : T529T ,PA0000.
    data : gd_repid type  sy-repid.
    DATA : LD_COLOR(10) TYPE N.
    DATA : GD_TAB_GROUP TYPE SLIS_T_SP_GROUP_ALV.
    Data:  is_fieldcat TYPE slis_fieldcat_alv.
    DATA : GD_LAYOUT TYPE SLIS_LAYOUT_ALV.
    DATA : GD_DATUM TYPE DATUM.
    DATA : BEGIN OF WA_TABLE,
                    MASSN TYPE T529T-MASSN,
                    MNTXT TYPE T529T-MNTXT,
                    userg type userg,
                    TOTAL TYPE I ,
                    begda type begda,
                    endda type endda,
                    april type i,
                    SLNO TYPE I,
                      LINE_COLOR(4) TYPE C,
                    END OF WA_TABLE,
                    IT_TABLE LIKE TABLE OF WA_TABLE.
    data : april type i.
    DATA : TEMP TYPE C.
    data :    LT_PA0000 TYPE TABLE OF PA0000,
              LT_PA0000_T typE TABLE OF PA0000 with header line.
    DATA : IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
            WA_FCAT LIKE LINE OF IT_FCAT.
    DATA : IT_EVENTS TYPE SLIS_T_EVENT,
            WA_EVENTS LIKE LINE OF IT_EVENTS.
            wa_events-form = 'HEADER'.
    WA_EVENTS-NAME = 'TOP_OF_PAGE'.
    APPEND WA_EVENTS TO IT_EVENTS.
    PERFORM HEADER.
    DATA : SLNO TYPE I.
    DATA : lv_output      TYPE  dats.
    CALL FUNCTION 'ZHR_RE_BE_CALC_START_DATE'
      EXPORTING
        id_daberi   = sy-datum
      IMPORTING
        ed_date_cor = lv_output.
    select-options...
    selection-screen BEGIN OF BLOCK B WITH FRAME TITLE TEXT-003.
    select-options : s_date for sy-datum OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK B.
    lv_output = sy-datum - 27.
    INITIALIZATION.
    S_DATE-LOW = lv_output.
    S_DATE-HIGH = SY-DATUM.
    S_DATE-SIGN = 'I'.
    S_DATE-OPTION = 'BT'.
    APPEND s_date.
    *AT SELECTION-SCREEN ON S_DATE.
    *SELECT MASSN INTO TABLE IT_TABLE FROM PA0000 WHERE BEGDA IN S_DATE.
    *SELECT STATEMENTS....
    start-of-selection.
      SELECT   t529t~MASSN t529t~MNTXT  INTO TABLE IT_table  FROM T529T where SPRSL EQ 'E' and t529t~massn in ('10','13','16','20','28','30','45','01','03') .
    DATUM IN S_DATE.
    PERFORM LAYOUT.
      loop at it_table into wa_table.
    LD_COLOR = 2.
      LD_COLOR = LD_COLOR + 1.
    if LD_COLOR = 8.
    LD_COLOR = 1.
    endif.
    concatenate 'C' '1' '11'  into wa_table-LINE_COLOR . "='C410'.
    modify it_table from wa_table.
    endloop.
      LOOP AT IT_TABLE INTO WA_TABLE." = 'C410'.
    select massn from pa0000 into table lt_pa0000 where begda in s_date and  massn = wa_table-massn.
    *write : / sy-dbcnt.  gt s_date-low and endda lt s_date-high
    *DESCRIBE TABLE LT_PA0000_t LINES LV_LINES.
    move sy-dbcnt to wa_table-total.
    READ TABLE lt_pa0000 INTO LT_PA0000_T WITH KEY MASSN = wa_TABLE-MASSN BINARY SEARCH.
    DESCRIBE TABLE LT_PA0000_t LINES LV_LINES.
    MOVE  LV_LINES to  wa_TABLE-TOTAL.
      MODIFY IT_TABLE FROM WA_TABLE.
    MOVE SY-TABIX TO WA_TABLE-SLNO.
      MODIFY IT_TABLE FROM WA_TABLE.
    REFRESH : LT_PA0000_t.
    CLEAR : LV_LINES.
      ENDLOOP.
    loop at it_table into wa_table.
    SELECT MASSN FROM PA0000 INTO TABLE lt_pa0000 where begda between '01.02.2008' and '20.02.2008'.
    MOVE SY-DBCNT TO   WA_TABLE-APRIL.
    MODIFY IT_TABLE FROM WA_TABLE.
    *endloop.
    *PERFORM STATEMENTS...
    PERFORM FCAT USING '1' 'MASSN' 'ACTIONCODE'.
    PERFORM FCAT USING '2' 'MNTXT' 'ACTION TYPE'.
    PERFORM fcat USING '3' 'TOTAL' 'TOTAL'.
    DEFINE m_fieldcat.
        is_fieldcat-fieldname = &1.
        is_fieldcat-hotspot = &2.
        is_fieldcat-seltext_m = &3.
        is_fieldcat-col_pos = &4.
        is_fieldcat-outputlen = &5.
        is_fieldcat-hotspot = &6.
        append is_fieldcat to it_fcat.
        clear is_fieldcat.
      END-OF-DEFINITION.
       m_fieldcat 'SLNO' '' Text-012 '1' '17'  ''.
      m_fieldcat 'MASSN' '' Text-010 '2' '40'  ''.
      m_fieldcat 'MNTXT'  ''  Text-009  '3' '50' ''  .
      m_fieldcat 'TOTAL'  ''  Text-011  '4' '10' 'X'.
      m_fieldcat 'april'  ''  Text-013  '5' '10' 'X'.
    *FOR DISPLAYING THE RECORDS...
    gd_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = gd_repid
      IS_LAYOUT = GD_LAYOUT
      I_CALLBACK_USER_COMMAND           = ' '
       I_GRID_TITLE                      = 'REPORT'
       IS_LAYOUT                         = gd_LAYOUT
       IT_FIELDCAT                       = IT_FCAT
       I_SAVE                            = 'X'
       IT_EVENTS                         = IT_EVENTS
      TABLES
        T_OUTTAB                          = IT_TABLE.
    **&      Form  FCAT
    *FORM FCAT  USING   FP_COL_POS
                     FP_FIELDNAME
                     FP_SELTEXT_M.
    WA_FCAT-COL_POS = FP_COL_POS.
    WA_FCAT-FIELDNAME = FP_FIELDNAME.
    wa_fcat-seltext_m = fp_seltext_m.
    APPEND WA_FCAT TO IT_FCAT.
    ENDFORM.
    *&      Form  HEADER
          text
    -->  p1        text
    <--  p2        text
    form header .
      DATA : IT_HEADER TYPE SLIS_T_LISTHEADER,
            WA_HEADER LIKE LINE OF it_header.
      WA_HEADER-TYP = 'H'.
      WA_HEADER-INFO = 'ACTION TYPE REPORT'.
      APPEND WA_HEADER TO IT_HEADER.
      wa_header-typ  = 'S'.
      wa_header-key = Text-022.
      CONCATENATE  s_date-low+6(2) '.'
                   s_date-low+4(2) '.'
                   s_date-low(4)
                   temp
                   '.     TO      .'
                   s_date-high+6(2) '.'
                   s_date-high+4(2) '.'
                   s_date-high(4)
                   INTO wa_header-info SEPARATED BY space.
      APPEND wa_header TO it_header.
      CLEAR wa_header.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = IT_HEADER
          I_LOGO             = 'HRRU_51050061'.
    *select single bstkd into CORRESPONDING FIELDS OF gt_vbkd
    *from vbkd where vbeln = rt_outtab-vgbel
    *and posnr = '000000'.
    *rt_outtab-bstkd = gt_vbkd-bstkd.
    ENDFORM.                    " HEADER
    *&      Form  LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM LAYOUT .
    GD_LAYOUT-NO_INPUT = ''.
    gd_layout-colwidth_optimize = ''.
    gd_layout-totals_text = 'TOTALS'(201).
    gd_layout-info_fieldname =      'LINE_COLOR'.
    ENDFORM.                    " LAYOUT

  • Running a ALV Report in bakcground and sending it to Email/FAX

    Hi,
         I am designing a ALV report to send a email/fax/Printer which has to be run in background or foreground according to selection screen inputs.
    I am doing the following
    1. After generating ALV report, converting it to pdf
    2. Sending Email or Fax or Print from selection screen value.
    3. after that scheduling in background using JOB_OPEN and JOB_SUBMIT FM's.
    Can I use SO_DOCUMENT_SEND_API1 FM for both Email and Fax.
    When I schedule the report in the background using JOB_OPEN, at which point I have to code it inside the report. Is it after I generate the ALV Report and Email sending code or before it..
    Thanks

    Hi
    How did you end up doing the emailing? I have the same task.....

  • Cant send an e-mail in ALV report for background executaion

    Hello friends,
    I am displaying ALV report using container.
    Now when i run this report in background, an e-mail should be go with an EXCEL attachment of report.
    I am  able to send e-mail and attachment in foreground .
    I am also able to run alv report in background.
    now, only problem is that i am am not able to send e-mail in background.
    any sujjetions ?
    Points will rewarded if little bit useful.
    Regards,
    nimesh
    if  cl_gui_alv_grid=>offline( ) is initial.
    Create custom container
      CREATE OBJECT g_r_cust_container
        EXPORTING
          container_name = gv_ctrl_custom.
    Create TOP-Document
      CREATE OBJECT g_r_dd_document
        EXPORTING
          style = 'ALV_GRID'.
    Create Splitter for custom_container
      CREATE OBJECT g_r_splitter
        EXPORTING
          parent  = g_r_cust_container
          rows    = 2
          columns = 1.
    Split the grid in two parts- top and grid
      CALL METHOD g_r_splitter->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
          container = g_r_parent_top.
      CALL METHOD g_r_splitter->get_container
        EXPORTING
          row       = 2
          column    = 1
        RECEIVING
          container = g_r_parent_grid.
    Set height for g_parent_html
      CALL METHOD g_r_splitter->set_row_height
        EXPORTING
          id     = 1
          height = 1.
    Create grid object
      CREATE OBJECT g_r_alvgrid
        EXPORTING
          i_parent = g_r_parent_grid. "g_r_cust_container.
    else .
    Create grid object
    CREATE OBJECT g_r_alvgrid
        EXPORTING
          i_parent = or_doc. "g_r_cust_container.
    endif .
    Create object handler object (of type local class)
      CREATE OBJECT g_r_handler.
      SET HANDLER g_r_handler->top_of_page FOR g_r_alvgrid.
      SET HANDLER g_r_handler->print_top_of_page FOR g_r_alvgrid.
      w_disvariant-report  = sy-repid.
      w_disvariant-variant = p_vari.
      CALL METHOD g_r_alvgrid->set_table_for_first_display
        EXPORTING
          i_structure_name = 'ysds_sox_price_change'
          is_layout        = w_layout
          is_variant       = w_disvariant
          i_save           = yc_chara
        CHANGING
          it_outtab        = t_st_result
          it_fieldcatalog  = t_fieldcat[]
          it_sort          = t_sortinfo[].
      CALL METHOD g_r_dd_document->initialize_document
        EXPORTING
          background_color = cl_dd_area=>col_textarea.

    no i am using container for ALV.
    In above code i have mantioned If.......ELSE.....Condition.
    which give me allow to run ALV in background mode but my problem is that  i am not able to send e-mail with attachment in background mode.
    DATA : or_doc  type ref to cl_gui_docking_container .
    My report is working fine in foreground but not able to send email in background.
    so anybody can solve it?

  • 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.

  • Plz provide the alv report

    The purpose of the report is to serve as an indicator for when an existing Purchase Requisitions is updated, and requires a Purchase Order to be changed.  Standard SAP offers no real efficient way to communicate changes/updates between Purchase Requisition and Purchase Order.
    This report will be used to notify a Purchasing Agent that a change has taken place against an existing Purchase Requisition, and the Purchase Order requires to be updated accordingly. This report will be emailed via a batch job to the buyers daily, or can be run on an ad hoc basis
    plz provide the alv report which is related to this discription.
    urgent plz

    The purpose of the report is to serve as an indicator for when an existing Purchase Requisitions is updated, and requires a Purchase Order to be changed.  Standard SAP offers no real efficient way to communicate changes/updates between Purchase Requisition and Purchase Order.
    This report will be used to notify a Purchasing Agent that a change has taken place against an existing Purchase Requisition, and the Purchase Order requires to be updated accordingly. This report will be emailed via a batch job to the buyers daily, or can be run on an ad hoc basis
    plz provide the alv report which is related to this discription.
    urgent plz

  • ABAP dump when running an ALV report in a portal

    Hi,
      I have an ABAP report created in SAP R/3 4.7. Am using the ALV function module REUSE_ALV_GRID_DISPLAY to display the output. The programs runs correctly when run in R/3 using the SAP GUI.
      When the report is run in the portal, I get a runtime error 'MESSAGE_TYPE_X'.
      Please let me know if anybody has faced such issues.
    I checked the OSS note 702732 which talks about increasing the threshold value of the start parameter. But this is not agreed by the BASIS team.
    Thanks,
    Best regards,
    Ajith
    The ST22 error log is as follows:
    What happened?
    The current application program detected a situation which really
    should not occur. Therefore, a termination with a short dump was
    triggered on purpose by the key word MESSAGE (type X).
    What can you do?
    Print out the error message (using the "Print" function)
    and make a note of the actions and input that caused the
    error.
    To resolve the problem, contact your SAP system administrator.
    You can use transaction ST22 (ABAP Dump Analysis) to view and administer
    termination messages, especially those beyond their normal deletion
    date.
    Error analysis
    Short text of error message:
    Data volume (84.550.400 bytes) is too large. (abap/alvgrid/size_nodod_mb
    Technical information about the message:
    Diagnosis
         You tried to send a data record to the front-end that contains
         84.550.400 bytes. However, the data volume is restricted to
         52.428.800 bytes.
    System Response
         The running application program was terminated with a runtime
         error.
    Procedure
         Restrict the data selection if possible or contact your system
         administrator.
    Procedure for System Administration
         You can set the maximum size of these data volumes using the kernel
         parameter 'abap/alvgrid/size_nodod_mb'  (in megabytes).
    Message classe...... "S>"
    Number.............. 890
    Variable 1.......... "84.550.400"
    Variable 2.......... "52.428.800"
    Variable 3.......... " "
    Variable 4.......... " "
    How to correct the error
    Probably the only way to eliminate the error is to correct the program.
    You may able to find an interim solution to the problem
    in the SAP note system. If you have access to the note system yourself,
    use the following search criteria:
    "MESSAGE_TYPE_X" C
    "SAPLAWRT" or "LAWRTU22"
    "ITS_CHECK_ALV_DATA_SIZE"
    If you cannot solve the problem yourself, please send the
    following documents to SAP:
    1. A hard copy print describing the problem.
       To obtain this, select the "Print" function on the current screen.
    2. A suitable hardcopy prinout of the system log.
       To obtain this, call the system log with Transaction SM21
       and select the "Print" function to print out the relevant
       part.
    3. If the programs are your own programs or modified SAP programs,
       supply the source code.
       To do this, you can either use the "PRINT" command in the editor or
       print the programs using the report RSINCL00.
    4. Details regarding the conditions under which the error occurred
       or which actions and input led to the error.
    Information on where terminated
    The termination occurred in the ABAP program "SAPLAWRT" in
    "ITS_CHECK_ALV_DATA_SIZE".
    The main program was "Z_BW_RECON_INV_RPT ".
    The termination occurred in line 25 of the source code of the (Include)
    program "LAWRTU22"
    of the source code of program "LAWRTU22" (when calling the editor 250).
    Source code extract
    000010   FUNCTION ITS_CHECK_ALV_DATA_SIZE.
    000020   *"
    000030   ""Lokale Schnittstelle:
    000040   *"  IMPORTING
    000050   *"     REFERENCE(DATA_TABLE) TYPE  TABLE
    000060   *"
    000070
    000080     data n type i.
    000090     data currsize type i.
    000100     statics maxsize type i.
    000110     data par_value(56).
    000120     if maxsize is initial.
    000130       sy-subrc = 0.
    000140       CALL 'C_SAPGPARAM'  ID 'NAME' FIELD 'abap/alvgrid/size_nodod_MB'
    000150                           id 'VALUE' field par_value.
    000160       if sy-subrc ne 0.
    000170         maxsize = 52428800.       " Default 50 MB
    000180       else.
    000190         maxsize = 1048576 * par_value.
    000200       endif.
    000210     endif.
    000220     describe table data_table lines n.
    000230     currsize = sy-tfill * sy-tleng.
    000240     if currsize gt maxsize.
         >       message x890(s>) with currsize maxsize.
    000260     endif.
    000270   ENDFUNCTION.

    HI,
    This is a Memory problem.
    System is allocated with a Max Memory of 50 MB,(see the dump code, in the last it is hardcoded in the std code)
    The data of your report is coming around 83 MB.
    Restrict your selection criteria of the Object and run the same report and see. it will work.
    Regards,
    Anji

  • Creating spool for ALV report in background

    Hi,
    Can we create a spool request if we run in background/forgorund? please help me..
    I am very much thankful for your quick responses.

    Yes we can create it. Execute the report in background using SM36 and then u can view the output using SM35 or the spool request number and tcode SP01.
    I hope it helps.
    Best Regards,
    Vibha
    *Please mark all the helpful answers

  • '@' not getting displayed in the ALV report

    Hello,
    I am facing  a strange issue in the ALV report display. A string starting with '@' is not getting displayed and says "default icon " on the report. and this is varying from system to system for the same user.
    can anyone please help me in resolving the issue.
    Thanks in advance.
    Thanks and Regards,
    Santhosh Guptha N.

    @ is a default value as per ALV internal process. This is used in icons .
    I think this is causing the confusion.
    Check in the fieldcat if there is any adjsutment to be made to handle this.
    Br,
    Vijay

Maybe you are looking for

  • 32-bit JDK 7 System.out.println not working in IDE

    Hi folks, I have a 64-bit Windows 7 OS. Due to 3rd party library/jar dependencies, i had to install the 32-bit Java JDK 1.7 and Eclipse IDE. I also installed NetBeans. So i have a 64-bit OS and am running 32-bit Java JDK/JRE & IDEs. The problem I am

  • HT4623 transfer to ipod touch

    I was able to download an audio book CD to Itune 11 but do not know how to transfer to my IPOD TOUCH 4th generation...

  • How to click on an Image and fire an event

    Is there anybody who can tell me how to click on an image and fire an event, so I can programmatically use the object? Can the image be used as an object? Thanks in advance Mario Bagnara Chile

  • Can you download CC onto more than one computer?

    I currently have a Mac Book and will be purchasing a PC soon and I want to use it on both of my computers. I am purchasing CC for a class I'm taking but I would also like to use it for personal projects. I just want to know how many time I can downlo

  • How to find list of mc's

    Hi,   how to find out list of mc's per site? i want to add missing mc's to all stores. how to add? plz suggest is there any transaction.