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: 

bdc

Former Member
0 Kudos
145

i am posting one question plz give me the answer.

what are the type of files in bdc?

5 REPLIES 5

Former Member
0 Kudos
94

BDC is used to enter the data from flat files into the SAP system. It helps to transfer data from the legacy system where data is in some other form as in the SAP System.The legacy data can be uploaded in the form of text file or in the form of MS-EXCEL. BDC is used in SAP implementation projects where data transfer/switching of technology is needed.

Former Member
0 Kudos
94

hi,

There are two types of files in bdc.

1.logical files

2.sequential files.

logical files: The files which are located in presentation server are called logical files or local files.

sequential files:The files which are located in Application server are called sequential files or datasets.

Inorder to read these sequential files we can use

OPEN DATASET,READ DATA SET ,AND CLOSE DATASET.

thanks,

raji

Former Member
0 Kudos
94

Hi,

In BDC u have two types of files ,

1)Local File(Which is available on presentation server to upload this file genrally u use gui_upload,Gui_download)

2)Sequential File(Which is available on ur SAP,system,Using open data sets and close datasets etc u can access this files)

Regads,

Muarali

Former Member
0 Kudos
94

HI,

in BDC while uploading/download data from prersentation server, we provide file types.. .txt(TEXT), .asc(ASCII) and .xls(EXCEL)

if we upload/download data from sequential files(logical files) we specifies test mode...., TEXT or BINARY

open dataset <name> for output/input in TEXT/BINARY mode.

*here write the logic as per our needs

close dataset <name>.

follow this link for sample program..

http://abapprogramming.blogspot.com/2007/11/abap-bdc-sample-code-xd01.html

regards,

Ashok

Former Member
0 Kudos
94

Hi,

FILE HANDLING IN BDC

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.

Handling of local files

Introduction

Files on presentation server / workstation are LOCAL FILES.

Local files are processed using UPLOAD and DOWNLOAD functions. The local files are brought into ABAP/4 memory using these functions. Unlike dataset, all the records of the file are UPLOADED into an internal table in one shot. Similarly, all records are DOWNLOADED in one shot from an internal table to a local file.

DOWNLOAD function:

Important EXPORTING parameters for this function are:

Filename = name of the local file to which the internal table is to be downloaded.

Filetype = file type, default values are ASC, DAT, BIN

Mode = Write mode, overwrite (u2018 u2018) or append (u2018Au2019)

Important IMPORTING parameters are:

Filename = actual file name entered

Tables to be passed to the function:

Data_tab = the internal table that is to be downloaded.

Similar function called WS_DOWNLOAD is used to download the information from internal table to local file. The only difference between DOWNLOAD and WS_DOWNLOAD is that, DOWNLOAD does not require the u2018FILENAMEu2019 and u2018FILETYPEu2019 to be exported to the function; instead it will ask for the same at runtime. However, for WS_DOWNLOAD, these two parameters need to be passed.

Processing Text file with multiple record types:

To process such files, it is necessary to first read the record into a character field that is a minimum of the lengths of the different structure in the file. If u2018Hu2019 type record is 30 char long (including the record identifier) and u2018Du2019 type is 40 long (including the record identifier), then this character field should be at least 40 char long.

Regards,

Bhaskar