Open dataset input error

Hi guys
i am trying to open more than 100 files  using open dataset input but i am getting below error
  program is abending reading after 50files..
Program failing in  open data set error  can u help me please?
143
144 * Each file is getting into an internal table
>>>   OPEN DATASET w_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
146   IF sy-subrc <> 0.
147     CONTINUE.
148   ELSE.
149     DO.
150       READ DATASET w_file INTO s700_delta.
What command I should give here
Error analysis
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_SY_TOO_MANY_FILES', was not
     caught and
    therefore caused a runtime error.
    The reason for the exception is:
    The maximum number of open files (100) has been exceeded.
please let me know what should makes changes to avoid this abend?

Standard programming problem, should be rather trivial to find with a quick search. Basically there's always a limit of how many open file handles you can have at a time.
Please try to consult the ABAP help next time before posting (or search on SCN). A quick check for [open dataset|http://help.sap.com/abapdocu_70/en/ABAPOPEN_DATASET.htm] would've told you the following:
You can open up to 100 files per internal session. The actual maximum number of simultaneously open files may be less, depending on the platform.
Most likely you actually don't want to have all those files open at the same time and you simply forgot to use a [close dataset|http://help.sap.com/abapdocu_70/en/ABAPCLOSE_DATASET.htm] after reading each file.

Similar Messages

  • Open dataset fails...says "error opening input file"

    Hi,
    I am trying to open a file in my BDC program and get the following error "error opening input file". Its a text file with continuous data. No delimiters and hence character count will be used to parse the data.
    I am using the following statement to open it..
    OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    but sy-subrc is set to 8 !!
    what could be the problem ??
    thanks

    This is pretty confusing !!I would explain to you my exact issue !!
    I have a program in which there is no GUI_UPLOAD call but just a direct open dataset statement !!
    This program runs fine for my collegue who has the file in a server (not the application server). She gives the full path name as
    servername\foldername\filename.
    I tried doing the same but as I did not have access to that server, it failed. So I received that file from her and stored it in my local system. So on program execution, i gave the path as c:\filename and I got the error message "Error opening the file"
    Find below some code extracts..
    PARAMETERS : p_sname TYPE d0100_mapn ,
                 p_file(136) TYPE c ,
    FORM open_file .
    *open file in textmode
      OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
      IF  sy-subrc = 0.
        DO.
        Read the file data and tranfer to workarea to internal table
          READ DATASET p_file  INTO  x_legacy_rec.
    Please help in debugging this issue !!
    thanks

  • Open dataset twice once for input and once for output in unicode system

    Hi All,
    In a program
    I used a open dataset to read the data from the file.
    OPEN DATASET cmp_file FOR INPUT IN TEXT MODE
          ENCODING NON-UNICODE.
    Then i closed the file.
    Again later in the program,
    I used a open dataset to transfer the data.
    OPEN DATASET cmp_file FOR OUTPUT IN TEXT MODE
          ENCODING NON-UNICODE.
    But this time I get sy-subrc = 8.
    Unable to open the file and subsequent TRANSFER is leading to the runtime error.
    Note : I am using a unicode system
    I could run the same program well in non-unicode system..
    ->
    Is it that if a file contains data already
    1.I need to delete the data and open it
    or
    2.I need to open in APPENDING mode manadatorily...
    in case of UNICODE system..
    Kindly suggest..

    Hi,
    IF you have write permission al S.O. Level you need to check your DATASET rigths using AUTHORITY_CHECK_DATASET, this validate your rigths with S_DATASET object.
    Example
    TYPE-POOLS SABC.
    CALL FUNCTION 'AUTHORITY_CHECK_DATASET'
    EXPORTING PROGRAM = 'ZDATASET'
    ACTIVITY = SABC_ACT_READ
    FILENAME = '/tmp/sapv01'
    EXCEPTIONS NO_AUTHORITY = 1
    ACTIVITY_UNKNOWN = 2.
    See SABC type pool to know wich activities are aviable.
    Hope this help.
    Regards

  • 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

  • Error opening dataset, return code:        8

    Hi,
    I'm passing the information from a txt to a transparente table. The problem is that it throws me the following message: Error opening dataset, return code:        8  .
    When I debug it the first row of information enters to the internal table but after it this erro comes.
    The code is the following:
    DATA: BEGIN OF record,
    data element: TABNAME
            tablename_001(030),
    data element: DESCR40
            des_002(040),
    data element: TYKLA
            tipo_003(015),
    data element: QUANTITY_I
            quan_004(011),
    data element: PRICE
            precio_005(021),
    data element: TOT01
            total_006(017),
          END OF record.
    End generated data section ***
    DATA:
    BEGIN OF i_tabla OCCURS 0,
    dest(40),
    type(15),
    quan(10),
    precio(15),
    tot(15),
    END OF i_tabla.
    PARAMETERS:
    p_user LIKE apqi-userid OBLIGATORY DEFAULT  sy-uname,
    p_fich LIKE rlgrap-filename OBLIGATORY
    DEFAULT: 'C:\Documents and Settings\lseri\My Documents\Book1.txt'.
    START-OF-SELECTION.
      CALL FUNCTION 'UPLOAD'
       EXPORTING
      CODEPAGE                      = ' '
         filename                      = p_fich
         filetype                      = 'DAT'
        TABLES
          data_tab                      = i_tabla
       EXCEPTIONS
         conversion_error              = 1
         invalid_table_width           = 2
         invalid_type                  = 3
         no_batch                      = 4
         unknown_error                 = 5
         gui_refuse_filetransfer       = 6
         OTHERS                        = 7
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      PERFORM open_dataset USING dataset.
      PERFORM open_group.
      LOOP AT i_tabla FROM 2.
    PERFORM bdc_dynpro      USING 'SAPLSETB' '0230'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'DATABROWSE-TABLENAME'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=ANLE'.
        PERFORM bdc_field       USING 'DATABROWSE-TABLENAME'
                                      record-tablename_001.
        PERFORM bdc_dynpro      USING '/1BCDWB/DBZSTOCK_TEST' '0101'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'ZSTOCK_TEST-TOTAL'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=SAVE'.
        PERFORM bdc_field       USING 'ZSTOCK_TEST-DES'
                                      record-des_002.
        PERFORM bdc_field       USING 'ZSTOCK_TEST-TIPO'
                                      record-tipo_003.
        PERFORM bdc_field       USING 'ZSTOCK_TEST-QUAN'
                                      record-quan_004.
        PERFORM bdc_field       USING 'ZSTOCK_TEST-PRECIO'
                                      record-precio_005.
        PERFORM bdc_field       USING 'ZSTOCK_TEST-TOTAL'
                                      record-total_006.
        PERFORM bdc_dynpro      USING '/1BCDWB/DBZSTOCK_TEST' '0101'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/EBACK'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'ZSTOCK_TEST-DES'.
        PERFORM bdc_dynpro      USING 'SAPLSETB' '0230'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/EBACK'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'DATABROWSE-TABLENAME'.
        PERFORM bdc_transaction USING 'SE16'.
      ENDLOOP.
      PERFORM close_group.
      PERFORM close_dataset USING dataset.
    Please help me!
    Thanks

      open dataset                                                       *
    FORM OPEN_DATASET USING P_DATASET.
      OPEN DATASET P_DATASET
                   FOR INPUT IN TEXT MODE
                   ENCODING DEFAULT.
      IF SY-SUBRC <> 0.
        WRITE: / TEXT-E00, SY-SUBRC.
        STOP.
      ENDIF.
    ENDFORM.
      create batchinput session                                          *
      (not for call transaction using...)                                *
    FORM OPEN_GROUP.
      IF SESSION = 'X'.
        SKIP.
        WRITE: /(20) 'Create group'(I01), GROUP.
        SKIP.
      open batchinput group
        CALL FUNCTION 'BDC_OPEN_GROUP'
             EXPORTING  CLIENT   = SY-MANDT
                        GROUP    = GROUP
                        USER     = USER
                        KEEP     = KEEP
                        HOLDDATE = HOLDDATE.
        WRITE: /(30) 'BDC_OPEN_GROUP'(I02),
                (12) 'returncode:'(I05),
                     SY-SUBRC.
      ENDIF.
    ENDFORM.
    I'm using these performs because they appeared automatically when the recording became a program.

  • 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

  • Getting 'Invalid argument' error while uisng OPEN DATASET. Help!

    Hi Experts,
       I am trying to read a file from a shared server location using OPEN DATASET as shown below.
    OPEN DATASET file_name FOR INPUT IN TEXT MODE ENCODING UTF-8 MESSAGE msg.
    The file_name i gave is '
    CNSGN-PRE-DM.COM\FUNCTIONAL\INVENTORY.CSV'.
    The program compiles perfectly. But when I run the program I am getting 'Invalid argument' error. I have checked the authorization to the server, file name, file availability and everything is fine.
    Strangely this code was working fine a week ago.
    What could be the problem? Kindly help me!
    Thanks
    Gopal

    Hi Chndrasekhar,
            You mean to say the we cannot use OPEN DATASET for reading file in shared server location. For example a shared folder in my PC.
    Is there something wrong in the file name path I have given? It started with '//'. Do I have to start the file path wih 'file://..'?
    Thanks
    Gopal

  • 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.

  • 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.

  • 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.

  • Open Dataset for input in BINARY MODE not working after ECC 6.0 upgrade

    Hi All,
    Our requirement is to download an XML file from the application server and there is a customized program to download these files.
    This program uses the statement,  Open dataset ...for input in BINARY MODE
    and it works perfect for 4.7. There were no issues. But, after the upgrade to ECC 6.0 this does not work.
    When the data is read in ECC 6.0 , it is shown in some special characters and it could not be opened with XML editor and the file is not completely downloaded. I read through the forum and tried the following statement as well,
    Open dataset....for input in LEGACY BINARY MODE.
    After this statement, there were no special characters, but there is a blank space introduced before every character.
    Example : TEST(actual)
                      T E S T (After the legacy binary mode)
    Could you please let me know if there is any solution to rectify this problem. Appreciate your help.
    Thanks a million.
    Edited by: Manikd on May 12, 2011 3:52 PM

    But this program was already using BINARY MODE and after upgrade this is not working. I know, it may work in TEXT MODE. However, I cannot change the whole program to TEXT mode now.

  • How to keep the field open for input with error message in report program

    Hi,
      Need a help in solving the below issue.
    "How to keep the field open for input with error message in report program"
    Regards,
    C.Shasiraj.

    Hi...
    you have to use the event:
    <b>AT SELECTION-SCREEN ON <FIELD> EVENT.</b>
    u have to give an error message in this event.
    Consider the following <b>Example:</b>
    <b>PARAMETERS : NUMBER TYPE I.
    AT SELECTION-SCREEN ON NUMBER.
      IF NUMBER = 10.
        MESSAGE 'Number vakue is 10' TYPE 'E'.
      ENDIF.
    START-OF-SELECTION.
      WRITE NUMBER.
    </b>
    in this if u give the value of number = 10, it will not proceed further, if u give some other value other than 10 you will proceed further...
    Execute this program once u will understand....
    also Consider the following links :
    <b>Regarding events:</b>
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/79/34a237d9b511d1950e0000e8353423/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/79/34a23ad9b511d1950e0000e8353423/frameset.htm
    <b>Regarding messages:</b>
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/c5/aa575426ad11d2954d0000e8353423/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/c5/aa575426ad11d2954d0000e8353423/frameset.htm
    This is very useful.......
    Reward points if useful....
    Suresh....

  • 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

  • BDC for transaction AC02, error opening dataset returning 0.

    Here is the code.
    Help me ASAP..             
    <unreadable code removed by moderator>
    Moderator message: please do some own research before posting, only posts text with less than 5000 characters, check formatting before posting, do not use terms like "ASAP".
    Edited by: Thomas Zloch on Jan 13, 2012

      open dataset                                                       *
    FORM OPEN_DATASET USING P_DATASET.
      OPEN DATASET P_DATASET
                   FOR INPUT IN TEXT MODE
                   ENCODING DEFAULT.
      IF SY-SUBRC <> 0.
        WRITE: / TEXT-E00, SY-SUBRC.
        STOP.
      ENDIF.
    ENDFORM.
      create batchinput session                                          *
      (not for call transaction using...)                                *
    FORM OPEN_GROUP.
      IF SESSION = 'X'.
        SKIP.
        WRITE: /(20) 'Create group'(I01), GROUP.
        SKIP.
      open batchinput group
        CALL FUNCTION 'BDC_OPEN_GROUP'
             EXPORTING  CLIENT   = SY-MANDT
                        GROUP    = GROUP
                        USER     = USER
                        KEEP     = KEEP
                        HOLDDATE = HOLDDATE.
        WRITE: /(30) 'BDC_OPEN_GROUP'(I02),
                (12) 'returncode:'(I05),
                     SY-SUBRC.
      ENDIF.
    ENDFORM.
    I'm using these performs because they appeared automatically when the recording became a program.

  • Open dataset for input don't work after upgrade from 46C to 47

    We did an upgrade from 46C to 47, after that all the Z programs that have the sentence "open dataset for input" alwas send a sy-subrc = 8, the curios things is that the sentece "open dataset for output" works ok.
    Please I need help to solve this?
    En example of code.
    PARAMETERS: P_ARCHF(60) OBLIGATORY DEFAULT
                'C:\20050900.txt' LOWER CASE.
    OPEN DATASET P_ARCHF FOR INPUT IN TEXT MODE.
    IF SY-SUBRC <> 0. MESSAGE i001 WITH ARCHIVO. stop. endif.

    Well, it's telling you that the datset doesn't exist. From the help in 4.7:
    OPEN DATASET
    Addition 1a
    ... FOR INPUT
    Effect
    OPEN ... FOR INPUT opens the file in read mode.
    If the file does not exist, OPEN ... FOR INPUT fails with Return Code SY-SUBRC = 8.
    Note
    If OPEN DATASET is not executed in a Unicode program and if the user has write authorization for the file, the file is opened in read and write mode. Otherwise, it is only opened in read mode.
    Rob

Maybe you are looking for