Error with OPEN DATASET Statement

Hi All,
I have a an executable program which downloads data into applcation server using OPEN DATASET statement.
  Following is my code:
OPEN DATASET w_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-subrc      NE 0
     MESSAGE e111 WITH text-003.
     ENDIF.
Text 003 is 'Error Opening File'.
sy-subrc becomes non-zero if file cannot be opened for writing.
Daily I am running this program in a background job. I am getting this error on and off. Some times I am able to create the file in application server and  sometimes this error comes up by cancelling the job. The message shown for the cancelled job along with text-003 is 'Job cancelled after system exception ERROR_MESSAGE'. This has no dump analysis.
Even When I run this program online I am facing the same issue.
Some users never faced this issue while others have this problem. I think it is not an authorization problem as I am able to create flat file in application server most of the times.
Can you please suggest what could have went wrong?
And kindly propse me a solution.
Thanks & Regards,
Paddu.

Hi Paddu,
I am not sure exactly but i would go as far as saying that the reason you may be having that error is because your server has a limited amount of space and that your program is not working due to that limitation.
Is that file that you have created being picked up by another application. If so then i would advise you to check the limitation of the server size.
Also, is your file name different all the time? if u r trying to write an already existing file name it will give u an error.
Edited by: Kevin Ck on Mar 9, 2009 10:19 AM

