Download as a CSV file

hi all,
    I have created a ALV ,  and i am trying to download it as a CSV file , but when i got the file , the issue occurs:
as you know , the columns in CSV file is seperate by ' , '  , but one of my column is currency , the value is ' 123.456,789 ' for example .
so this column must be seperated because it contains ' , '. Is there a way to solve this ? how should i show ' , ' in CSV file ?
kind regards
Kevin

Hi Kevin,
If you are using the standard ALV export file routines the currency should already be handled.
If you are coding this yourself then any number field that has a ',' needs to be surrounded by double quotes.
For example
999,999.99 needs to be output as "999,999.99",
Excel treats the double quotes as part of the field delimiter and removes them.
cheers
David Cooper

Similar Messages

  • To download data into csv file format

    Hi All
    I have to download data into csv file format. I use the FM
    GUI_DOWNLOAD and gave the filename text.csv. But data is stored in excel
    file in place of csv file.
    Can anyone tell me what should i do to load the data into csv file or any other function module should used?
    Regards

    see this sample code
    REPORT  YSG_MATSTK_REPT    LINE-SIZE 220
                               LINE-COUNT 50(5).
    *&                       DATA DECLARATION                              *
    TABLES: MARA,                      "GENERAL MASTER DATA
            MARC,                      "PLANT DATA FOR MATERIAL
            MARD,                      "STORAGE LOCATION DATA FOR MATERIAL
            MVKE,                      "SALES DATA FOR MATERIAL
            MAKT,                      "MATERIAL DESCRIPTION
            EKKO,                      "PURCHASING DOCUMENT HEADER
            EKPO,                      "PURCHASING DOCUMENT ITEM
            VBAK,                      "SALES DOCUMENT HEADER DATA
            VBAP.                      "SALES DOCUMENT ITEM DATA
    TYPE-POOLS : SLIS.
    DATA: VT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
          V_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
          V_LAYOUT TYPE SLIS_LAYOUT_ALV,
          BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
          BEGIN OF I_MARA OCCURS 0,
             MATNR LIKE MARA-MATNR,  "MATERIAL NUMBER
             MBRSH LIKE MARA-MBRSH,  "INDUSTRY SECTOR
             MEINS LIKE MARA-MEINS,  "BASE UNIT OF MEASURE
             MATKL LIKE MARA-MATKL,  "MATERIAL GROUP
          END OF I_MARA,
          BEGIN OF I_MARC OCCURS 0,
             MATNR LIKE MARC-MATNR,  "MATERIAL NUMBER
             WERKS LIKE MARC-WERKS,  "PLANT
             LVORM LIKE MARC-LVORM,  "FLAG MATERIAL FOR DELETION AT PLANT
                                     "LEVEL
             DISPO LIKE MARC-DISPO,  "MRP CONTROLLER
          END OF I_MARC,
          BEGIN OF I_MAKT OCCURS 0,
             MATNR LIKE MAKT-MATNR,  "MATERIAL NUMBER
             MAKTX LIKE MAKT-MAKTX,  "MATERIAL DESCRIPTION
             SPRAS LIKE MAKT-SPRAS,  "LANGUAGE KEY
          END OF I_MAKT,
          BEGIN OF I_MVKE OCCURS 0,
             MATNR LIKE MVKE-MATNR,  "MATERIAL NUMBER
             VKORG LIKE MVKE-VKORG,  "SALES ORGANIZATION
             VTWEG LIKE MVKE-VTWEG,  "DISTRIBUTION CHANNEL
          END OF I_MVKE,
          BEGIN OF I_MARD OCCURS 0,
            MATNR LIKE MARD-MATNR,  "MATERIAL NUMBER
            LGORT LIKE MARD-LGORT,  "STORAGE LOCATION
            LABST LIKE MARD-LABST,  "VALUATED STOCK WITH UNRESTRICTED USE
          END OF I_MARD,
          BEGIN OF I_EKPO OCCURS 0,
            EBELN LIKE EKPO-EBELN,  "PURCHASING DOCUMENT NUMBER
            EBELP LIKE EKPO-EBELP,  "ITEM NUMBER OF PURCHASING DOCUMENT
            MATNR LIKE EKPO-MATNR,  "MATERIAL NUMBER
          END OF I_EKPO,
          BEGIN OF I_VBAP OCCURS 0,
            VBELN LIKE VBAP-VBELN,  "SALES DOCUMENT
            POSNR LIKE VBAP-POSNR,  "SALES DOCUMENT ITEM
            MATNR LIKE VBAP-MATNR,  "MATERIAL NUMBER
          END OF I_VBAP,
          BEGIN OF I_OUT OCCURS 0,
            MATNR LIKE MARC-MATNR,
            WERKS LIKE MARC-WERKS,
            LVORM LIKE MARC-LVORM,
            DISPO LIKE MARC-DISPO,
            MBRSH LIKE MARA-MBRSH,
            MEINS LIKE MARA-MEINS,
            MATKL LIKE MARA-MATKL,
            VKORG LIKE MVKE-VKORG,
            VTWEG LIKE MVKE-VTWEG,
            SPRAS LIKE MAKT-SPRAS,
            MAKTX LIKE MAKT-MAKTX,
            LGORT LIKE MARD-LGORT,
            LABST LIKE MARD-LABST,
            EBELN LIKE EKPO-EBELN,
            EBELP LIKE EKPO-EBELP,
            VBELN LIKE VBAP-VBELN,
            POSNR LIKE VBAP-POSNR,
          END OF I_OUT,
          BEGIN OF I_HEADING OCCURS 0,
            TEXT1(20),
            TEXT2(20),
            TEXT3(20),
            TEXT4(20),
            TEXT5(20),
            TEXT6(20),
            TEXT7(20),
            TEXT8(20),
            TEXT9(20),
            TEXT10(20),
            TEXT11(40),
            TEXT12(20),
            TEXT13(20),
            TEXT14(20),
            TEXT15(20),
            TEXT16(20),
            TEXT17(20),
          END OF I_HEADING.
    *&                   S E L E C T I O N - S C R E E N                   *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-100.
    SELECT-OPTIONS: S_MATNR FOR MARA-MATNR. "OBLIGATORY.
    PARAMETERS: P_WERKS LIKE MARC-WERKS. "OBLIGATORY.
    SELECT-OPTIONS: S_LGORT FOR MARD-LGORT,
                    S_DISPO FOR MARC-DISPO,
                    S_EBELN FOR EKPO-EBELN .
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-101.
    PARAMETERS : RB1 RADIOBUTTON GROUP G1,
                 RB2 RADIOBUTTON GROUP G1,
                 RB3 RADIOBUTTON GROUP G1.
    SELECTION-SCREEN END OF BLOCK B2.
    *&                  I N I T I A L I Z A T I O N                      *
    *INITIALIZATION.
    *&             S T A R T - O F - S E L E C T I O N                     *
    START-OF-SELECTION.
      SELECT MATNR WERKS LVORM DISPO FROM MARC
      INTO CORRESPONDING FIELDS OF TABLE I_MARC
                          WHERE MATNR IN S_MATNR
                          AND DISPO IN S_DISPO
                          AND WERKS = P_WERKS.
      IF I_MARC[] IS INITIAL.
        WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MARC'.
        EXIT.
      ENDIF.
      PERFORM PURCHASEDATA_VALIDATION.
      PERFORM SALESDATA_VALIDATION.
      SELECT MATNR LGORT LABST FROM MARD INTO TABLE  I_MARD
                          FOR ALL ENTRIES IN I_MARC
                          WHERE MATNR = I_MARC-MATNR
                          AND WERKS EQ P_WERKS
                          AND LGORT IN S_LGORT.
      IF I_MARD[] IS INITIAL.
        WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MARD'.
        EXIT.
      ENDIF.
      SELECT MATNR VKORG VTWEG FROM MVKE INTO TABLE I_MVKE
                          FOR ALL ENTRIES IN I_MARC
                          WHERE MATNR = I_MARC-MATNR.
      IF I_MVKE[] IS INITIAL.
        WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MVKE'.
        EXIT.
      ENDIF.
      LOOP AT I_MARC.
        MOVE-CORRESPONDING I_MARC TO I_OUT.
        CLEAR MARC.
        SELECT SINGLE MATNR MBRSH MEINS MATKL FROM MARA
                          INTO CORRESPONDING FIELDS OF MARA
                          WHERE MATNR = I_OUT-MATNR.
        IF SY-SUBRC = 0.
          MOVE: MARA-MBRSH TO I_OUT-MBRSH,
                MARA-MEINS TO I_OUT-MEINS,
                MARA-MATKL TO I_OUT-MATKL.
        ELSE.
          CONTINUE.
        ENDIF.
        SELECT SINGLE MATNR MAKTX SPRAS FROM MAKT
                        INTO  CORRESPONDING FIELDS OF MAKT
                        WHERE  MATNR = I_OUT-MATNR.
        IF SY-SUBRC = 0.
          MOVE: MAKT-MAKTX TO I_OUT-MAKTX,
                MAKT-SPRAS TO I_OUT-SPRAS.
        ELSE.
          CONTINUE.
        ENDIF.
        LOOP AT I_EKPO WHERE MATNR =  I_MARC-MATNR.
          MOVE: I_EKPO-EBELN TO I_OUT-EBELN,
                I_EKPO-EBELP TO I_OUT-EBELP.
        ENDLOOP.
        LOOP AT I_VBAP WHERE MATNR =  I_MARC-MATNR.
          MOVE: I_VBAP-VBELN TO I_OUT-VBELN,
                I_VBAP-POSNR TO I_OUT-POSNR.
        ENDLOOP.
        LOOP AT I_MARD WHERE MATNR = I_MARC-MATNR.
          MOVE: I_MARD-LABST TO I_OUT-LABST,
                I_MARD-LGORT TO I_OUT-LGORT.
        ENDLOOP.
        LOOP AT I_MVKE WHERE MATNR = I_MARC-MATNR.
          MOVE: I_MVKE-VKORG TO I_OUT-VKORG,
                I_MVKE-VTWEG TO I_OUT-VTWEG.
        ENDLOOP.
        APPEND I_OUT.
        CLEAR I_OUT.
      ENDLOOP.
      PERFORM OPTIONS.
                         FORM  OPTIONS                                *
    FORM OPTIONS.
      IF RB2 = 'X'.
        PERFORM FIELDCAT.
        PERFORM OUTPUT.
      ELSE.
        IF RB1 = 'X'.
          PERFORM HEADINGS.
          PERFORM DLOAD.
        ELSE.
          IF RB3 = 'X'.
            PERFORM HEADINGS.
            PERFORM DLOAD.
            PERFORM FIELDCAT.
            PERFORM OUTPUT.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDFORM.                    "OPTIONS
                         FORM  HEADINGS                               *
    FORM HEADINGS.
      I_HEADING-TEXT1 = 'MATNR'.
      I_HEADING-TEXT2 = 'WERKS'.
      I_HEADING-TEXT3 = 'LVORM'.
      I_HEADING-TEXT4 = 'DISPO'.
      I_HEADING-TEXT5 = 'MBRSH'.
      I_HEADING-TEXT6 = 'MEINS'.
      I_HEADING-TEXT7 = 'MATKL'.
      I_HEADING-TEXT8 = 'VKORG'.
      I_HEADING-TEXT9 = 'VTWEG'.
      I_HEADING-TEXT10 = 'SPRAS'.
      I_HEADING-TEXT11 = 'MAKTX'.
      I_HEADING-TEXT12 = 'LGORT'.
      I_HEADING-TEXT13 = 'LABST'.
      I_HEADING-TEXT14 = 'EBELN'.
      I_HEADING-TEXT15 = 'EBELP'.
      I_HEADING-TEXT16 = 'VBELN'.
      I_HEADING-TEXT17 = 'POSNR'.
      APPEND I_HEADING.
    ENDFORM.                    "HEADINGS
                         FORM  DLOAD                                  *
    FORM DLOAD.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          FILENAME              = 'C:\MATSTK.csv'
          FILETYPE              = 'DAT'
          WRITE_FIELD_SEPARATOR = 'X'
        TABLES
          DATA_TAB              = I_HEADING
        EXCEPTIONS
          FILE_WRITE_ERROR      = 1.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          FILENAME              = 'C:\MATSTK.csv'
          FILETYPE              = 'DAT'
          APPEND                = 'X'
          WRITE_FIELD_SEPARATOR = 'X'
        TABLES
          DATA_TAB              = I_OUT.
    ENDFORM.                    "DLOAD
                              FORM  FIELDCAT                          *
    FORM FIELDCAT.
      V_FIELDCAT-COL_POS = '1'.
      V_FIELDCAT-FIELDNAME     = 'MATNR'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-HOTSPOT = 'X'.
      V_FIELDCAT-REF_FIELDNAME = 'MATNR'.
      V_FIELDCAT-REF_TABNAME   = 'MARC'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '2'.
      V_FIELDCAT-FIELDNAME     = 'WERKS'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'WERKS'.
      V_FIELDCAT-REF_TABNAME   = 'MARC'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '3'.
      V_FIELDCAT-FIELDNAME     = 'LVORM'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'LVORM'.
      V_FIELDCAT-REF_TABNAME   = 'MARC'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '4'.
      V_FIELDCAT-FIELDNAME     = 'DISPO'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'DISPO'.
      V_FIELDCAT-REF_TABNAME   = 'MARC'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '5'.
      V_FIELDCAT-FIELDNAME     = 'MBRSH'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'MBRSH'.
      V_FIELDCAT-REF_TABNAME   = 'MARA'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '6'.
      V_FIELDCAT-FIELDNAME     = 'MEINS'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'MEINS'.
      V_FIELDCAT-REF_TABNAME   = 'MARA'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '7'.
      V_FIELDCAT-FIELDNAME     = 'MATKL'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'MATKL'.
      V_FIELDCAT-REF_TABNAME   = 'MARA'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '8'.
      V_FIELDCAT-FIELDNAME     = 'VKORG'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'VKORG'.
      V_FIELDCAT-REF_TABNAME   = 'MVKE'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '9'.
      V_FIELDCAT-FIELDNAME     = 'VTWEG'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'VTWEG'.
      V_FIELDCAT-REF_TABNAME   = 'MVKE'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '10'.
      V_FIELDCAT-FIELDNAME     = 'SPRAS'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'SPRAS'.
      V_FIELDCAT-REF_TABNAME   = 'MAKT'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '11'.
      V_FIELDCAT-FIELDNAME     = 'MAKTX'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'MAKTX'.
      V_FIELDCAT-REF_TABNAME   = 'MAKT'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '12'.
      V_FIELDCAT-FIELDNAME     = 'LGORT'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
    V_FIELDCAT-REF_FIELDNAME = 'LGORT'.
    V_FIELDCAT-REF_TABNAME   = 'MARD'.
      V_FIELDCAT-SELTEXT_L = 'STRG LOCT'.
      V_FIELDCAT-OUTPUTLEN = 10.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '13'.
      V_FIELDCAT-FIELDNAME     = 'LABST'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-SELTEXT_M = 'STOCK'.
      V_FIELDCAT-OUTPUTLEN = 15.
    V_FIELDCAT-REF_FIELDNAME = 'LABST'.
    V_FIELDCAT-REF_TABNAME   = 'MARD'.
      V_FIELDCAT-DO_SUM = 'X'.
      V_LAYOUT-TOTALS_TEXT = 'TOTAL STOCK:'.
      V_FIELDCAT-HOTSPOT = 'X'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '14'.
      V_FIELDCAT-FIELDNAME     = 'EBELN'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-HOTSPOT = 'X'.
      V_FIELDCAT-REF_FIELDNAME = 'EBELN'.
      V_FIELDCAT-REF_TABNAME   = 'EKPO'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '15'.
      V_FIELDCAT-FIELDNAME     = 'EBELP'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'EBELP'.
      V_FIELDCAT-REF_TABNAME   = 'EKPO'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '16'.
      V_FIELDCAT-FIELDNAME     = 'VBELN'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-HOTSPOT = 'X'.
      V_FIELDCAT-REF_FIELDNAME = 'VBELN'.
      V_FIELDCAT-REF_TABNAME   = 'VBAP'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '17'.
      V_FIELDCAT-FIELDNAME     = 'POSNR'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'POSNR'.
      V_FIELDCAT-REF_TABNAME   = 'VBAP'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
    ENDFORM.                      "FIELDCAT
                              FORM  OUTPUT                            *
    FORM OUTPUT.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM      = SY-REPID
          I_CALLBACK_TOP_OF_PAGE  = 'TOP-OF-PAGE'
          I_GRID_TITLE = 'CLICK ON MATERIAL/PURDOC/SALESDOC FOR DETAILS'
          I_CALLBACK_USER_COMMAND = 'DISPLAYDETAILS'
          IS_LAYOUT               = V_LAYOUT
          IT_FIELDCAT             = VT_FIELDCAT1
        TABLES
          T_OUTTAB                = I_OUT.
      IF SY-SUBRC <> 0.
      ENDIF.
    ENDFORM.                    "OUTPUT
                            FORM  TOP-OF-PAGE                         *
    FORM TOP-OF-PAGE.
      DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
            WA_HEADER TYPE SLIS_LISTHEADER.
      WA_HEADER-TYP = 'H'.
      WA_HEADER-INFO = 'REPORT FOR : '.
      APPEND WA_HEADER TO T_HEADER.
      CLEAR WA_HEADER.
      WA_HEADER-TYP = 'S'.
      WA_HEADER-INFO = 'MATERIAL DETAILS'.
      APPEND WA_HEADER TO T_HEADER.
      CLEAR WA_HEADER.
      WA_HEADER-TYP = 'S'.
      WA_HEADER-INFO = 'PURCHASE ORDER DETAILS'.
      APPEND WA_HEADER TO T_HEADER.
      CLEAR WA_HEADER.
      WA_HEADER-TYP = 'S'.
      WA_HEADER-INFO = 'SALES ORDER DETAILS'.
      APPEND WA_HEADER TO T_HEADER.
      CLEAR WA_HEADER.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          I_LOGO             = 'GEAR'
          IT_LIST_COMMENTARY = T_HEADER.
    ENDFORM.                    "TOP-OF-PAGE
    *&                       FORM  DISPLAYDETAILS                          *
    FORM DISPLAYDETAILS USING UCOMM LIKE SY-UCOMM
          SELFIELD TYPE SLIS_SELFIELD.
      IF SELFIELD-FIELDNAME = 'EBELN'.
        IF UCOMM = '&IC1'.
          READ TABLE I_OUT INDEX SELFIELD-TABINDEX.
          PERFORM PORECDNG.
          CLEAR BDCDATA[].
        ENDIF.
      ELSE.
        IF SELFIELD-FIELDNAME = 'MATNR'.
          IF UCOMM = '&IC1'.
            READ TABLE I_OUT INDEX SELFIELD-TABINDEX.
            PERFORM MMRECDNG.
            CLEAR BDCDATA[].
          ENDIF.
        ELSE.
          IF SELFIELD-FIELDNAME = 'VBELN'.
            IF UCOMM = '&IC1'.
              READ TABLE I_OUT INDEX SELFIELD-TABINDEX.
              PERFORM SALESRECDNG.
              CLEAR BDCDATA[].
            ENDIF.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDFORM.                    "DISPLAYDETAILS
                        FORM PORECDNG                                   *
    FORM PORECDNG.
      PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0105'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    'RM06E-BSTNR'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM BDC_FIELD       USING 'RM06E-BSTNR'
                                    I_OUT-EBELN.
      PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0120'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    'RM06E-BSTPO(01)'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '=AH'.
      PERFORM BDC_FIELD       USING 'RM06E-EBELP'
                                    I_OUT-EBELP.
      PERFORM BDC_FIELD       USING 'RM06E-TCSELFLAG(01)'
                                    'X'.
      PERFORM BDC_TRANSACTION USING 'ME23'.
    ENDFORM.                    "PORECDNG
                        FORM MMRECDNG                                   *
    FORM MMRECDNG.
      PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '0060'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    'RMMG1-MATNR'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM BDC_FIELD       USING 'RMMG1-MATNR'
                                    I_OUT-MATNR.
      PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '0070'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    'MSICHTAUSW-DYTXT(01)'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '=ENTR'.
      PERFORM BDC_FIELD       USING 'MSICHTAUSW-KZSEL(01)'
                                    'X'.
      PERFORM BDC_TRANSACTION USING 'MM03'.
    ENDFORM.                    "MMRECDNG
                        FORM SALESRECDNG                                *
    FORM SALESRECDNG.
      PERFORM BDC_DYNPRO      USING 'SAPMV45A' '0102'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    'VBAK-VBELN'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM BDC_FIELD       USING 'VBAK-VBELN'
                                    I_OUT-VBELN.
      PERFORM BDC_TRANSACTION USING 'VA03'.
    ENDFORM.                    "SALESRECDNG
                     FORM BDC_TRANSACTION                               *
    FORM BDC_TRANSACTION USING TCODE.
      CALL TRANSACTION TCODE USING BDCDATA MODE 'E'.
    ENDFORM.                    "BDC_TRANSACTION
                           FORM BDC_DYNPRO                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR BDCDATA.
      BDCDATA-PROGRAM = PROGRAM.
      BDCDATA-DYNPRO = DYNPRO.
      BDCDATA-DYNBEGIN = 'X'.
      APPEND BDCDATA.
    ENDFORM.                    "BDC_DYNPRO
                           INSERT FIELD                                  *
    FORM BDC_FIELD USING FNAM FVAL.
      CLEAR BDCDATA.
      BDCDATA-FNAM = FNAM.
      BDCDATA-FVAL = FVAL.
      APPEND BDCDATA.
    ENDFORM.                    "BDC_FIELD
    *&                  FORM  PURCHASEDATA_VALIDATION                      *
    FORM PURCHASEDATA_VALIDATION.
      SELECT EBELN EBELP MATNR
                 FROM EKPO
                 INTO TABLE I_EKPO
                 FOR ALL ENTRIES IN I_MARC
                 WHERE MATNR = I_MARC-MATNR
                 AND EBELN IN S_EBELN
                 AND WERKS EQ P_WERKS.
      IF I_EKPO[] IS INITIAL.
        WRITE:/ 'NO MATCHING DATA AVAILABLE FROM TABLE EKPO'.
        EXIT.
      ENDIF.
      DATA: T_EKPO LIKE I_EKPO OCCURS 0 WITH HEADER LINE.
      T_EKPO[] = I_EKPO[].
      REFRESH I_EKPO.
      FREE I_EKPO.
      LOOP AT T_EKPO.
        SELECT SINGLE EBELN FROM EKKO INTO EKPO-EBELN
        WHERE EBELN = T_EKPO-EBELN.
        IF SY-SUBRC = 0.
          MOVE-CORRESPONDING T_EKPO TO I_EKPO.
          APPEND I_EKPO.
          CLEAR I_EKPO.
        ELSE.
          CONTINUE.
        ENDIF.
      ENDLOOP.
      SORT I_EKPO.
    ENDFORM.                    "PURCHASEDATA_VALIDATION
    *&                  FORM  SALESDATA_VALIDATION                         *
    FORM SALESDATA_VALIDATION.
      SELECT VBELN POSNR MATNR
              FROM VBAP
              INTO CORRESPONDING FIELDS OF TABLE
              I_VBAP FOR ALL ENTRIES IN I_MARC
              WHERE MATNR = I_MARC-MATNR.
    IF I_VBAP[] IS INITIAL.
        WRITE:/ 'NO MATCHING DATA AVAILABLE FROM TABLE VBAP'.
        EXIT.
      ENDIF.
      DATA: T_VBAP LIKE I_VBAP OCCURS 0 WITH HEADER LINE.
      T_VBAP[] = I_VBAP[].
      REFRESH I_VBAP.
      FREE I_VBAP.
      LOOP AT T_VBAP.
        SELECT SINGLE VBELN FROM VBAK INTO VBAK-VBELN
        WHERE VBELN = T_VBAP-VBELN.
        IF SY-SUBRC = 0.
          MOVE-CORRESPONDING T_VBAP TO I_VBAP.
          APPEND I_VBAP.
          CLEAR I_VBAP.
        ELSE.
          CONTINUE.
        ENDIF.
      ENDLOOP.
      SORT I_VBAP.
    ENDFORM.                    "SALESDATA_VALIDATION
    regards,
    srinivas
    <b>*reward for useful answers*</b>

  • Download as a CSV file (excel)

    hi all,
    I am trying to download it as a CSV file (local and unix files), but when i get the data in excel , the issue occurs is:
    F1     F2     F3                                        
    OU Code     OU Name     OU Description                                        
    0000010000     0000010000-PG/US/PRIM CARE                                             
    0000010001     0000010001-PG/US/APOTH COMMODIT     APOTHECON COMMODITY                                        
    note: in the first line iam getting as F1,F2 & F3. i dont want these to come, rest all iam getting it perfectly.
    For downloading it i used the below code:
    *&      Form  DOWNLOAD_FILE
          text
    -->  p1        text
    <--  p2        text
    FORM DOWNLOAD_FILE .
    **Add column headers
      clear x_out_prctr.
      x_out_prctr-prctr = 'OU Code'.
      x_out_prctr-ktext = 'OU Name'.
      x_out_prctr-ltext = 'OU Description'.
      x_out_prctr-OUTNAME = 'OU Type Name'.
      x_out_prctr-OTNAME = 'Organization Type Name'.
      x_out_prctr-POUCODE = 'Parent OU'.
      x_out_prctr-STATUS =  'Status'.
      x_out_prctr-OUOUNAME = 'OU Owner'.
      x_out_prctr-OUAUNAME = 'OU Assistant'.
      x_out_prctr-OUCUNAME = 'OU Controller'.
      x_out_prctr-OUMRUNAME = 'OU MSP Rep'.
      Insert x_out_prctr into it_out index 1.
    Insert x_out_prctr into it_out1 index 1.
      clear x_out_prctr.
      IF p_local = c_x.
        perform gui_download.
      elseif p_unix = c_x.
        open dataset p_file for output in text mode encoding non-unicode
            ignoring conversion errors.
        if sy-subrc = 0.
    *-For Profit Center
          loop at it_out into x_out_prctr.
            transfer x_out_prctr to p_file.
            if sy-subrc ne 0.
              write:/ 'Error writing file'(011), p_file.
              stop.
            endif.
          endloop.
        endif.
      Close dataset
        close dataset p_file.
      endif.
    ENDFORM.                    " DOWNLOAD_FILE
    *&      Form  GUI_DOWNLOAD
          text
    -->  p1        text
    <--  p2        text
    FORM GUI_DOWNLOAD .
      DATA : lv_fname TYPE string.
      CLEAR lv_fname.
      lv_fname = p_file.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          FILENAME                = lv_fname
          FILETYPE                = 'DBF'
        TABLES
          DATA_TAB                = it_out
        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.
    ENDFORM.                    " GUI_DOWNLOAD
    could any one solve my issue ASAP?
    Regards,
    Shalini

    Hi Karthik,
    when i give the file type as ASC it  is not working, The column heading are getting messed up when i use this. the column heading is coming in one text line. but when i changed it to other one...everthing is working fine...but....in the downloaded file in the first line iam getting the F1 ,F2, F3 ..which i dont want it. if i delete this line my problem will be solved.
    my program code is:
                     Includes                                            *
    *--- BMS standard header and footer routines
    INCLUDE zsrepthd.
    *--- ALV Routinesg
    INCLUDE zvsdi_alv_routines_ver3.
    *--- Authorization Check
    INCLUDE z_selection_auth_check.
                     Types Declarations                                  *
    **-Profit Center
    *-For CEPC table
    TYPES: BEGIN OF ty_cepc,
            prctr TYPE prctr,
            datbi TYPE datbi,
           END OF ty_cepc.
    *-For CEPCT table
    TYPES: BEGIN OF ty_cepct,
            prctr TYPE prctr,
            datbi TYPE datbi,
            ktext TYPE ktext,
            ltext TYPE ltext,
           END OF ty_cepct.
    *-Output field name
    TYPES: BEGIN OF ty_output,
            prctr(10) TYPE c,
            ktext(40) TYPE c,
            ltext TYPE ltext,
            OUTNAME(13) TYPE c,
            OTNAME(30) TYPE c,
            POUCODE(13) TYPE c,
            STATUS(8) TYPE c,
            OUOUNAME(17) TYPE c,
            OUAUNAME(30) TYPE c,
            OUCUNAME(30) TYPE c,
            OUMRUNAME(17) TYPE c,
           END OF ty_output.
                     Internal Table Declarations                         *
    DATA:
    *--- Alv parameters
         it_out_alvp TYPE typ_alv_form_params, "for alv parameters
    **--To store prctr for profit center data
         it_profit_prctr type standard table of ty_cepc,
    **--To store text for profit center data
         it_text_prctr type standard table of ty_cepct.
    **--To store output for profit center data
    DATA: BEGIN OF it_out occurs 0,
            prctr(10) TYPE c,
            ktext(40) TYPE c,
            ltext TYPE ltext,
            OUTNAME(13) TYPE c,
            OTNAME(30) TYPE c,
            POUCODE(13) TYPE c,
            STATUS(8) TYPE c,
            OUOUNAME(17) TYPE c,
            OUAUNAME(30) TYPE c,
            OUCUNAME(30) TYPE c,
            OUMRUNAME(17) TYPE c,
           END OF it_out.
                     Work Area Declarations                              *
    DATA: x_profit_prctr type ty_cepc,
          x_text_prctr type ty_cepct,
          x_out_prctr type ty_output,
                     Data Declarations                                   *
          v_prctr TYPE cepc-prctr,
          l_prctr(10) TYPE c,
          l_ktext(40) TYPE c.
                     Constants Declarations                              *
    CONSTANTS: c_0  TYPE char1 VALUE '0',
               c_x  TYPE char1 VALUE 'X'.
                     Selection Screen                                    *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-fr1.
    SELECT-OPTIONS:  s_prctr FOR v_prctr.
    PARAMETERS:      p_date TYPE sy-datum OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-fr2.
    PARAMETERS: p_local RADIOBUTTON GROUP rb1 USER-COMMAND cmd DEFAULT 'X',
                p_unix  RADIOBUTTON GROUP rb1,
                p_file TYPE rlgrap-filename.
    SELECTION-SCREEN END OF BLOCK b2.
                     Initialization                                      *
    INITIALIZATION.
                     At Selection Screen                                 *
    AT SELECTION-SCREEN.
                     At Selection value request                          *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      IF p_local = c_x.
    *--- Getting F4 help for Costcenter file
        PERFORM get_filename CHANGING p_file.
      ELSEIF p_unix = c_x.
        MESSAGE i999(zi) WITH 'This fucntion is not available'(i01).
      ENDIF.
                     Start-of-Selection                                  *
    START-OF-SELECTION.
    *--- Check Authorizations for Selection-screen
      PERFORM z_selection_auth_check.
    **-- Get the profit center data from tables CEPC,CEPCT
      PERFORM f_get_profitcenter.
                     End-of-Selection                                    *
    END-OF-SELECTION.
    **-- Download data to final internal table.
      PERFORM data_output.
      IF NOT it_out[] IS INITIAL.
    *--- Fill the structure for calling the ALV form
        PERFORM initialize_alv_params.
    **-- Display ALV Report
        PERFORM setup_and_display_alv_ver2
           USING
            it_out_alvp      "Parameter structure
            it_out[]         "Internal Data table(header table)
            it_out[].        "Dummy table for Hierarchical ALV!!(item table)
    **-- Down load to excel.
        PERFORM download_file .
      ENDIF.
    *&      Form  f_top_of_page
    *This is to write the top of page
    FORM top_of_page.
      DATA:  lt_list TYPE slis_t_listheader,
             lx_list TYPE slis_listheader.
    *--- Title name
      CLEAR lx_list.
      lx_list-typ  = 'S'.
      lx_list-key  = 'Title name'(t13).
      lx_list-info = sy-title.
      APPEND lx_list TO lt_list.
      IF NOT lt_list IS INITIAL.
        CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
          EXPORTING
            it_list_commentary = lt_list.
      ENDIF.
    ENDFORM.                    "top_of_page
    *&      Form  init_page_head
    Description : This subroutine initializes the fields in table BHDGD  *
                  for printing the report heading.                       *
    FORM init_page_head.
      bhdgd-line1  = 'Profit Center Extraction'(h04).
      bhdgd-line2  = sy-title.
      bhdgd-lines  = sy-linsz.
      bhdgd-fcpyrt = sy-uline.
      bhdgd-inifl  = '0'.
    ENDFORM.                    "init_page_head
    *&      Form  initialize_alv_params
    Description : Form to initialize ALV Params
    FORM initialize_alv_params.
      CONSTANTS: lc_alv_grid  TYPE char1 VALUE 'G',  "Grid
                 lc_u         TYPE char1 VALUE 'U'.
      MOVE 'IT_OUT' TO  it_out_alvp-tablname.   "final TABLE
      MOVE sy-repid    TO   it_out_alvp-repid.
      MOVE lc_alv_grid TO   it_out_alvp-alvtype.
      MOVE c_x         TO   it_out_alvp-bringdefaultvar.
      MOVE lc_u        TO   it_out_alvp-variantsavetype.
    ENDFORM.                    " initialize_alv_params
          FORM it_out_init_events                                       *
    -->this is form is to modify the events
    FORM it_out_init_events
          CHANGING
           alevnts TYPE slis_t_event.
      FIELD-SYMBOLS <alevnt> TYPE slis_alv_event.
      LOOP AT alevnts ASSIGNING <alevnt>.
        CASE <alevnt>-name.
          WHEN  slis_ev_top_of_page.
            MOVE 'TOP_OF_PAGE'  TO <alevnt>-form.
        ENDCASE.
      ENDLOOP.
    ENDFORM.                    "it_out_init_events
    *&      Form  get_filename
    Description : This subroutine is used for F4 Prompting
    FORM get_filename CHANGING p_path LIKE rlgrap-filename.
      DATA : l_file  LIKE ibipparms-path, "Local file for upload/download
             l_repid LIKE syst-cprog,     "ABAP program, caller in external
                                          "procedures
             l_dynnr TYPE syst-dynnr.     "Current screen No
      l_repid = syst-cprog.
      l_dynnr = syst-dynnr.
    *--- Function module used for F4 help
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = l_repid
          dynpro_number = l_dynnr
        IMPORTING
          file_name     = l_file.
      MOVE l_file TO p_path.
    ENDFORM.                    " get_filename
    *&      Form  F_GET_PROFITCENTER
    *Get the profit center data from CEPC,CEPCT
    FORM f_get_profitcenter.
      SELECT prctr
             datbi
             from cepc
             into table it_profit_prctr
             where prctr in s_prctr
             and   datbi >= p_date.
      IF sy-subrc = c_0.
        SORT it_profit_prctr BY prctr datbi.
      ENDIF.
      If not it_profit_prctr is initial.
        SELECT prctr
               datbi
               ktext
               ltext
               from cepct
               into table it_text_prctr
               for all entries in it_profit_prctr
               where prctr = it_profit_prctr-prctr
               and   datbi = it_profit_prctr-datbi.
        IF sy-subrc = c_0.
          SORT it_text_prctr BY prctr datbi ktext ltext.
        ENDIF.
      endif.
    ENDFORM.                    " F_GET_PROFITCENTER
    *&      Form  DATA_OUTPUT
          text
    -->  p1        text
    <--  p2        text
    FORM DATA_OUTPUT .
      loop at it_profit_prctr into x_profit_prctr.
        read table it_text_prctr into x_text_prctr with key prctr =
                                                x_profit_prctr-prctr
                                                            datbi =
                                                x_profit_prctr-datbi.
        if sy-subrc = 0.
          x_out_prctr-prctr = x_text_prctr-prctr.
          concatenate x_text_prctr-prctr x_text_prctr-ktext into l_ktext
           separated by '-'.
          x_out_prctr-ktext = l_ktext.
          x_out_prctr-ltext = x_text_prctr-ltext.
          x_out_prctr-outname = 'Profit Center'.
          x_out_prctr-status = 'Active'.
        endif.
        append x_out_prctr to it_out.
      endloop.
    ENDFORM.                    " DATA_OUTPUT
    *&      Form  DOWNLOAD_FILE
          text
    -->  p1        text
    <--  p2        text
    FORM DOWNLOAD_FILE .
    **Add column headers
      clear x_out_prctr.
      x_out_prctr-prctr = 'OU Code'.
      x_out_prctr-ktext = 'OU Name'.
      x_out_prctr-ltext = 'OU Description'.
      x_out_prctr-OUTNAME = 'OU Type Name'.
      x_out_prctr-OTNAME = 'Organization Type Name'.
      x_out_prctr-POUCODE = 'Parent OU'.
      x_out_prctr-STATUS =  'Status'.
      x_out_prctr-OUOUNAME = 'OU Owner'.
      x_out_prctr-OUAUNAME = 'OU Assistant'.
      x_out_prctr-OUCUNAME = 'OU Controller'.
      x_out_prctr-OUMRUNAME = 'OU MSP Rep'.
      Insert x_out_prctr into it_out index 1.
    Insert x_out_prctr into it_out1 index 1.
      clear x_out_prctr.
      IF p_local = c_x.
        perform gui_download.
      elseif p_unix = c_x.
        open dataset p_file for output in text mode encoding non-unicode
            ignoring conversion errors.
        if sy-subrc = 0.
    *-For Profit Center
          loop at it_out into x_out_prctr.
            transfer x_out_prctr to p_file.
            if sy-subrc ne 0.
              write:/ 'Error writing file'(011), p_file.
              stop.
            endif.
          endloop.
        endif.
      Close dataset
        close dataset p_file.
      endif.
    ENDFORM.                    " DOWNLOAD_FILE
    *&      Form  GUI_DOWNLOAD
          text
    -->  p1        text
    <--  p2        text
    FORM GUI_DOWNLOAD .
      DATA : lv_fname TYPE string.
      CLEAR lv_fname.
      lv_fname = p_file.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          FILENAME                = lv_fname
          FILETYPE                = 'DBF'
        TABLES
          DATA_TAB                = it_out
        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.
    ENDFORM.                    " GUI_DOWNLOAD
          FORM it_out_alv_fieldcat_before                               *
    -->  PT_FCAT                                                       *
    -->  ALVP                                                          *
    FORM it_out_alv_fieldcat_before  CHANGING
        pt_fcat TYPE slis_t_fieldcat_alv
        alvp TYPE typ_alv_form_params.
      DATA: lx_fcat TYPE slis_fieldcat_alv.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUT'.
      lx_fcat-fieldname      = 'PRCTR'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'OU Code'(010).
      lx_fcat-seltext_m      = 'OU Code'(010).
      lx_fcat-seltext_s      = 'OU Code'(010).
      lx_fcat-reptext_ddic   = 'OU Code'(010).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUT'.
      lx_fcat-fieldname      = 'KTEXT'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'OU Name'(030).
      lx_fcat-seltext_m      = 'OU Name'(030).
      lx_fcat-seltext_s      = 'OU Name'(030).
      lx_fcat-reptext_ddic   = 'OU Name'(030).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUT'.
      lx_fcat-fieldname      = 'LTEXT'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'OU Description'(040).
      lx_fcat-seltext_m      = 'OU Description'(040).
      lx_fcat-seltext_s      = 'OU Description'(040).
      lx_fcat-reptext_ddic   = 'OU Description'(040).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUT'.
      lx_fcat-fieldname      = 'OUTNAME'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'OU Type Name'(013).
      lx_fcat-seltext_m      = 'OU Type Name'(013).
      lx_fcat-seltext_s      = 'OU Type Name'(013).
      lx_fcat-reptext_ddic   = 'OU Type Name'(013).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUT'.
      lx_fcat-fieldname      = 'OTNAME'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'Organization Type Name'(030).
      lx_fcat-seltext_m      = 'Organization Type Name'(030).
      lx_fcat-seltext_s      = 'Organization Type Name'(030).
      lx_fcat-reptext_ddic   = 'Organization Type Name'(030).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUT'.
      lx_fcat-fieldname      = 'POUCODE'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'Parent OU Code'(013).
      lx_fcat-seltext_m      = 'Parent OU Code'(013).
      lx_fcat-seltext_s      = 'Parent OU Code'(013).
      lx_fcat-reptext_ddic   = 'Parent OU Code'(013).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUT'.
      lx_fcat-fieldname      = 'STATUS'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'Status'(008).
      lx_fcat-seltext_m      = 'Status'(008).
      lx_fcat-seltext_s      = 'Status'(008).
      lx_fcat-reptext_ddic   = 'Status'(008).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUT'.
      lx_fcat-fieldname      = 'OUOUNAME'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'OU Owner User Name'(017).
      lx_fcat-seltext_m      = 'OU Owner User Name'(017).
      lx_fcat-seltext_s      = 'OU Owner User Name'(017).
      lx_fcat-reptext_ddic   = 'OU Owner User Name'(017).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUT'.
      lx_fcat-fieldname      = 'OUAUNAME'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'OU Assistant User Name'(030).
      lx_fcat-seltext_m      = 'OU Assistant User Name'(030).
      lx_fcat-seltext_s      = 'OU Assistant User Name'(030).
      lx_fcat-reptext_ddic   = 'OU Assistant User Name'(030).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUT'.
      lx_fcat-fieldname      = 'OUCUNAME'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'OU Controller User Name'(030).
      lx_fcat-seltext_m      = 'OU Controller User Name'(030).
      lx_fcat-seltext_s      = 'OU Controller User Name'(030).
      lx_fcat-reptext_ddic   = 'OU Controller User Name'(030).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUT'.
      lx_fcat-fieldname      = 'OUMRUNAME'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'OU MSP Rep User Name'(017).
      lx_fcat-seltext_m      = 'OU MSP Rep User Name'(017).
      lx_fcat-seltext_s      = 'OU MSP Rep User Name'(017).
      lx_fcat-reptext_ddic   = 'OU MSP Rep User Name'(017).
      APPEND lx_fcat TO pt_fcat.
    ENDFORM.                    " it_out_alv_fieldcat_before
    Thanks & Regards,
    Shalini

  • Add text to downloaded CSV file

    Hi.
    I'm trying to place a text at the bottom of the csv file, but I can not find the way to do it.
    What I'm trying to do is, after all rows downloaded in my csv file, I'd like to place a general comment in the next row regarding some information about the data I've downloaded.
    Is this possible?
    Thanks
    Ivo

    one of my colleagues might have a better answer for this, but one not-so-elegant way to get a message to display at the bottom of your csv output would be to manually put your own "download to csv" link on your page. have that link go to another page in your app that reports on the same query as your original report. put a region of type HTML right after your duplicate report region that displays the text you want to see in your csv output (be sure to use "No Template" for this region's template). change the report template of the second report region to "export: CSV". now when users click your manually added "download to csv" link, they'll be linked over to your other page. that page will immediately output the csv data as well as the additional line from your extra HTML region.
    hope this helps,
    raj

  • Dyanmic csv file downloading with out writing a copy to server

    Hi,
    Here is my problem, any help most appriciated..
    I want to download dynamically created CSV file from the weblogic server, using jsp/servlet communication.
    I developed a servlet for this and i called that servlet from my jsp page, when user clicks on download button, my servlet works fine, but it writes a copy of CSV file into c:\bea\wlserver6.0 of the server, My intention is just it's has to dowload file to the client system, with out writing a copy in the server.
    Here is my code snnipits..
    public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
    HttpSession session = req.getSession(true);
    try {
    resultMessageLastBalance = mtdRetrieveLastBalance(req);
    rsTrxnDetailLastBalance = resultMessageLastBalance.getRecordSet("lasttentrxn");
    } catch (Exception e) {
    e.printStackTrace();
    e.getMessage();
    File csvFile;
    FileOutputStream file;
    //codes to generate a file in local server for downloading
    Calendar calendar = Calendar.getInstance();
    String strFileName = Integer.toString(calendar.get(Calendar.YEAR))+Integer.toString(calendar.get(Calendar.MONTH))+Integer.toString(calendar.get(Calendar.DATE))+Integer.toString(calendar.get(Calendar.HOUR))+Integer.toString(calendar.get(Calendar.MINUTE))+Integer.toString(calendar.get(Calendar.SECOND))+Integer.toString(calendar.get(Calendar.MILLISECOND));
    try {
    strFileName = DeformatAcctNo(req.getParameter("acct_trxn__acctselected")) + strFileName + ".csv";
    } catch (Exception e) {}
    calendar = null;
    csvFile = new File(strFileName);
    if (!csvFile.exists()) {
    csvFile.createNewFile();
    file = new FileOutputStream(csvFile);
    res.setContentType("application/download");
    res.setHeader("Content-Disposition","attachment;filename=" + strFileName);
    javax.servlet.ServletOutputStream servletoutputstream1 = res.getOutputStream();
    String s = strFileName;
    dumpFile(s, servletoutputstream1);
    servletoutputstream1.flush();
    servletoutputstream1.close();

    Hi,
    Thanx a lot for ur solution..it's helful for me to send data with a file format,but i need t send data in csv file foramt.
    hav a look at my complete servelt and try to suggesst some thing..
    In this case csv file is creating in c:\bea\wlserver directory.my intensions sre just it jas to download to client, no copy in the server.
    public class AcctStmtD2 extends HttpServlet {
         public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
         //variables for retrieving last balance
         Message resultMessageLastBalance = null;
         RecordSet rsTrxnDetailLastBalance = null;
         double dblDebitTotal = 0.00;
         double dblCreditTotal = 0.00;
         HttpSession session = req.getSession(true);
    Enumeration ea = session.getAttributeNames();
         while(ea.hasMoreElements()) {
         Object name = ea.nextElement();
         System.out.println("values = " + session.getAttribute((String)name));
         try {
         resultMessageLastBalance = mtdRetrieveLastBalance(req);
         rsTrxnDetailLastBalance = resultMessageLastBalance.getRecordSet("formonthtrxn");
         } catch (Exception e) {
         e.printStackTrace();
         e.getMessage();
         File csvFile;
         FileOutputStream file;
         //codes to generate a file in local server for downloading
         Calendar calendar = Calendar.getInstance();
         String strFileName = Integer.toString(calendar.get(Calendar.YEAR))+Integer.toString(calendar.get(Calendar.MONTH))+Integer.toString(calendar.get(Calendar.DATE))+Integer.toString(calendar.get(Calendar.HOUR))+Integer.toString(calendar.get(Calendar.MINUTE))+Integer.toString(calendar.get(Calendar.SECOND))+Integer.toString(calendar.get(Calendar.MILLISECOND));
         try {
              strFileName = DeformatAcctNo(req.getParameter("acct_stmt__acctselected")) + strFileName + ".csv";
         } catch (Exception e) {}
         calendar = null;
         csvFile = new File(strFileName);
         if (!csvFile.exists()) {
         csvFile.createNewFile();
         file = new FileOutputStream(csvFile);
         if (rsTrxnDetailLastBalance.getTotalRowCount() >= 1) {
         String strLastBal = "";
         String strCurrCd = "";
              try {
                        rsTrxnDetailLastBalance.moveLast();
         strLastBal = rsTrxnDetailLastBalance.getValue("bal");
                        rsTrxnDetailLastBalance.moveFirst();
         strCurrCd = "(" + GetCurrCdFromSession(session, req.getParameter("acct_stmt__acctselected")) + ")";
         file.write(("\""+req.getParameter("acct_stmt__acctselected")+"\"").getBytes());
         file.write(',');
         file.write(',');
         file.write(',');
         file.write(',');
         file.write(',');
         file.write(("\""+"Last Balance "+strCurrCd+" = "+strLastBal+"\"").getBytes());
         file.write('\n');
         file.write(("\""+"Date"+"\"").getBytes());
         file.write(',');
         file.write(("\""+"Slip No"+"\"").getBytes());
         file.write(',');
         file.write(("\""+"Description"+"\"").getBytes());
         file.write(',');
         file.write(("\""+"Debit"+" "+strCurrCd+"\"").getBytes());
         file.write(',');
         file.write(("\""+"Credit"+" "+strCurrCd+"\"").getBytes());
         file.write(',');
         file.write(("\""+"Balance"+" "+strCurrCd+"\"").getBytes());
         file.write('\n');
         } catch (Exception e) {System.out.println("!");}
    while(rsTrxnDetailLastBalance.moveNext()) {
         try {
         file.write(("\""+rsTrxnDetailLastBalance.getValue("txn_dt").substring(0,12)+"\"").getBytes());
    file.write(',');
         file.write(("\""+rsTrxnDetailLastBalance.getValue("slip_no")+"\"").getBytes());
         file.write(',');
         file.write(("\""+rsTrxnDetailLastBalance.getValue("dscp")+"\"").getBytes());
         file.write(',');
         file.write(("\""+rsTrxnDetailLastBalance.getValue("debit")+"\"").getBytes());
         file.write(',');
         file.write(("\""+rsTrxnDetailLastBalance.getValue("credit")+"\"").getBytes());
         file.write(',');
         file.write(("\""+rsTrxnDetailLastBalance.getValue("bal")+"\"").getBytes());
         file.write('\n');
         } catch(Exception e) {}
         try {
                             dblDebitTotal += Double.parseDouble(rsTrxnDetailLastBalance.getValue("debit"));
         } catch (Exception e) {
                             dblDebitTotal = 0;
         try {
                             dblCreditTotal += Double.parseDouble(rsTrxnDetailLastBalance.getValue("credit"));
         } catch (Exception e) {
                             dblCreditTotal = 0;
         file.write(',');
         file.write(',');
         file.write(("\""+"Total"+"\"").getBytes());
         file.write(',');
         file.write(("\""+Double.toString(dblDebitTotal)+"\"").getBytes());
         file.write(',');
         file.write(("\""+Double.toString(dblCreditTotal)+"\"").getBytes());
         } else {
         file.write(("\""+"No Record Found!"+"\"").getBytes());
         file.close();
         res.setContentType("application/download");
         res.setHeader("Content-Disposition","attachment;filename=" + strFileName);
                   javax.servlet.ServletOutputStream servletoutputstream1 = res.getOutputStream();
         String s = strFileName;
         dumpFile(s, servletoutputstream1);
         servletoutputstream1.flush();
         servletoutputstream1.close();
    public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
              doGet(req, res);
    private void dumpFile(String s, OutputStream outputstream) {
    byte abyte0[] = new byte[4096];
         boolean flag = true;
         try {
         FileInputStream fileinputstream = new FileInputStream(s);
         int i;
         while((i = fileinputstream.read(abyte0)) != -1)
         outputstream.write(abyte0, 0, i);
         fileinputstream.close();
         } catch(Exception e) {}
    private Message mtdRetrieveLastBalance(HttpServletRequest req) throws Exception {
         Message msgMessage = new Message();
         DAC.Parser.RecordSet objFund_Tx = msgMessage.createRecordSet("formonthtrxn");
         //Set the header fields for the record
         objFund_Tx.addHeaderFields("acctselected","String");
         objFund_Tx.addHeaderFields("formonth","String");
         objFund_Tx.addHeaderFields("foryear","String");
         //Add a new row to the recordset
         objFund_Tx.addRow();
         msgMessage.setData("recordnm", "string", "formonthtrxn");
         //Set the required fields into the recordset
         objFund_Tx.setValue("acctselected", DeformatAcctNo(req.getParameter("acct_stmt__acctselected")));
         objFund_Tx.setValue("formonth", req.getParameter("acct_stmt__formonth"));
         objFund_Tx.setValue("foryear", req.getParameter("acct_stmt__foryear"));
         objFund_Tx.setStatus("select");
         System.out.println("JSP IN :"+msgMessage);
         msgMessage = mtdOpenConnection(msgMessage);
         System.out.println("JSP OUT :"+msgMessage);
         return msgMessage;
    private Message mtdOpenConnection(Message objMessage) throws Exception {
    java.util.Hashtable ht = new java.util.Hashtable();
         ht.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
         ht.put(javax.naming.Context.PROVIDER_URL, "t3://localhost:7001");
    javax.naming.InitialContext ic = new javax.naming.InitialContext(ht);
    DAC.BusinessObjects.RIB.Account.AccountHome pmHome = (DAC.BusinessObjects.RIB.Account.AccountHome)PortableRemoteObject.narrow(ic.lookup("AccountEJB"),Class.forName("DAC.BusinessObjects.RIB.Account.AccountHome"));
         DAC.BusinessObjects.RIB.Account.Account pmObj = (DAC.BusinessObjects.RIB.Account.Account)PortableRemoteObject.narrow(pmHome.create(),Class.forName("DAC.BusinessObjects.RIB.Account.Account"));
         return pmObj.mtdRetrieveTrxForMonth(objMessage);
    private String convertSingleDigitMonthDayToDouble(String param) throws Exception {
         if (param.length() > 1) {
         return param;
         } else {
         return "0" + param;
         //remove dashes and product name and branch code from string
         private String DeformatAcctNo(String strAcctNo) throws Exception {
              strAcctNo.trim();
              return strAcctNo.substring(0,3)+strAcctNo.substring(4,6)+strAcctNo.substring(7,12)+strAcctNo.substring(13,14);
         private     String GetCurrCdFromSession(HttpSession session, String acct_no) throws Exception {
              String strAcctDetail = "";
              String strCurrCd = "";
              Vector vList = (Vector)session.getAttribute("accountlist");
              for (int i = 0; i < vList.size(); i++) {
                   strAcctDetail = (String)vList.get(i);
                   if ((strAcctDetail.substring(0, acct_no.length()).equals(acct_no))) {
                        strCurrCd = strAcctDetail.substring(strAcctDetail.indexOf(":") + 1, (strAcctDetail.indexOf(":") + 4));
                        break;
              vList = null;
              strAcctDetail = null;
              return strCurrCd;
    }

  • How to use auto fit selection when downloading to csv file

    hi,
    I am working on reports, i need to download to a .csv file. I am using GUI_DOWNLOAD is there any option for it where text fits exactly in a single cell.
    For Eg:
    I excel there is an option (Format-column-Autofitselection).
    Then the column size increases or decreased according to the text size.

    Dear Josephine,
       There is no option the way you want of autofit. Rather while opening the CSV in excel u can do the required formatting.
    Regards,
    Deva.

  • How can I download zipped CSV files in Firefox and ensure this happens automatically in future?

    When I attempt to download a zipped CSV file in Firefox, the usual pop-up window appears asking what Firefox should do with this file... even after I select "Open with" and choose my Zip File Manager and tick the box that says "Do this automatically for files like this from now on", this pop-up continues to appear every time I come to download files

    @Corel
    Thanks, I had forgotten all about potential server side problems.
    @Conners81 <br/>
    If sample problem files and links are publicly available maybe you could include an example of the link being used, preferably to one of the smaller simpler files.
    *What is the website you are using?
    For comparison an example you may like to try
    * site providing .csv data [http://www.ofcom.org.uk/static/cmr-10/WAL-3.4.html]
    ** a small few lines csv download file [http://www.ofcom.org.uk/static/cmr-10/csv/WAL-3.4.csv]
    ** similar info as a pdf chart [http://www.ofcom.org.uk/static/cmr-10/pdfs/WAL-3.4.pdf]
    Of course you have the added complication of the zipped file.

  • Date format in CSV file not coming as required

    Hi,
    I have a problem in date format after it is downloaded as a CSV file. In CSV file it is coming as 2/6/2009
    but the format i required is 2009/02/06. Im using GUI_UPLOAD FM for file download. In the internal table im having the date in this format YYYY/MM/DD only.
    How can i bring the date in CSV file in required format?
    Thanks in advance,
    Srilakshmi.

    Hi Srilashmi,
    You question really made me wear thinking cap.
    When you populate date in SAP system, it's taken in internal format i.e YYYYMMDD, though you declare date field as DATE, D or SY-DATUM, the issue comes into light, when you got to display it.
    1. Import date in internal format i.e. YYYYMMDD,
    DATA:
      w_date type d.
    2. Declare another variable w_date1(10) like C.
    3. Goto System-> User Profile -> Own Data -> Defaults -> Date Format. Now, whatever date you have set, it's gonna take the same format.
    4. WRITE W_DATE TO W_DATE1, transport imported date to char type w_date1, this makes date appear in format you want it to .
    And regarding, saving in CSV format, not always GUI_UPLOAD or GUI_DOWNLOAD works,
    TEXT _ CONVERT _ XLS_TO_SAP   -> From program to excel sheet
    ALSM_EXCEL_TO_INTERNAL_TABLE  -> Excel sheet to Program
    Hope this helps you.
    Thanks: Zahack

  • Need to download only in .csv format

    hi
    i need to download only in .csv file
    if any one gives the other format file then it must change to.csv onthe selectionscreen itself and then it is to be executed
    i mean the last 3 digits to be changed ' csv'
    urgent
    regards
    sachin

    Hi
    Check this code, maybe is helpful
        clear it_tabla2[].
        call function 'SAP_CONVERT_TO_CSV_FORMAT'
             exporting
                  i_field_seperator    = ';'
             tables
                  i_tab_sap_data       = empleados
             changing
                  i_tab_converted_data = it_tabla2
             exceptions
                  conversion_failed    = 1
                  others               = 2.
        call function 'WS_DOWNLOAD'
             exporting
                  filename                = emplea
    *              filetype                = 'DAT'
    *              mode                    = ' '
                  filetype_no_change      = 'X'
    *              item                    = 'Archivo de Empleados'
             tables
                  data_tab                = it_tabla2[]
             exceptions
                  invalid_filesize        = 1
                  invalid_table_width     = 2
                  invalid_type            = 3
                  no_batch                = 4
                  unknown_error           = 5
                  gui_refuse_filetransfer = 6
                  customer_error          = 7
                  others                  = 8.
    Regards
    Gregory

  • Need help to download csv file in application by writting to outputstream.

    HI All,
    Requirment of my client is donloading CSV file from portal.
    My approach  is:
    On clicking "Download" button in JSP I am calling an action in controller and from here I am redirecting call to DownloadCSV.jsp where i am writing to output stream of response.
    Action called in controller:
         @Jpf.Action(forwards = { @Jpf.Forward(name = StaticConstants.SUCCESS, redirect = true, path = "DownloadCSV.jsp") })
         public Forward gotoReports() {
              Forward forward = new Forward(StaticConstants.SUCCESS);
              return forward;
    Download jsp:
    response.resetBuffer();
         response.reset();
         response.setContentType("application/vnd.ms-excel");
         response.addHeader("Content-Disposition", "attachment;filename="+ companyId +"_Audit_Report.csv");
         ServletOutputStream os = response.getOutputStream();
              os .println();
              os .print("DATE");
              os .print("USER");
    os .println();
    os.flush();
    os.close();
    I am able to download the csv file in excel. But after that i am not able to perform any operation in portal page. Mouser pointer becomes busy and cant click on anything.
    Second approach followed:
    I wrote the code for writting to outputstream of outputresponse in controller action itself and forwarded to the same jsp where my download button resides.
    Problem:
    Download happens perfectly but the excel in csv format contains the portal framework generated content also other than content i wrote to response.
    If u have any other approach to download an excel without redirecting to JSP plz let me know. Coing is being done in 10.2 weblogic portal.
    Please help. Its very urgent.
    Plz let me know how a file can be downloded in portal context without keeping a file at server side. I need to download file by writting to outputstream.
    If it is possible plz attach one small example project also.
    Thanks a ton in advance.
    It is very important plz do reply.

    Hi Srinivas,
    For downloading binary content that is not text/html, the Oracle WebLogic Portal content management tools use javascript in an onclick event handler to set the window URL to the URL of a download pageflow controller: window.location = url. The content management tools are in a portal so it should be possible for you to do the same thing.
    The url is a custom pageflow controller that streams the bytes to the response. It sounds like you already have a pageflow you could recycle to use in that way. You don't want to stay within your portlet pageflow because then you will be streaming bytes into the middle of a portal response. You want a separate download pageflow that you invoke directly, outside of the portal framework (in other words, don't invoke it by rendering a portlet that invokes the pageflow).
    You can set the url to invoke the pageflow directly by giving the path to the pageflow controller from the web root (remember the pageflow path matches the package name of the pageflow controller class) like this: "/content/node/nodeSelected/download/DownloadContentController.jpf"
    By the way, for the case of text/html, the tools uses a standalone portlet URL so that the text/html is not rendered in the browser window, which would replace the portal markup (because the browser renders text/html by default, instead of giving you a download widget or opening some other application to deal with the bytes).

  • Download CSV-File from Interactive Report

    Dear all,
    I want to download a CSV-File from a Interactive report.
    The content of the Rows in Excel:
    Erste,"B","C","D","E","F","G","H","I","J","K","L","M","N","O","P"
    IBC ->,"-","1","2","3","4","5","6","7","8","9","10","11","12","13","14" [...]
    How can I solve this problem?
    Thanks for help.

    Your CSV-File use "comma" as separator. But Excel think, that CSV-File separator is "semicolon".
    Try to set "CSV Separator"=";" in section "Report Attributes" - "Download".

  • Problem with finding correct application to open a .csv file from Downloads

    Hi Guys. I've been a Mac user for some time now but have only just found this forum! Anyway, I've downloaded a .csv file to my Download folder but when I click on it to open it I get the "Can't find an application etc. " message. When the dropdown "Choose Application" menu appears it wont choose (ie the "Open" button won't enable). What is a .csv file and what Application would open it (if I can get the thing to choose one in the first place?)
    Your help would be greatly appreciated. (BTW the file comes from my Paypal history if that helps.)

    A .csv file is a standard text file which typically contains data of some sort.
    CSV stands for Comma Separated Values.
    You could open the file using TextEdit, or a Word processor... but the content of the file might look a little strange and it won't be easy to read.
    Your best bet is to import this .csv file using a Spreadsheet application such as Microsoft Excel or other.

  • How to get fixed field length when download a CSV  file ?

    hi all ,
        I had downloaded a CSV file from an ALV list which created by myself. the current layout of the CSV file is :
    aaa;bbbbbbbbbb;cc;                
                                                         for example . but what i want is :
    aaa         ;bbbbbbbbbbb            ;cc     ; 
    it means these three fields are all with fixed length don't ommitting spaces when you preview the CSV file. how should i do this ?
    best regards
    Kevin

    i got the solution.

  • How to get file download dialog box in IE 6.0 for .CSV files?

    In our Java application, when we download .csv file (by clicking a tool bar button or menu item) in IE 5.5, it brings up the download dialog box and when we click the open button it opens the file in a seperate browser window but after migrating to IE 6.0 it doesn't bring the download dialog box and we are not able to open the excle sheet in a new browser window.
    We tried downloading .csv file in IE 6.0 by changing its extension(such as .cs1 and .xls) even then it did not work.We also tried associating CSV type of extension with "Microsoft Excel Comma Separated Values File" in the Windows folder options (Windows Explorer->tools->folder options->file types(tab)), which did not work.
    Please respond if you have come across this kind of issue and solution for the same.
    Thanks in Advance

    This has nothing to do with Java. It's Microsoft
    setting for known file type. IE is responding to the
    setting which will automatically download known file
    type (MIME type).
    To show the "Save As" file dialog, you have to do the
    following (for each file type)
    1. open Window Explorer
    2. click on Tool-->"Folder Option"
    3. click on the "File Type" tab
    4. select the extension and then click on the
    "Advance" button
    5. Check the "Confirm open after download" checkbox
    6. Click OK
    IE should now display the "Save As" file dialog for
    that extension. Remeber, you have to to this for all
    extension you want to see a "file dialog" pop up.Unfortunately this is not the only cause. Even with this box checked, downloading java source files from the pages of The Java Tutorial causes them to open in the most recent IE - I (and others also) don't get the save/open dialog box. Java source files downloaded from (some) other websites result in the save/open dialog box. I believe that one of the security changes that MS made in IE's handling of files is the cause. The setting of content-disposition by the server appears to be the key, according to MSDN information.

  • Download int table into csv file with each column in separate column in csv

    Hi All,
    I want to download the data in internal table to CSV file. but each column in the table should come as separate column in csv format.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          FILENAME                = GD_FILE
          FILETYPE                = 'ASC'
          WRITE_FIELD_SEPARATOR   = 'X'
        tables
          DATA_TAB                = I_LINES_NEW
        EXCEPTIONS
          FILE_OPEN_ERROR         = 1
          FILE_READ_ERROR         = 2
          NO_BATCH                = 3
          GUI_REFUSE_FILETRANSFER = 4
          INVALID_TYPE            = 5
          NO_AUTHORITY            = 6
          UNKNOWN_ERROR           = 7
          BAD_DATA_FORMAT         = 8
          HEADER_NOT_ALLOWED      = 9
          SEPARATOR_NOT_ALLOWED   = 10
          HEADER_TOO_LONG         = 11
          UNKNOWN_DP_ERROR        = 12
          ACCESS_DENIED           = 13
          DP_OUT_OF_MEMORY        = 14
          DISK_FULL               = 15
          DP_TIMEOUT              = 16
          OTHERS                  = 17.
      IF SY-SUBRC NE 0.
        WRITE: 'Error ', SY-SUBRC, 'returned from GUI_DOWNLOAD SAP OUTBOUND'.
        SKIP.
      ENDIF.
    with the above values passd , I am getting csv file but all the columns in one column separated by some square symbol.
    How to separate them into different columns.
    Thanks in advance
    rgds,
    Madhuri

    Below example might help you understand on dowloading CSV file:
    TYPE-POOLS: truxs.
    DATA: i_t001 TYPE STANDARD TABLE OF t001,
          i_data TYPE truxs_t_text_data.
    SELECT * FROM t001 INTO TABLE i_t001 UP TO 20 ROWS.
    CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'
      EXPORTING
        i_field_seperator          = ','
    *   I_LINE_HEADER              =
    *   I_FILENAME                 =
    *   I_APPL_KEEP                = ' '
      TABLES
        i_tab_sap_data             = i_t001
    CHANGING
       i_tab_converted_data       = i_data
    EXCEPTIONS
       conversion_failed          = 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.
    DATA: file TYPE string VALUE 'C:\testing.csv'.
    CALL METHOD cl_gui_frontend_services=>gui_download
      EXPORTING
        filename                = file
      CHANGING
        data_tab                = i_data[]
      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
        not_supported_by_gui    = 22
        error_no_gui            = 23
        OTHERS                  = 24.
    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
    Eswar

Maybe you are looking for