GUI_DOWNLOAD for txt

Hi guys,
im using GUI_DOWNLOAD, and i need the file in txt format, but is always generated in dat format,
any help is more than welcome.
this is the code
CALL function 'GUI_DOWNLOAD'
  exporting
  BIN_FILESIZE                    =
    filename                        = t_filename
   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                      =
  tables
    data_tab                        = table
  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
   OTHERS                          = 22.

hi  javier santana,
I have the code for your question.
look at:
REPORT  ZTABLETOTXT                             .
TABLES: spfli.
DATA: ti_spfli LIKE STANDARD TABLE OF spfli WITH HEADER LINE,
      p_file   TYPE string value 'C:\spfli.txt'.
PARAMETERS: sel_file(128) TYPE c
            default 'C:\spfli.txt' OBLIGATORY LOWER CASE.
SELECT * FROM spfli INTO TABLE ti_spfli.
p_file = sel_file.
CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    FILENAME = p_file
  TABLES
    DATA_TAB = ti_spfli[].
IF SY-SUBRC = 0.
  MESSAGE I398(00) WITH 'OK.'.
else.
  MESSAGE E398(00) WITH 'ERROR.'.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR sel_file.
  CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
      def_filename     = ''
      def_path         = 'C:\'
      mask             = ',all files, *.txt.'
      mode             = ''
    IMPORTING
      filename         = p_file
    EXCEPTIONS
      inv_winsys       = 1
      no_batch         = 2
      selection_cancel = 3
      selection_error  = 4
      OTHERS           = 5.
*Here is the code...
  find '.txt' IN p_file.
  if sy-subrc <> 0.
    concatenate p_file '.txt' into sel_file.
  else.
    sel_file = p_file.
  endif.

