OPEN DATA SET to write files in application server folder - some of the files are missing

Hi,
I'm using OPEN DATASET statement in batch job to write the files in application server. what i'm experiencing is when i schedule the batch job all the files are not writing into the folder.
If i run the report again to write the missed files, the files are writing into the application server folder.
after opening the dataset, i'm closing it. do we need to give any delay between creation of the files? or until the first write operation is done, 2nd one can't start ..how can we achieve this.
Thanks for your help in advance.
Thanks,
Adi.

Hello Bathineni,
Are you using the sy-subrc check after the OPEN DATASET statement.
If not use a sy-subrc check and transfer the contents to file only when the OPEN DATASET returns value sy-subrc = 0.
if sy-subrc is 8 repeat the same loop say for 3 attempts until the OPEN DATASET becomes 0.
DO 3 TIMES. <---- put any number of attempts as you need
OPEN DATASET.
IF sy-subrc = 0.
   TRANSFER contents to file.
   EXIT.
ENDIF.
ENDDO.
CLOSE DATASET.
Regards,
Thanga

Similar Messages

  • I have set up folders to file my emails on iCloud but notice that some of the emails are missing. Can anyone tell me where they are and how to get them back.

    I have set up folders on iCloud to file my mail but notice that some of the emails are missing when I've transferred them. Can anyone tell me where they are and how to get them back please?

    This can be a problem with the file places.sqlite that stores the bookmarks and the history.
    * http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox

  • I am having trouble downloading photoshopcc.   when I try to open it tells me that files are missing

    I am having trouble downloading photoshopcc.   when I try to open it tells me that files are missing and I need to re-download, but system willnot let me re-download.

    Moved to ADE forum.

  • Unable to open iTunes...Required files are missing

    Windows XP User - just downloaded 7.5 and received the above message. Reinstalled and received same error. Any ideas?
    Thanking you in advance

    Hey... I had the same problem! In one of the other forums, they suggested uninstalling Quicktime player and reinstalling it. The downloading from here
    www.apple.com/support/downlods/quicktime72forwindows.html
    and then launch iTunes... it worked for me just a few mins ago!
    Good luck!

  • How come some of the apps are missing from the Adobe Application Manager.

    When I downloaded the AAM for cloud it only gave 14 apps instead of the 26 apps to install.  What do I need to do to see all of the apps?  I have windows 7.
    Thanks,
    D.....

    Branched this out to a new discussion.  If you have programs missing it is likely that your computer does not meet the system requirements for that particular application.  For example if you are running a 32-bit operating system you will not be given the option to install After Effects or Premiere Pro since they require a 64-bit OS.

  • Answer the following question regarding GUI_UPLOAD and Open Data Set

    1. what’s the connection or relationship of S_GUI to GUI_UPLOAD?
    2. GUI_UPLOAD saves files to local directory of a use while OPEN DATA SET saves/archives files in the server directory.  Where is the risk directed towards consuming disk space?  Server disk or workstation disk space?
    3. how will this work for multiple files?
    4. Regarding Open Data Set - How the files will be put in AL11?

    The GUI_DOWNLOAD only download the file to local PC...so any abap code running in other pc will not able to use the file.
    BUt if you use open dataset to load the file APPLICATION server any ABAP pogram can access the file.
    Following code explains how you load file using open data setto appl server,
    you can check in t-code <b>AL11</b> for files/dir in applicatin server.
    you to change the value of <b>myfile</b> variable in my code..
    you have to give the full path of the dirctory.
    <b><b>plz reward  points if it hlps you.</b></b>
    Report ZANID_TEST2 message-id ZM.
    data begin of itab occurs 0. "your internal table
    include structure MARA.
    data end of itab.
    *--file upload purpose--
    DATA: BEGIN OF it_file OCCURS 0,
    buffer(200),
    END OF it_file.
    DATA: myfile(128) type c value 'E:\usr\sap\put\sample1xx.txt',
    start-of-selection.
    *--populating itab--
    select * from mara into corresponding fields of table itab
    up to 100 rows.
    perform UPLOAD_FILE_TO_APPL.
    *--form definitin--
    form UPLOAD_FILE_TO_APPL.
    OPEN DATASET myfile FOR OUTPUT IN TEXT MODE.
    IF sy-subrc NE 0.
    MESSAGE e999(zm) WITH 'File could not be opened'.
    ENDIF.
    *-- creating the file data table
    loop at itab.
    *-- i am only taking two fields
    concatenate itab-matnr itab-matkl into it_file-buffer
    separated by space.
    append it_file.
    endloop.
    LOOP AT it_file.
    TRANSFER it_file-buffer TO myfile.
    CLEAR IT_FILE-BUFFER.
    ENDLOOP.
    CLOSE DATASET myfile.
    IF sy-subrc NE 0.
    MESSAGE e999(zm) WITH 'File could not be closed'.
    ENDIF.
    endform. " DUPLOAD_FILE_TO_APPL

  • Open data set for reading excel file on application server in back ground

    open data set for reading excel file on application server in back ground

    hi Vijay,
    I am afraid you won't be able to read from Excel file on Appl. Server.
    ec

  • Download using open data set and close data set

    can any body please send some sample pgm using open data set and close data set .the data should get downloaded in application server
    very simple pgm needed

    Hi Arun,
    See the Sample code for BDC using OPEN DATASET.
    report ZSDBDCP_PRICING no standard page heading
    line-size 255.
    include zbdcrecx1.
    *--Internal Table To hold condition records data from flat file.
    Data: begin of it_pricing occurs 0,
    key(4),
    f1(4),
    f2(4),
    f3(2),
    f4(18),
    f5(16),
    end of it_pricing.
    *--Internal Table To hold condition records header .
    data : begin of it_header occurs 0,
    key(4),
    f1(4),
    f2(4),
    f3(2),
    end of it_header.
    *--Internal Table To hold condition records details .
    data : begin of it_details occurs 0,
    key(4),
    f4(18),
    f5(16),
    end of it_details.
    data : v_sno(2),
    v_rows type i,
    v_fname(40).
    start-of-selection.
    refresh : it_pricing,it_header,it_details.
    clear : it_pricing,it_header,it_details.
    CALL FUNCTION 'UPLOAD'
    EXPORTING
    FILENAME = 'C:\WINDOWS\Desktop\pricing.txt'
    FILETYPE = 'DAT'
    TABLES
    DATA_TAB = it_pricing
    EXCEPTIONS
    CONVERSION_ERROR = 1
    INVALID_TABLE_WIDTH = 2
    INVALID_TYPE = 3
    NO_BATCH = 4
    UNKNOWN_ERROR = 5
    GUI_REFUSE_FILETRANSFER = 6
    OTHERS = 7.
    WRITE : / 'Condition Records ', P_FNAME, ' on ', SY-DATUM.
    OPEN DATASET P_FNAME FOR INPUT IN TEXT MODE.
    if sy-subrc ne 0.
    write : / 'File could not be uploaded.. Check file name.'.
    stop.
    endif.
    CLEAR : it_pricing[], it_pricing.
    DO.
    READ DATASET P_FNAME INTO V_STR.
    IF SY-SUBRC NE 0.
    EXIT.
    ENDIF.
    write v_str.
    translate v_str using '#/'.
    SPLIT V_STR AT ',' INTO it_pricing-key
    it_pricing-F1 it_pricing-F2 it_pricing-F3
    it_pricing-F4 it_pricing-F5 .
    APPEND it_pricing.
    CLEAR it_pricing.
    ENDDO.
    IF it_pricing[] IS INITIAL.
    WRITE : / 'No data found to upload'.
    STOP.
    ENDIF.
    loop at it_pricing.
    At new key.
    read table it_pricing index sy-tabix.
    move-corresponding it_pricing to it_header.
    append it_header.
    clear it_header.
    endat.
    move-corresponding it_pricing to it_details.
    append it_details.
    clear it_details.
    endloop.
    perform open_group.
    v_rows = sy-srows - 8.
    loop at it_header.
    perform bdc_dynpro using 'SAPMV13A' '0100'.
    perform bdc_field using 'BDC_CURSOR'
    'RV13A-KSCHL'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_field using 'RV13A-KSCHL'
    it_header-f1.
    perform bdc_dynpro using 'SAPMV13A' '1004'.
    perform bdc_field using 'BDC_CURSOR'
    'KONP-KBETR(01)'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    perform bdc_field using 'KOMG-VKORG'
    it_header-f2.
    perform bdc_field using 'KOMG-VTWEG'
    it_header-f3.
    **Table Control
    v_sno = 0.
    loop at it_details where key eq it_header-key.
    v_sno = v_sno + 1.
    clear v_fname.
    CONCATENATE 'KOMG-MATNR(' V_SNO ')' INTO V_FNAME.
    perform bdc_field using v_fname
    it_details-f4.
    clear v_fname.
    CONCATENATE 'KONP-KBETR(' V_SNO ')' INTO V_FNAME.
    perform bdc_field using v_fname
    it_details-f5.
    if v_sno eq v_rows.
    v_sno = 0.
    perform bdc_dynpro using 'SAPMV13A' '1004'.
    perform bdc_field using 'BDC_OKCODE'
    '=P+'.
    perform bdc_dynpro using 'SAPMV13A' '1004'.
    perform bdc_field using 'BDC_OKCODE'
    '/00'.
    endif.
    endloop.
    *--Save
    perform bdc_dynpro using 'SAPMV13A' '1004'.
    perform bdc_field using 'BDC_OKCODE'
    '=SICH'.
    perform bdc_transaction using 'VK11'.
    endloop.
    perform close_group.
    Hope this resolves your query.
    Reward all the helpful answers.
    Regards

  • What is open data set and close data set

    what is open data set and close data set,
    how to use the files in sap directories ?

    hi,
    Open Dataset is used to read or write on to application server ... other than that i am not sure that there exists any way to do the same ... here is a short description for that
    FILE HANDLING IN SAP
    Introduction
    • Files on application server are sequential files.
    • Files on presentation server / workstation are local files.
    • A sequential file is also called a dataset.
    Handling of Sequential file
    Three steps are involved in sequential file handling
    • OPEN
    • PROCESS
    • CLOSE
    Here processing of file can be READING a file or WRITING on to a file.
    OPEN FILE
    Before data can be processed, a file needs to be opened.
    After processing file is closed.
    Syntax:
    OPEN DATASET <file name> FOR {OUTPUT/INPUT/APPENDING}
    IN {TEXT/BINARY} MODE
    This statement returns SY_SUBRC as 0 for successful opening of file or 8, if unsuccessful.
    OUTPUT: Opens the file for writing. If the dataset already exists, this will place the cursor at the start of the dataset, the old contents get deleted at the end of the program or when the CLOSE DATASET is encountered.
    INPUT: Opens a file for READ and places the cursor at the beginning of the file.
    FOR APPENDING: Opens the file for writing and places the cursor at the end of file. If the file does not exist, it is generated.
    BINARY MODE: The READ or TRANSFER will be character wise. Each time ‘n’’ characters are READ or transferred. The next READ or TRANSFER will start from the next character position and not on the next line.
    IN TEXT MODE: The READ or TRANSFER will start at the beginning of a new line each time. If for READ, the destination is shorter than the source, it gets truncated. If destination is longer, then it is padded with spaces.
    Defaults: If nothing is mentioned, then defaults are FOR INPUT and in BINARY MODE.
    PROCESS FILE:
    Processing a file involves READing the file or Writing on to file TRANSFER.
    TRANSFER Statement
    Syntax:
    TRANSFER <field> TO <file name>.
    <Field> can also be a field string / work area / DDIC structure.
    Each transfer statement writes a statement to the dataset. In binary mode, it writes the length of the field to the dataset. In text mode, it writes one line to the dataset.
    If the file is not already open, TRANSFER tries to OPEN file FOR OUTPUT (IN BINARY MODE) or using the last OPEN DATASET statement for this file.
    IF FILE HANDLING, TRANSFER IS THE ONLY STATEMENT WHICH DOES NOT RETURN SY-SUBRC
    READ Statement
    Syntax:
    READ DATASET <file name> INTO <field>.
    <Field> can also be a field string / work area / DDIC structure.
    Each READ will get one record from the dataset. In binary mode it reads the length of the field and in text mode it reads each line.
    CLOSE FILE:
    The program will close all sequential files, which are open at the end of the program. However, it is a good programming practice to explicitly close all the datasets that were opened.
    Syntax:
    CLOSE DATASET <file name>.
    SY-SUBRC will be set to 0 or 8 depending on whether the CLOSE is successful or not.
    DELETE FILE:
    A dataset can be deleted.
    Syntax:
    DELETE DATASET <file name>.
    SY-SUBRC will be set to 0 or 8 depending on whether the DELETE is successful or not.
    Pseudo logic for processing the sequential files:
    For reading:
    Open dataset for input in a particular mode.
    Start DO loop.
    Read dataset into a field.
    If READ is not successful.
    Exit the loop.
    Endif.
    Do relevant processing for that record.
    End the do loop.
    Close the dataset.
    For writing:
    Open dataset for output / Appending in a particular mode.
    Populate the field that is to be transferred.
    TRANSFER the filed to a dataset.
    Close the dataset.
    Regards
    Anver
    if hlped pls mark points

  • How to use open data set in SAP

    Hi SAP Gurus,
            Could anyone help, how to use open data set in SAP.
          I need to upload a file from Application server (ZSAPUSAGEDATA) to internal table (IT_FINAL).
    Thanks & Regards,
    Krishnau2026

    Hi Krishna.
    These are the steps you need to follow.
    tables: specify the table.
    data: begin of fs_...
            end of fs_    " Structure Field string.
    data: t_table like
            standard table
                      of fs_...
    data:
    w_file TYPE string.
    data:
      fname(10) VALUE '.\xyz.TXT'.
    select-options: if any.
    PARAMETERS:
      p_file LIKE rlgrap-filename.
    w_file = p_file.
    select .... statement
    OPEN DATASET fname FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    *OPEN DATASET fname FOR OUTPUT IN BINARY MODE.
    LOOP AT t_... INTO fs_....
    write:/ .....
    TRANSFER fs_... TO fname.
    or
    TRANSFER t_... TO fname
    ENDLOOP.
    CLOSE DATASET fname.
    Reward points wisely and if you are benefitted or ask for more detailed explanation if problem not solved.
    Regards Harsh.

  • Open data Set Error?

    Hi Guys,
                  I am using Open dataset for downloading the data into Application server   .I am getting the  error file path is not opened  but in al11 i was able to see the path what i mentioned here except bseg.txt file.I am getting error at Open data set statement.I have to write the bseg table data into the file bseg.txt in application server.can any body suggest the solution for this problem.
              Very urgent.
    wa_BSEG_file = '/interfaces/DR1/MM/outbounb/ZMMOF3007/BSEG.txt'.
      OPEN DATASET wa_BSEG_file FOR OUTPUT         "Write to appl. server
                                          IN TEXT MODE
                                          Encoding default.  "Open dataset Return code
    IF sy-subrc = 0.
    TRANSFER it_cosp1 to wa_BSEG_file.
    Write : 'File Transferred BSIK'.
      ELSE .
    Write : 'File Not Found / Transferred BSIK'.
    ENDIF.
       CLOSE DATASET wa_BSEG_file.
               Very urgent.Full marks will be alloted if u give me the correct answer.
    Thanks,
    Gopi.

    Hi,
    Due to serveral reasons
    1. Check whether you have proper authority in the directory?
    2. check the whether any files with same name?
    3. use addition message in the open dataset statement so that you can know the system message it getting.
    DATA: msg(100).
    OPEN DATASET wa_BSEG_file FOR OUTPUT MESSAGE msg
    IN TEXT MODE Encoding default.
    aRs

  • Open data set

    hi friends
    i make one file like dat.i use open data set so dat file created
    so my question is that where this file is created ?
    it will create on applicationserver?
    bcoz its not create on my local drive.

    Hi
    Yes
    A file will be created on Application server.
    We use DATASET concept for reading, writing, transfering data from Local to Application servers.
    see the sample code
    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.
    Reward points for useful Answers
    Regards
    Anji

  • Difference between SXPG_COMMAND_EXECUTE and Open data set mechanism

    Can you please help me to know the difference between moving a file using FM "SXPG_COMMAND_EXECUTE" and moving file using "open data set - transfer file- close data set" mechanism?

    Through 'SXPG_COMMAND_EXECUTE' u can execute a External command  (ie.. UNIX /Windows/OS/400) In ABAP programming..
    for Conversion Of Aplication server File/Move the file from one directory to Other...
    The Command must be present in SM69.
    Using this function module'SXPG_COMMAND_EXECUTE' , you can check the authorization of a user to execute a particular external command and run the command:
    With the arguments specified in ADDITIONAL_PARAMETERS
    On the target host system defined by OPERATINGSYSTEM and TARGETSYSTEM
    If an SAP profile parameter is inserted in the portion of the command stored in the database, then the value of this parameter is substituted into the command. If an SAP application server is active on the target system (TARGETSYSTEM), then the profile parameter values are read from the profile that is active on that system. No parameter substitution is made in ADDITIONAL_PARAMETERS.
    After substitution, the command is checked for the presence of "dangerous" characters such as the semicolon ( ; ) on UNIX systems.
    If an additional "security function module" is specified in the command definition, this function module is also called in the course of processingebenfalls. This function module can prevent execution of the command.
    If the authorization checks complete successfully, the command is run on the target host system.
    Through Open Data Set u can read and write the file in the same directory...
    Thnaks,
    SD
    Moderator message: copy/paste without credit, points removed, please do not repeat!
    http://www.google.de/search?hl=de&q=%22youcanchecktheauthorizationofauserto+execute%22&meta=&aq=f&aqi=&aql=&oq=&gs_rfai=
    http://www.google.de/search?hl=de&q=%22Aftersubstitution%2Cthecommandischeckedforthepresence%22&meta=&aq=f&aqi=&aql=&oq=&gs_rfai=
    Edited by: Thomas Zloch on Aug 17, 2010 12:47 PM

  • Open data set problem with binary mode

    Hi everyone,
    I am trying to read into a buffer the content of a binary file (like Excel) and to write that content file using open data set into a folder destination.
    The file destination has a size diferent than from the original one and cannot be open.
    Here is the code.
      DATA:  lv_file_name(100),
             lt_content LIKE sdokcntbin OCCURS 0 WITH HEADER LINE.
      MOVE '\computerTestA1.xls' TO lv_file_name.
      OPEN DATASET lv_file_name FOR INPUT IN BINARY MODE.
      IF sy-subrc NE 0.
        EXIT.
      ENDIF.
      DO.
        READ DATASET lv_file_name INTO lt_content-line.
        IF sy-subrc NE 0.
          EXIT.
        ENDIF.
        APPEND lt_content.
      ENDDO.
      CLOSE DATASET lv_file_name.
    *  DELETE DATASET lv_file_name.
      CLEAR: lv_file_name.
      MOVE '\computerTestB2.xls' TO lv_file_name.
      OPEN DATASET lv_file_name FOR OUTPUT IN BINARY MODE.
      IF sy-subrc NE 0.
        EXIT.
      ENDIF.
      LOOP AT lt_content.
        TRANSFER lt_content-line TO lv_file_name.
      ENDLOOP.
      CLOSE DATASET lv_file_name.
    THanks in advance.
    Regards.
    Message was edited by:
            David Fryda

    Hi,
    I solve the problem.
    In fact, when I try to write the last line of lt_content, it does write all the line even if this line is not full of data.
    Solution :
      DATA:  lv_file_name(100),
             lt_content LIKE sdokcntbin OCCURS 0 WITH HEADER LINE,
             alen TYPE i,
             pos TYPE i.
      MOVE '\mr0221TestA1.xls' TO lv_file_name.
      OPEN DATASET lv_file_name FOR INPUT IN BINARY MODE.
      IF sy-subrc NE 0.
        EXIT.
      ENDIF.
      SET DATASET lv_file_name POSITION END OF FILE.
      GET DATASET lv_file_name POSITION pos.
      SET DATASET lv_file_name POSITION 0.
      DO.
        CLEAR lt_content.
        READ DATASET lv_file_name INTO lt_content-line ACTUAL LENGTH alen .
        IF sy-subrc NE 0.
          APPEND lt_content.
          EXIT.
        ENDIF.
        APPEND lt_content.
      ENDDO.
      CLOSE DATASET lv_file_name.
    *  DELETE DATASET lv_file_name.
      CLEAR: lv_file_name.
      MOVE '\mr0221TestB2.xls' TO lv_file_name.
      OPEN DATASET lv_file_name FOR OUTPUT IN BINARY MODE.
      IF sy-subrc NE 0.
        EXIT.
      ENDIF.
      LOOP AT lt_content.
        AT LAST.
          TRANSFER lt_content-line TO lv_file_name LENGTH alen.
          EXIT.
        ENDAT.
        TRANSFER lt_content-line TO lv_file_name.
      ENDLOOP.
      CLOSE DATASET lv_file_name.
    Thanks.

  • 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