Skip to Content
author's profile photo Former Member
Former Member

how to send the report output to the application server in a excel file

Hello,

how to send the report output to the application server in a excel file.

and the report runs in background.

Thanks in advance.

Sundeep

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 04:00 PM

    u can't send an excel sheet to application server...Data is transffered to application server as a file which has strings as records....if ur file has 100 records then 100 strings are dumped into 1 file which is stored in application server file path....

    to do this u should use DATASET concept.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 04:09 PM

    Dear Sundeep.

    I'm providing you with the following piece of code ... Its working fine for me ... hopefully it suits your requirement ...

    ************************************************************************

    • D A T A D E C L A R A T I O N *

    ************************************************************************

    TYPES: BEGIN OF TY_EXCEL,

    CELL_01(80) TYPE C,

    CELL_02(80) TYPE C,

    CELL_03(80) TYPE C,

    CELL_04(80) TYPE C,

    CELL_05(80) TYPE C,

    CELL_06(80) TYPE C,

    CELL_07(80) TYPE C,

    CELL_08(80) TYPE C,

    CELL_09(80) TYPE C,

    CELL_10(80) TYPE C,

    END OF TY_EXCEL.

    DATA: IT_EXCEL TYPE STANDARD TABLE OF TY_EXCEL,

    WA_EXCEL TYPE TY_EXCEL..

    ************************************************************************

    • E V E N T : S T A R T - O F - S E L E C T I O N *

    ************************************************************************

    START-OF-SELECTION.

    • Here you populate the Internal Table.

    • -------------------------------------

    • Display - Top of the Page.

    • --------------------------------------

    PERFORM DISPLAY_TOP_OF_PAGE.

    ************************************************************************

    • E V E N T : E N D - O F - S E L E C T I O N *

    ************************************************************************

    END-OF-SELECTION.

    SET PF-STATUS 'GUI_STATUS'.

    ************************************************************************

    • E V E N T : A T U S E R - C O M M AN D *

    ************************************************************************

    AT USER-COMMAND.

    CASE SY-UCOMM.

    WHEN 'EXPORT'.

    • Exporting the report data to Excel.

    PERFORM EXPORT_TO_EXCEL.

    ENDCASE.

    &----


    *& Form DISPLAY_TOP_OF_PAGE

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM DISPLAY_TOP_OF_PAGE .

    SKIP.

    WRITE: /05(128) SY-ULINE,

    /05 SY-VLINE,

    06(127) 'O R I C A'

    CENTERED COLOR 1,

    132 SY-VLINE.

    WRITE: /05(128) SY-ULINE,

    /05 SY-VLINE,

    06(127) 'Shift Asset Depreciation - Period/Year-wise Report.'

    CENTERED COLOR 4 INTENSIFIED OFF,

    132 SY-VLINE.

    WRITE: /05(128) SY-ULINE.

    *----


    • E X C E L O P E R A T I O N

    *----


    CLEAR: IT_EXCEL[],

    WA_EXCEL.

    PERFORM APPEND_BLANK_LINE USING 1.

    WA_EXCEL-cell_02 = ' XYZ Ltd. '.

    APPEND WA_EXCEL TO IT_EXCEL.

    CLEAR: WA_EXCEL.

    WA_EXCEL-cell_02 = 'Shift Asset Depreciation - Period/Year-wise Report.'.

    APPEND WA_EXCEL TO IT_EXCEL.

    PERFORM APPEND_BLANK_LINE USING 1.

    ENDFORM. " DISPLAY_TOP_OF_PAGE

    &----


    *& Form APPEND_BLANK_LINE

    &----


    • text

    ----


    • -->P_1 text

    ----


    FORM APPEND_BLANK_LINE USING P_LINE TYPE I.

    DO P_LINE TIMES.

    CLEAR: WA_EXCEL.

    APPEND WA_EXCEL TO IT_EXCEL.

    enddo.

    ENDFORM.

    &----


    *& Form EXPORT_TO_EXCEL

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM EXPORT_TO_EXCEL .

    DATA: L_FILE_NAME(60) TYPE C.

    • Create a file name

    CONCATENATE 'C:\' 'Shift_Depn_' SY-DATUM6(2) '.' SY-DATUM4(2)

    '.' SY-DATUM+0(4) INTO L_FILE_NAME.

    • Pass the internal table (it_excel which is already populated )

    • to the function module for excel download.

    CALL FUNCTION 'WS_EXCEL'

    exporting

    filename = L_FILE_NAME

    tables

    data = IT_EXCEL

    exceptions

    unknown_error = 1

    others = 2.

    if sy-subrc <> 0.

    message e001(ymm) with 'Error in exporting to Excel.'.

    endif.

    ENDFORM. " EXPORT_TO_EXCEL

    *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    When you click the button - Export to Excel ( GUI-Status) you'll be able to export the content of the Internal Table to an Excel file .......

    Regards,

    Abir

    ************************************

    • Don't forget to award Points *

                                                                        Add a comment
                                                                        10|10000 characters needed characters exceeded

                                                                      • author's profile photo Former Member
                                                                        Former Member
                                                                        Posted on Jan 10, 2007 at 04:32 PM

                                                                        Hello Biswas,

                                                                        Thanks for your answer.but ur not getting my problem.my problem is not generating the excel file but to send it to the application server and the report runs in back ground.so their is no question of push button.

                                                                        Add a comment
                                                                        10|10000 characters needed characters exceeded

                                                                      • author's profile photo Former Member
                                                                        Former Member
                                                                        Posted on Jan 11, 2007 at 11:35 AM

                                                                        thank for the help.

                                                                        Add a comment
                                                                        10|10000 characters needed characters exceeded

                                                                      Before answering

                                                                      You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
                                                                      You must be Logged in to submit an answer.

                                                                      Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.