Similar Messages

  • GUI_Download for XML file ?

    Hi Experts,
    I have xml data in an internal table say int_xml_data.
    While i m downloading this data to presenatation server using gui_download m getting an error:
    "The XML page cannot be displayed
    Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
    Invalid at the top level of the document. Error processing resource 'file:///C:/Vendor File.xml'. Line 1, Position 1
    3C3F786D6C2076657273696F6E3D22312E30223F3E3C57535F56454E444F525F444154413E3C57535F56454E444F525F444154413E3C4C49464E52204461"
    I have used the function like this:-
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
      BIN_FILESIZE                  =
        FILENAME                      = 'C:\Vendor File.xml'
       FILETYPE                      = 'BIN'
      APPEND                        = ' '
      WRITE_FIELD_SEPARATOR         = ' '
      HEADER                        = '00'
      TRUNC_TRAILING_BLANKS         = ' '
      WRITE_LF                      = 'X'
      COL_SELECT                    = ' '
      COL_SELECT_MASK               = ' '
      DAT_MODE                      = ' '
    IMPORTING
      FILELENGTH                    =
      TABLES
        DATA_TAB                      = int_xml_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
       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.
    What is the mistake ???
    How can the xml data be downloaded to presentation seerver? ?
    Function works fine for .txt data but not for xml ???

    @ Sandeep:
    I did this only.
    Firstly I converted data into xml using SAP_CONVERT_TO_XML_FORMAT
    the code is:
    CALL FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'
    EXPORTING
      I_FIELD_SEPERATOR          = ':'
      I_LINE_HEADER              =
      I_FILENAME                  = w_path
      I_APPL_KEEP                = ' '
      I_XML_DOC_NAME              = <w_xml_file>
    IMPORTING
      PE_BIN_FILESIZE            =
        TABLES
          I_TAB_SAP_DATA             = int_final_vendor
       CHANGING
         I_TAB_CONVERTED_DATA        = int_xml_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.
    After this I am downloading the data using GUI_Download
    Code is
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
      BIN_FILESIZE                  =
        FILENAME                      = w_file
        FILETYPE                      = 'BIN'
      APPEND                        = ' '
      WRITE_FIELD_SEPARATOR         = ' '
      HEADER                        = '00'
      TRUNC_TRAILING_BLANKS         = ' '
      WRITE_LF                      = 'X'
      COL_SELECT                    = ' '
      COL_SELECT_MASK               = ' '
      DAT_MODE                      = ' '
    IMPORTING
      FILELENGTH                    =
      TABLES
        DATA_TAB                      = int_xml_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
       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.
    What is the mistake ????

  • Gui_download for transferring the data from internal table to excel sheet.

    hi all,
    i am using gui_download for transferring the data from internal table to excel sheet.
    I have a internal table with 3 columns col1,col2,col3 and I am getting the file at the specified path,but my problem is that,in the excel sheet(path specified) all the 3 columns values are printed in one column.Please help me.
    Thanks in advance.

    Hi Venkata,
    plz use FM 'SAP_CONVERT_TO_XLS_FORMAT' :
      call function 'SAP_CONVERT_TO_XLS_FORMAT'
        exporting
    *   I_FIELD_SEPERATOR          =
    *   I_LINE_HEADER              =
          i_filename                 = p_file
    *   I_APPL_KEEP                = ' '
        tables
          i_tab_sap_data             = t_mbew
    * CHANGING
    *   I_TAB_CONVERTED_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.
    Hope this helps,
    Erwan

  • Attachment in UWL is opening except for .TXT extension file

    Hi,
    The attachment in the workitem is oppening in SBWP for all file extensions, For the same workitem in UWL its not oppening. It opens only for .TXT extension files. Please advise how to fix this error.
    Regards
    Sri

    Hello,
    What is the UWLJWF version that you are working with?  There were patch fixes on the UWLJWF component in regards to attachments, and if you let me know your UWLJWF full version, I can let you know what patch fixes this issue.
    Beth Maben
    EP - Senior Support Consultant
    AGS Primary Support, Business Suite & Technology
    Please see the UWL Wiki @
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/bpx/uwl+faq  ***

  • Pagenumber and totalpagecount is always shown 1/1 for .txt format.

    When I export my report in .txt format somehow the pagenumber/totalpagecount is always shown 1/1.So I had placed formulae as page_num :-
    whileprintingrecords;
    if recordnumber  = 1  then 1
    else if recordnumber mod 10 = 0 then int ( recordnumber / 10 ) + 1;
    and a formulae for total page count as :-
    if isnull ( {rpt.account_number} ) then 1
    else if count ({rpt.account_number} ) <= 10 then 1
    else if count ( {rpt.account_number} ) > 10 then   int ( count ( {rpt.account_number} ) / 10 ) + 1;
    This formulae worked fine for all reports except 1 where we required to suppress some of the records in the report according to a flag.
    example : there are 10 accounts of flag a,b,c,d.We needed to show only those flags having 'a' or 'b' flag.The rest of the records were suppressed as in the summary of report only count(c) and count(d) was required.Display of these records were not needed. But the total page count and page number formulae failed in this case as it also took into consideration those accounts too which are to be suppressed.
    What alternative can be applied? Is there anyway that the problem of pagenumber/totalpagecount always showing 1/1 for .txt export can be solved.If not what change can be done in the formulae I have written?Any completely different suggestion is also acceptable.Only the criteria is that it is compulsory for me too export the report in .txt format.
    Please suggest!!

    Hi Som
    Can you try using the following formula:
    totext(PageNumber,0,'') & "/" & totext(TotalPageCount,0,'')
    and for the suppression condition, just right click on the formula and give the suppression condition for "Suppress" option.
    Hope this helps you.
    Thanks
    Pradeep Hulke

  • Blank spaces while using GUI_DOWNLOAD for Chinese characters

    Hi,
    While using GUI_DOWNLOAD for chinese characters I have used a code page option of 8300 for Chinese.
    The file which is getting downloaded in a notepad has some Chinese characters coming under some headings.
    After that columns other columns are getting shifted towards the right.
    This is working correctly for English characters.
    Can someone please help me.
    Now I am using CL_GUI_FRONT_END_SERVICES=>GUI_DOWNLOAD.
    What special options should I pass now.
    Regards,
    Subhashini

    Hi,
    I only solved my problem by using different code pages 8400 and 8300 for Chinese and Taiwanese characters.
    I fixed the lengths of the fields by converting them to hexadecimal string and back to string using these function modules as below.
    DATA:lv_xstring TYPE xstring,
           lv_temp TYPE string.
      DATA: lv_conv TYPE REF TO cl_abap_conv_in_ce.
      lv_temp = p_name.
      CALL FUNCTION 'HR_KR_STRING_TO_XSTRING'
        EXPORTING
          codepage_to      = p_codepage
          unicode_string   = lv_temp
          out_len          = p_outlen
        IMPORTING
          xstring_stream   = lv_xstring
        EXCEPTIONS
          invalid_codepage = 1
          invalid_string   = 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.
    CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
       EXPORTING
         from_codepage = p_codepage
         in_xstring    = lv_xstring
         out_len       = p_outlen
       IMPORTING
         out_string    = p_string.
    Create a Conversion Instance
    lv_conv = cl_abap_conv_in_ce=>create(
    encoding = p_codepage
    input = lv_xstring ).
    v_conv->read( IMPORTING data = p_string ).
    Regards,
    Subhashini

  • Samsung Stratosphere set own ringtone for txt and pic messaging??

    I have been able to set my own ringtones for Email alerts but can't figure out how to set my own ringtones for txt msgs other than the ones already on the phone.
    for email alerts I went to My Files app and found the music i wanted that i put in folder saved ringtones..  The I hit the menu button on bottom left of phone and selected Set as. And chose Phone ringtone.
    Just can't find similar path to set for Txt and Pic messaging.

    Go to Messaging. Then Menu > Settings, and scroll down to the Notification settings area, where Select ringtone is an option.

  • Gui_download for excel

    Hi all,
           Please if sumone cud help,
           give me a sample WORKING code for download from internal table to   EXCEL (not vice versa!!).
    my internal table is getting in the excelfile but all the fieldsare in 1 line..
    heres my code..:
    data: Lv_file type string,
    Lv_path type string,
    Lv_file_path type string.
    call method cl_gui_frontend_services=>file_save_dialog
    changing filename = Lv_file
    path = Lv_path
    fullpath = Lv_file_path.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
      BIN_FILESIZE                    =
        filename                        = Lv_file_path
       FILETYPE                        = 'ASC'
      APPEND                          = ' '
       WRITE_FIELD_SEPARATOR           = 'X'
    IMPORTING
      FILELENGTH                      =
      tables
        data_tab                        = LIT_ORDER
      FIELDNAMES                      =

    *& Report  ZMR_BACKGROUND_DOWNLOAD_EXCEL
    REPORT  zmr_background_download_excel.
    *TABLES: y001.
    CONSTANTS: c_path(14) VALUE '/downloads/'.
    *CONSTANTS: c_path(14) VALUE 'C:\ABAP\'.
    DATA: BEGIN OF c_tab,
            x(2) TYPE C VALUE '09',
          END OF c_tab.
    DATA : FILENAME LIKE RLGRAP-FILENAME VALUE 'EXAMPLE.TXT'.
    DATA: buffer(8000),
          fieldname_offset TYPE i,
        fullpath(128),
          fullpath LIKE sxpgcolist-parameters,
        cmdfullpath(128),
          cmdfullpath LIKE sxpgcolist-parameters,
          cmd(40),
          ibtcxpm LIKE btcxpm OCCURS 0.
    DATA : BEGIN OF I_MKAL OCCURS 0,
              MATNR LIKE MKAL-MATNR,
              WERKS LIKE MKAL-WERKS,
              VERID LIKE MKAL-VERID,
           END OF I_MKAL.
    DATA : WA_MKAL LIKE I_MKAL.
    DATA : FLAG TYPE C.
    DATA : BEGIN OF I_FINAL OCCURS 0,
              MATNR LIKE MKAL-MATNR,
              MAKTX LIKE MAKT-MAKTX,
              WERKS LIKE MKAL-WERKS,
              VERID LIKE MKAL-VERID,
              ATWRT LIKE AUSP-ATWRT,
             ATWRT1 LIKE AUSP-ATWRT,
           END OF I_FINAL.
    DATA : ZATWRT1 LIKE AUSP-ATWRT,
           ZATWRT  LIKE AUSP-ATWRT,
           ZMAKTX  LIKE MAKT-MAKTX.
    DATA : LOCATION TYPE C VALUE 'A'.
    Start of processing
    *FUNCTION z_download.
    ""Local interface:
    *"  IMPORTING
    *"     VALUE(FILENAME)
    *"     VALUE(LOCATION)
    *"  TABLES
    *"      DATA_TAB
    *"      FIELDNAMES OPTIONAL
         data: ws_line type i.
      FIELD-SYMBOLS: <f>.
      CHECK NOT filename IS INITIAL.
    START-OF-SELECTION.
    FORMAT COLOR COL_NORMAL.
        SELECT MATNR
               WERKS
               VERID
          FROM MKAL INTO CORRESPONDING FIELDS OF TABLE I_MKAL
         WHERE SERKZ = 'X'
           AND WERKS IN ('1101', '1102').
    LOOP AT I_MKAL.
      SELECT SINGLE ATWRT
               FROM AUSP INTO ZATWRT
              WHERE OBJEK = I_MKAL-MATNR
                AND ATINN = '0000000019'
                AND KLART = '001'.
          IF SY-SUBRC = 0.
             FLAG = 'X'.
          ENDIF.
      SELECT SINGLE ATWRT
               FROM AUSP INTO ZATWRT1
              WHERE OBJEK = I_MKAL-MATNR
                AND ATINN = '0000000022'
                AND KLART = '001'.
          IF SY-SUBRC = 0 AND FLAG = 'X'.
                SELECT SINGLE MAKTX
                         FROM MAKT INTO ZMAKTX
                        WHERE MATNR = I_MKAL-MATNR.
                I_FINAL-MATNR = I_MKAL-MATNR.
                I_FINAL-MAKTX = ZMAKTX.
                I_FINAL-WERKS = I_MKAL-WERKS.
                I_FINAL-VERID = I_MKAL-VERID.
                I_FINAL-ATWRT = ZATWRT.
               I_FINAL-ATWRT1 = ZATWRT1.
                APPEND I_FINAL.
          ENDIF.
    CLEAR ZATWRT.
    CLEAR ZATWRT1.
    CLEAR ZMAKTX.
    ENDLOOP.
    END-OF-SELECTION.
      CONCATENATE c_path filename INTO fullpath.
      OPEN DATASET fullpath IN TEXT MODE FOR OUTPUT ENCODING DEFAULT.
      DESCRIBE TABLE I_FINAL LINES ws_line.
      IF ws_line NE 0.
        PERFORM fieldnames_2_buffer TABLES I_FINAL CHANGING buffer.
        fieldname_offset = STRLEN( buffer ).
        TRANSFER buffer TO fullpath LENGTH fieldname_offset.
      ENDIF.
      LOOP AT I_FINAL.
        CLEAR buffer.
        CLEAR fieldname_offset.
        DO.
          ASSIGN COMPONENT sy-index OF STRUCTURE I_FINAL TO <f>.
          IF sy-subrc NE 0.  EXIT.  ENDIF.
          WRITE <f> TO buffer+fieldname_offset.
          CONDENSE buffer.
          fieldname_offset = STRLEN( buffer ).
          WRITE c_tab TO buffer+fieldname_offset(1).
          ADD 1 TO fieldname_offset.
        ENDDO.
        TRANSFER buffer TO fullpath LENGTH fieldname_offset.
      ENDLOOP.
      CLOSE DATASET fullpath.
      CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
        EXPORTING
          commandname                   = 'ZCHMOD'
          additional_parameters         = fullpath
        TABLES
          exec_protocol                 = ibtcxpm
        EXCEPTIONS
          no_permission                 = 1
          command_not_found             = 2
          parameters_too_long           = 3
          security_risk                 = 4
          wrong_check_call_interface    = 5
          program_start_error           = 6
          program_termination_error     = 7
          x_error                       = 8
          parameter_expected            = 9
          too_many_parameters           = 10
          illegal_command               = 11
          wrong_asynchronous_parameters = 12
          cant_enq_tbtco_entry          = 13
          jobcount_generation_error     = 14
          OTHERS                        = 15.
          IF SY-SUBRC = 0.
          ENDIF.
      CONCATENATE c_path filename '_cmd' INTO cmdfullpath.
      OPEN DATASET cmdfullpath IN TEXT MODE FOR OUTPUT ENCODING DEFAULT.
      CASE location.     "location A, B, C, D on a network
        WHEN 'A  '.
    BREAK-POINT.
          TRANSFER 'open 192.9.200.223' TO cmdfullpath.
          TRANSFER 'user ROOT ROOT123' TO cmdfullpath.
        WHEN 'B  '.
          TRANSFER 'open xx.xxx.xx.xx' TO cmdfullpath.
          TRANSFER 'user sapftp <pwd>' TO cmdfullpath.
        WHEN 'C  '.
          TRANSFER 'open xx.xxx.xx.xx' TO cmdfullpath.
          TRANSFER 'user sapftp <pwd>' TO cmdfullpath.
        WHEN 'D  '.
          TRANSFER 'open xx.xxx.xx.xx' TO cmdfullpath.
          TRANSFER 'user sapftp <pwd>' TO cmdfullpath.
        WHEN OTHERS.
      ENDCASE.
    *start>
        clear y001.
    SELECT SINGLE y_path INTO y001-y_path
                          FROM y001 WHERE bname = sy-uname
                                      AND y_site = location.
    TRANSFER y001-y_path TO cmdfullpath.
    *<end
    BREAK-POINT.
         concatenate 'lcd' c_path into cmd separated by space.
      TRANSFER cmd TO cmdfullpath.
      CLEAR cmd.
      CONCATENATE 'put' filename INTO cmd SEPARATED BY space.
      TRANSFER cmd TO cmdfullpath.
      TRANSFER 'bye' TO cmdfullpath.
      CLOSE DATASET cmdfullpath.
      CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
        EXPORTING
          commandname                   = 'ZCHMOD'
          additional_parameters         = cmdfullpath
        TABLES
          exec_protocol                 = ibtcxpm
        EXCEPTIONS
          no_permission                 = 1
          command_not_found             = 2
          parameters_too_long           = 3
          security_risk                 = 4
          wrong_check_call_interface    = 5
          program_start_error           = 6
          program_termination_error     = 7
          x_error                       = 8
          parameter_expected            = 9
          too_many_parameters           = 10
          illegal_command               = 11
          wrong_asynchronous_parameters = 12
          cant_enq_tbtco_entry          = 13
          jobcount_generation_error     = 14
          OTHERS                        = 15.
    IF SY-SUBRC = 0.
          ENDIF.
      CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
           EXPORTING
                commandname                   = 'ZFTP'
             commandname                   = 'ZFTP'
                additional_parameters         = cmdfullpath
           TABLES
                exec_protocol                 = ibtcxpm
           EXCEPTIONS
                no_permission                 = 1
                command_not_found             = 2
                parameters_too_long           = 3
                security_risk                 = 4
                wrong_check_call_interface    = 5
                program_start_error           = 6
                program_termination_error     = 7
                x_error                       = 8
                parameter_expected            = 9
                too_many_parameters           = 10
                illegal_command               = 11
                wrong_asynchronous_parameters = 12
                cant_enq_tbtco_entry          = 13
                jobcount_generation_error     = 14
                OTHERS                        = 15.
    IF SY-SUBRC = 0.
          ENDIF.
    *ENDFUNCTION.
          form fieldnames_2_buffer                                      *
    -->  fieldnames                                                    *
    -->  buffer                                                        *
    form fieldnames_2_buffer tables fieldnames changing buffer.
    CLEAR buffer.
    CLEAR fieldname_offset.
    LOOP AT fieldnames.
      WRITE fieldnames TO buffer+fieldname_offset.
      CONDENSE buffer.
      fieldname_offset = STRLEN( buffer ).
      WRITE c_tab TO buffer+fieldname_offset(1).
      ADD 1 TO fieldname_offset.
    ENDLOOP.
    fieldname_offset = fieldname_offset - 1.
    IF fieldname_offset >= 0.
      WRITE space TO buffer+fieldname_offset(1).
    ENDIF.
    ENDFORM.                    "

  • Using Gui_download for excel output

    Hi,
    I am using gui_download to output in excel format, my requirement is i want to start records from 3rd row in excel.
    On first row first column title shoud come? Second row blank,  i used fieldname for header in export paramenter from 3rd row.
    Plz help me to sove this issue.
    Thanks in advance.
    Vishnu.

    Hi vishnu,
    Here is the sample code below.
    *& Report  ZVK_TEST1
    REPORT  zvk_test1.
    TYPES:BEGIN OF ty_ekko,
            ebeln TYPE ekko-ebeln,
            bukrs TYPE ekko-bukrs,
    END OF ty_ekko.
    TYPES:BEGIN OF ty_fields,
            field TYPE dd03l-fieldname,
          END OF ty_fields.
    DATA:lt_ekko TYPE STANDARD TABLE OF ty_ekko,
         lt_dummy TYPE STANDARD TABLE OF ty_ekko.
    DATA:lw_ekko TYPE ty_ekko.
    APPEND INITIAL LINE TO lt_dummy.
    APPEND INITIAL LINE TO lt_dummy.
    SELECT ebeln bukrs INTO TABLE lt_ekko
      FROM ekko UP TO 10 ROWS.
    DATA:lt_fields TYPE TABLE OF ty_fields,
         lw_field TYPE ty_fields.
    lw_field-field = 'PO NUMBER'.
    APPEND lw_field TO lt_fields.
    lw_field-field = 'COMPANY CODE'.
    APPEND lw_field TO lt_fields.
    CALL METHOD cl_gui_frontend_services=>gui_download
      EXPORTING
       bin_filesize              =
        filename                  = 'C:\Documents and Settings\krishnavatte\Desktop\kris.xls'
        filetype                  = 'ASC'
      CHANGING
        data_tab                  = lt_dummy
      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.
    CALL METHOD cl_gui_frontend_services=>gui_download
      EXPORTING
       bin_filesize              =
        filename                  = 'C:\Documents and Settings\krishnavatte\Desktop\kris.xls'
        filetype                  = 'ASC'
        append                    = 'X'
        write_field_separator     = 'X'
        fieldnames                = lt_fields
      CHANGING
        data_tab                  = lt_ekko
      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.

  • GUI_Upload & GUI_Download for excel files

    Hi experts,
    I want to upload excel file into sap. i am trying with GUI_Upload function module. when i see the data it is filled with # and other special char. When i save the excel file as .txt file and then read the txt file. Now i am getting correct data. Is it possible to read Excel data using GUI_UPLOAD directly without changing .xls to .txt.
    Also, how to change data in  second or  third tab of excel file using GUI_Download.
    -RK

    Hi
    Actually ur file selection s wrong.
    CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          PROGRAM_NAME  = SYST-REPID
          DYNPRO_NUMBER = SYST-DYNNR
          FIELD_NAME    = 'P_FNAME'
          STATIC        = 'X'
         MASK          = '*.txt'
        CHANGING
          FILE_NAME     = P_FNAME
        EXCEPTIONS
          MASK_TOO_LONG = 1
          OTHERS        = 2.
    Upload:
    CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME                = LV_FNAME
          FILETYPE                = 'ASC'
          HAS_FIELD_SEPARATOR     = 'X'
        TABLES
          DATA_TAB                = IT_UEXBANK01
        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 <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

  • GUI_DOWNLOAD with txt file?

    I can succesfully upload a csv, comma delimited, file, and manipulate it with GUI_DOWNLOAD. This way....
    DATA: BEGIN OF gt_coa_data_holder OCCURS 0,
             rec(200) TYPE c,
          END OF gt_coa_data_holder.
    CALL FUNCTION 'GUI_UPLOAD'
             EXPORTING
                  filename                = lv_filename
             TABLES
                  data_tab                = gt_coa_data_holder
    LOOP AT gt_coa_data_holder into <gs_coa_data_holder>.
        SPLIT <gs_coa_data_holder> AT ',' INT into wa-fields
    But I discovered the file has commas in it so I need to do this with a text, space delimited file. When I use the new txt, space delimited file the space appears as a # in gt_coa_data_holder but as a /h/ in the work area. Thus I can not split up the records lines field by field properly. Even when I say
    SPLIT <gs_coa_data_holder> AT '#' INT into wa-fields
    or
    SPLIT <gs_coa_data_holder> AT '/h/' INT into wa-fields
    I tried using different parameters like "has field seperator" whos default is space.
    Any suggestions?
                 Thank-You.

    Hello Tom,
    I've encountered a similar problem. Not being aware of the exits or abap classes as of which to use, what I've done is that...
    Downloaded the file on the presentation server into an elementary table of type c. Then used the SPLIT AT ','command and store them into the required table fields, here 'gt_coa_data_holder' .
    It worked this way!!
    Indu.

  • Function like GUI_UPLOAD/GUI_DOWNLOAD for background

    Is there a function or functions that work the same way as GUI_UPLOAD and GUI_DOWNLOAD but can be run both in the foreground and background?

    GUI_UPLOAD and GUI_DOWNLOAD can only work in the foreground.  The reason for this is that they use some code which reside on the frontend PC.  A background process knows nothing of the PC connected thru SAPgui. In order to "download" data to files, you must write the files to the application layer using OPEN DATASET, TRANSFER DATASET, CLOSE DATASET.
    Regards,
    Rich Heilman

  • Numbers '09 2.1 - setting import delimiter for .txt or .rtf

    Hi there -
    I have a series of text files with leading numbers that I'd like to remove. The files are lists, where each line is enumerated sequentially & these line-numbers have to be removed for further processing.
    This is too painful to do manually (takes forever), but the content is not in English and so Excel, which allows me to set the delimited & correctly parses the information, doesn't read the content properly (even after copy paste into a word processor that usually does) whereas Pages will handle the content, but for the life of me I can't get it to parse the information - so it's effectively useless.
    The other threads I've read basically suggest that one has to manually insert tabs between the fields - is this actually the case? Is there really no way to control how Pages '09 parses imported data?
    As a final add-on: I know this would be relatively easy to do with a script, but I havne't a clue where to get started with scripting for the Mac, so if you read this & have a suggestion as to where I might get started (generally, or w.r.t. this particular project), I would very much appreciate the enlightenment.
    Thanks in advance and all the best,
    Rax

    If the leading numbers are separated from the rest of lines by space character, you file is not a tab delimited one.
    If a file whose name ends with .txt is a tab delimited one, it may be opened by Numbers with no problem.
    If its name ends with .csv, thingsa re more complicated.
    If the system use the period as decimal separator, the values MUST be separated by commas
    but
    if the system use the comma as decimal separator, the values MUST be separated by semi-colons.
    I have a possible understanding of your problem.
    Maybe values are separated by single or several spaces which is the awful format used in the typewriter era.
    I guess that with this structure, Excel use its knowledge of English language to split the lines.
    As I don't like to work in the Terminal, I wrote a short script achieving what you described.
    --{code}
    set fichier_source to choose file with prompt "Select a text file" of type {"public.plain-text"}
    set le_fichier to POSIX path of (fichier_source as text)
    do shell script "sed -i.bak -e 's/^[0-9]* *//' " & quoted form of le_fichier
    tell application "Pages"
      open le_fichier
    end tell
    --{code}
    Yvan KOENIG (VALLAURIS, France) mardi 25 octobre 2011 00:03:57
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • How do I turn on sound alert for calls but turn off sound for txt

    At night, I want to be able to hear  if I get a call, but I do not want to hear if I get a txt mssg.   I went into setting/txt/sounds and turned it off, and had a ring tone selected for calls, but when I get calls I do not hear the ring tone.

    Hi,
    To do this you will need to go to Settings>Notifications>Do Not Disturb and from there sellect "Allow Calls From" to everyone. This will mean that if you schedule Do Not Disturb at Night time, only Calls will make alerts and ring whereas other notifications will be silenced.

  • Is it possible to do some researches for .txt files or .doc files in labview?

    Hi,
    I want to do some researches to a .txt file or a .doc file so as to find some keywords.then make some operations to the file to save it later.I wonder if it is possible for bits operations and for researches?
    Thanks a lot.

    Absolutely.
    From your block diagram, in the Functions Palette, click on "File I/O". You'll find a number of useful vi's. For instance, you can use the "Read Characters From File" or "Scan From File" vi's to read character strings, which can be manipulated using the string functions (vi's).
    You can also click on "Binary File vi's" if you are dealing with bit-operations.
    You can read a file, parse it, manipulate the data and write it back, all within LabView. It is very useful for that.
    Explore & have fun! )
    -JLV-

Maybe you are looking for

  • Backing up iPad's & iPhones on one iTunes account

    i just got the new ipad and have set it up with my existing itunes acc, could someone please tell me if i turn off back up on certain apps does it also affect my iphone?

  • Allowing another computer to access my network

    I bought an Airport Extreme Base Station for my roommate and I to share. I set up the network, and I can access the network and get on the internet, but she cannot. She can access the network and gets an excellent signal, but it is just a local conne

  • B&W PRESET

    Once I tried to bring in some images to LR utilizing the B&W conversion preset. Now every time I go to the library module all images on the screen automatically convert to B&W . How do I get rid of the B&W conversion?

  • MP4's tagged as music video only play audio + static picture?

    Hi everyone, Is it normal that MP4 files, that have been tagged as Music Video (Itunes Media Type), only show a static image on playback instead of a moving image. I assumed that a music video would show the video too. Hence the tag name "Music VIDEO

  • Broadcast E-Mail (Bursting)

    Hi,   Can someone please provide me with a "how to" guide to sending a Broadcast E-Mail using authorizations so that each user can only see the information that they are authorized to see.  We are currently using version 3.5 of the BW. Any help would