Display header for excel output using FM GUI_DOWNLOAD

Good morning experts,
                 I've been exporting my output in excel using the FM GUI_DOWNLOAD.  The problem is, my header is not displaying.  Kindly check what I've done wrong.  Below is how I declared my header.
DATA: BEGIN OF header OCCURS 0,
        head1(15),
        head2(15),
      END OF header.
*&      FORM USER_COMMAND
      COMMAND for ALV Grid Buttons
FORM user_command USING r_ucomm LIKE sy-ucomm
                  rs_selfield TYPE slis_selfield.
PERFORM write_header.
CASE r_ucomm.
  WHEN 'XCEL'.
    CONCATENATE: 'C:\' fname sy-datum INTO fname.
    CONCATENATE: fname '.XLS' INTO FILENAME.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        FILENAME = FILENAME
        WRITE_FIELD_SEPARATOR = 'X'
      TABLES
        DATA_TAB = jtab
        FIELDNAMES = header
      EXCEPTIONS
        FILE_WRITE_ERROR        = 1
        NO_BATCH                = 2
        GUI_REFUSE_FILETRANSFER = 3
        INVALID_TYPE            = 4
        NO_AUTHORITY            = 5
        UNKNOWN_ERROR           = 6
        HEADER_NOT_ALLOWED      = 7
        SEPARATOR_NOT_ALLOWED   = 8
        FILESIZE_NOT_ALLOWED    = 9
        HEADER_TOO_LONG         = 10
        DP_ERROR_CREATE         = 11
        DP_ERROR_SEND           = 12
        DP_ERROR_WRITE          = 13
        UNKNOWN_DP_ERROR        = 14
        ACCESS_DENIED           = 15
        DP_OUT_OF_MEMORY        = 16
        DISK_FULL               = 17
        DP_TIMEOUT              = 18
        FILE_NOT_FOUND          = 19
        DATAPROVIDER_EXCEPTION = 20
        CONTROL_FLUSH_ERROR = 21
        OTHERS = 22.
      IF sy-subrc <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ELSEIF sy-subrc = 0.
        MESSAGE S000(38) WITH 'File ' fname 'saved in Drive C.'.
      ENDIF.
ENDCASE.
ENDFORM.
*&      Form  write_header
      text
-->  p1        text
<--  p2        text
FORM write_header.
DATA: ctr(2) TYPE p.
DO 6 TIMES.
  ADD 1 TO ctr.
  CASE ctr.
    WHEN 1. header-head1 = 'EMPLOYEE'.
            header-head2 = '   NO   '.
    WHEN 2. header-head1 = 'EMPLOYEE'.
            header-head2 = '  NAME  '.
    WHEN 3. header-head1 = 'LOAN'.
            header-head2 = 'TYPE'.
    WHEN 4. header-head1 = 'APPROVAL'.
            header-head2 = '  DATE  '.
    WHEN 5. header-head1 = 'LOAN'.
            header-head2 = 'CODE'.
    WHEN 6. header-head1 = '   MONTHLY  '.
            header-head2 = 'AMORTIZATION'.
  ENDCASE.
  APPEND header.
  CLEAR: header.
Please help me.  All helpful advice will be rewarded points.  Thanks a lot.

Follow this Example. You can do it in the below manner
You need not add HEADER1 HEADER2 to the internal table. You can just declare one field like below and append all the header columns to the internal table HEADER
data : begin of IT_HEADING occurs 0,
         TEXT(15),
       end of IT_HEADING.
    IT_HEADING-TEXT = 'Company Code'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'PO Number'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'PO Line Item'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'SO Number'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'SO Line Item'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'PO Quantity'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'PO Unit'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'PO Amount'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'PO Currency'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'Job Number'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'SO Quantity'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'SO Unit'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'SO Amount'.
    append IT_HEADING.
    IT_HEADING-TEXT = 'SO Currency'.
    append IT_HEADING.
    move P_FNAME to L_FNAME.
    call function 'GUI_DOWNLOAD'
      exporting
        FILENAME                = L_FNAME
        FILETYPE                = 'DAT'
      tables
        DATA_TAB                = IT_FINAL
        FIELDNAMES              = IT_HEADING
      exceptions
        FILE_WRITE_ERROR        = 1
        NO_BATCH                = 2
        GUI_REFUSE_FILETRANSFER = 3
        INVALID_TYPE            = 4
        NO_AUTHORITY            = 5
        UNKNOWN_ERROR           = 6
        HEADER_NOT_ALLOWED      = 7
        SEPARATOR_NOT_ALLOWED   = 8
        FILESIZE_NOT_ALLOWED    = 9
        HEADER_TOO_LONG         = 10
        DP_ERROR_CREATE         = 11
        DP_ERROR_SEND           = 12
        DP_ERROR_WRITE          = 13
        UNKNOWN_DP_ERROR        = 14
        ACCESS_DENIED           = 15
        DP_OUT_OF_MEMORY        = 16
        DISK_FULL               = 17
        DP_TIMEOUT              = 18
        FILE_NOT_FOUND          = 19
        DATAPROVIDER_EXCEPTION  = 20
        CONTROL_FLUSH_ERROR     = 21
        others                  = 22.
    if SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
