Transfer string to unix file

Hi Gurus,
I am converting data in an internal table (consisting of 5000 records) into XML string using CALL TRANSFORMATION. All data is stored in XML format in a variable of type STRING.
I am trying to write this data in a Unix file using TRANSFER statement.
The problem is all data is not copied into the file!
Can anyone suggest a suitable solution so that complete data in the string variable will be reflected in the file?
Regards,
Jack

Hi,
If you are opening the file in text mode, your itab fields have to be character type fields. So define another itab with fields of character type with lengths defined as per your output requirements.
You have understand that if you have floating, decimal fields, currency or quantity fields in your itab, they are know to SAP only, once you try to download such records, converting them into character form needs to happen.
Did you try the binary mode with your 'open dataset' statement?
Srinivas

Similar Messages

  • How to delete string or line from unix file(dataset) of application server

    Hi  All,
    After transfer workarea information or all records into dataset(unix file). When I see the file in application server automatically the last line is shown a blank line. I am not passing any blank line.
    I have tried for single record than also the file generates the last line(2nd line) also a blank line.
    When I m reading the dataset, it is not reading the last blank line but why it is showing the last blank line?
    How to delete string or line from unix file(dataset) of application server?
    Please give your comments to resolve this.
    Thanks
    Tirumula Rao Chinni

    Hi Rio,
    I faced similar kind of issue working with files on UNIX platform.
    The line is a line feed to remove it use
    DATA : lv_carr_linefd TYPE abap_cr_lf VALUE cl_abap_char_utilities=>cr_lf. 
      DATA : lv_carr_return TYPE char1,                                   
             lv_line_feed   TYPE char1.                                          
      lv_line_feed   = lv_carr_linefd(1).
      lv_carr_return = lv_carr_linefd+1(1).
    Note: IMP: The character in ' ' is not space but is a special
    character set by pressing ALT and +255 simultaneosly
      REPLACE ALL OCCURRENCES OF lv_line_feed IN l_string WITH ' '.
      REPLACE ALL OCCURRENCES OF lv_carr_return IN l_string WITH ' '.

  • Using File Adapter to transfer files from directories on unix file server.

    I have this scenario. I have a PI server on hpus45 and I want to use it to transfer files from a source directory to a destination directory on a unix file server. The unix file server is on a different box eg hpus30.
    What do I configure in SLD and Integration Directory? All the examples I have seen is transfering files from directories on the PI server but none on a different box.'
    Is it possible? I need help asap. I need to determine what the best approach is by today.

    Hi Agasthuri Doss,
    I'm using PI 7.1. I'm not seeing your instructions in ID.
    The objects in PI 71. are in this order
    Unassigned Objects
    Party
    communication component
    communication channel
    receiver determination
    interface determination
    sender agreement
    receiver agreement
    direct connection
    integrated configurations
    configuration scenario
    value mapping group.

  • About download file into unix file

    Hi expert,
    i use the openset to write file into unix file server.
    but why there are some space at the end of every line.
    by the way, i works very well in windows server
       DATA: DATA_TRANSFER(70).
        Data: DATA_TRANSFER type string.
        data: fine_riga1(1) TYPE X VALUE '0D0A'.
        DATA: gt_data TYPE STANDARD TABLE OF ty_data.
        Constants: ascii_tab type x value ','.
        field-symbols: <f> type any, <delim> type any.
        "Assign delimiter field such as tab or comma.
        assign ASCII_tab to <delim>.
        CLEAR VN_CNT.
        concatenate DSNU 'employee' PN-BEGDA SY-UZEIT into P_UNIX.
        OPEN DATASET P_UNIX in legacy text MODE FOR OUTPUT. " IN TEXT MODE encoding UTF-8.
        IF SY-SUBRC <> 0.
          WRITE: / 'Error on file open:', P_UNIX.
        ELSE.
          LOOP AT TI_DATA .
            CLEAR DATA_TRANSFER.
            concatenate TI_DATA-TYPE
                              TI_DATA-PERNR
                              TI_DATA-ZAUSW
                              TI_DATA-ENAME
                              TI_DATA-TERID
                              INTO DATA_TRANSFER separated by cl_abap_char_utilities=>HORIZONTAL_TAB.
            CONDENSE DATA_TRANSFER NO-GAPS.
            TRANSFER DATA_TRANSFER TO P_UNIX.
            ADD 1 TO VN_CNT.
            CLEAR DATA_TRANSFER.
          ENDLOOP.
          CLOSE DATASET P_UNIX.
        ENDIF.
        WRITE: / P_UNIX,
               / 'Transfered', VN_CNT, 'records'.
    Best Regards,
    Kevin

    Hi,
    Try this way...
    TRANSFER dobj TO dset [LENGTH len]
                                          [NO END OF LINE].
    Addition 1
    ... LENGTH len
    Effect
    This addition determines how many characters or how many bytes of data object dobj are written to the file. len is expected to be a data object of type i that contains the number of characters or bytes. In text files, the content of len specifies the number of characters that are written from the storage. For binary files, legacy text file, and legacy binary files, len specifies the number of bytes that are written to the file. The first len characters or bytes are transferred and alignment gaps are included in the structures. If the addition LENGTH is not specified, all characters or bytes are transferred.
    If the value of len is less than or equal to 0, no characters or bytes are transferred. If the file is opened as a (legacy) text file, however, a line end marker is inserted into the file by default. If the value of len is greater than the number of characters or bytes in dobj, hexadecimal 0 or blank characters are transferred to the file instead of the missing bytes or characters, depending on whether the file was opened as a (legacy) text file or a (legacy) binary file.

  • How can i transfer more than one file from server to client

    Hi,
    our requirement is transfer more than one files from server to client using the
    webutil_file_transfer.as_to_client_with_progress.One file transfer is already working in our system.If anybody know the solution please inform
    regards
    mat

    just an idea ...
    for this purpose let us put aside security concerns and other potential problems....
    -- Get the content of a server directory with Filter and create zip file
    1) create a class that implements java.io.FilenameFilter ...
    2) define accept() method ...
    3) call File.list() with the filter as a parameter. The returned array of strings will have all the names that passed through the accept() filter
    4) use java.util.Zip to create ZIP file on the server side
    -- I think it is better to create this functionality as a separate Java class, put it in required folder and after it
    -- use Forms->Program->"Import Java class" to create pl/sql wrappers, than to create wrappers for all classes and code in pl/sql
    5) use webutil to transfer file on the client
    6) use Java on client side to unzip transferred file
    if you think this is not too complicated, you should try ...
    Regards,
    Vladimir

  • Transfer records to UNIX with different record length

    Hi all,
    I have the following problem. I have to transfer records to a UNIX file. The maximum length of a record is 2000. The records are TAB seperated. I also have records which have a length less then 2000. When i look at the file in Excel the last field is always very large. Isn't there a way to only transfer the real length of the record. I have tried to transfer the record in Binary an Text mode. I used the Length statement, but nothing worked for me.
    Hope anyone can help me.
    Greetings Maarten

    Hi Maarten,
    "Transfer" with "length" option should work. I am not sure what you passed as length to the "transfer" command. Did you used a fixed length of 2000 or did you actually found out the record length of each record and passed that value?
    Scenario 1.
    Here in this scenario, you will always have the last field set to maximum length.
    loop at itab.
    transfer itab-record to file length 2000.
    endloop.
    Scenario 2.
    In this second scenario, you should have your excel's last field set to the maximum occupied length of that field.
    loop at itab.
    v_len = strlen( itab-record ).
    transfer itab-record to file length v_len.
    endloop.
    Hope this helps.
    Srinivas

  • URGENT : Writing to UNIX file problem !

    Hi friends,
    I am stuck at a crucial point while uploading a UNIX file from ABAP program.
    I am using open dataset & then transfer to...the file path.
    But when I go and check the UNIX file it is split into 2 lines (it is supposed to be a
    record with 1 line with 1500 characters) ! It shows a maximum of 255 chars in one line.Moreover,while I download to a text file via Txn CG3Y,some data are missing or truncated etc.
    Please suggest how can I create a record with 1500 characters in UNIX and download it successfully with full data or how can I ensure proper data has been transferred as the record display is truncated.I checked the program its fine,only after transferring I get the problem.
    Thanks,
    Sandip.

    The files would not get truncated. The file actually exists in App. server but you will be able to see only uptil 255 characters. You can check the same by downloading it onto Pres. server by specifying  file type as BIN when you are downloading through CG3Y

  • Problem in outputting a string into a file

    Hi guys,
    I tried to output a string to a file. The string is 'Size : 30u201D X 13 ½u201D X17 ¾u201D(H)'.
    However, with this code :
    l_file = '/erp/reports/testgk.txt'.
    l_str = 'Size : 30u201D X 13 ½u201D X17 ¾u201D(H)'.
    OPEN DATASET l_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    TRANSFER l_str TO l_file.
    It returned me a weird string: 'Size : 30M-bM-@M-] X 13 M-BM-=M-bM-@M-] X17 M-BM->M-bM-@M-](H)'
    Would you please let me know how to solve this problem?
    Thanks, gk

    Hello gk,
    I tried this code & works fine for me though:
    DATA: v_data TYPE string VALUE ' 30u201D X 13 ½u201D X17 ¾u201D(H)',
          v_file TYPE string VALUE
                  '\glbwi720InterfaceID2100I_MB_207INsdn.txt'.
    OPEN DATASET v_file FOR OUTPUT
    IN TEXT MODE
    ENCODING DEFAULT.
    IF sy-subrc = 0.
      TRANSFER v_data TO v_file.
      CLOSE DATASET v_file.
    ENDIF.
    Looks like the "usual" ENCODING problem
    BR,
    Suhas

  • How to upload pdf file format in unix file directory?

    how to upload pdf file format in unix file directory?

    Hi Karthikeyan,
    If you have PDF internal table with you, You can follow the below method to upload into Unix directory.
        DATA:file_path TYPE char100 VALUE '/usr/sap/tmp/rep_out.PDF'.
        OPEN DATASET file_path FOR OUTPUT IN BINARY MODE.
        IF sy-subrc EQ 0.
          LOOP AT it_pdf.
            TRANSFER it_pdf TO file_path.
          ENDLOOP.
        ENDIF.
        CLOSE DATASET file_path.
    Thanks
    Venkat.O

  • Allowing user to  submit unix file on selection screen.

    how to allow the user to  submit  the unix file on selection screen.
    based on that file data ,the selection screen shd be populated automatically.

    Refer Sample Code:
    constants: c_split TYPE c
    VALUE cl_abap_char_utilities=>horizontal_tab,
    c_path TYPE char100
    VALUE '/local/data/interface/A28/DM/OUT'.
    Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS : rb_pc RADIOBUTTON GROUP r1 DEFAULT 'X'
    USER-COMMAND ucomm, "For Presentation
    p_f1 LIKE rlgrap-filename
    MODIF ID rb1, "Input File
    rb_srv RADIOBUTTON GROUP r1, "For Application
    p_f2 LIKE rlgrap-filename
    MODIF ID rb2, "Input File
    p_direct TYPE char128 MODIF ID abc DEFAULT c_path.
    "File directory
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_f1.
    *-- Browse Presentation Server
    PERFORM f1000_browse_presentation_file.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_f2.
    *-- Browse Application Server
    <b>PERFORM f1001_browse_appl_file.</b>
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
    IF rb_pc = 'X' AND screen-group1 = 'RB2'.
    screen-input = '0'.
    MODIFY SCREEN.
    ELSEIF rb_srv = 'X' AND screen-group1 = 'RB1'.
    screen-input = '0'.
    MODIFY SCREEN.
    ENDIF.
    IF screen-group1 = 'ABC'.
    screen-input = '0'.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    *& Form f1000_browse_presentation_file
    Pick up the filepath for the file in the presentation server
    FORM f1000_browse_presentation_file .
    CONSTANTS: lcl_path TYPE char20 VALUE 'C:'.
    CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
    def_path = lcl_path
    mask = c_mask "',.,..'
    mode = c_mode
    title = text-006
    IMPORTING
    filename = p_f1
    EXCEPTIONS
    inv_winsys = 1
    no_batch = 2
    selection_cancel = 3
    selection_error = 4
    OTHERS = 5.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    flg_pre = c_x.
    ENDIF.
    ENDFORM. " f1000_browse_presentation_file
    *& Form f1001_browse_appl_file
    Pick up the file path for the file in the application server
    FORM f1001_browse_appl_file .
    DATA: lcl_directory TYPE char128.
    lcl_directory = p_direct.
    CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
    EXPORTING
    directory = lcl_directory
    filemask = c_mask
    IMPORTING
    serverfile = p_f2
    EXCEPTIONS
    canceled_by_user = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    MESSAGE e000(zmm) WITH text-039.
    flg_app = 'X'.
    ENDIF.
    ENDFORM. " f1001_browse_appl_file
    *& Form f1003_pre_file
    Upload the file from the presentation server
    FORM f1003_pre_file .
    DATA: lcl_filename TYPE string.
    lcl_filename = p_f1.
    IF p_f1 IS NOT INITIAL.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = lcl_filename
    filetype = 'ASC'
    has_field_separator = 'X'
    TABLES
    data_tab = i_input
    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 s000 WITH text-031.
    EXIT.
    ENDIF.
    ELSE.
    PERFORM populate_error_log USING space
    text-023.
    ENDIF.
    ENDFORM. " f1003_pre_file
    *& Form f1004_app_file
    upload the file from the application server
    FORM f1004_app_file .
    REFRESH: i_input.
    OPEN DATASET p_f2 IN TEXT MODE ENCODING DEFAULT FOR INPUT.
    IF sy-subrc EQ 0.
    DO.
    READ DATASET p_f2 INTO wa_input_rec.
    IF sy-subrc EQ 0.
    *-- Split The CSV record into Work Area
    PERFORM f0025_record_split.
    *-- Populate internal table.
    APPEND wa_input TO i_input.
    CLEAR wa_input.
    IF sy-subrc <> 0.
    MESSAGE s000 WITH text-030.
    EXIT.
    ENDIF.
    ELSE.
    EXIT.
    ENDIF.
    ENDDO.
    ENDIF.
    ENDFORM. " f1004_app_file
    Move the assembly layer file into the work area
    FORM f0025_record_split .
    CLEAR wa_input.
    SPLIT wa_input_rec AT c_split INTO
    wa_input-legacykey
    wa_input-bu_partner
    wa_input-anlage.
    ENDFORM. " f0025_record_split
    Thanks
    Seshu

  • Unix file to be converted to proper excel format

    Hi Ima writing data to unix file but when i want to download from there in excel format i data is not not aligned in excel format
    please let me know the seperator to be used to upload to unix which can be converted to excel with good alignment.
    i tried  seperator '09'  but didn't work and my version is 4.6 c so i can not use the encoding command or the classes.
    pls guide
    OPEN DATASET p_unix FOR OUTPUT IN TEXT MODE MESSAGE v_message .
      IF NOT sy-subrc IS INITIAL.
        MESSAGE e398(00) WITH text-008 p_unix v_message space.
      ENDIF.
    ** Write header to unix file
      LOOP AT gt_fieldcat1 INTO st_fieldcat1.
        CONCATENATE st_rec st_fieldcat1-seltext_l
               INTO st_rec
               SEPARATED BY ','.
      ENDLOOP.
    CONDENSE st_rec.
      TRANSFER st_rec TO p_unix.
    ** Write data to unix file
      LOOP AT  <fs_table>  ASSIGNING <fs_struc>.
        CLEAR: st_rec.
        DO.
          ASSIGN COMPONENT sy-index OF STRUCTURE <fs_struc> TO
                                                 <field>.
          IF sy-subrc NE 0.
            EXIT.
          ENDIF.
          v_field = <field>.
          IF v_field IS INITIAL.
            CONCATENATE st_rec v_field ','
                INTO st_rec .
          ELSE.
            CONCATENATE st_rec v_field ','
                INTO st_rec.
          ENDIF.
        ENDDO.
        TRANSFER st_rec TO p_unix.
      ENDLOOP.
    Close unix file
      CLOSE DATASET p_unix.

    Although I dislike MPEG-1 because of the large file size those .mpg files are commonly used on the Web. They can be played by nearly any computer and are not "Player" dependent like WMP or QuickTime so each user can decide how to view them.
    As a bonus they are a "playback" format which makes editing and repurposing them a bit more difficult so your media is a bit more "secure".
    I'll stick to QuickTime formats (avoiding H.264 video codec) and force QuickTime down their WiMPy throats. Millions of PC's have QuickTime installed (because of iTunes) and others can easily download the free Player and browser plug-in. By avoiding H.264 my files can be viewed on Mac's and PC's that can't install QuickTime 7.

  • Trailing space issue in Unix File

    Hi All,
    I am facing an issue with the trailing space in Unix file content.
    When the file is being created in Unix server the trailing space is getting trimmed automatically.
    As per the requirement,this space should be retained in the Unix file as it is when the file is being downloaded to PC.
    Is there any solution for this issue? Request your help for resolving this.
    Thanks in Advance,
    Savitha

    Hi,
    When you're writing youd data to the file (assume you're using the TRANSFER command), you could try explicitly specifying the length of the data line to write, ie.
    TRANSFER data(200) TO DATASET filename.
    Regards,   Andy

  • Transfering trailing space to unix file.

    I have a variable of length (400) type c.
    When I transfer this variable to a unix file and if
    <b>the variable is blank or assigned 400</b> spaces nothing seems to show up in the unix file(not even the spaces).
    This is the also true for structures that end with a
    char component and are space filled. <b>When transferred the trailing spaces in a line are truncated</b>.
    How can i overcome this if i have to write even these spaces into the file?

    Hi,
    Use the TRANSFER statement with LENGTH.
    TRANSFER <f> to <dsn> [LENGTH <len>].
    You can specify the length of the data you want to transfer using the LENGTH addition. The system then transfers the first <len> bytes into the file. If <len> is too short, excess bytes are truncated. If <len> is greater than the length of the field, the system adds trailing blanks.
    OPEN DATASET FNAME FOR OUTPUT IN TEXT MODE.
    TRANSFER: RECORD TO FNAME LENGTH 400,
    CLOSE DATASET FNAME.
    Regards,
    Maha

  • Transfer data in unix with tab-delimited

    Hi,
    How can we transfer data to unix with tab-delimited? I have incoming file with tab-delimited and want to copy as backup file in another folder in unix. When I read the incoming file, tab separator is translated into '#' so when I do transfer data to the backup folder, the file contains '#'.
    Is there a way to transfer data in tab-delimited?
    thank you
    alia

    try to use delimiter cl_abap_char_utilities=>HORIZONTAL_TAB.
    here is a piece of code:
    REPORT  ztestfile                               .
    DATA: BEGIN OF gt_file_out OCCURS 0,
            filed(2000),
          END OF gt_file_out.
    START-OF-SELECTION.
      DATA: lv_file_out LIKE filename-fileextern.
      CONCATENATE 'Hello' 'World' INTO gt_file_out SEPARATED
        BY cl_abap_char_utilities=>horizontal_tab.
      APPEND gt_file_out.
      lv_file_out = '
    XXXX\XXXX\mytest1.txt'.
      OPEN DATASET lv_file_out FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
      LOOP AT gt_file_out.
        TRANSFER gt_file_out TO lv_file_out.
      ENDLOOP.
      CLOSE DATASET lv_file_out.
    Message was edited by: joseph fryda

  • Old mac audio files now appear as executable unix files

    a long time mac user, back in 95 & 96 i had a PB165 that allowed me to record some of my daughters first words as she spoke into the computer. long ago i saved them to floppy disks. i got an external floppy drive with a usb port and was all ready to transfer these files and create a cd of these sounds but they now appear as "Executable Unix files". First i blindly tried to open one of them using iTunes but there was no luck there. Then i searched this site on how to open "executable unix files" and got some information about using Terminal. Have never used Terminal before and tried to follow the directions but had no luck.
    I've probably missed something easy, but have spent a bit of time trying to do this without any luck. So am humbly asking for help as I try to retrieve these nuggets of sounds that can not be reproduced.
    thanks,
    david

    Just adding an extension won't change what is in the file. If you know what the file is (.wav, .aif, etc), then adding the appropriate extension will help the system figure out what to open them as.
    Do the files have any extensions now? If iTunes can't open them they may be in an old format, such as a System 7 sound. In that case, you might give PlaySound a try.
    Edit: Other converter applications for those old sound files are SystemSound (free) and File Juicer (not free).