Similar Messages

  • Weird Error with open dataset

    I am trying to read a .csv file using WS_upload. Please see the foll code:
    IF FILE1+0(1) <> '\'.
    CALL FUNCTION 'WS_UPLOAD'
         EXPORTING
             FILENAME = dataset
              FILENAME = FILE1
             FILETYPE = 'DAT'
              FILETYPE = 'ASC'
         TABLES
              DATA_TAB = rec.
    ENDIF.
    OPEN DATASET FILE1 IN TEXT MODE for INPUT.
    IF sy-subrc = 0.
      DO.
        READ DATASET FILE1 INTO rec2.
        IF sy-subrc <> 0.
          EXIT.
        ELSE.
         WRITE / rec2.
          rec-INFO = rec2.
          APPEND REC.
        ENDIF.
      ENDDO.
    ENDIF.
    The system is behaving different when I run in foreground on our test server and it gives error while running on produciton server. The open dataset block does not execute on the test server but on production server it does. And it ahs suddenly started doing it with any CSV file.. including the ones which earlier it did not ahve any problem with. Because the open dataset block executes on the production server it adds around 10000 lines to the file... the file ofcourse contain all garbage values for eg gwrd.exe, instance.lst , car.exe, dll etc. I have no clue why this has started happening suddenly when it was not happeing 1 hour before.
    please help/
    thanks.

    Hi Pranav,
    For the first IF condition where you determine whether to use WS_UPLOAD or to call OPEN DATASET.
    What will happen if the first IF condition is satisfied? It will trigger the WS_UPLOAD logic and after that it will also try to trigger the OPEN DATASET logic rite?
    Did u check if the program is trying to trigger the OPEN DATASET also? Coz if its trying to call OPEN DATASET after trying to call WS_UPLOAD it might either end up in error or might try to read some junk.
    Try to use the MESSAGE option of OPEN DATASET command and see if there is any error message issued.
    Hope this helps
    Cheers
    VJ

  • Open dataset statement in different SAP versions

    Hi ,
    I have to write a program which is for extracting data from application server. I have to run this program on different sap versions like, 4.6b, 4.6c, 4.7, 5.0 . I am using 'OPEN DATASET' statement in my program. But the problem is, in versions below 4.6c, this statement is written as "OPEN DATASET filename FOR READING IN TEXT MODE".
    And in versions above 4.7 it is written as "OPEN DATASET filename FOR READING IN TEXT MODE DEFAULT ENCODING".
    So when this statement will be executed in versions below 4.6c, it will give syntax errors.
    Can you let me know how to solve this problem.
    Thanks.

    Hi,
    differ btw. syst-SAPRL
    -> if you get syntax-error create a subroutine-pool
    with abap command generate subroutine...
    A.

  • Question re ENCODING cp option of OPEN DATASET statement

    I'm working on a 6.0 system with 4.6 data that I've downloaded from the 4.6 system and uploaded to the 6.0 system.
    The 4.6 data has "umlauts" in it (like when "o's" have two dots above them in Scandinavian names), and  when my READ DATASET executes on the 6.0 server, my try block is catching  a CX_SY_CONVERSION_CODEPAGE error.
    I'm assuming that to solve this, I will need to specify the codepage of the 4.6 server in the ENCODING codepage option of the OPEN DATASET statement that's exceuting on the 6.0 server.
    Will this solve the problem?  If not, what do I try next ?
    Also, how can I determine the system codpage of my current ABAP "text environment"?  I know all the possibilities are in table TCP0P, but how do I know which one is "active" ???
    Thanks guys.

    Hi,
    Refer this OPEN DATASET in ECC6.0 solves your problem and also check the abap documentation for system codepage and text environment.
    For unicode systems,system code page is UTF-16.
    Thanks.
    Ramya.

  • OPEN dataset statement

    Hi folks,
    I have a file stored on the network shared drive. Can I read the file using open dataset statement. This file is not stored on the application server.
    I have read that the open dataset statement works for only with the files stored in the application server.
    thanks
    sankar

    Hi
    Go thru this code, it will help you,.
    See the use of open dataset statement here.
    Pls reward if help.
    Refer this:
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm
    ABAP code for uploading a TAB delimited file into an internal table. See code below for structures.
    *& Report  ZUPLOADTAB                                                  *                     &----
    *& Example of Uploading tab delimited file                             *
    REPORT  zuploadtab                    .
    PARAMETERS: p_infile  LIKE rlgrap-filename
                            OBLIGATORY DEFAULT  '/usr/sap/'..
    DATA: ld_file LIKE rlgrap-filename.
    *Internal tabe to store upload data
    TYPES: BEGIN OF t_record,
        name1 like pa0002-VORNA,
        name2 like pa0002-name2,
        age   type i,
        END OF t_record.
    DATA: it_record TYPE STANDARD TABLE OF t_record INITIAL SIZE 0,
          wa_record TYPE t_record.
    *Text version of data table
    TYPES: begin of t_uploadtxt,
      name1(10) type c,
      name2(15) type c,
      age(5)  type c,
    end of t_uploadtxt.
    DATA: wa_uploadtxt TYPE t_uploadtxt.
    *String value to data in initially.
    DATA: wa_string(255) type c.
    constants: con_tab TYPE x VALUE '09'.
    *If you have Unicode check active in program attributes then you will
    *need to declare constants as follows:
    *class cl_abap_char_utilities definition load.
    *constants:
       con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB.
    *START-OF-SELECTION
    START-OF-SELECTION.
    ld_file = p_infile.
    OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-subrc NE 0.
    ELSE.
      DO.
        CLEAR: wa_string, wa_uploadtxt.
        READ DATASET ld_file INTO wa_string.
        IF sy-subrc NE 0.
          EXIT.
        ELSE.
          SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
                                          wa_uploadtxt-name2
                                          wa_uploadtxt-age.
          MOVE-CORRESPONDING wa_uploadtxt TO wa_upload.
          APPEND wa_upload TO it_record.
        ENDIF.
      ENDDO.
      CLOSE DATASET ld_file.
    ENDIF.
    *END-OF-SELECTION
    END-OF-SELECTION.
    *!! Text data is now contained within the internal table IT_RECORD
    Display report data for illustration purposes
      loop at it_record into wa_record.
        write:/     sy-vline,
               (10) wa_record-name1, sy-vline,
               (10) wa_record-name2, sy-vline,
               (10) wa_record-age, sy-vline.
      endloop.

  • In OPEN DATASET Statement Filenames are platform-specific How to specify MS

    In OPEN DATASET Statement
    Filenames are platform-specific. You must therefore use file- and pathnames that conform to the rules of the operating system under which your R/3 System is running. However, you can also use logical filenames to ensure that your programs are not operating system-specific. For further information, refer to Using Platform-Independent Filenames.
    DATA FNAME(60).
    FNAME = '/tmp/myfile'.
    OPEN DATASET 'myfile'.
    OPEN DATASET FNAME.
    This example works as long as your R/3 System is running under UNIX. The program opens the file "myfile" in the directory in which the R/3 System is running, and also opens the file "myfile" in directory "/tmp".
    FNAME = '[TMP]myfile.BIN'
    OPEN DATASET 'myfile.BIN'.
    question]]  How to specify an MS-file & how to go about?

    Hi,
    Just get the input file name from the application server through selection screen and keep it in parameter(p_inpfile).
    Then pass the parameter to OPEN DATASET statement.
    OPEN DATASET p_inpfile FOR INPUT IN TEXT MODE ENCODING DEFAULT.
      IF sy-subrc NE 0.
        WRITE :/ text-004.                                   "'No such input file' COLOR 3.
        EXIT.
      ELSE.
        DO.
          CLEAR : wa_string,wa_0001.
    *Reading the file from application server and moving to work area*
          READ DATASET p_inpfile INTO wa_string.
          IF sy-subrc NE 0.
            EXIT.
          ELSE.
            CLEAR wa_0001.
    *Spliting fields in the file-
            REPLACE ALL OCCURRENCES OF '#' IN wa_string WITH ' '.
            SPLIT wa_string AT c_htab INTO wa_0001-pernr
                                           wa_0001-werks       "Personnel Area
                                           wa_0001-persk       "Employee Sub-Group
                                           wa_0001-vdsk1       "Org. Key
                                           wa_0001-abkrs       "Payroll area
                                           wa_0001-ansvh.      "Work contract
            wa_0001-begda = p_efdate.
            wa_0001-endda = '99991231'.
            APPEND wa_0001 TO int_0001.
          ENDIF.
        ENDDO.
        CLOSE DATASET p_inpfile.
    Use like this and pass all those values to internal table.
    Thanks,
    Sakthi C
    *Rewards if useful*

  • In OPEN DATASET statement to open a file

    In OPEN DATASET statement
    To open a file, the user under which the R/3 System is running must have the requisite authorizations at operating system level.
    How to do this ? what knowledge apart from ABAP do I need ?
    what is its requirement in prograqmming domain?

    Hi,
    You can consult Basis people to get this authorization for OS folders for your login ID.
    From programming point of view, you need to put OPEN DATASET keyword inside try...catch block to avoid the short dump due to authorization issue as below.
    try.
    open dataset <....>
    catch CX_SY_FILE_AUTHORITY into wa_error.
    w_text = wa_error->IF_MESSAGE~GET_TEXT.
    write:/ w_text.
    endtry.
    hope that helps

  • Runtime Error in OPEN DATASET

    Dear All,
    I am trying to upload a text file in application server. But I am getting the run time error which says-
    " For the statement
        "TRANSFER f TO ..."
    only character-type data objects are supported at the argument position
    "f".
    In this case. the operand "f" has the non-character-type "u". The
    current program is a Unicode program. In the Unicode context, the type
    'X' or structures containing not only character-type components are
    regarded as non-character-type."
    If I remove the quantity fields then the error does not happen. But I have to take quantity fields also. Plz tell me what to do. My code is,
    DATA FILENAME like rlgrap-filename VALUE 'MIGO_VALUE.txt'.
    TABLES VBAK.
    DATA D_MSG_TEXT(50).
    DATA : BEGIN OF it_mseg OCCURS 0,
           mblnr TYPE mseg-mblnr,
           mjahr TYPE mseg-mjahr,
           matnr TYPE mseg-matnr,
    *       erfmg TYPE mseg-erfmg,
           werks TYPE mseg-werks,
           lgort TYPE mseg-lgort,
           END OF it_mseg.
    DATA wa LIKE it_mseg.
    SELECT mblnr mjahr matnr werks lgort FROM mseg INTO CORRESPONDING FIELDS OF TABLE it_mseg WHERE bwart = '101'.
    SORT it_mseg BY mblnr.
    OPEN DATASET FILENAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT
                          MESSAGE D_MSG_TEXT.
    if sy-subrc eq 0.
    message 'File created succesfully in SAP System'(002) type 'S'.
    endif.
    IF SY-SUBRC NE 0.
      WRITE: 'File cannot be opened. Reason:', D_MSG_TEXT.
      EXIT.
    ENDIF.
    * Transferring Data
    LOOP AT it_mseg INTO wa.
    TRANSFER wa to filename.
    ENDLOOP.
    * Closing the File
    CLOSE DATASET FILENAME.
    Thanks,
    Tripod.

    Thanks Sri for your help. I tried to apply the logic, but the  error i am getting here is -
    "IT_MSEG-ERFMG" must be a character-like data object (data type C, N,D, T, or STRING) STRING).
    Same case here, if I remove ERFMG field, i do not get such error.
    data ld_string type string.
    LOOP AT it_mseg INTO wa.
      CONCATENATE it_mseg-mblnr it_mseg-mjahr it_mseg-matnr it_mseg-erfmg it_mseg-werks it_mseg-lgort INTO ld_string.
         endloop.
    With regards,
    Tripod.

  • Problem in the internal table of open dataset statement

    Hi abapers,
    I am using the open dataset command to download my file at application server into an internal table.
    But some colums of the internal table are string since i do not want to truncate any of the long text present in the file.
    The open dataset command does not allow the internal table to have string components.
    Is there any workaround by which i can download all the text components of the file without truncating them .
    Regards,
    Aditya

    try to use field symbols:-
    FORM download_file  .
      DATA: l_file TYPE  rlgrap-filename,
            l_line TYPE string.
      DATA: v_excel_string(1000) TYPE c,
              v_len TYPE i,
              v_zover TYPE i .
      FIELD-SYMBOLS: <f>     TYPE ANY .
      CLEAR wa_fin.
    *--- Seting File path
      CONCATENATE p_cfile v_file sy-datum INTO l_file.
    *--- Open data set
      OPEN DATASET l_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
      IF sy-subrc = 0.
        LOOP AT it_down INTO wa_down.
          CLEAR : v_excel_string, v_zover, v_len.
          DO.
            ASSIGN COMPONENT sy-index OF STRUCTURE wa_down TO <f>.
            IF sy-subrc <> 0.
              EXIT. "exits do loop and process next record in itab
            ENDIF.
            DESCRIBE FIELD <f> LENGTH v_len IN CHARACTER MODE.
            v_excel_string+v_zover(v_len) = <f> .
            v_zover = v_zover + v_len .
          ENDDO.
          TRANSFER v_excel_string TO l_file.
          CLEAR : v_excel_string,
                  wa_down       ,
                  v_zover       .
        ENDLOOP.
    *--- Close data set
        CLOSE DATASET l_file.
        IF sy-subrc = 0.
    *--- Success Message
         MESSAGE s000(000) WITH text-018.
        ENDIF.
      ELSE.
    *--- Error unable to open file.
        MESSAGE e000(000) WITH text-017.
      ENDIF.
    ENDFORM.                    " DOWNLOAD_FILE
    Thanks ,
    Ruchi Tiwari

  • Create Tab-delimited text file with OPEN DATASET

    Hi everyone,
    My problem goes like this: the text file that I am writing using OPEN DATASET needs to be tab-delimited.  Originally the file was to be delimited using the pipe ( '|' ) character.
    I read in one of the threads that to put in tab delimiters you need to use something like this:
    DATA v_tab TYPE x value '09'.
    CONCATENATE  wa-field1 wa-field2
      INTO wa_output SEPARATED BY v_tab.
    I also encountered the same problem, the error that I can't concatenate the v_tab with the other fields.
    What, therefore, is the correct way to declare the fields to be used?
    Thanks.

    Try this. It worked for me:
    class cl_abap_char_utilities definition load.
    constants:
        tab  type c value cl_abap_char_utilities=>horizontal_tab.

  • Error while OPEN DATASET

    Hi all,
             I am getting a text file from presentation server and uploading it to application server like /tmp/TEXTFILE .
    Then I am scheduling a job in the same program .In the job I'll be retrieving the data from the file in app server like
    OPEN DATASET w_infile FOR INPUT IN TEXT MODE ENCODING DEFAULT MESSAGE msg.
    But m getting the error in msg as "No such file or directory".And my job is getting failed.
    I tried to open the file through AL11,It is opening.Also while I try to debug the failed job the file is opening properly and my changes are carried out succesfully.
    Can smbody help???

    Hi,
    Try using the sample code below:
      DATA: l_file TYPE tpfht-pffile                                  .
      DATA:g_data(1000) TYPE c                                        ,
           g_delim TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
      CLEAR l_file                                                    .
      l_file = p_file               "In P_file the path entered on the selection screen in captured                                   .
      CALL FUNCTION 'PFL_CHECK_OS_FILE_EXISTENCE'     "this function module will check the                                                                               
    "existence of the file on application server
        EXPORTING
          fully_qualified_filename = l_file
        IMPORTING
          file_exists              = l_true.
      IF l_true = space   .
        MESSAGE e001(zmsg).
      ENDIF               .
    *& File upload from application server
      OPEN DATASET l_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
      IF sy-subrc = 0                                              .
        DO.
          READ DATASET l_file INTO g_data                          .
          IF sy-subrc = 0                                          .
            SPLIT g_data AT g_delim INTO
            wa_upload-doc_type
    *       wa_upload-neg_posting
            wa_upload-comp_code    wa_upload-currency
            wa_upload-doc_date     wa_upload-pstng_date
            wa_upload-ref_doc_no   wa_upload-accnt
            wa_upload-amt_doccur   wa_upload-indicator
            wa_upload-header_txt   wa_upload-pmnttrms
            wa_upload-payment_meth wa_upload-gl_account
            wa_upload-tax_code     wa_upload-taxjurcode
            wa_upload-kostl        wa_upload-prctr
            wa_upload-alloc_nmbr
    *       wa_upload-wbs_element
           wa_upload-item_text                                   .
            IF wa_upload-doc_date IS NOT INITIAL.
              APPEND wa_upload TO it_upload                      .
              CLEAR wa_upload                                    .
            ENDIF                                                .
          ELSE                                                   .
            EXIT                                                 .
          ENDIF                                                  .
        ENDDO                                                    .
        CLOSE   DATASET l_file.
      ELSE.
        MESSAGE e004(zmsg)                                       ." error message if no file is uploaded
      ENDIF                                                      .
    *& Check for data exist or not
      IF it_upload[] IS INITIAL.
        MESSAGE e002(zmsg)     .
      ENDIF                    .
    Hope this helps
    Regards
    Mansi

  • Open zip file with the OPEN DATASET statement.

    How?
    The zip file is a text file compressed.
    Thanks for answers.

    in application server no ZIP files exist...as such flat files exist which can be read using DATASET concept.

  • Sync error with open Office 2011 files

    Have recently installed Microsoft's Office:Mac 2011 Home and Business. Have a setup with MA and PHD syncing. Whenever an office file is open FileSync reports a syncing error of that file, which after a while is annoying. Didn't get this with Office 2004. Does anyone have a remedy for this?
    Thanks
    Tomas

    I've not noticed this issue, and I have moved several movies over, and they fall into the 500-600MB range. Have you tried any of the troubleshooting steps? Try to power the phone off/on, then try a reset. That is accomplished by holding down the home button and the sleep/wake button together until you see the Apple logo, then releasing. Ignore the screen with the slide to power off option. If that doesn't seem to do it, it could be one of the files is having a problem. You say that eliminating all of them lets the sync work. Do you have USB 2.0 ports? Try to add just one file at a time to the sync and then see when the sync finally fails. It could be something corrupt in one of the files, and you might be able to elimiate the one by this method. If possible, then redo that particular file, be it a music file from CD or video, and then try again. See if any of this helps.

  • Error with "Open/Create/Replace File" function with cancel button

    I've attached a very simple VI that embodies what I want to do with my Open File function. I simply want to stop the rest of my program (theoretically encased in the Case Structure) from running if the user deigns not to specify a file location.
    However, if the Cancel button is clicked an error is produced before the rest of the program runs. If you ignore the error and continue, the "cancelled' variable is appropriately made true and the Case Structure runs properly. I simply want to remove the error message LabView gives me.
    Any ideas on why or how?
    Solved!
    Go to Solution.
    Attachments:
    Open file test.vi ‏34 KB

    The cancel button gives you error code 43 (if I remember correctly). After your file vi's, use the general error handler (GEH) to clear this error (and no other errors). Use
    [exception action]=Cancle Error on Match
    [exception code]=43
    type of dialog=no dialog
    Felix
    www.aescusoft.de
    My latest community nugget on producer/consumer design
    My current blog: A journey through uml

  • Error in Open Dataset. Application server file shows null value .

    Dear Gurus,
    As with my previous problem, I am now getting value from SAP Directory in AL11. But problem is-
    1. When I try to get Quantity or Currency field, it shows runtime error while uploading in App. Server.  So, I used Char data type variable  to store currency field and concatenate these in a string type variable.
    LOOP AT it_mseg INTO wa.
              move it_mseg-erfmg to amount.   " amount is a char type variable.
             CONCATENATE it_mseg-mblnr it_mseg-mjahr it_mseg-matnr amount it_mseg-werks it_mseg-lgort INTO ld_string.
      TRANSFER ld_string to filename.
    But I am getting only 0 for all the records. If I directly transfer wa to filename, it shows values. But when i am passing string, all value shows 0. Plz give me solution.
    Thanks,
    With regards,
    Tripod.

    Hi,
    use
    WRITE it_mseg-erfmg to amount.
    or, assuming that the currency is WW_WAERS,
    WRITE it_mseg-erfmg CURRENCY WW_WAERS to amount.

Maybe you are looking for

  • HT6010 My iPad wont let me update because it says I need more usage.

    I bought usage and it still will not let me install updates. What's going on?

  • How to enter a 'pdf-documentation' to an iview ?

    hi, at a presentation today in another company i have seen that in ESS-absence-entry web dynpro application on the top there was a link to a pdf-file -> which is the help for the application, written by this company for their employees. they said 'no

  • Can anyone please explain this code to me?

    I am a new (junior)programmer?Can anyone please explain this code to me in lame terms? I am working at a client location and found this code in a project. _file name is AtccJndiTemplate.java_ Why do we use the Context class? Why do we use the propert

  • File supposed to be not-exist although it is listed in direcotry

    Hello, When I get the file list in Unix, the non-English-named files supposed to be not-exist. For better understanding:     File dir = new File("./");     File[] children = dir.listFiles();     if (children != null)         for (int i=0; i<children.

  • Status Flag not appearing if branching

    I have a CP project with branching after a question slide (slide 14).  If the user gets the question wrong, they follow an alternate path to slide 15 to review the correct answer.  Then they hit slide 16.  If they get the question right, they skip sl