Open dataset in text mode utf-8 no funciona

Hola que tal, soy nuevo en el foro tengo un problema espero me puedan ayudar si alguien de casualidad se ha topado con esto,
lo que pasa es que necesito descargar un archivo en proceso de fondo que me deje el archivo .txt de tipo UTF-8 no ANSI para la version 4.6C de SAP hice una función vasandome en el guidownload y me funciono pude generar el archivo en ese formato pero solo funciona en línea, ocupo que lo haga en proceso de fondo,
Estoy buscando una función que me guarden en proceso de fondo que no sea el open dataset, encontre una que se llama pero no me ha funcionado me manda un 2 la función es
CALL FUNCTION 'RZL_WRITE_FILE_LOCAL'
    EXPORTING
    APPEND               = ' '
      NAME                 = l_nfile
    TABLES
      LINE_TBL             = i_archivo
   EXCEPTIONS
     ARGUMENT_ERROR       = 1
     WRITE_ERROR          = 2
     OTHERS               = 3
  IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
o si ustedes conocen una forma de guardar un archivo de tipo UTF-8 con el open dataset u otra función que se ejecute en proceso de fondo para la veresion 4.6C de SAP pues sse los agradeceria si me pudieran ayudar.
Saludos!!!

Hi,
I have a problem, i need to save a file in the server by job, but i need to save teh file in utf-8 format, right now i'm usign the 4.6C version's sap, and it dosen't has the instruction
open dataset namefile for output in text mode encoding utf-8.
only has open dataset namefile for output in text mode and a i think that if i'm using this function the file will be save in ansi format and i need to save the file in utf-8 format.
right now i have a function for save the file in utf-8 format in my pc but it dosen't work in job so i need a function for save the file in job in my pc or in the server,
sorry  with my english is bad.
Saludos!!