Maybe you are looking for

  • Generic CSV log collection Rule not pulling all records

    Hi, I created a Generic csv log collection rule with details as follows: Target: Windows Computer Directory: D:\async Pattern: Async*.csv Seperator: , Expression: Params/Param[1]-matches wildcard- * Problem is the Csv file has around 50000 records wh

  • 7.4 changed my full screen view of videos

    I updated to iTunes 7.4 this morning after realizing most of the new features are useless to me who has no iPod or iPhone, but I did see mention of full screen support (and couldn't remember if that was new or not.) I played a couple of videos going

  • Agent12c on different platforms (without SelfUpdate)

    Hi Is there a way to install an agent other than one on which my Management Service runs ? SelfUpdate is not configured in my oms server since internet access is disabled.

  • Achieving iPhone Native Look-and-Feel

    Im currently doing an Iphone tutorial for my final year project. Here's the link for the tutorial that I am doing http://www.oracle.com/technology/pub/articles/huang-iphone.html I have no idea how to start doing the second part of the tutorial; Achie

  • Need Bapi for posting docuemtn through - FB60

    Hi Friends.. I need a Bapi for Transaction FB60.I tried with lot of option including BAPI_INCOMINGINVOICE_CREATE.But I didn't get a proper one. No Bapi have a Vendor input field.Plz help me to identify the right Bapi for FB60. Thanks Gowrishankar