Unable to delete a file on application server

Hello Experts,
I have gone through  couple of post and sample nothing worked that's the reason Iam posting a query here.
Please help me with your valuable suggestions.
I am reading a file from the application server running a BDC program to update my ztable all works fine.
now i wanted to move this file to another folder thats too working perfectly but now when i try deleting the older one it is not getting deleted.
I have closed the dataset and checked the authorization that is not a concern but still it is not getting deleted.
I have pasted the code below.
For READ and CLOSE dataset it returns subrc as 0 but after delete it returns 4.
data : mess type string.
OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT message mess.
IF SY-SUBRC = 0.
DO.
    READ DATASET ld_file INTO wa_string.
    if sy-subrc eq 0.
        append wa_string to it_string.
        clear wa_string.
    else.
        exit.
    endif.
  enddo.
  close dataset ld_file.
  delete dataset ld_file.
else.
WRITE 'Unable to open source file to move the content'.
endif.
Regards,
Ranjith N

Hello Mr Ghode,
Thaking you for your response on my query.
as you said to handle exception this is what i have done.
kindly verify the same would be of great help.
still iam unable to delete the file.  
OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
  IF SY-SUBRC = 0.
    DO.
      READ DATASET ld_file INTO wa_string.        "LV_LINE is variable to hold line contents being read
      if sy-subrc eq 0.
        append wa_string to it_string.
        clear wa_string.
      else.
        exit.
      endif.
  enddo.
  close dataset ld_file.
  if sy-subrc eq 0.
  try.
    delete dataset ld_file.
    catch CX_dynamic_check into t_ref.
    err_txt = t_ref->get_longtext( ).
endtry.
endif.
endif.
Regards,
Ranjith N

