Open dataset dump.

hi guys,
I am getting OPEN DATASET SHORTDUMP using below code.
can somebody suggest me alteration of code..
Dump says error in READ statement.
DATA : BEGIN OF IT_EDIT OCCURS 0,
         CNO(5)         TYPE C,
         DATE(8)        TYPE C,
         VENDOR(10)     TYPE C,
         MATERIAL(18)   TYPE C,
         STARTDT(8)     TYPE C,
         ENDDT(8)       TYPE C,
         QUANTITY(13)   TYPE N,
       END OF IT_EDIT.
OPEN DATASET P_INFILE FOR INPUT IN TEXT MODE ENCODING DEFAULT.
  DO.
    IF NOT SY-SUBRC IS INITIAL.
      EXIT.
    ELSE.
<b>      READ DATASET P_OUFILE INTO IT_EDIT.</b>
      APPEND IT_EDIT.
    ENDIF.
  ENDDO.
  CLOSE DATASET P_OUFILE.
Regards
Chandra.

hi,
pls chk this sample code.
report zfiles_0001.
Parameters: d1 type localfile default '/usr/sap/TST/SYS/Data1.txt',
            d2 type localfile default '/usr/sap/TST/SYS/Data2.txt'.
data: itab type table of string.
data: wa type string.
start-of-selection.
Read file
  open dataset d1 for input in text mode.
  if sy-subrc = 0.
    do.
      read dataset d1 into wa.
      if sy-subrc <> 0.
        exit.
      endif.
      append wa to itab.
    enddo.
  endif.
  close dataset d1.
Copy to new file
  open dataset d2 for output in text mode.
  loop at itab into wa.
    transfer wa to d2.
  endloop.
  close dataset d2.
Delete the first
  delete dataset d1.
regards
anver
if hlpful pls mark points