Similar Messages

  • Open dataset in binary mode-data missing in pdf file

    Hi,
    I am downloading a pdf file to the appl server using the below code.
    open dataset filename for output in binary mode.
    OPEN DATASET file_name FOR OUTPUT IN BINARY MODE.
         LOOP AT lines INTO ls_lines.
           TRANSFER ls_lines TO file_name.
         ENDLOOP.
         CLOSE DATASET file_name.
         MESSAGE 'File has been Transfered' TYPE 'S'.
    pdf file is downloading to the appl server.
    I am reading the file using CG3Y transaction, an found that some tax values are missing.
    please advice on how to fix this issue ASAP.

    Pls find the code..
    In this case, the pdf file tax values are missing out as shown above screenshot..
    i also tried with legacy binary mode and binary mode code page 1100.
    * Convert OTF Data to pdf data
       CALL FUNCTION 'CONVERT_OTF'
         EXPORTING
           format                = 'PDF'
         IMPORTING
           bin_filesize          = pdf_size
         TABLES
           otf                   = ls_job_info-otfdata
           lines                 = lines
         EXCEPTIONS
           err_max_linewidth     = 1
           err_format            = 2
           err_conv_not_possible = 3
           err_bad_otf           = 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.
       ENDIF.
       LOOP AT lines INTO ls_lines.
         ASSIGN ls_lines TO <fs_x> CASTING.
         CONCATENATE lv_content <fs_x> INTO lv_content IN BYTE MODE.
       ENDLOOP.
    *  call SCREEN 9001.
       SHIFT wa_final1-vbeln LEFT DELETING LEADING '0'.
       SHIFT wa_final1-bstkd LEFT DELETING LEADING '0'.
       SHIFT wa_final1-kunnr LEFT DELETING LEADING '0'.
       IF sy-sysid = 'DEV' AND  sy-mandt = '046'.   " Development Server or Client.
         CONCATENATE 'E:\OrdAckNotfctn\Acknowledgements\' wa_final1-erdat
            '_' wa_final1-bstkd '_' wa_final1-vbeln '_' wa_final1-kunnr '.Pdf'
            INTO file_name.
         OPEN DATASET file_name FOR OUTPUT IN BINARY MODE. "TEXT MODE ENCODING DEFAULT.
         LOOP AT lines INTO ls_lines.
           TRANSFER ls_lines TO file_name.
         ENDLOOP.
         CLOSE DATASET file_name.
         MESSAGE 'File has been Transfered' TYPE 'S'.
       ELSEIF sy-sysid = 'SBX' AND  sy-mandt = '046'. " Testing Server or Client.
         CONCATENATE 'E:\OrdAckNotfctn\Acknowledgements\' wa_final1-erdat
              '_' wa_final1-bstkd '_' wa_final1-vbeln '_' wa_final1-kunnr '.Pdf'
              INTO file_name.
         OPEN DATASET file_name FOR OUTPUT IN LEGACY BINARY MODE. "TEXT MODE ENCODING DEFAULT.
         LOOP AT lines INTO ls_lines.
           TRANSFER ls_lines TO file_name.
         ENDLOOP.
         CLOSE DATASET file_name.
         MESSAGE 'File has been Transfered' TYPE 'S'.
       ELSEIF sy-sysid = 'PRD' AND  sy-mandt = '046'. " Production Server or Client.
         CONCATENATE 'E:\OrdAckNotfctn\Acknowledgements\' wa_final1-erdat
           '_' wa_final1-bstkd '_' wa_final1-vbeln '_' wa_final1-kunnr '.Pdf'
           INTO file_name.
         OPEN DATASET file_name FOR OUTPUT IN BINARY MODE. "TEXT MODE ENCODING DEFAULT.
         LOOP AT lines INTO ls_lines.
           TRANSFER ls_lines TO file_name.
         ENDLOOP.
         CLOSE DATASET file_name.
         MESSAGE 'File has been Transfered' TYPE 'S'.
       ENDIF.

  • Bad data added in Open Dataset for output in Binary mode

    Hello,
    I am getting random bad data being added to the end of the file that is created on the file server when I run the Open Dataset for output in Binary mode.  This data sometimes looks like information about the Unix file server.  If I do the Open Dataset in Text mode, it does not add the extra bad data.
    ** transfer file to Unix File server
           DATA: LIN TYPE P.
                                                                                    OPEN DATASET P_APPFIL FOR OUTPUT IN BINARY MODE.
                                                                                    DESCRIBE TABLE XML_TAB LINES LIN.
                                                                                    IF LIN EQ 0.
             EXIT.
           ELSE.
             LOOP AT XML_TAB.
               TRANSFER XML_TAB TO P_APPFIL.
             ENDLOOP.
           ENDIF.
                                                                                    CLOSE DATASET P_APPFIL.
    Running the program 2 times with the same variant will give different results.
    For example, the data in file should end with </cPedigreeXML> but it added data as shown below:
    </cPedigreeXML>8        ˜        I   X-UNKNOWN                                                 9            œ        I   X-UNKNOWN                                                10   
                C   X-UNKNOWN   
    Then, when the program was run again with the same selections, it did not add the erroneous data at the end.
    This is a real problem because the bad data that gets added causes the file to error in the application.  Any help would be greatly appreciated.
    Thanks,
    Bob

    Hi Bob,
          Use CLEAR statement after TRANSFER statement and check once.
         IF LIN EQ 0.
             EXIT.
           ELSE.
             LOOP AT XML_TAB.
               TRANSFER XML_TAB TO P_APPFIL.
               <b>CLEAR XML_TAB.</b>
             ENDLOOP.
           ENDIF.
    Thanks,
    Vinay

  • OPEN DATASET and TRANSFER

    Hi all,
    I open Dataset in Text Mode with default encoding and trying to transfer data from an internal table to TEXT file in application server.
    But my internal table has 1 numeric field, so while transfering i am getting error stating: "cannot write Non-chracter field".
    So, is there any way to write Non-character fields also using same OPEN Dataset and TRANSFER Statements.
    Help will be rewarded.
    Sachin

    Hi  Saching..
    As per UNICODE We cannot transfer Numeric fields to file .
    So We must convert the Record to Character format.
    This is the Modified code. Changes are in BOLD.
    TABLES: ZSACHIN_STUDENT.
    PARAMETERS:
    OUTFILE(20) DEFAULT 'sachin_test.txt'
    LOWER CASE.
    TYPES: BEGIN OF st_student,
    ID TYPE ZSACHIN_STUDENT-ID,
    NAME TYPE ZSACHIN_STUDENT-NAME,
    ADDRESS TYPE ZSACHIN_STUDENT-ADDRESS,
    STATE TYPE ZSACHIN_STUDENT-STATE,
    CITY TYPE ZSACHIN_STUDENT-CITY,
    STATUS TYPE ZSACHIN_STUDENT-STATUS,
    END OF st_student.
    DATA : it_student TYPE STANDARD TABLE OF st_student,
    it_student_wa TYPE st_student.
    <b>DATA: V_RECORD(200) TYPE C.</b>
    OPEN DATASET OUTFILE FOR OUTPUT IN TEXT MODE encoding default.
    IF sy-subrc <> 0.
    message e001(z_error).
    endif.
    SELECT * FROM ZSACHIN_STUDENT INTO
    CORRESPONDING FIELDS OF TABLE it_student.
    <b>LOOP AT it_student INTO it_student_wa.
    <b>CONCATENATE IT_student_wa-name
                             IT_student_wa-address
                             IT_student_wa-state
                             IT_student_wa-city
                             IT_student_wa-status
                             INTO V_RECORD
       SEPARATED BY CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
    TRANSFER V_RECORD TO OUTFILE.</b>
    ENDLOOP.</b>
    CLOSE DATASET OUTFILE.
    Here SEPARATED BY is for generating  TAB delimiter .
    <b>Reward if Helpful</b>

  • Unicode Open Dataset Question

    We are beginning to prepare for the Unicode enabling of our custom ABAP programs and I have a question about the new OPEN DATASET statement.  We have programs that write sequential files for use by the following:
    1) ABAP programs that execute on our own SAP system
    2) Non-SAP programs that execute in our data center
    3) Programs (which may or may not be SAP) that execute in the data centers of other completely independent companies.
    Conversely, we have programs that read files supplied by those systems. 
    After reading through a lot of information, I am reaching the conclusion that for our files that contain only character data, it would be safe for us to modify our OPEN DATASET statements simply to use u201COPEN DATASET IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORSu201D without attempting to be more explicit with some of the other options that are available. 
    Can any of you confirm that this is (or is not) a valid assumption?

    yes you can go ahead with that..for the text files and chardata files
    OPEN DATASET IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORSu201D

  • Open dataset file length

    Hi Friends,
    I am uploading a file into SAP server and I would like to upload with 300 length char. ( I mean The file should contian 300 coloms)
    where we can declare the length of the file?
    Thanks,
    Sridhar

    Hi Sridhar,
    Define variable of type string or type CHAR(XXX), XXX should be equal or more than expected length of record.
    Open dataset in text mode or binary mode.(prefer binary mode - if user will go to OS and see the file by double click prefer text mode so that it will get downloaded in readable format).
    if dataset is opened successfully -
    Loop at your internal table into string or defined variable .
    Use transfer command to transfer each line.
    Close the dataset.
    Here goes some code:
      DATA: lv_file1 TYPE string.
      FIELD-SYMBOLS: <f_t_table> TYPE ANY.
      lv_file1 = lfile_path.
      IF im_binary_mode IS NOT INITIAL.
        OPEN DATASET lv_file1 FOR OUTPUT IN BINARY MODE.
      ELSE.
        OPEN DATASET lv_file1 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT .
      ENDIF.
      IF sy-subrc EQ 0.
        LOOP AT t_table ASSIGNING <f_t_table> .
          TRANSFER <f_t_table> TO lv_file1.
        ENDLOOP.
        CLOSE DATASET lv_file1.
       MESSAGE s027(zdev) RAISING download_success.
      ELSE.
        MESSAGE e028(zdev) RAISING download_error.
      ENDIF.
    Now important thing:
    Record with length more than 255 gets downloaded successfuly intext mode but when you try to read it via AL11, CG3Y, or with OPEN dataset- READ- write ..CLOSE dataset you can see only 255 character.
    Dont worry about this.
    AL11 and CG3Y is unable to display more than 255 char in text mode. if you are writing content of the file on list screen, use OFFSET, like WRITE: /01(500) lv_string.
    write statement in AL11/cg3y doesnt have this offset in write so more than 255 length cant be seen.
    I hope u get the answer and able to understand this solution.
    Bless u.

  • Japanies characters are converting to # in output file in open dataset

    Hi Experts,
    I am trying to transfer data from my internal table to application server. When i use
    Open Dataset e_file for output in text mode encoding NON-UNICODE ignoring convertion errors.
    All Japanies and chines characters(double byte characters) are converting to "#" in output file. I have used set locale language commend also.Still same problem is there.
    Could you please any one help me on this.
    Thanks
    Srinivas

    hi
    problem exporting text in hebrew
    Similar kind of problem has been solved here.. check that link first
    Use the class CL_ABAP_CONV_OUT_CE and use it to convert file from unicode to ascii.
    After that you should call OPEN DATASET IN LEGACY MODE and write the file.
    you have to find the Code Page format for japanese here..
    Is your system Unicode enables, if not please check whether you have japanese installed on your system.
    Run the program RSCINST in SE38 which throws a pop up if u work on a Unicode system and also shows what are the language packs currently installed on ur system.... if u dont have Japanese installed then u need to contact Basis People for installion of that language pack

  • Related to Open Dataset

    Hi all,
    The abstract of my problem is as follows.
    I have to use both the AT POSITION and FILTER Optinns in Open dataset statement.
    e.g Open dataset <dsn> in <Mode>
                           AT POSITION <pos>
                           FILTER <command>
    But when i execute this, i get a syntax error at this line stating that i can only use filter and at poition at one place even though i put then one after the other.
    Is there any way i can use both the additions?
    If yes,How? and If no.. are there any alternatives?
    Thanks in advance..
    Sravan

    Hi sravan,
    1. As mentioned, use two statement.
       One shot statement cannot work.
    2. try this code(just copy paste)
       it will do what u want.
       Try with commenting / uncommenting the line
       of SET DATASET
      and u will know the difference.
      [mention proper filename in the code]
    3. REPORT abc.
    DATA : fname(100) TYPE c.
    DATA : lin(100) TYPE c.
    fname = '/tmp/arv'.
    OPEN DATASET fname FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    comment/uncomment
    *SET DATASET fname POSITION 10.
    READ DATASET fname INTO lin.
    WRITE lin.
    regards,
    amit m.
    Message was edited by: Amit Mittal

  • OPEN DATASET......FOR APPENDING

    Hello ppl,
    I found the following help for OPEN DATASET in APPENDING mode:
    If the file already exists, its contents are retained, and the system moves to the end of the file. If the file does not exist, the system creates it. If the file was already open, the system moves to the end of the file.
    But, I am not sure what exactly will happen if the file is already open.
    Please help me understand it better.
    Thanks,
    Dawood.

    Hello,
    From SAP HELP.
    Attempted read access to a file opened with FOR APPENDING with the statement READ DATASET fails, and returns the value 4 for sy-subrc.
    It will not let you write to a already opened file.
    Hope it helps.
    Thanks,
    Jayant

  • Problem writing file ANSI to UTF-8. OPEN DATASET FOR OUTPUT IN TEXT MODE

    Hello everybody,
    My report needs  to create a file in ANSI so I am using this sentence: * "OPEN DATASET p_dir_a FOR OUTPUT IN TEXT MODE ENCODING DEFAULT."*  almost all charters in the file are well generating excepting for this two: ( Á ) & ( Í ) because SAP assigns the same code to both characters ( Ã? ) = 'xC3'  which is not correct, the right code should be ( Á ) = 'xC1'  ( Í ) = 'xCD' respectively
    from this string = ( ÁÉÍÓÚáéíóúàèìòùÀÈÌÒÙ ) only those two characters are wrong converted.
    Also I tray to catch a conversion error with this sentence:
              TRY.
                TRANSFER <field> TO p_dir_a NO END OF LINE.
              CATCH cx_sy_conversion_codepage.
                MESSAGE 'error' type 'I'.
            ENDTRY.
    but never enters in it.
    Does anyone know where I can configure SAP to SET this value correctly?
    Thanks for your help.

    was a server problem, not SAP

  • OPEN DATASET file FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE

    Hi There,
    I also have the similar issue. I am able to write the data into appliaction server in Chinese Characters using :OPEN DATASET datei FOR OUTPUT IN TEXT MODE ENCODING DEFAULT or OPEN DATASET datei FOR OUTPUT IN TEXT MODE ENCODING UTF-8. But when i save that file into my presentation server manually, all the chinese characters are showing as Junk.
    When i use OPEN DATASET datei FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE, giving runtime error and when i use OPEN DATASET datei FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE IGNORING CONVERSION ERRORS, No error but application server output itself showing as Junk characters.
    Could you please suggest me what you have done?
    Regards,
    Chaitanya A

    Hi,
       Use this
      OPEN DATASET File_path  FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE
      WITH SMART LINEFEED
    it will definitely work.
    Regards,
    Manesh. R

  • OPEN DATASET FOR INPUT IN TEXT MODE - linesize issue

    Hi,
    I faced a problem when opened ANSI file with CYRILLIC in ECC 6.0 Unicode system - the system cuts the line to 250 characters. Below is snip of code:
    REPORT  Z_TEST_01 LINE-SIZE 1023.
    DATA:
      file TYPE char40 VALUE 'ansi_file.txt',
      line TYPE char1024, len TYPE i.
    OPEN DATASET file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    WHILE sy-subrc = 0.
          READ DATASET file INTO line ACTUAL LENGTH len.
            WRITE: / len, line.
    ENDWHILE.
    CLOSE DATASET file.
    In this case, variable LEN always get value 250. File-content is correctly converted from ANSI and all CYRILLIC is displayed to the screen. I changed type for LINE - initialy the type was STRING, actially.
    Further, tried to open it in BINARY - like this:
    DATA:
      file TYPE char40 VALUE 'ansi_file.txt',
      line TYPE char1024, len TYPE i.
    FIELD-SYMBOLS <hex_container> TYPE x.
    OPEN DATASET file FOR INPUT IN BINARY MODE.
    ASSIGN line TO <hex_container> CASTING.
    DO.
      READ DATASET file INTO <hex_container>.
      IF sy-subrc = 0.
        WRITE: / line.
      ELSE.
        EXIT.
      ENDIF.
    ENDDO.
    CLOSE DATASET file.
    WRITE: / line.
    In this case I got bigger linesize (obviously 1024), but faced conversion issues - the file contains some CYRILLIC and it is messed. Played for few hours with conversions - using additions: IN LEGACY BINARY MODE... BIG/LITTLE ENDIAN, CODE PAGE... without success. So decided to ask...
    Well, I searched SDN for a similar issue, but didn't found, except this one:
    Re: OPEN DATASET STRING Problem
    Could someone points me what am I doing wrong? How can I read my ANSI file with line-size more than 250 chars? Actually, in my case line size may vary up to 1800 chars. Further, afrer conversion and some validation, I should save it back to the AS.
    Many thans in advance.
    Regards,
    Ivaylo Mutafchiev

    Sorry for the noise - it is not an issue anymore.

  • OPEN DATASET FOR OUTPUT IN LEGACY TEXT MODE not working!

    Hi All,
    I need your expertise to help me with my problem.
    The program passed through the code OPEN DATASET ... FOR OUTPUT IN LEGACY TEXT MODE. Then it gave an error message "Error Accessing File /home/sap/sample.txt".
    I would like to know what are the causes of this error. Please explain to me further why the program gives an error message specified above because I'm not familiar in OPEN DATASET.
    Please reply asap since the issue need to be resolved immediately.
    Thanks in advance,
    Carina

    Hi Carmey,
    The Problem will u need toi get Open Dataset Authorisation from ur Basis Team from the Specified Path.
    Regards,
    Morris Bond.
    Reward Points if Helpful.

  • Open dataset filename for output in text mode encoding default

    Hi,
    When I excute this command I get a sy-subrc = 0, but no file is created. This happens in an ECC 6.0 system. In 4.6C works ok.
    filename has the following structure '
    server\directory\filename'
    What am I doing wrong??
    Thank you very much for your your help.
    Regards.

    Hi,
    Can u tell what syntax u have written for open statement.
    In programs with active Unicode check, you must specify the access type (such as ... FOR INPUT, ... FOR OUTPUT, and so on) and the mode (such as ... IN TEXT MODE, ... IN BINARY MODE, and so on). If the file is opened using ... IN TEXT MODE, you must still use the addition ... ENCODING. If the Unicode check is enabled, it is possible to use file names containing blanks.
    Regards,
    Sruthi

  • Open data set from Text mode to Binary mode

    Hello All,
    In a program i am using the command
        OPEN DATASET file FOR OUTPUT IN TEXT MODE
        ENCODING NON-UNICODE IGNORING CONVERSION ERRORS.
    Now i want to change this open data set to binary mode. I mean to change the command like below.
    OPEN DATASET file FOR OUTPUT IN BINARY MODE.
    when i do this. the output in the file is totally changing. I mean previously i have some text now i have some diffrent characters.
    How can i use this command with out change in the output as previous output. Please tell me  the changes and why i have to do.
    OPEN DATASET file FOR OUTPUT IN BINARY MODE.
    Regards,
    Lisa.
    Message was edited by:
            Lisa Roy

    Text Mode means that the records in the file have a carriage return marking the end of each record.
    Binary Mode means the file is a string of data.
    You can't read a text file in BINARY MODE, or a binary file in TEXT MODE.
    If you are changing the mode, then you must be supplied with a file in the new mode.

Maybe you are looking for

  • Oracle 8.1.5 install on Linux Redhat 6.0: character set (and other) problem(s)

    I am trying to install Oracle 8i on Linux and it does not work : once the install is finished, I have a message saying that "Character Set not found". I am runing a french version of Linux (fr-latin 1) and I try to install Oracle with French and Engl

  • Remove All Spacing Between Components

    I simply have two Labels in a VBox and would like to remove all gaps and padding between them. I've tried specifying verticalGap="0" on the VBox and setting the Label paddings to 0 and bottom="0". Since the labels will be dynamic and have different s

  • Non Cumulative KF in DSO

    Hi Experts, Can any one say why we cant model a DSO with a noncumulative keyfigure.Any reason behind this? Thanks! James

  • IPhone plays one video & quits... why?

    Hi folks, perhaps, you can help me. I have over 50 music videos i my iPhone that I bought from the iTunes. One of my two problems is: the iPhone would only play one music video at a time, and then goes back to the menu of videos. Plz, how can I make

  • Infotype Screen

    Hi all of you. I developed an infotype of Module PA. this screen has around 130 fields.To enter the data into all of the fields user should scroll the screen.At below i use one checkbox,will let some fields into change mode while checking the box. Af