Regards
Gopi

Similar Messages

  • Displaying header in excel horizontally using FM GUI_DOWNLOAD

    Dear Experts,
            I'm exporting my data to an excel file using GUI_DOWNLOAD.  The problem is that I'm having problems with exporting the headings of my excel.  I can export the heading but the problem is that it is displayed vertically and not horizontally.
    Is there a way I could display the heading horizontally?  Hope you could help me.
    Below is my program.
    DATA: BEGIN OF itab OCCURS 0,
                  DVNO TYPE ZPFHEADER-DVNO,
                  EMPNO(8),
                  EMPNAME LIKE PA0002-CNAME,
                  LTYPE LIKE it_header-wtype,
                  LCODE LIKE it_header-dkond,
                  MA(6) TYPE p DECIMALS 2,
                  APRVDATE(15),
                  DTL LIKE ZPFHEADER-DVNO,
              END OF itab.
    DATA: BEGIN OF header OCCURS 0,
                  head1(15) TYPE c,
                  head2(15) TYPE c,
              END OF header.
    PERFORM DISPLAY_DATA.
          FORM DISPLAY_DATA                                             *
    FORM DISPLAY_DATA.
          CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
            EXPORTING
              i_callback_program = g_repid
              I_CALLBACK_PF_STATUS_SET = 'PF_STATUS'
              I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
              is_layout          = gs_layout
              it_fieldcat        = gt_fieldcat[]
              it_events          = gt_events[]
            TABLES
              t_outtab           = jtab.
    ENDFORM.
    *&      FORM USER_COMMAND
          COMMAND for ALV Grid Buttons
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    PERFORM write_header.
    CASE r_ucomm.
      WHEN 'XCEL'.
        CONCATENATE: 'C:\' fname sy-datum INTO fname.
        CONCATENATE: fname '.XLS' INTO FILENAME.
        CALL FUNCTION 'GUI_DOWNLOAD'
          EXPORTING
            FILENAME = FILENAME
            HEADER = '00'
            WRITE_FIELD_SEPARATOR = 'X'
          TABLES
            DATA_TAB   = header
            FIELDNAMES = header.
        CALL FUNCTION 'GUI_DOWNLOAD'
          EXPORTING
            FILENAME = FILENAME
            APPEND   = 'X'
            WRITE_FIELD_SEPARATOR = 'X'
          TABLES
            DATA_TAB = jtab
          EXCEPTIONS
            FILE_WRITE_ERROR        = 1
            NO_BATCH                = 2
            GUI_REFUSE_FILETRANSFER = 3
            INVALID_TYPE            = 4
            NO_AUTHORITY            = 5
            UNKNOWN_ERROR           = 6
            HEADER_NOT_ALLOWED      = 7
            SEPARATOR_NOT_ALLOWED   = 8
            FILESIZE_NOT_ALLOWED    = 9
            HEADER_TOO_LONG         = 10
            DP_ERROR_CREATE         = 11
            DP_ERROR_SEND           = 12
            DP_ERROR_WRITE          = 13
            UNKNOWN_DP_ERROR        = 14
            ACCESS_DENIED           = 15
            DP_OUT_OF_MEMORY        = 16
            DISK_FULL               = 17
            DP_TIMEOUT              = 18
            FILE_NOT_FOUND          = 19
            DATAPROVIDER_EXCEPTION = 20
            CONTROL_FLUSH_ERROR = 21
            OTHERS = 22.
          IF sy-subrc <> 0.
          ELSEIF sy-subrc = 0.
            MESSAGE S000(38) WITH 'File ' fname 'saved in Drive C.'.
          ENDIF.
    ENDCASE.
    ENDFORM.
    *&      Form  write_header
          text
    -->  p1        text
    <--  p2        text
    FORM write_header.
    DATA: ctr(2) TYPE N.
    DO 6 TIMES.
      ADD 1 TO ctr.
      CASE ctr.
        WHEN 1. header-head1 = 'EMPLOYEE'.
                header-head2 = ' NO '.
        WHEN 2. header-head1 = 'EMPLOYEE'.
                header-head2 = ' NAME '.
        WHEN 3. header-head1 = 'LOAN'.
                header-head2 = 'TYPE'.
        WHEN 4. header-head1 = 'APPROVAL'.
                header-head2 = ' DATE '.
        WHEN 5. header-head1 = 'LOAN'.
                header-head2 = 'CODE'.
        WHEN 6. header-head1 = ' MONTHLY '.
                header-head2 = 'AMORTIZATION'.
      ENDCASE.
      APPEND header.
      CLEAR: header.
    ENDDO.
    The output should be something like this as shown below:
    Employee     Employee                     Loan     Approval     
    Number     Name                     Type     Date     
    6633     ABAD, JUSTINA     DVP1     2-Apr-07

    Hi,
    Check this sample code:
    REPORT  ZSW_DOWNLOAD_HEADER.
      DATA : itab LIKE TABLE OF t001 WITH HEADER LINE.
      SELECT * FROM t001 INTO TABLE itab.
      PERFORM mydownload TABLES itab USING 'C:\t001.txt'.
      FORM mydownload TABLES ptab USING filename.
    DAta
    *DATA : components LIKE rstrucinfo OCCURS 0 WITH HEADER LINE.
        DATA: dfies_tab LIKE dfies OCCURS 0 WITH HEADER LINE.
        DATA : allfields(300) TYPE c.
        DATA : fld(100) TYPE c.
        DATA : BEGIN OF htab OCCURS 0,
        allfields(300) TYPE c,
        END OF htab.
        CALL FUNCTION 'DDIF_FIELDINFO_GET'
        EXPORTING
        tabname = 'T001'
    FIELDNAME = ' '
    LANGU = SY-LANGU
    LFIELDNAME = ' '
    ALL_TYPES = ' '
    GROUP_NAMES = ' '
    UCLEN = UCLEN
    IMPORTING
    X030L_WA = X030L_WA
    DDOBJTYPE = DDOBJTYPE
    DFIES_WA = DFIES_WA
    LINES_DESCR = LINES_DESCR
        TABLES
        dfies_tab = dfies_tab
    FIXED_VALUES = FIXED_VALUES
    EXCEPTIONS
    NOT_FOUND = 1
    INTERNAL_ERROR = 2
    OTHERS = 3
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        LOOP AT dfies_tab.
          CONCATENATE dfies_tab-fieldtext
          cl_abap_char_utilities=>horizontal_tab INTO fld.
          CONCATENATE allfields fld INTO allfields .
        ENDLOOP.
        htab-allfields = allfields.
        APPEND htab.
    download first field list
        CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
    BIN_FILESIZE =
        filename = 'c:\t001.xls'
        filetype = 'DAT'
        write_field_separator = 'X'
        TABLES
        data_tab = htab.
    then download file data
        CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
    BIN_FILESIZE =
        filename = 'c:\t001.xls'
        filetype = 'DAT'
        append = 'X'
        write_field_separator = 'X'
        TABLES
        data_tab = ptab.
      ENDFORM.                    "mydownload

  • Is it possible to display a date as (DD-MON-YYYY) in excel output using excel template in xml publisher

    Is it possible to display a date as (DD-MON-YYYY) in excel output using excel template in xml publisher where date should be displayed as date only not string.

    I've tried to use hierarchy node variables, but it seems like you can't specify a attribute of the hierarchy such as level.  So with the WBS hierarchy, if you create a hierarchy node variable, you specify the WBS value to select (If I understand this correctly).  I wish I could instead specify "give me all the WBS nodes that happen to have the value of the level attribute greater or equal to 3.  If I understand Juergens post, he is saying make security access so that only certain WBS levels can be returned in the query.  I suppose we can try that, but that would then preclude getting the level 1 and 2 in the future if the authorization is global.

  • Report VS Excel output using XML Publisher tool (DBMS_XMLGEN)

    Hi All,
    Currently I am working on report generation in MRP module with Excel output using XML Publisher tool.
    XML tool works based on query.
    I have developed PLSQL block by using DBMS_XMLGEN – database package, to generate XML output of query.
    My question is how we can put generated xml on above PLSQL block into OUT file (APPS).
    Because DBMS_OUTPUT.PUT_LINE( ) has limitation, it allow 255 character string only.
    But I do not know, Is FND_FILE.PUT_LINE (FND_FILE.OUTPUT,’’) allow for large data?
    If it does not allow what will be the other solution in oracle application to resolve above problem.
    Let me know any queries regarding to this problem.
    Thanks and Regards,
    Sai Krishna @cavaya.com

    Hi Prakash,
    Thanks for the reply. We did apply the one-off patch and got rid of the problem of not viewing 'Excel' output using XMLP.
    Now we are looking at a different perspective:
    Basically our client is looking for the following:
    1. Mathematical functions in the resulting XLS (like SUM, AVG etc..) ouput
    2. Use of macros if possible.
    And to do this i am looking out for a sample template that gives me output in excel format I have a TAR with Oracle for this purpose, but the TAR has so far been unsuccessful in providing us with any material in the direction.
    Our client remembers seeing this as a demo at the Oracle Conference this yr at San Fransisco, but does not have a sample to provide us. We are looking for such a sample.
    Thx,
    Nitin

  • Excel output using XML Publisher 5.5

    Hi,
    We are trying to obtain output of a simple customer summary report in 'EXCEL" format. For this purpose we have registered a 'RTF' template using which we get output in PDF/RTF formats. We are trying the 'EXCEL' format for the first time. Each time we run the concurrent request for XMLP, and then click 'View Output' we get a pop saying the following message
    "ORA-1403: no data found". The same report works perfectly fine when i run it using the template builder/viewer tool i have on my desktop. Can some throw light on this issue that we are facing.
    Please note that this is extremely important for us, as we plan to design a 'Gross Margin' report using XMLP in 'EXCEL' format and for this, this needs to work. Any inputs will be helpful.
    It would be great if someone in thr group can share a sample RTF template that generates output in 'Excel ' format.
    Tx,
    Nitin Jain

    Hi Prakash,
    Thanks for the reply. We did apply the one-off patch and got rid of the problem of not viewing 'Excel' output using XMLP.
    Now we are looking at a different perspective:
    Basically our client is looking for the following:
    1. Mathematical functions in the resulting XLS (like SUM, AVG etc..) ouput
    2. Use of macros if possible.
    And to do this i am looking out for a sample template that gives me output in excel format I have a TAR with Oracle for this purpose, but the TAR has so far been unsuccessful in providing us with any material in the direction.
    Our client remembers seeing this as a demo at the Oracle Conference this yr at San Fransisco, but does not have a sample to provide us. We are looking for such a sample.
    Thx,
    Nitin

  • Addiing additional data in header of excel output  of alv excel dowload.

    Hi Experts,
    I want to set(print) some additional data in header(with table header) of excel output of alv standard functionality(Export to Microsoft Excel) in webdynpro abap.
    any suggesions...
    Reg,
    Rajesh.

    OLE is the solution but not very performance oriented. Search for details in SDN

  • How to Design Report for Excel output?

    Hello Experts...
    I have both versions Crystal Report XI and Crystal 2013 at this time as we are in the process of Upgrading...
    How to design for excel output with no page size limit.
    I have several fields going across (crossing width of paper size 11X17 landscape) and I do not need this report output to be printed at all only for excel output.
    Appreciate your time!
    Thank you,
    Padma

    Hi Padma,
    You would need to increase the Page Size horizontally. Go to File > Page Setup > Check 'No Printer' > Check 'Dissociate Formatting Page Size and Printer page Size' > Increase the Horizontal value.
    Also see:
    http://scn.sap.com/docs/DOC-6687
    and
    How to WYSIWYG SAP Crystal Reports Export to XLS
    Formatting a Crystal Report for Export to MS Excel
    -Abhilash

  • Preventing automatic scientific notation conversion for excel output?

    I have a column in a report that contains a mixture of numbers and letters and hyphens. If the only letter is E, then I get scientific notation instead of the actual text when I run the report for excel output and open it in excel.
    For example:
    185701E-02 becomes 1.86E+03
    4962E6 becomes 4.96E+09
    Any ideas how to fix or work around this in the template, data definition, or excel config?
    Thanks,
    Kevin

    I tried pre-pending an apostrophe in the SQL and in the rtf template to indicate to excel that it is a text field, but this just resulted (not surprisingly) in '185701E-02 instead of 185701E-02

  • Heading for excel sheet

    Hi everyone,
                     I am downloading an internal table into an excel sheet using function module using GUI_DOWNLOAD . Now i need to have a heading line in the excel sheet. How should i do this? I kindly request you to help me in this issue. Thanks in advance.

    hiii
    yes you right..that is the only problem you are having..without using FIELDNAMES you can get header like following program..just check follwoing program it will solve your problem...as that parameter is not used in FM gui_download
    TABLES:
      mara.
    *                        T Y P E S                                     *
    TYPES:
      BEGIN OF type_a090,
        kschl TYPE a090-kschl,             " Condition type
        vbeln TYPE a090-vbeln,             " Sales document number
        posnr TYPE a090-posnr,             " Item number
        matnr TYPE a090-matnr,             " Material number
        datbi TYPE a090-datbi,             " Valid from
        datab TYPE a090-datab,             " Valid to
      END OF type_a090.
    TYPES:
      BEGIN OF type_mara,
        matkl TYPE mara-matkl,             " Material group
        matnr TYPE mara-matnr,             " Material number
      END OF type_mara.
    TYPES:
      BEGIN OF type_makt,
        maktx TYPE makt-maktx,             " Material description
        matnr TYPE makt-matnr,             " Material number
      END OF type_makt.
    TYPES:
      BEGIN OF type_output,
        kschl TYPE a090-kschl,             " Condition type
        vbeln TYPE a090-vbeln,             " Sales document number
        posnr TYPE a090-posnr,             " Item number
        matnr TYPE a090-matnr,             " Material number
        datbi(10) TYPE c,                  " Valid from
        datab(10) TYPE c,                  " Valid to
        matkl TYPE mara-matkl,             " Material group
        maktx TYPE makt-maktx,             " Material description
      END OF type_output.
    TYPES:
      BEGIN OF type_final,
        string TYPE string,
      END OF type_final.
    *                            D A T A                                   *
    DATA:wa_a090 TYPE type_a090,
         i_a090  TYPE STANDARD TABLE OF type_a090,
         wa_mara TYPE type_mara,
         i_mara  TYPE STANDARD TABLE OF type_mara,
         wa_makt TYPE type_makt,
         i_makt  TYPE STANDARD TABLE OF type_makt,
         wa_output TYPE type_output,
         i_output  TYPE TABLE OF type_output,
         wa_final TYPE type_final,
         i_final  TYPE STANDARD TABLE OF type_final.            "#EC NEEDED
    *                 S E L E C T I O N     S C R E E N                    *
    SELECTION-SCREEN BEGIN OF BLOCK sel1 WITH FRAME TITLE text-se1.
    SELECT-OPTIONS:
      s_matnr          FOR mara-matnr,     " Material Number
      s_mtart          FOR mara-mtart.     " Material Type
    PARAMETERS p_kschl TYPE konp-kschl  DEFAULT text-000.
    " Condition Type
    SELECTION-SCREEN END   OF BLOCK sel1.
    SELECTION-SCREEN BEGIN OF BLOCK sel2 WITH FRAME TITLE text-se2.
    SELECTION-SCREEN BEGIN OF BLOCK sel3 WITH FRAME TITLE text-se3.
    PARAMETERS:
      p_app_a          RADIOBUTTON GROUP file,
      p_filea          type rlgrap-filename,
                                           " Local file for upload/download
      p_app_p          RADIOBUTTON GROUP file,
      p_filep          type rlgrap-filename.
    " Local file for upload/download
    SELECTION-SCREEN END   OF BLOCK sel3.
    SELECTION-SCREEN BEGIN OF BLOCK sel4 WITH FRAME TITLE text-se4.
    PARAMETERS:
      p_price          type rlgrap-filename OBLIGATORY
        DEFAULT text-001.
    SELECTION-SCREEN END   OF BLOCK sel4.
    SELECTION-SCREEN END   OF BLOCK sel2.
    * Selection screen processing
    AT SELECTION-SCREEN ON p_filea.
      IF NOT p_app_a IS INITIAL.
        IF p_filea IS INITIAL.
          MESSAGE e398
            WITH text-002 '' '' ''.
        ENDIF.                             " IF p_filea IS INITIAL
      ENDIF.                               " IF NOT p_app_a IS INITIAL
    AT SELECTION-SCREEN ON p_filep.
      IF NOT p_app_p IS INITIAL.
        IF p_filep IS INITIAL.
          MESSAGE e398
            WITH text-003 '' '' ''.
        ENDIF.                             " IF p_filep IS INITIAL
      ENDIF.                               " IF NOT p_app_p
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM output_data.
      PERFORM header.
    *&      Form  get_data                                                 *
    * Fetching data from the tables.
    *  There are no interface parameters to be passed.                     *
    FORM get_data .
      SELECT   kschl                       " Condition type
               vbeln                       " Sales document number
               posnr                       " Item number
               matnr                       " Material number
               datbi                       " Valid from
               datab                       " Valid to
               FROM a090
               INTO TABLE i_a090
               WHERE matnr IN  s_matnr AND
               kschl EQ p_kschl
               AND datab LE syst-datum
               AND datbi GE syst-datum.
      IF sy-subrc EQ 0.
        SELECT matkl                         " Material group
               matnr                         " Material number
               FROM mara
               INTO TABLE i_mara
               FOR ALL ENTRIES IN i_a090
               WHERE matnr = i_a090-matnr.
      ENDIF.
      IF sy-subrc EQ 0.
        SELECT maktx                         " Material description
               matnr                         " Material number
               FROM makt
               INTO TABLE i_makt
               FOR ALL ENTRIES IN i_mara
               WHERE matnr = i_mara-matnr
               AND spras = 'EN'.
      ENDIF.
    ENDFORM.                               " get_data
    *&      Form  output_data                                              *
    *  Populating the final output table.
    * There are no interface parameters to be passed.                      *
    FORM output_data .
      DATA:
        w_date2(10) TYPE c,                " For date formate
        w_date1(10) TYPE c.                " For date formate
      LOOP AT i_a090 INTO wa_a090.
        CONCATENATE wa_a090-datbi+6(2) wa_a090-datbi+4(2) wa_a090-datbi+0(4)
        INTO w_date1 SEPARATED BY '/'.
        CONCATENATE wa_a090-datab+6(2) wa_a090-datab+4(2) wa_a090-datab+0(4)
        INTO w_date2 SEPARATED BY '/'.
        wa_output-kschl = wa_a090-kschl.
        wa_output-vbeln = wa_a090-vbeln.
        wa_output-posnr = wa_a090-posnr.
        wa_output-matnr = wa_a090-matnr.
        wa_output-datbi = w_date1.
        wa_output-datab = w_date2.
        READ TABLE i_mara INTO wa_mara WITH KEY matnr = wa_a090-matnr.
        IF sy-subrc EQ 0.
          wa_output-matkl = wa_mara-matkl.
        ENDIF.
        READ TABLE i_makt INTO wa_makt WITH KEY matnr = wa_a090-matnr.
        IF sy-subrc EQ 0.
          wa_output-maktx = wa_makt-maktx.
        ENDIF.
        APPEND wa_output TO i_output.
        CLEAR wa_output.
      ENDLOOP.                             " LOOP AT i_a090
      DELETE ADJACENT DUPLICATES FROM i_output COMPARING ALL FIELDS.
      LOOP AT i_output INTO wa_output.
        CONCATENATE wa_output-kschl
                    wa_output-vbeln
                    wa_output-posnr
                    wa_output-matnr
                    wa_output-datbi
                    wa_output-datab
                    wa_output-matkl
                    wa_output-maktx
               INTO wa_final-string
               SEPARATED BY ','.
        APPEND wa_final TO i_final.
      ENDLOOP.                             " LOOP AT i_output...
    ENDFORM.                               " output_data
    *&      Form  header                                                   *
    *  Formating the header.                                               *
    *  There are no interface parameters to be passed.                     *
    FORM header .
      CONCATENATE text-004
                  text-005
                  text-006
                  text-007
                  text-008
                  text-009
                  text-010
                  text-011
             INTO wa_final-string
             SEPARATED BY ','.
      INSERT wa_final
      INTO i_final INDEX 1.
      PERFORM f901_output.
    ENDFORM.                               " header
    *&      Form  f901_output                                              *
    *  Downloading the final output table to the presentation server or    *
    *  application server.                                                 *
    *      -->P_I_OUTPUT  text                                             *
    *      -->P_P_PRICE  text                                              *
    FORM f901_output .
      IF p_app_p = 'X'.
        PERFORM f903_file_to_presentation
          USING p_price.
      ELSE.
        PERFORM f904_file_to_application
          USING p_price.
      ENDIF.                               " IF p_app_p
    ENDFORM.                               " f901_output
    *&      Form  f903_file_to_presentation                                *
    *  Dowload the file to the presentation server.                        *
    *      -->P_P_PRICE  text                                              *
    FORM f903_file_to_presentation  USING    p_p_price.
      DATA:
        lwa_file            TYPE string.  "#EC NEEDED     "rlgrap-filename.
      CONCATENATE p_filep p_p_price INTO lwa_file.
    *      Download the file
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
    *   BIN_FILESIZE                    = BIN_FILESIZE
          filename                        = lwa_file
          filetype                        = 'ASC'
    *   APPEND                          = ' '
    *   WRITE_FIELD_SEPARATOR           = ' '
    *   HEADER                          = '00'
    *   TRUNC_TRAILING_BLANKS           = ' '
    *   WRITE_LF                        = 'X'
    *   COL_SELECT                      = ' '
    *   COL_SELECT_MASK                 = ' '
    *   DAT_MODE                        = ' '
    *   CONFIRM_OVERWRITE               = ' '
    *   NO_AUTH_CHECK                   = ' '
    *   CODEPAGE                        = ' '
    *   IGNORE_CERR                     = ABAP_TRUE
    *   REPLACEMENT                     = '#'
    *   WRITE_BOM                       = ' '
    *   TRUNC_TRAILING_BLANKS_EOL       = 'X'
    *   WK1_N_FORMAT                    = ' '
    *   WK1_N_SIZE                      = ' '
    *   WK1_T_FORMAT                    = ' '
    *   WK1_T_SIZE                      = ' '
    * IMPORTING
    *   FILELENGTH                      = FILELENGTH
        TABLES
          data_tab                        = i_final
    *   FIELDNAMES                      = FIELDNAMES
        EXCEPTIONS
          file_write_error                = 1
          no_batch                        = 2
          gui_refuse_filetransfer         = 3
          invalid_type                    = 4
          no_authority                    = 5
          unknown_error                   = 6
          header_not_allowed              = 7
          separator_not_allowed           = 8
          filesize_not_allowed            = 9
          header_too_long                 = 10
          dp_error_create                 = 11
          dp_error_send                   = 12
          dp_error_write                  = 13
          unknown_dp_error                = 14
          access_denied                   = 15
          dp_out_of_memory                = 16
          disk_full                       = 17
          dp_timeout                      = 18
          file_not_found                  = 19
          dataprovider_exception          = 20
          control_flush_error             = 21
      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.                               " f903_file_to_presentation
    regards
    twinkal

  • How to Display Heading for TREE Structure (report)

    hi,
         tell me how display the heading for the TREE Report.
    With Regards,
    Shakthi Raj N.

    Hi,
    If you are using object oriented approach for developing the Tree report, then you can use below shown example for creating header for the report.
      first create tree control
      CREATE OBJECT TREE1
        EXPORTING
            PARENT              = G_CONTAINER_OBJECT
            NODE_SELECTION_MODE = CL_GUI_COLUMN_TREE=>NODE_SEL_MODE_SINGLE
            ITEM_SELECTION      = ''
            NO_HTML_HEADER      = ''
            NO_TOOLBAR          = ''
        EXCEPTIONS
            CNTL_ERROR                   = 1
            CNTL_SYSTEM_ERROR            = 2
            CREATE_ERROR                 = 3
            LIFETIME_ERROR               = 4
            ILLEGAL_NODE_SELECTION_MODE  = 5
            FAILED                       = 6
            ILLEGAL_COLUMN_NAME          = 7.
      CLEAR GT_HEADER.
      GT_HEADER-TYP = 'H'.
      GT_HEADER-INFO = 'Output'.
      APPEND GT_HEADER.
      CLEAR GT_HEADER.
      GT_HEADER-TYP = 'S'.
      GT_HEADER-KEY = 'Display'.
      GT_HEADER-INFO = 'Report'.
      APPEND GT_HEADER.
    then create empty tree-control
      CALL METHOD TREE1->SET_TABLE_FOR_FIRST_DISPLAY
              EXPORTING
                   IS_HIERARCHY_HEADER  = G_HIERARCHY_HEADER
                   I_BACKGROUND_ID      = 'ALV_BACKGROUND'
                   IT_LIST_COMMENTARY   = GT_HEADER[]
              CHANGING
                   IT_OUTTAB            = GT_SPFLI[]    "empty table
                   IT_FIELDCATALOG      = GT_FIELDCAT_LVC[].
    In this way header can be given for Tree report.
    Hope this answers your query.
    Regards,
    Brajvir

  • List header for alv grid using abap objects

    Hai all,
          I have displayed alv grid in container control using abap objects i.e. using method set_table_for_first_display.
    now i need to display list header for this alv grid.
    please help me how to create with a sample coding.
    Thanks and regards,
    Prabu S.

    Create a splitter using CL_GUI_EASY_SPLITTER_CONTAINER with a top and bottom half.  Put the alv grid in the bottom half.  Use cl_dd_document (documented in help.sap.com )  to build the header in the top half.  Use events on CL_GUI_ALV_GRID to handle the top-of-list printing.
    Or, if available, use CL_SALV_TABLE, and read the documentation on that.  When I needed a header for my report, that's what I did.  There's plenty of good documentation about if you'll search for it.
    matt

  • Displaying header in ALV By using OO ABAP

    Hi,
    I have displayed ALV Grid by using OO ABAP.
    Would you please tell me how to disply header for this ALV by Using OO ABAP.
    Moderator Message: Please search for available information.
    Edited by: kishan P on Nov 22, 2010 8:22 PM

    Hi,
    Try this way
    form built_sort_table.
      data ls_sort_wa type lvc_s_sort.
      ls_sort_wa-spos = 1.
      ls_sort_wa-fieldname = 'MATNR'.
      ls_sort_wa-up = selected.
      ls_sort_wa-subtot = ''.
      append ls_sort_wa to gt_sort.
      ls_sort_wa-spos = 2.
      ls_sort_wa-fieldname = 'STATUS'.
      ls_sort_wa-up = selected.
      ls_sort_wa-subtot = ''.
      append ls_sort_wa to gt_sort.
    endform.                              
    then
      call method grid1->set_table_for_first_display
        exporting
          it_list_commentary = gt_header[]
          is_layout          = gs_layout_tree
        changing
          it_sort            = gt_sort[]
          it_outtab          = gt_yitm[]
          it_fieldcatalog    = gt_fieldcat_lvc[].
    aRs

  • How to display Header for table in Script

    Dear All,
    In script i am displaying the data in tabular format, by using the
    function module write_form_lines. For this i have called multiple
    windows for each column. I am able to display the data,however
    don't know how to name this column, i.e the header for each column.
    (Sr_No,,Vendor Name,,Account Number,,Reference Code,,Amount ).
    Any help is appreciated.
    Thanks & Regards,
    Manju

    Hi Manju,
    Create a widow to display the header details(hard code the name of the columns). You have to  use main window for displaying the table data.Loop the internal table in driver program, inside the loop call the function write_form for printing the table contents.
    Thanks,
    Prabhakaran

  • Chart(graph) is not displaying in my Excel output

    Hi All,
    I was working with oracle EBZ R12, and bi publisher 10g,
    I have developed a RTF with graph, when i moved the RTF and run the report through application (the Excel output is not showing the Graph,but in pdf output the graph is coming fine).
    I have gone through this documents
    http://docs.oracle.com/cd/E10091_01/doc/bip.1013/e05000/toc.htm
    and the forum question already raised for the same.
    https://forums.oracle.com/thread/1018488
    But i dont know the exact path of the web.xml file to change as mentioned in the links. Can any one help on this to resolve this issue.
    Thanks & Regards
    Srikkanth.M

    Hi,
    Its looks like this might be the customization issue please have a look at the OSS Notes 457497 and refer to the questions 2, 3 &  4 may be you can get the idea (Specially 4).
    Why are some texts not printed at all?
    Answer:
    Which texts are printed depends on the Customizing settings of purchasing.
    Go to Customizing for purchasing.
    Choose "Messages -> Texts for Messages -> Define Texts for <Purchasing Document>". Choose "Print Document <Purchasing Document>". Select "Texts for Document Items" and add a new entry.
    You must specify a value for the print sequence in the detailed screen for your new entry.
    Let me know in case of any.
    Regards,
    SRinivas

  • Displaying paramters in excel output

    Hi, I am designing a report in excel format, using the 'True Excel' method.
    Refering to the section "Declaring and Passing Parameters" in Link, it mentioned i can simply add this in the metadata worksheet.
    XDO_PARAM_?1? <?param@begin:Country;US?>
    XDO_?Country? <?$Country?>
    And add XDO_?Country? as desired in the output worksheet as usual.
    But I am not getting this work properly in running my report on R12 instance. The OPP log said Variable not defined.
    Any ideas on this? Thanks in advance!

    First, your default value needs to be surrounded by single quotes (use notepad to ensure they get ASCII characters)
    XDO_PARAM_?1? <?param@begin:Country;'US'?>
    Next, make sure you have defined this parameter in your report definition as well (i.e data model)
    regards
    Jorge

Maybe you are looking for