Similar Messages

  • Dump on OPEN DATASET ; TRANSFER stmt

    p_name is the file name parameter
    FORM APPL_TRAN.
      file = p_name.
      OPEN DATASET file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
      IF sy-subrc = 0.
        CLEAR wa_final.
    Loop through the internal table which has the ECC data and transfer it to the file.
        LOOP AT it_final  into wa_final.
          TRANSFER wa_final to file.
          CLEAR wa_final.
        ENDLOOP.
    *Close the file.
        CLOSE DATASET file.
      ENDIF.
    ENDFORM.                    "APPL_TRAN
    I'm getting a short dump when the stmt TRANSFER is executed.
    The Error Analysis is as follows:
    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 "TY_ECC2". 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.
    Can someone please help me in this regard.
    Thanks,
    FS

    hi,
    ur internal table it_final declaration is like this
    data : begin of it_final occurs 0,
              matnr(18),
              werks(4),
             end of it_final.
    in this situation ur statement
    OPEN DATASET file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    works then u wont get any dump in transfer statement.
    so u replace
    OPEN DATASET file FOR OUTPUT IN BINARY MODE .
    it works.
    regards
    siva

  • Data transfer error open dataset files

    hi,
    When i try to create a excel or text in my application server using open dataset.
    i.e
    l_filename type rlgrap-filename  value '/tmp/down.txt'.
    I got a short dump during the run time
    i got the output and put into an internal table.
    the following code has been used.
    form user_command using r_ucomm like sy-ucomm
    rs_selfield  type slis_selfield.
    if r_ucomm = 'confirm' .
    OPEN DATASET l_fname FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    LOOP AT it_out INTO wa_out.
      IF sy-subrc = 0.
        TRANSFER wa_out TO l_filename.
      ENDIF.
    ENDLOOP.
    endform.
    during the execution i hv a button alv grid outpu. when i click the button the file should be transferred.
    but NO authorization to open the file "/tmp/down.txt".
    and the error is pointed in the opendataset line.
    Please tell me where i am wrong . and  help me in resoving this.

    Try this..instead of moving field by field into the file 1st convert all he fields to a character stream..and then move that steam to file. Ex:
    loop at internal table into l_h_tbl_file.
    concatenate l_h_tbl_file-f1 l_h_tbl_file-f2 l_h_tbl_file-f3
    l_h_tbl_file-f4 l_h_tbl_file-f5 into g_string.
    TRANSFER g_string TO fu_wk_get_file.
    endloop.

  • How to open a pdf file using OPEN DATASET

    Im trying to convert a pdf into binary format. So im trying to read the contents of the pdf into a XSTRING. Using the FM 'SCMS_XSTRING_TO_BINARY' i can convert the XSTRING to binary format.
    How to open a pdf file using OPEN DATASET and transfer its contents in a XSTRING variable.
    What i've tried is....
    DATA: f_name type string value 'C:\rep_output_pdf.pdf',
          x1 type xstring,
          LT_DATA TYPE STANDARD TABLE OF X255.
    OPEN DATASET f_name FOR input IN BINARY MODE.
    READ DATASET f_name INTO x1.
    CLOSE DATASET f_name.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
        EXPORTING
          BUFFER     = x1
        TABLES
          BINARY_TAB = LT_DATA.
    Im getting a short dump .
    Short text: The file is not open.
    Plz help me out.

    Hello Rajesh,
    You are trying to do use OPEN DATASET with a local file. NOT POSSIBLE
    You have to have the file in the app server to use OPEN DATASET.
    BR,
    Suhas

  • OPEN DATASET FILENAME FOR OUTPUT.

    HI,
    While doing unicode enable inECC6.0 FOLLOWING ERROR IS COMING.hOW IT WILL BE RESOLVED.
    oPEN DATASET physname FOR OUTPUT.

    Hello,
    For opendataset u need to add the below coding.
    open dataset 'filename' for output in text mode encoding default. ( Based on ur filetype)
                                                            binary mode encoding default
    if it not a unicode system then non unicoding must be added.
    N.B
    In the Transfer stmt the data types apart from CNDT will result dump.
    So please ensure that all are of CNDT types.
    With Regards,
    Sumodh.P

  • Open dataset in ECC 6.0 passes AUTHORITY_CHECK but still fails to download

    Hello Gurus,
    I'm having trouble getting open dataset to work in ECC 6.0.
    I've tried using encoding utf-8 and default plus an authority check.
    The program doesn't abap dump, but nothing happens.
    Am I doing something wrong?
      DATA: my_full_path_auth LIKE authb-filename .
      my_full_path_auth = 'c:\temp\inv_coverage_by_material.txt'.
      MESSAGE i001(zstd) WITH 'converting itab to characters'.
      REFRESH ta_by_part_number_ascii.
      LOOP AT pta_out INTO ts_by_part_number .
        MOVE-CORRESPONDING ts_by_part_number
          TO ts_by_part_number_ascii.
        APPEND ts_by_part_number_ascii TO ta_by_part_number_ascii.
      ENDLOOP.
      MESSAGE i001(zstd) WITH 'convertion complete'.
      CALL FUNCTION 'AUTHORITY_CHECK_DATASET'
        EXPORTING
    *   PROGRAM                =
          activity               = 'WRITE'
          filename               = my_full_path_auth
        EXCEPTIONS
          no_authority           = 1
          activity_unknown       = 2
          OTHERS                 = 3 .
      IF sy-subrc <> 0.
        MESSAGE i001(zstd) WITH 'authority check failed'.
      ELSE.
        MESSAGE i001(zstd) WITH 'authority check PASSED'.
      ENDIF.
      OPEN DATASET my_full_path FOR OUTPUT
         IN TEXT MODE ENCODING DEFAULT .
      LOOP AT ta_by_part_number_ascii INTO ts_by_part_number_ascii .
        TRANSFER ts_by_part_number_ascii TO my_full_path.
      ENDLOOP.
      CLOSE DATASET my_full_path.

    Ahhh. I forgot that the file is saved on the app server.
    New question:
    I was trying to do a download of an internal table in batch mode. The GUI_DOWNLOAD function won't work for that.
    What do people do to download a file to the presentation server?
    Moderator message - Please limit yourself to one question per thread. That makes it easier for others to find solutions to their similar problems.
    So please close this one and ask a new question
    Edited by: Rob Burbank on Apr 14, 2009 1:12 PM

  • Open dataset for output

    Hi,
      When I create a file from R3 using open dataset for output, the file is created at the OS Level with rights coming from R3. Is there a way to control the properties of those rights.
    Regards,

    Hi,
    you can use authorization object S_DATASET & S_PATH to control user & program access to the file system . Then in your program use FM AUTHORITY_CHECK_DATASET to check the authority before opening to avoid a dump.
    Cheers
    Allan

  • Truncated record in OPEN DATASET ENCODING NON-UNICODE

    Hi,
    I have to read a Unicode created file into a non-unicode SAP System, version 4.7.
    When I make the OPEN DATASET using ENCODING UTF-8 y get a CONVT_CODEPAGE dump. That´s odd cause my system is non-unicode. I don´t wanna use IGNORING CONVERSION ERRORS attribute, the output will be corrupt.
    But when I use ENCODING NON-UNICODE or ENCODING DEFAULT the READ DATASET mysteriously truncate the record which try to read from real 401 characters to 361 characters. Variable is string.
    I can see full records through AL11.
    Any ideas?
    Thanks,
    Pablo.

    Hi,
    Try using:
      open dataset filename in text mode encoding default for input
                                  ignoring conversion errors.
    As said in AL11 its coming so the above code is used for that.
    Hope this will surely help you !!!
    Regards,
    Punit

  • Open dataset doesn't lock the file at OS level

    Hi,
    I have a program, which tries to write a file on application server. Once the file is opened, and while program is writing to the file, if somebody goes at application server and deletes the file, I get a short dump, saying the file doesn't exist.
    Why doesn't SAP lock the file at OS level? Why is someone able to delete the file while SAP is processing it? What is to be done to check at OS level, to see if SAP is currently writing?
    Thanks,
    Juwin

    I tried what Kesav and Adrian told. I created 2 programs, 1st to create a file and 2nd to move the file.
    1st program: [url]http://www.mediafire.com/?gmrn1zyd0t0
    2nd program: [url]http://www.mediafire.com/?di2kzzzemkz
    Now, I executed the 1st program. While the 1st program is running, I executed the 2nd program. The Open dataset in the 2nd program always gave me sy-subrc as 0. So, I always got the message as ready to be moved. I tried executing the programs from different SAP user IDs as well. Got the same result. So, it seems, Open dataset, doesn't even lock the file at SAP level. I cannot use Open dataset for output in the second program, because that will erase the contents of the file.
    I cannot change the program, to execute a system command, because the file is created from a standard program, and we dont want to touch it.

  • CG3Z working not open dataset for output

    Hi,
    I am trying to upload data into the application server for which m using the OPEN DATASET statement. My file name is as follows in lowercase.
    p_file = '/usr/upi/out/test_20100220.dat'. TYPE c.
    While trying to execute this i am getting a short dump 'DATASET_NOT OPEN'.
    I tried to upload a file through tcode CG3Z with the same file path and its working fine whereas through the below code its not working at all.
    open DATASET w_filename_unix for INPUT in TEXT MODE ENCODING DEFAULT.
        LOOP AT i_fieldnames INTO wa_fieldnames.
          TRANSFER wa_fieldnames TO w_filename_unix.
        ENDLOOP.
        LOOP AT i_output INTO wa_output.
          TRANSFER wa_output TO w_filename_unix.
        ENDLOOP.
      if sy-subrc NE 0.
        WRITE: 'Error'.
      ENDIF.
      CLOSE DATASET w_filename_unix.
    Please help.
    Regards herwin..

    hii,
    Why is it W_filename...??? it should be p_file ...... after opendataset...

  • 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

  • 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

  • Open dataset exception not triggered

    hello folks i'm having a dump because i can't open the dataset, but
    when i use this code
    open dataset p_file for output in text mode encoding default message mes.
    if sy ne 0.
    message mess type E.
    endif.
    the error is triggered but if i use:
    TRY.
           OPEN DATASET p_file FOR OUTPUT
                IN TEXT MODE ENCODING DEFAULT.
         CATCH cx_dynamic_check  INTO gr_err.
           gs_msg = gr_err->get_text( ).
       ENDTRY.
    in debug i can see sy-subrc = 8 but the catch is not trigger, i have also try with   cx_sy_file_authority but nothing, i'm in ECC6 unicode.
    Regards

    hy all thanx for you reply, i've also try to catch all the possible exception like this:
    data gr_err TYPE REF TO cx_root,
    TRY.
           OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE.
         CATCH cx_sy_file_open INTO gr_err.
           gs_msg = gr_err->get_text( ).
         CATCH cx_sy_file_authority   INTO gr_err.
           gs_msg = gr_err->get_text( ).
         CATCH cx_dynamic_check  INTO gr_err.
           gs_msg = gr_err->get_text( ).
       ENDTRY.
    still nothing catch and sy-subrc still 8.

  • OPEN DATAST DUMP

    Hi,
    i use this code for open dataset and i have dump in bold line
      OPEN DATASET file_n FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
      LOOP AT it_d INTO wa_it.
        TRANSFER wa_it TO file_n.
      ENDLOOP.
    An exception occurred. This exception will be dealt with in more detail
    below. The exception, assigned to the class 'CX_SY_FILE_OPEN_MODE', was not
    caught, which
    led to a runtime error. The reason for this exception is:
    The system tried to access the file "C:\Documents and
    Settings\user\Desktop\CSV\xx.TXT" but found that this file was
    not opened. For this reason, it could not access the file.
    what can be the problem?
    Regards

    hi alvro ,
    Thanks,
    i try to write in gui download but the problem is
    that when i open the file i have lot of space between rows of table
    like line 50 empty rows and after anther line ,
    becouse that the file is huge
    how i can avoid that?
    i think it because of table in bold.
    TYPE-POOLS:truxs.
    types truxs_t_text_data(4096) type c occurs 0.
    DATA: da_tab TYPE truxs_t_text_data.
    CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
    EXPORTING
    i_field_seperator = ';'
    i_appl_keep = 'X'
    TABLES
    i_tab_sap_data = it_d
    CHANGING
    i_tab_converted_data = da_tab
    EXCEPTIONS
    conversion_failed = 1
    OTHERS = 2.
    CALL METHOD cl_gui_frontend_services=>gui_download
    EXPORTING
    filename = file_n
    filetype = 'BIN'
    append = 'X'
    codepage = 'UTF-8'
    CHANGING
    data_tab =  da_tab
    EXCEPTIONS
    file_write_error = 1
    no_batch = 2
    Regards

  • Unicode - Read dataset dump

    *{Comm Unicode Conversion
    OPEN DATASET DDDEIN FOR INPUT IN TEXT MODE.
    *}Comm  Unicode Conversion
    *{Ins   Unicode Conversion
      OPEN DATASET DDDEIN FOR INPUT IN TEXT MODE
                       ENCODING DEFAULT.
    *}Ins  Unicode Conversion
    READ DATASET DDDEIN INTO DEIN.
    here i am geeting dump. this is due ot DEIN is a structure, contains quanity and currency fields. these are not converted.
    So, How can i solve this issues. 
    Note: if dont understand plese leave youe quiries here, i will give reply immediately.
    Thanks
    Sudhakar
    Edited by: sudhakara reddy on Feb 7, 2008 2:34 PM

    Hi,
    Check this link
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3d42358411d1829f0000e829fbfe/content.htm
    Regards
    Shiva

Maybe you are looking for

  • How can I transfer songs from one computers iTunes library to another library?

    How can I transfer songs from one computers iTunes library to another computers iTunes library?

  • OBIEE 11.1.1.5 & BI Applicartions 7.9.6.3; Sales Analytics

    I have installed OBIEE and Bi APplications, created a repository for Sales Analytics and Sales, Marketing Service and Contact Centre. The installls all complete successfully. ALl services start and I can log-in and view SampleAppLite. However as soon

  • How do can I use Jumpstart to boot Solaris from Slave Drive

    Hi all, I have XP on Master Drive and I used Jumpstart to install Solaris on Slave Drive. This is the profile: install_type     initial_install system_type     standalone usedisk          c0d1 boot_device      c0d1 update root_device     c0d1s0 fdisk

  • Obsolete FM

    Hi, Can you please briefly explain on how to find the OBSOLETE function modules. Thanks in advance, Naresh

  • MIGO & 641

    Hello friends, My client requirement is stock transfer between two plants belongs to same company code  using T.code MIGO and using movement type 641.Is it possible? If possible can U explain me what  are the steps involved in it? regards, Sekhar_fun