Similar Messages

  • How to delete a file from application server?

    Hi gurus,
    i want delete a file from application server . can any one tell me the BAPI/Fm .
    thanks in advance

    See the replies of the thread;
    How to delete  File from the Application Server,ABAP
    But i can smell something fishy in both  The specified item was not found. and The specified item was not found. style of posting questions. Also both of you have similar questions in your profile....
    Hmmm, Mods have to take care of the Rest...
    Regards
    Karthik D

  • Unable to create a file in Application Server using OPEN DATASET stattement.

    I am unable to create a file in Application Server using the following statement.
    OPEN DATASET filename FOR OUTPUT
    IN TEXT MODE ENCODING DEFAULT
    MESSAGE msg.
    The message I'm getting is "Permission Denied". I have checked authorisation using SU53 which says "The last authorization check was successful". Please help.

    You can use following code to capture the error.
    TRY.
          OPEN DATASET filename FOR OUTPUT IN BINARY MODE MESSAGE V_MSG.
          CATCH CX_ROOT
          INTO EXCEPTION.
          CALL METHOD O_EXCEPTION ->IF_MESSAGE~GET_TEXT
            RECEIVING
            RESULT = V_MSG.
          MESSAGE v_msg
          TYPE 'E'.
    ENDTRY.
    You can capture error in v_msg.
    Following are the exceptions for the same:
    Exceptions
    Catchable Exceptions
    CX_SY_FILE_OPEN
    Cause: The file is already open.
    Runtime Error: DATASET_REOPEN
      CX_SY_CODEPAGE_CONVERTER_INIT   
    Cause: The desired conversion is not supported. (Due to specification of invalid code page or of language not supported in the conversion, with SET LOCALE LANGUAGE.)
    Runtime Error: CONVT_CODEPAGE_INIT
    CX_SY_CONVERSION_CODEPAGE
    Cause: Internal error in the conversion.
    Runtime Error: CONVT_CODEPAGE
    CX_SY_FILE_AUTHORITY
    Cause: No authorization for access to file
    Runtime Error: OPEN_DATASET_NO_AUTHORITY
    Cause: Authorization for access to this file is missing in OPEN DATASET with addition FILTER.
    Runtime Error: OPEN_PIPE_NO_AUTHORITY
      CX_SY_PIPES_NOT_SUPPORTED   
    Cause: The operating system does not support pipes.
    Runtime Error: DATASET_NO_PIPE
    CX_SY_TOO_MANY_FILES
    Cause: Maximum number of open files exceeded.
    Runtime Error: DATASET_TOO_MANY_FILES   Non-Catchable Exceptions   
    Cause: An attempt was made to open a pipe that is already open.
    Runtime Error: DATASET_PIPE_POSITION
    Hope that will help you.
    Please reward if useful.

  • Move file to application server  or delete a file from application server

    Hi all
    I have one application in which if succeful uploading  of BMP file  from application server is not  done , File has to move to another folder like 'ERROR' Folder
    but i am unable to do that.
    here is the code:
    CONDENSE g_t_ws_move.
    CALL 'SYSTEM' ID 'COMMAND' FIELD g_t_ws_move
      ID 'TAB'     FIELD g_t_ws_command_line[].
    where
    <b>G_T_WS_MOVE= 'MOVE /Y /sapin/XVZ/journeyplan/0000000.BMP /tmp/0000000.BMP'
    means  i have to move 000000.bmp file from XVZ to tmp directory ,</b>

    Hello Neetu
    Alternatively you could use a combination of the following function modules:
    - EPS_FTP_PUT
    - EPS_DELETE_FILE
    Regards
      Uwe

  • Unable to open a file in Application server

    This path exist in the Application server.
            DR1/interfaces/Esker
    ORDHIST - This is the File name in whihc i need to save the data.
    I had specified the whole path as DR1/interfaces/Esker/ORDHIST
    I am trying to upload the data from the Internal table to the above specified file ORDHIST.
    It is not opening the File on the application server, it says that it 'could not open file'.
    Any suggestions will be apprecaited to open the file and transfer the data from
    Final Internal table to --> Application server
    Below is my code....If found any mistakes then plz correct me...
    *&      Form  UPLOAD_APPLSERVER
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM UPLOAD_APPLSERVER .
    DATA : GV_OUTPUT(275) TYPE C.
    DATA : P_FILE TYPE STRING.
    P_FILE = 'DR1/interfaces/Esker/ORDHIST'.
    OPEN DATASET P_FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    IF SY-SUBRC <> 0.
        MESSAGE : I002(ZMSSG) WITH 'Could not open file'.
        STOP.
    ENDIF.
    LOOP AT T_FINAL1 INTO WA_FINAL1.
    CONCATENATE  WA_FINAL1-VBUND
                  WA_FINAL1-BSTNK
                  WA_FINAL1-KUNNR
                  WA_FINAL1-AUDAT
                  INTO GV_OUTPUT
                  SEPARATED BY ','.
    TRANSFER GV_OUTPUT TO P_FILE.
    IF SY-SUBRC <> 0 .
         MESSAGE : I003(ZMSSG) WITH 'Trasnfer is failed'.
         STOP.
    ENDIF.
    ENDLOOP.
    CLOSE DATASET P_FILE.
    ENDFORM.                    " UPLOAD_APPLSERVER
    Thanks & Regards,
    Krishna

    Hello Kittu,
    What was the Sy-Subrc value after executing the Open Dataset statement?
    If it is 8, then the problem could be with
    1) The path name not mentioned properly (or)
    2) User Id might not be having access to the file mentioned in the path
    Also, if you are using the App Server as UNIX then the filenames should be of case sensitive.
    Check the path first and note it down as per the actual case
    Hope this is helpful
    Thanks,
    Babu Kilari
    Edited by: Babu Kilari on Apr 6, 2009 6:18 AM

  • How to delete file from application server(Unix)

    Hi All,
    Using the below code downloading a file from application server(Unix) to client machine. I want to delete the file from application server once it is downloaded to client
    We work on Forms 11.1.1.4.0 and Oracle DB 10g. Client machine are Windows 7.
    BEGIN
      IF webutil_file_transfer.AS_to_Client
      (clientFile => Name_In('global.g_file_name')
      ,serverFile => ls_AppServer_Loc)THEN
      message('Data exported Successfully');
      ELSE
       message('File download from Application Server failed');
      END IF;
    EXCEPTION
      WHEN OTHERS THEN
      message('File download failed: '||SUBSTR(sqlerrm,1,200));
      END;
    I have search for solution on OTN. Few suggested to use HOST.
    Can any one help me how to use Host() built_in to delete the file.
    Thanks,
    Maddy

    Can any one help me how to use Host() built_in to delete the file.
    Host('/bin/rm <complete file path>');

  • Delete file from application server

    Hi,
       Can any one tell me how to delete a file from application server?
    Thanks,
    Rahul.

    Basic question, please search for available information.
    Thread locked.
    Thomas

  • System exception while deleting the file from app server in background job

    Hi All,
    I have a issue while the deleting the file from application server.
    I am using the statement DELETE DATASET in my program to delete the file from app server.
    I am able to delete the file from the app server when i run the program from app server.
    When i run the same report from background job i am getting the message called System exception.
    Is there any secuirity which i need to get the issue.
    Thank You,
    Taragini

    Hi All,
    I get all the authorization sto delete the file from application serever.
    Thing is i am able to run the program sucessfully in foreground but not in the background .
    It i snot giving any short dump also just JOB is cancelled with the exception 'Job cancelled after system exception ERROR_MESSAGE'.
    Can anybody please give me suggestion
    Thanks,
    Taragini

  • How to Select the Latest file from Application Server?

    Dear All,
    I am working on object, which had requirement to Pick the file from application server.
    The Application server contain the files in ‘/temp/sms/’ directory. The files are having the name Like ‘smsqry_yyyymmddhhmmss.txt’ and I have to Pick the Latest file (Base on file name for eg. 'smsqry_20060713102333’) from that all and after getting the file I have to delete the file from application server.
    So How to do this.
    Regards

    hi,
    look function group EPSF-
    esp. fm EPS_GET_DIRECTORY_LISTING
    if you're looking fo OS-date and time
    look here:Re: How do I convert MTIME to date and time?
    A.
    Message was edited by: Andreas Mann

  • How to delete a file from Appliction Server.

    Hi Gurus,
    I want to delete a file from application server .
    can any one tell me the FM/BAPI.
    Plz Reply me ASAP.
    Thanks in Advance.

    BAPI_DOCUMENT_DELETE ?
    GUI_DELETE_FILE ?
    maybe just go to SE37, enter DELETE, and click on the document icon to find from repository system.
    Regards,
    Vincent

  • Process Chain - Delete File from Application Server

    Hi Gurus,
    Im working with Process chain, and i have a load from a flat file, so my question is :
    How can i delete that file from the application server after was loaded ?
    THANKS IN ADVANCED !!! I REALLY APRECCIATE YOUR HELP.
    Marcos

    hi,
    I have gone through the forum you have posted for deleting files from application server through process chain.
    I have similar reuirement in my project.
    Can you please provide me the solution?
    Your inputs will be highly appreciated.
    Thanks in advance.
    Regards,
    Lavanya.

  • Delete files from APPLICATION SERVER?

    Hi All,
    I am creating the files in application server with folder name as
    /interface/freeway/ and filename as PO concatenating with sy-datum and sy-uzeit.
    Ex file name now is /interface/freeway/PO20081201064120.csv
    Now my req is i need to delete files which has beeen created less than 30 days.
    regards,
    Sachin.

    hi,,,,,,
    REPORT ZDELETE.
    * Delete a file on the application server.
    PARAMETERS: P_DIR LIKE RLGRAP-FILENAME
    DEFAULT '/usr/sap/trans/',
    P_FILE1 LIKE RLGRAP-FILENAME.
    DATA: P_FILE(128).
    DATA: W_ANS.
    START-OF-SELECTION.
    CONCATENATE P_DIR P_FILE1 INTO P_FILE.
    * check file exists
    OPEN DATASET P_FILE FOR INPUT.
    IF SY-SUBRC NE 0.
    MESSAGE E899(BD) WITH P_FILE 'does not exist'.
    EXIT.
    ELSE.
    CALL FUNCTION 'POPUP_CONTINUE_YES_NO'
    EXPORTING
    DEFAULTOPTION = 'N'
    TEXTLINE1 = P_DIR
    TEXTLINE2 = P_FILE1
    TITEL = 'ARE YOU SURE YOU WANT TO DELETE'
    * START_COLUMN = 25
    * START_ROW = 6
    IMPORTING
    ANSWER = W_ANS
    EXCEPTIONS
    OTHERS = 1.
    ENDIF.
    CLOSE DATASET P_FILE.
    CHECK W_ANS = 'J'.
    * delete
    DELETE DATASET P_FILE.
    IF SY-SUBRC NE 0.
    MESSAGE E899(BD) WITH 'Invalid file name' P_FILE.
    ELSE.
    CLOSE DATASET P_FILE.
    MESSAGE I899(BD) WITH P_DIR P_FILE1 'DELETED'.
    ENDIF.

  • Delete file on application server (Froms9iAS)

    How can I delete file on application server (Froms9iAS) from client machine (file such as *.txt,*dbf). I try use old win_api_utility (from Forms6i) but it doesn't work.

    Check out Webutil.
    More on it in the Forms page.

  • How to delete the Generated files from application server(open hub)?

    hi experts,
    when i try to execute process chain the DTP it is giving below dump. Exception CX_RSBK_REQUEST_LOCKED logged.
    when i execute the DTP manually and trying to delete the previous request, it is giving for dump ITAB_DUPLICATE_KEY.
    so to delete the generated file from application server, how to delete it for specific dates?
    Information on where terminated
    Termination occurred in the ABAP program "GPD6S3OE0BCVGC6L9DBNVYQARZM" - in
    "START_ROUTINE".
    The main program was "RSBATCH_EXECUTE_PROZESS ".
    In the source code you have the termination point in line 2874
    of the (Include) program "GPD6S3OE0BCVGC6L9DBNVYQARZM".
    The program "GPD6S3OE0BCVGC6L9DBNVYQARZM" was started as a background job.
    and when i check the dump it is point out at below code
    " Populate the lookup table for 0STOR_LOC
    SELECT * from /BI0/TSTOR_LOC
    into CORRESPONDING FIELDS OF table L_0STOR_LOC_TEXT
    FOR ALL ENTRIES IN SOURCE_PACKAGE WHERE
    STOR_LOC = SOURCE_PACKAGE-STOR_LOC.
    but the programme is syntactically correct only.
    how to rectify the issue.
    regards
    venuscm
    Edited by: venugopal vadlamudi on Sep 28, 2010 1:59 PM

    hi experts,
    We have written start routine to get the storage location text and sending to File located at Application server through OPEN HUB.
    here is the code written in the Transformations
    In the global section
    Text for 0STOR_LOC
        DATA: l_0stor_loc_text TYPE HASHED TABLE OF /bi0/tstor_loc
              WITH UNIQUE KEY stor_loc.
        DATA: l_0stor_loc_text_wa TYPE /bi0/tstor_loc.
    and in the code to get the text
    " Populate the lookup table for 0STOR_LOC
        *SELECT * from /BI0/TSTOR_LOC*
          into CORRESPONDING FIELDS OF table L_0STOR_LOC_TEXT
          FOR ALL ENTRIES IN SOURCE_PACKAGE WHERE
                  STOR_LOC = SOURCE_PACKAGE-STOR_LOC.
    im sure there is problem with the Routine only. i think i need to change the code if so please provide me the modified one.
    thanks
    venuscm
    Edited by: venugopal vadlamudi on Sep 29, 2010 9:37 AM

  • Deleting file from application server

    can any one tell me how to delete file from application server?

    Hi,
      Use statement
      delete dataset 'tmpfile.txt'.
    \tmp\file.txt is the file path on application server which you want to delete.
    Regards
    Sailaja.

Maybe you are looking for

  • Problems in creating OU and O

    I've 2 scenarios which I don't how to handle: Suppose I have a department in an organisation that have many smaller sub-department & these sub-departments may have groups within them (so sort like nesting), how do I create such entries? For the top l

  • Import and export the database table

    I would like to know what is the syntax of using imp.exe and exp.exe to import and export the database table? Could anyone teach me what is the syntax and how could do the export and import in the Forms? Thanks a loT~

  • Can I purchase additional apple care if mine has expired

    I guess I did not purchase Apple Care when I purchased my phone.,  Can I purchase it now??  I have a 5s

  • Smart Form translation via SE63 not possible

    I want to translate Smart forms from English to French, but when doing so via SE63, I get a codepage error. We don't have language Fr installed in our system. Is this a prerequisite or is there another way to translate the smartform? many thanks

  • Insert a photo in screen painter or tab strip

    Hi, Please give me a solution for how to insert employee photo like jpeg in screen painter or tab strip control thanks, suresh