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

How to define a application file path in program

Former Member
0 Likes
2,154

Hi,

In my program i want to define file path in application directory. using that file i want to upload the records as per my requirement.

I want to open and close that file in every time, but open time the file should be initial. how to write the code...please help me.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,657

try tcode AL11.

regards

Prabhu

8 REPLIES 8
Read only

Former Member
0 Likes
1,658

try tcode AL11.

regards

Prabhu

Read only

Former Member
0 Likes
1,657

The AL11 File path i need to define in my program.

how to write the coding.....

Read only

Former Member
0 Likes
1,657

Hi,

Open Dataset.

loop at table

Transfer work area.

endloop.

Closedataset.

If u open the same file then for every opening data in file will be cleared and new data wil transfered to file

If u want to dine new path then,

Goto Tcode -- > FILE, there u can create new file path.....

Kiran.

Edited by: kiran vempati on May 6, 2009 9:03 AM

Read only

Former Member
0 Likes
1,657

Hi,

To access the Application server directory using AL11 tcode. and the file will be created by tbe basis people.

In the program write the below code

Open dataset p_file for input encoding default (in ECC version)

you can write the code

transfer the data from internal to application server

Close dataset

Regards

Ramakrishna Pathi

Read only

Former Member
0 Likes
1,657

Hello,

all the application files r stored in AL11 tcode...

to open those

OPEN DATASET

for delate

DELETE DATASET

for transfer

TRANSFER DATA...

Thanks

Jay........

Read only

Former Member
0 Likes
1,657

Hi ,

To get the file at application server with no data in it each time when u r going for download use stmt

OPEN DATASET.

eg:

OPEN DATASET V_FILE FOR OUTPUT IN BINARY MODE. (where V_FILE is application server path)

IF SY-SUBRC NE 0.

MESSAGE E002 WITH 'Error while opening File'.

EXIT.

ELSE.

*---Data is downloaded to the application server file path

LOOP AT <IT> ."INTO wa_tab2.

TRANSFER <IT> TO V_FILE.

ENDLOOP.

IF SY-SUBRC EQ 0.

MESSAGE S002 WITH 'Data successfully downloded to application server'.

ENDIF.

ENDIF.

CLOSE DATASET V_FILE.

The keyword "FOR OUTPUT" in open dataset indicates that if the specified file already exists, its content is deleted

To append the data u can use "FOR APPENDING".

regards,

ajit.

Edited by: AJIT THAKUR on May 6, 2009 9:17 AM

Edited by: AJIT THAKUR on May 6, 2009 9:18 AM

Read only

Former Member
0 Likes
1,657

Hi,

Use the syntax:

DATA FNAME(60) VALUE 'myfile'.

DATA NUM TYPE I.

OPEN DATASET FNAME FOR OUTPUT.

DO 10 TIMES.

NUM = NUM + 1.

TRANSFER NUM TO FNAME.

ENDDO.

CLOSE DATASET FNAME.

If the file does not already exist, it is created automatically. If it does already exist, but is closed,

its contents are overwritten. If the file exists and is already open (for read or write access, or for

appending), the position is reset to the beginning of the file. If the system can open the file

<dsn> successfully, SY-SUBRC is set to 0. If not, it is set to 8.

Read only

Former Member
0 Likes
1,657

Santosh,

Is this what you are looking for

PARAMETERS: p_file(128) MODIF ID 001.

declare a parameter that opens Application server.

and then use FM

F4_DXFILENAME_TOPRECURSION

to get the file path from the search directories.

Regards,

ARS