Save ALV Reporrt

Hi
i need to save ALV layout in  grid display. wat to do.
Regards
Rasheed

Hi,
In 'REUSE_ALV_GRID_DISPLAY' set the exporting parameter
I_SAVE                         = 'X '.
By default it is SPACE.
In  OOP ALV Grid display also you have this option.(I_SAVE                         = 'X '. )
Please Close the thread when you got the solution to the problem.
I observed that many of your threads remain open.
Please take time to close them.
Don't forget to reward points for useful answers.
Regards,

Similar Messages

  • Save ALV grid to local excel-file in background

    Hi,
    i want to save a alv grid to an excel-file on a local fileshare using an background job..
    Does anybody know how this works?
    Thanks ahead

    DATA: file TYPE string VALUE `flights.dat`,
          wa   TYPE spfli.
    FIELD-SYMBOLS TYPE x.
    OPEN DATASET file FOR OUTPUT IN BINARY MODE.
    SELECT *
           FROM spfli
           INTO wa.
      ASSIGN wa TO CASTING.
      TRANSFER TO file.
    ENDSELECT.
    CLOSE DATASET file.
    <b>The binary data from database table SPFLI is transferred to a binary file flights.dat</b>

  • Save ALV report output as excel file in background

    Hi all,
    As the no. of records is huge and the running time is long, I'd like to modify my program to be able to run in background mode with excel as output..
    Is there any method to generate the result list in ALV format and save it as an excel file while running the program in background mode?
    And any limitation?
    Thanks!

    Try to create ALV output to spool in background then try to use any of the below mentioned fm
    SAP_CONVERT_TO_XLS_FORMAT
    MS_EXCEL_OLE_STANDARD_DAT
    RSPO_DOWNLOAD_SPOOLJOB
    RH_START_EXCEL_WITH_DATA
    or
    create CSV using OPEN DATASET & TRANSFER

  • Save alv report as excel file directly from program

    Hello guys,
    I require this in my work.
    I want to save the ALV report tat is to be generated in the filepath that is given in the selection screen (want to save it locally eg: my windows desktop) and in the layout which is also given in the selection screen.
    your comments will be very much appreciated.
    Thanks in Advance,
    Johny

    Hi Johny,
    Actually we have an option to download report output in ALV but it does not download the specified on Selection-screen. For this Create on button for Excell download by setting PF status. and use USER_COMMAND event to trigger when u click on the button and download data to specified path.
    1.
    declare events table like this.
    data :
          i_events  type slis_t_event,
          w_events  like line of i_events.
    2.
    Build events table .
    w_events-name = 'USER_COMMAND' .
    w_events-form = 'USER_COMMAND' .
    append w_events to i_events.
    clear w_events.
    w_events-name = 'PF_STATUS_SET' .
    w_events-form = 'PF_STATUS_SET' .
    append w_events to i_events.
    clear w_events.
    3.
    pass this events table through REUSE_ALV_GRID_DISPLAY.
    4.
    USER_COMMAND and PF_STATUS_SET call back subroutines should be like this in your case. These are nowhere called using PERFORM statement in ur program.
    5.
    PF_STATUS_SET' subroutine should be like this.
    *&      Form  pf_status_set
    form pf_status_set    using extab type slis_t_extab.
    set pf-status 'STATUS1' excluding g_extab.
    "If you write like above Standard status will be gone.
    "For that u have to copy standard status of any ALV program which has standard status.
    "1. goto SE41 tcode. give program SAPLKKBL and status :STANDARD_FULLSCREEN .
    2.Click on the Copy status button below program is ur program and status ur program status.
    3. After that create your own button for Excel downlod.
    endform.                    "pf_status_set
    6.
    USER_COMMAND subroutine should be like this.
    *&      Form  user_command
    form user_command using ucomm like sy-ucomm
                      selfield type slis_selfield.
      case ucomm .
        when 'XLS_DOWN'.
        perform download_to_xls.
      endcase.
    endform.                    "user_command
    Here is the sample program to download data into Excel file with header and Columns..
    Check this program by running.
    *& Report  ZVENKAT_DOWNLOAD_XLS_WITH_HEAD
    REPORT  zvenkat_download_xls_with_head.
    "  Data retrieval related declarations
    TYPES:
         BEGIN OF t_emp_dat,
           pernr TYPE pa0001-pernr,
           persg TYPE pa0001-persg,
           persk TYPE pa0001-persk,
           plans TYPE pa0001-plans,
           stell TYPE pa0001-stell,
         END OF t_emp_dat,
         t_attachment TYPE  solisti1.
    DATA:
         w_emp_data TYPE t_emp_dat,
         w_attachment     TYPE  t_attachment.
    DATA:
         i_emp_data TYPE STANDARD TABLE OF t_emp_dat,
         i_attachment     TYPE STANDARD TABLE OF t_attachment.
    PARAMETERS: p_file TYPE string DEFAULT 'c:\tmp\test.xls'.
    "Start-of-selection.
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM build_xls_data_and_download.
      "Form  get_data from PA0001
    FORM get_data.
      SELECT pernr
             persg
             persk
             plans
             stell
       FROM pa0001
       INTO CORRESPONDING FIELDS OF TABLE i_emp_data
       UP TO 4 ROWS.
    ENDFORM.                    " get_data
    "Form  build_xls_data_and_download
    FORM build_xls_data_and_download.
      "If you have Unicode check active in program attributes then
      "you will need to declare constants as follows.
      CLASS cl_abap_char_utilities DEFINITION LOAD.
      CONSTANTS:
          con_tab  TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
          con_cret TYPE c VALUE cl_abap_char_utilities=>cr_lf.
      DATA :l_lines TYPE char10.
      DESCRIBE TABLE i_emp_data LINES l_lines.
      CONCATENATE 'Total no of records:' l_lines
             INTO  w_attachment
    SEPARATED BY  con_tab.
      CONCATENATE con_cret
                  w_attachment
             INTO w_attachment.
      APPEND w_attachment TO i_attachment.
      CLEAR  w_attachment.
      CONCATENATE 'PERNR' 'PERSG' 'PERSK' 'PLANS' 'STELL'
             INTO  w_attachment
    SEPARATED BY  con_tab.
      CONCATENATE con_cret
                  w_attachment
             INTO w_attachment.
      APPEND w_attachment TO i_attachment.
      CLEAR  w_attachment.
      LOOP AT i_emp_data INTO w_emp_data.
        CONCATENATE w_emp_data-pernr
                    w_emp_data-persg
                    w_emp_data-persk
                    w_emp_data-plans
                    w_emp_data-stell
               INTO w_attachment
       SEPARATED BY con_tab.
        CONCATENATE con_cret w_attachment
               INTO w_attachment.
        APPEND w_attachment TO i_attachment.
        CLEAR  w_attachment.
      ENDLOOP.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename              = p_file
          write_field_separator = con_tab
        TABLES
          data_tab              = i_attachment.
      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.                    "build_xls_data_and_download
    I hope that it helps u .
    Regards,
    Venkat.O

  • Save ALV Layout

    Hi
    I need to save chaged layout in ALV GRID DISPLAY
    I am using I_save = 'A' but iam unable to save the layout
    wat could be reason
    Give me suggestion
    Regards

    first declare two variables :
    it_variant LIKE disvariant,
          it_variant_return LIKE it_variant.
    then declare parameter for variant on selection screen.
    PARAMETER p_vari LIKE disvariant-variant.
    and then use this function module which will provide u f4 help for parameter on selection screen.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
      it_variant-report = sy-repid.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          is_variant    = it_variant
          i_save        = 'A'
        IMPORTING
          es_variant    = it_variant_return
        EXCEPTIONS
          not_found     = 1
          program_error = 2
          OTHERS        = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE 'S'      NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
        p_vari = it_variant_return-variant.
      ENDIF.
    and finally pass this variant to REUSE_ALV_GRID_DISPLAY
    as.....
    is_variant             = it_variant_return
    after all this when u run ur report then in the tool bar u will see save layout option which will be the last one them save it with that name. next time when ever u run that report then it will give u name of variant in the parameter a sf4 help.
    plz reward point if helpful.
    with this u will sure use variant.

  • How to save alv report

    Hi,
    I want to allow the user to save the alv report. I could not enable to save button in my report.
    I could save only layout..not the result of the report.
    my code is
    data:is_variant type disvariant.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM = sy-repid
          I_STRUCTURE_NAME   = 'ZSQUANT_V1'
          I_DEFAULT          = 'X'
          I_SAVE             = 'A'
          IS_VARIANT         = is_variant
        TABLES
          T_OUTTAB           = <int>
        EXCEPTIONS
          PROGRAM_ERROR      = 1
          OTHERS             = 2.

    When ALV report display's the out put, you have option of using EXPORT ICON in the default ALV report Icons right.
    So using that icon you can save.
    In the function module that SAVE is for variants for the report.
    Hope this will help.

  • To save ALV output as a PDF file

    Hi,
    We have the requirement to save an ALV report output(FM used:REUSE_ALV_GRID_DISPLAY) to a PDF file. Standard ALV buttons doesnot have this functionality.
    We have a custom button on the tool bar,Clicking this button should save the output as a PDF format file.Please guide How to achieve this ?any FM available?
    Regards,
    Khader.

    Hello All,
    PDF conversion is working fine with the below approach. But physical print is happening since I called GET_PRINT_PARAMETERS.
    Is there a way to control this anywhere? I mean I dont wnat that document to be printed on my printer.
    1) Call GET_PRINT_PARAMETERS
    2)*Store the current selection screen details
          CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
            EXPORTING
              curr_report     = sy-repid
            TABLES
              selection_table = t_rsparams.
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
          t_rsparams-selname = 'P_DUMMY'.
          t_rsparams-low  = 'X'.
          APPEND t_rsparams.
    *submit to get the spool number
          SUBMIT ztr_hrg_report WITH SELECTION-TABLE t_rsparams
                                       TO SAP-SPOOL
                                       SPOOL PARAMETERS gs_print_parms
                                       WITHOUT SPOOL DYNPRO
                                       AND RETURN.
    3)CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          src_spoolid              = w_spool_nr
          no_dialog                = space
          dst_device               = gs_print_parms-pdest
         pdf_destination          = 'X'
        IMPORTING
          pdf_bytecount            = g_bytecount
        TABLES
          pdf                      = t_pdf
    Please help.

  • How to save ALV extract to document management system

    Hi all,
    i have a requirement of saving the alv extract to DOCUMENT MANAGEMENT SYSTEM. Could any one of you please help me out in giving a solution to do this.
    Thanks in advance.
    Kiran

    Hi
    check this
    SAP DMS - Document Management System
    SAP DMS are for storing documents such as CAD drawings, Materials pictures etc.
    With the document management system, users will be able to view the documents with ease within their SAP systems.
    Installing the SAP DMS requires a little bit of planning on how you want to do it.
    You have to give a little thoughts to stuff such as :-
    1.  The total numbers of documents that will be store monthly.
    2.  The average file size of each documents.
    3.  The capacity of your present R/3 system.
    4.  Your present network bandwidth.
    5.   Document Archiving Strategy.
    6.   Backup and Recovery Plan.
    Additional purchasing of hardware are required, especially if you have large amount of documents to stored.
    With this in mind, you can then decide on how you want to do it.
    You can do this in a few ways :-
    1.  Import the documents into the R/3 system.
    2.  Use an external document server.
    3.  Have a dedicated PCs where all the documents are stored.
    Most companies that intend to used DMS will opt for Option 2 as they does not want to overstretch the R/3 database.
    Options 1 requires you to setup the conversion interface. 
    The conversion interface allows R/3 to automatically covert your files and import it into the R/3 database.
    Here is a simple example of storing documents into your PCs, just to have a feel how the SAP DMS works:-
    For those using Citrix, you have to set this at the Citrix Server where the SAPGUI is located.
    Configure SM30 - V_TDWE_C1
    Put this command in your autoexec.bat
    SET HOSTNAME=PC1234
    Restart your pc.
    You can create/manage your documents in transaction code CV01N / CV02N
    Assigning Documents to a Material Master Record
    Access a material master record in Create or Change mode, and select Basic Data. 
    To create links to documents, choose Additional data -> Document data.
    The Link to Documents dialog box appears.
    Assign one or more documents to the material. 
    If you do not know what the document number is, you can search for it using the search help or by choosing Find document.
    When assigning a document to a material, you have the following options:
    1. Viewing the document by choosing it in the Link to Documents dialog box.
    2. Viewing any originals of the document by positioning the cursor on the document and 
       choosing Display originals in the Link to Documents dialog box.
    To return to the Basic Data screen, choose Continue.
    Save your data. 
    Regards
    Anji

  • How to save ALV data at runtime...?

    Dear All,
    How to Save the data of ALV report at Runtime... (I have to save data in to an internal table).
    regards.

    You mean that you have to get the data from a submitted program's output(alv output)?
    Regards,
    Rich HEilman

  • How to save ALV data into DB after Editing values in WDA

    Hi All,
    I have created a WD application with and able to successfully make columns editable in ALV. But I failed when trying to save the edited data in database.
    I use ON_CELL_ACTION event but its not working as of now. I go through few blocks but ultimately i got confused. Please guide me in correct way.

    Hi Sanjib,
    ON_DATA_CHECK  event is triggered every time when you change the data in table
    For this event, you have to implement an Event Handler method in which the logic is written.
    There is already a thread where this question has been answered:
    ALV Edit how to save changes to DB??
    I would suggest that you search more on scn before starting a discussion
    Regards,
    Ashvin

  • Can't save ALV layout as user-specific

    Hi!
    Whenever I try to save an ALV layout the option User-specific is grayed out, so all variants will be public.
    Users would like to save their own layouts safe from other users, as happens with program variants.
    First of all then, is there any authorization object related to the User-specific option that my roles are missing?
    I read somewhere that 'user-specific' option is controlled by auth. S_ALV_LAYO, ACTVT = 23, yet I have
    this auth object with ACTVT = *.
    Second, if this option was available, would this let users create their own layouts so that other users don't
    overwrite them?
    thanks
    gracias
    xiè xiè

    in the resue FM check the I_SAVE which value are you passing:
    Value range
    ' ' = Display variants cannot be saved
    Defined display variants (such as delivered display variants) can be selected for presentation regardless of this indicator. However, changes cannot be saved.
    'X' = Standard save mode
    Display variants can be saved as standard display variants.
    Saving display variants as user-specific is not possible.
    'U' = User-specific save mode
    Display variants can only be saved as user-specific.
    'A' = Standard and user-specific save mode
    Display variants can be saved both as user-specific and as standard
    variants. Users make their choice on the dialog box for saving the
    display variant.

  • F4 help before save - ALV Grid in Module Pool

    Hi,
       I am calling an ALV Grid using CL_GUI_A;V_GRID. When I create a new record, I need F4 help for a particular field based on the entries in 2 other fields. Thing is I can't use DATA_CHANGED event coz then I won't be able to display the F4 button. And F4 option doesn't pass the data that has been changed(ER_CHANGED_DATA table). So frustrating. Can anyone help me plz???
    Thanks in advance,
    Poornima L Nathan

    Hi ,
    i think you are missing one params while registering your F4 fields..
      ls_f4-register   = 'X'.
      ls_f4-getbefore  = 'X'.
      ls_f4-chngeafter = 'X'.
    Documentatin of SAP program *BCALV_EDIT_08*
    *   1b. If the value range in your f4 help depends on other
    *       values of cells that are input enabled, set the
    *       GETBEFORE parameter.
    now you can use row_indx no to read your internal table
    regards
    Prabhu
    Edited by: Prabhu Peram on Aug 23, 2011 2:11 PM

  • How do I save ALV Grid O/P to spool

    Hi All,
               I have a requirement of saving alv grid output to spool. How can this be done?
    could I get any help on this?
    Thanks & Regards,
    Deepak Raj

    DATA: BEGIN OF i_mara OCCURS 0,
      matnr LIKE mara-matnr.
      DATA: END OF i_mara.
      DATA: v_dest LIKE tsp01-rqdest,
      v_handle LIKE sy-tabix,
      v_spool_id LIKE tsp01-rqident,
      v_rc TYPE c,
      v_errmessage(100) TYPE c,
      v_text(70) TYPE c.
    START-OF-SELECTION.
      SELECT matnr FROM mara INTO TABLE i_mara.
      CALL FUNCTION 'RSPO_OPEN_SPOOLREQUEST'
           EXPORTING
                dest            = 'LOCL'
               layout          =
               name            =
               suffix1         =
               suffix2         =
               copies          =
               prio            =
               immediate_print =
               auto_delete     =
               titleline       =
               receiver        =
               division        =
               authority       =
               posname         =
               acttime         =
                lifetime        = '8'
               append          =
               coverpage       =
               codepage        =
               doctype         =
           importing
                handle          = v_handle
                spoolid         = gd_spool_nr
                rc              = v_rc
                errmessage      = v_errmessage.
      LOOP AT i_mara.
        v_text = i_mara-matnr.
        CALL FUNCTION 'RSPO_WRITE_SPOOLREQUEST'
             EXPORTING
                  handle           = v_handle
                  text             = v_text
                  length           =
                  codepage         =
                  truncate         =
             importing
                  rc               = v_rc
                  errmessage       = v_errmessage
             EXCEPTIONS
                  handle_not_valid = 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.
      ENDLOOP.
      CALL FUNCTION 'RSPO_CLOSE_SPOOLREQUEST'
           EXPORTING
                handle           = v_handle
           IMPORTING
                rc               = v_rc
                errmessage       = v_errmessage
           EXCEPTIONS
                handle_not_valid = 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.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount            = gd_bytecount
           TABLES
                pdf                      = it_pdf_output
           EXCEPTIONS
                err_no_abap_spooljob     = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_destdevice       = 5
                user_cancelled           = 6
                err_spoolerror           = 7
                err_temseerror           = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed  = 11
                OTHERS                   = 12.
      CHECK sy-subrc = 0.
    get the spool number
    Declaration of local variables.
      DATA:
      lv_rq2name LIKE tsp01-rq2name.
      CONCATENATE sy-repid+0(8)
      sy-uname+0(3)
      INTO lv_rq2name SEPARATED BY '_'.
    Get the spool number.
      SELECT * FROM tsp01 WHERE rq2name = lv_rq2name
      ORDER BY rqcretime DESCENDING.
        v_rqident = tsp01-rqident.
        EXIT.
      ENDSELECT.
      IF sy-subrc NE 0.
        CLEAR v_rqident.
      ENDIF

  • How to save ALV list  and send listoutput as email in background process

    Can anyone tell me if an ALV list report could be saved as LIST using 'LIST_TO_MEMORY' and then by using 'LIST_FROM_MEMORY' we need to read the list. If so How?
    I don't want to use 'Submit....exporting list to memory and return' as then I have to trigger my program twice.
    Finally with one program itself i want to get the listoutput and send the list output as an email to the customer in background.
    I have gone through the forums and could see many of them facing the same problem, but could not find the solution in the forums.
    Waiting for a reply
    Santhoshi

    if you want to send mail with the same data as you display in ALV, you can use the same internal table,which you sent to ALV_LIST_DISPLAY function module.
    take the email ids from the user on the selection-screen & use the below code to send mail to them.
    call this FORM F_SEND_MAIL before you called the ALV function module.
    FORM F_SEND_MAIL .
      CLEAR WA_RECLIST.
      REFRESH IT_RECLIST.
    *-popualate email ids
    *--Receipient 1
    this receipient can be select-option from the selection screen. or can be hardcoded as below.
      WA_RECLIST-RECEIVER = '[email protected]'.
      WA_RECLIST-REC_TYPE = C_U.
      WA_RECLIST-EXPRESS  = C_X.
    *--append receiver table
      APPEND WA_RECLIST TO IT_RECLIST.
      CLEAR : WA_RECLIST.
    *--Receipient 2
      WA_RECLIST-RECEIVER = '[email protected]'.
      WA_RECLIST-REC_TYPE = C_U.
      WA_RECLIST-EXPRESS  = C_X.
    *-append receiver table
      APPEND WA_RECLIST TO IT_RECLIST.
      CLEAR : WA_RECLIST.
    *--populate document attributes
      CLEAR: X_DOC_CHNG.
      X_DOC_CHNG-OBJ_NAME = 'HEADING'.
      CONCATENATE 'Japan BOL details for the delivery#'(003)
                  V_VBELN
                  INTO X_DOC_CHNG-OBJ_DESCR SEPARATED BY SPACE.
    *-populate body text
    CONCATENATE 'Japan BOL details for the Delivery#'(003)
      CONCATENATE TEXT-003
                   V_VBELN
                   ',is attached'
                   INTO WA_OBJTXT SEPARATED BY SPACE.
      APPEND WA_OBJTXT TO IT_OBJTXT.
    *---- Append Date and Time into Body of email.
      MOVE 'File is generated on'(004) TO V_INFO.
      V_TIME = SY-UZEIT.
    WRITE : SY-UZEIT TO V_TIME USING EDIT MASK '__:__:__'.
      CONCATENATE V_TIME+0(2)
                  V_TIME+2(2)
                  V_TIME+4(2)
                  INTO
                  V_TIME2 SEPARATED BY ':'.
       WRITE : sy-datum MM/DD/YYYY TO lv_date .
      CONCATENATE SY-DATUM+4(2)
                  SY-DATUM+6(2)
                  SY-DATUM+0(4)
                  INTO V_DATE.
      CONCATENATE V_INFO
                  V_DATE
                  'At'
                  V_TIME2
                  INTO V_INFO
                  SEPARATED BY SPACE.
      WA_OBJTXT = V_INFO.
      APPEND WA_OBJTXT TO IT_OBJTXT.
    *-document size
      CLEAR : V_TABLE_LINES.
      DESCRIBE TABLE IT_OBJTXT LINES V_TABLE_LINES.
      READ TABLE IT_OBJTXT INTO WA_OBJTXT INDEX V_TABLE_LINES.
      X_DOC_CHNG-DOC_SIZE =
                     ( V_TABLE_LINES - 1 ) * 255 + STRLEN( WA_OBJTXT ).
    *-populate packing list for body text
    CLEAR IT_OBJPACK-TRANSF_BIN.
      WA_OBJPACK-HEAD_START = 1.
      WA_OBJPACK-HEAD_NUM = 0.
      WA_OBJPACK-BODY_START = 1.
      WA_OBJPACK-BODY_NUM = V_TABLE_LINES.
      WA_OBJPACK-DOC_TYPE = 'RAW'.
      APPEND WA_OBJPACK TO IT_OBJPACK.
      CLEAR WA_OBJPACK.
    *--for attachment
    *--add Internal table lines here, as attachment.
    *--IT_FINAL IS THE internal table which you used to display the result as ALV output
      loop at IT_FINAL.
        CONCATENATE IT_FINAL-FIELD1
                    IT_FINAL-FIELD2
    *--AND SO ON
             INTO WA_OBJBIN.
      APPEND WA_OBJBIN TO IT_OBJBIN.
      CLEAR  WA_OBJBIN.
    ENDLOOP.
    *-get total no.of lines of Object table(attachment)
      CLEAR : V_TABLE_LINES.
      DESCRIBE TABLE IT_OBJBIN LINES V_TABLE_LINES.
    *-populate object header
      CONCATENATE  'Delivery#'(005)
                     V_VBELN
                     SY-DATUM
                     V_TIME
                     INTO
                     WA_OBJHEAD SEPARATED BY SPACE.
      APPEND WA_OBJHEAD TO IT_OBJHEAD.
      CLEAR  WA_OBJHEAD.
    *-packing list for attachment
      WA_OBJPACK-TRANSF_BIN = C_X.
      WA_OBJPACK-HEAD_START = 1.
      WA_OBJPACK-HEAD_NUM = 1.
      WA_OBJPACK-BODY_START = 1.
      WA_OBJPACK-BODY_NUM = V_TABLE_LINES .
    WA_OBJPACK-DOC_TYPE = 'CSV' .
      WA_OBJPACK-DOC_TYPE = 'RAW' .
      WA_OBJPACK-OBJ_NAME = 'POTR'.
    CONCATENATE 'Delivery details for '(005)
      CONCATENATE TEXT-005
                V_VBELN
                SY-DATUM
                V_TIME
                '.CSV'
                INTO
                WA_OBJPACK-OBJ_DESCR SEPARATED BY SPACE.
      BREAK-POINT.
      WA_OBJPACK-DOC_SIZE = V_TABLE_LINES * 255.
      APPEND WA_OBJPACK TO IT_OBJPACK.
      CLEAR  WA_OBJPACK.
    *-Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA              = X_DOC_CHNG
          PUT_IN_OUTBOX              = C_X
          COMMIT_WORK                = C_X
        TABLES
          PACKING_LIST               = IT_OBJPACK
          OBJECT_HEADER              = IT_OBJHEAD
          CONTENTS_BIN               = IT_OBJBIN
          CONTENTS_TXT               = IT_OBJTXT
          RECEIVERS                  = IT_RECLIST
        EXCEPTIONS
          TOO_MANY_RECEIVERS         = 1
          DOCUMENT_NOT_SENT          = 2
          DOCUMENT_TYPE_NOT_EXIST    = 3
          OPERATION_NO_AUTHORIZATION = 4
          PARAMETER_ERROR            = 5
          X_ERROR                    = 6
          ENQUEUE_ERROR              = 7
          OTHERS                     = 8.
      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.                    " F_SEND_MAIL
    Regards
    srikanth
    added comments
    Message was edited by: Srikanth Kidambi

  • Fewer than expected group outlines after display Excel inplace ALV

    After upgrade 4.6 to ECC, I save alv grid layout with sorting and total function .  If you switch to the Excel inplace display in ALV, the system displays an "group outlines" option in only first page (nearly 14 groups) . But the next page cannot group the same data in  1 value and no yellow color in subtotal lines
    For example :
    Current :     
    Material number   |  transaction data |   origin   | actual cost   |
      10                     |  Good issue       |    A        |   10              |
      10                     |  Good issue       |    B        |   20              |
      10                     |   Good issue      |    C        |   30              |
    10                     |  Good issue       |              |   60              | *   >>> No yellow color
    Need :
    Material number   |  transaction data |   origin   | actual cost   |
      10                     |  Good issue       |    A        |   10              |
    B
    20
    C
    30
    10                     |  Good issue       |              |   60              | *   >>> Have yellow color
    Please give me the solution ...

    I apply many sap note but it can not solve this issue...
    1046560 WD ABAP ALV (SP13): Eliminate duplicate code
    1065242 WD ABAP ALV (SP13): Export to Excel, Problems during load
    1067707  WD ABAP ALV (SP13): Export Excel hyperlink w/o reference
    1075242 WD ABAP, ALV, export, Excel, counting table entries
    1083072 ABAP ALV Export: Missing icon display
    1084202 ABAP: ALV export: Icons missing in subtotals
    Please help to solve this problem ...

Maybe you are looking for

  • Adobe Reader X crashes when connected to Internet

    I have several systems which I've updated to Adobe Reader X.  On *one* of the systems, Reader crashes ~10 seconds after opening it.  This happens whether I open a document or just the application with no document.  Platform is WinXP-32.  There are no

  • Module exist in the cache of the company web server

    Hi, I am accessing my Flex Application through the web server of my company. Just today, I have noticed that the module which my flex application downloads is not the latest version of the module. I have deleted the module from my PC internet cache b

  • Sequence setup incorrectly

    Hi, I have an entity, where its id is generated by a sequence. The sequence was created as follows, in an oracle DB CREATE SEQUENCE SEQ_BITACORA INCREMENT BY 1 START WITH 1 MAXVALUE 999999999999 MINVALUE 1 ; In the entity class I have set the generat

  • How do I get this fixed?

    "there is a problem with Adobe Acrobat/Reader.  If it is running, please exist and try again. (103:103).

  • MBP running slow after 10.9.2 update

    I have a late 2011 macbook pro & here's what's going on, it takes up to 10 minutes or so just to boot up, plus another 5 to 8 minutes to log in while watching the spinning ball, when I eventually log in, it takes about 30 seconds to a minute & a half