2007 Oct 14 4:25 PM
Hi Guru's
I am reading from the UNIX application server.
Even if I dont give the file name.Sy-subrc remains zero after open dataset.
I am giving this file path in initialization '/devabap/if/hcm/out/'
but after that i am not giving any file name.
OPEN DATASET p_infile FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc = 0.
DO.
READ DATASET p_infile INTO wa_file.
IF sy-subrc = 0.
APPEND wa_file TO t_file.
ELSE.
EXIT.
ENDIF.
ENDDO.
ELSE.
MESSAGE i030 WITH p_infile.
ENDIF.
CLOSE DATASET p_infile.
Please help
Hi Guru's
I am reading from the UNIX application server.
Even if I dont give the file name.Sy-subrc remains zero after open dataset.
I am giving this file path in initialization '/devabap/if/hcm/out/'
but after that i am not giving any file name.
OPEN DATASET p_infile FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc = 0.
DO.
READ DATASET p_infile INTO wa_file.
IF sy-subrc = 0.
APPEND wa_file TO t_file.
ELSE.
EXIT.
ENDIF.
ENDDO.
ELSE.
MESSAGE i030 WITH p_infile.
ENDIF.
CLOSE DATASET p_infile.
Please help
2007 Oct 14 6:07 PM
hi,
What exactly is your requirement.
Thanks & Regards
Abhishek
Message was edited by:
Abhishek Jolly
2007 Oct 14 6:22 PM
Hi
I am reading a file from UNIX app server.
Even if i dont gve filename on sel screen.
after open dataset sy-subrc returns 0
i dont know y its returnig it and from where its reading the garbage values
2007 Oct 14 6:53 PM
My assumption would be - it reads dierctory as File,so whatever under directory ,it shows data.
open dataset will give sy-subrc eq 0 ,if file opens ,so here directory becomes file and it is opening.
Thanks
Seshu
2007 Oct 15 7:14 AM
are you able to see this file in AL11..if no then path may be incorrect..
2007 Oct 15 10:51 AM
Hi Manu,
What might be happening is the path which u r giving......<b>at that path a dir mite be existing...</b>So u can use 2 separate FM to identify this.... <b><i>Use the following piece of code</b></i>&----
*& Form sub_file_presence_check
&----
Checking the existence of the file on application server
&----
FORM sub_file_presence_check .
*--Local data declaration
DATA : tl_file TYPE STANDARD TABLE OF spflist."returned table by FM
IF NOT p_file IS INITIAL.
*--Check to see if it is a directory or file and make sure it is a file
CALL FUNCTION 'RZL_READ_DIR'
EXPORTING
name = p_file "file name to be verified
TABLES
file_tbl = tl_file "returned table by FM
EXCEPTIONS
argument_error = 1
not_found = 2
send_error = 3
system_failure = 4
OTHERS = 5.
*--If file does not exist
IF sy-subrc = 0.
*--This is a directory
MESSAGE e000 WITH text-005.
ELSEIF sy-subrc <> 0.
*--Check for file name
CALL FUNCTION 'RZL_READ_FILE'
EXPORTING
name = p_file "file name to be verified
TABLES
line_tbl = tl_file "returned table by FM
EXCEPTIONS
argument_error = 1
not_found = 2
send_error = 3
system_failure = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE e000 WITH text-006."'No such file exists'.
ENDIF.
ENDIF.
ELSE. "of if p_file is not initial
*--Please enter a file name
MESSAGE e000 WITH text-007.
ENDIF. ""of if p_file is not initial
ENDFORM. " sub_file_presence_check
2007 Oct 15 10:53 AM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |