Application Development 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: 

file from logical system

Former Member
0 Kudos

Hi Gurus,

What is the FM used to call a file which is in the logical system. I am not able to recollect the name.

Thanks and Regards,,

Vishwa.

6 REPLIES 6

Former Member
0 Kudos

hi,

GUI_DOWNLOAD is the function module and other which acts opposite is

GUI_UPLOAD.

hope this would be helpful

Regards

Narin Nandivada

0 Kudos

Hi

Thanks for the reply, but that is from the physical system, like desktop,there is another FM which starts with get_file.....

The FM you mentioned cannot be used to call the file in the server of sap or non sap.

Thanks and Regards,

Vishwa.

Former Member
0 Kudos

Hi,

datasets are the file son the application server.

open dataset opens the file for reading / writing or appending records.

read dataset reads the data from teh file to the work area / variables of the program

close dataset closes the file on the application server.

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

u2022 Files on application server are sequential files.

u2022 Files on presentation server / workstation are local files.

u2022 A sequential file is also called a dataset.

Handling of Sequential file

Three steps are involved in sequential file handling

u2022 OPEN

u2022 PROCESS

u2022 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 u2018nu2019u2019 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,

Raj.

0 Kudos

Thanks fo the Reply Raj.

But, I am not doing a BDC program here, I am trying to do a vendor master interface from a web based application into SAP,to do that we need the FM which calls logical files.

Thanks and Regards,

Vishwa.

Former Member
0 Kudos

Hi Vishwa,

Can you be specific, what exactly is your requirement.

Regards,

Chandra Sekhar

Former Member
0 Kudos

Hi Vishwa,

I think you want the function module to browse and select the file on the logical system. If so, the function module is:

F4_FILENAME.

Hope this helps you,

Any queries, get back to me.

Regards,

Chandra Sekhar