Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Creating a file on the application server

Former Member
0 Likes
1,009

Hi,

I am creating a new file on the application server. Do we always need to create a logical path or it can be done just by normal file handling statements?

Also I would like to know if the file is physically present at this location and can we open it notepad (in case .txt ot .csv)?

~Sid

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
923

Hi,

an update, logical path is being created to give platform-independent feature.. so this is solved.

Now, I am looking for a fact, when a file is being created on the application server and I can see that file by going in to AL11, with contents....is that file physically present and how to reach that file through if I want to open that file in notepad or wordpad???

Thanks

Sid

Hi,

I am creating a new file on the application server. Do we always need to create a logical path or it can be done just by normal file handling statements?

Also I would like to know if the file is physically present at this location and can we open it notepad (in case .txt ot .csv)?

~Sid

7 REPLIES 7
Read only

Former Member
0 Likes
924

Hi,

an update, logical path is being created to give platform-independent feature.. so this is solved.

Now, I am looking for a fact, when a file is being created on the application server and I can see that file by going in to AL11, with contents....is that file physically present and how to reach that file through if I want to open that file in notepad or wordpad???

Thanks

Sid

Read only

0 Likes
923

Hi,

The unix file you are trying to access is physically present on the server. The accessibilty of the file may be password protected. So, in some of the systems there would be a seperate FTP related transaction for the uploading/downloading of files to/from unix. In order to access the file or view the file present in the system, there would be seperate cuteFTP server access which would have all the directories and the relevant files present in them. Through this you can download the unix file onto the system in the notepad format.So you may have to ask the basis admin for the access of this server.

One more option is goto transaction AL11 in which you can see a list of directories which would have some of the unix files in it.

reward points if useful.

Thanks,

Archana

Read only

0 Likes
923

Hi Archana,

Thanks for the suggestion. Actually I was thinking of the same thing....I know we can go to AL11 and see teh file content..

Thnx

~Sid

Read only

Former Member
0 Likes
923

HI,

Check out the below program..Here "'F4_DXFILENAME_TOPRECURSION' is used to get the F4 help for the file in application Server.Also here, The data is transferred to the internal table and then to the Database table.

CODE:

report z_aru_banks1.

----


*TABLES

----


tables: zcust_master2.

----


*INTERNAL TABLES

----


data: begin of itab1 occurs 0,

zcustid like zcust_master2-zcustid,

zcustname like zcust_master2-zcustname,

zaddr like zcust_master2-zaddr,

zcity like zcust_master2-zcity,

zstate like zcust_master2-zstate,

zcountry like zcust_master2-zcountry,

zphone like zcust_master2-zphone,

zemail like zcust_master2-zemail,

zfax like zcust_master2-zfax,

zstat like zcust_master2-zstat,

end of itab1.

----


*DATA DECLARATION

----


data: str(1000).

data : sr_dir type dxfields-longpath value 'E:\usr\sap\ECC\SYS\gen\dbg'.

data: file1 like dxfields-longpath.

----


*CONSTANTS DECLARATION

----


constants: con_tab value cl_abap_char_utilities=>horizontal_tab.

----


*CALLING FUNCTION MODULE 'F4_DXFILENAME_TOPRECURSION'

----


call function 'F4_DXFILENAME_TOPRECURSION'

exporting

i_location_flag = 'A'

i_server = ''

i_path = sr_dir

filemask = '.'

fileoperation = 'R'

importing

o_path = file1

exceptions

rfc_error = 1

error_with_gui = 2

others = 3

.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

----


*OPEN DATASET

----


open dataset file1 for input in text mode encoding default.

do.

read dataset file1 into str.

if sy-subrc ne 0.

exit.

else.

split str at con_tab into itab1-zcustid itab1-zcustname itab1-zaddr itab1-zcity itab1-zstate itab1-zcountry

itab1-zphone itab1-zemail itab1-zfax itab1-zstat.

append itab1.

insert zcust_master2 from itab1.

endif.

enddo.

----


*CLOSE DATASET

----


close dataset file1.

Hope this helps u,

Regards,

Arunsri

Read only

0 Likes
923

Hi, Thanks for the reply!!

Quick question, when we are writing "OPEN DATASET ....." to create a file on application server, Is this file physically being stored or not? If yes then without writing the program that yoiu mentioned can we access it or not...?

Thanks

Sid

Read only

0 Likes
923

Hi,

when the 'open dataset' statement is executed , a file is physically created on the server.and without the program the file can be accessed by using the customised FTP transaction in your system or as i said through the cuteFTP server access.

Read only

0 Likes
923

yup, Thats what I was thinking!! Thnx