0% found this document useful (0 votes)
99 views3 pages

Handling The Flat File That Exist in The Application Server

This document provides instructions for uploading and downloading flat files from the application server in SAP using dataset statements. It describes the TCODE AL11 for accessing application server directories, and includes the syntax for opening, reading, writing, appending, and deleting datasets. Steps are provided to upload data from a flat file into internal tables using the OPEN DATASET and READ DATASET statements, and to download data from internal tables to a flat file using SELECT and TRANSFER statements.

Uploaded by

Farooq Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
99 views3 pages

Handling The Flat File That Exist in The Application Server

This document provides instructions for uploading and downloading flat files from the application server in SAP using dataset statements. It describes the TCODE AL11 for accessing application server directories, and includes the syntax for opening, reading, writing, appending, and deleting datasets. Steps are provided to upload data from a flat file into internal tables using the OPEN DATASET and READ DATASET statements, and to download data from internal tables to a flat file using SELECT and TRANSFER statements.

Uploaded by

Farooq Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Handling the flat file that exist in the application server

TCODE for application server directories or SAP Directories is AL11

Data Sets: Through dataset statement we can upload the data from flatfile that exist in the
Application server.

Syntax for uploading

>OPEN DATASET <DATASET NAME> FOR INPUT <MODE TYPE> MODE ENCODING DEFAULT.

>READ DATASET <DATASET NAME> INTO INTERNAL TABLE.

FOR DOWNLOADING

>OPEN DATASET <DATASET NAME> FOR OUTPUT IN <MODE TYPE> MODE ENCODING DEFAULT.

FOR APPENDING

>OPEN DATASET <DATA SET NAME> FOR APPENDING IN <MODE TYPE> MODE ENCODING DEFAULT.

FOR DELETING

>DELETE DATASET <DATA SET NAME>

MODE :
> TEXT
> BINARY

Note: GUI_UPOAD cannot be used to upload the flatfile when it is in the application server so we use
dataset.

TO UPLOAD

Parameters : file(50) type c default D:\USER\SAP\PRD\DVEBM\DATA\Customer.TXT.

Data: begin of it occurs 10,


Kunnr like kunnr,
Land1 like land1,
Name1 like name1,
Ort01 like ort01,
End of it.

Data :it_bdcdata type bdcdata occurs 10 with header line.

Data: it_bdcmsgcoll type bdcmgscoll occurs 10 with header line.

Open dataset file for input in the text mode encoding default.

Do.
Refresh it_bdcdata.
Read dataset file into it_bdcdata.
If sy-subrc ne 0 .
Exit.
Endif.

Perform sub1 using <program name> <screen no>.

Perform sub2 using <field name> <field value>.

Call transaction <tcode> using it_bdcdata mode a messages into it_bdcmsgcoll update a.

Loop at it_bdcmsgcoll.

Refresh it_bdcmsgcoll.

If it_bdcmsgcoll-msgtyp = I.

Message <succuess>.
Exit.
Elseif it_bdcmsgcoll msgtyp = E.
Message <unsuccess>.
Exit.
Endif.
Endloop.
Enddo.

Form sub1 a b.
It_bdcdata-program = a.
It_bdcdata-dynpro = b.
It_bdcdata-dynbegin = X.
Append it_bdcdata.
Endform.

Form sub2 d f.
It_bdcdata-fnam = d.
It_bdcdata-fval = f.
Append It_bdcdata.
Endform.

===
To download

Tables kna1.
Parameters : file(50) type c default D:\USER\SAP\PRD\DVEBM\DATA\Customer.TXT.

Select-options: cust for kna1-kunnr.

Data: begin of it occurs 10,


Kunnr land1 name1 ort01
End of it.

Select kunnr name1 land1 ort01 from kna1 into table it where kunnr in cust.

If sy-subrc = 0.
Open dataset file for output in text mode encoding default.
Open dataset file for appending in text mode encoding default.

Loop at it.
Transfer it to file.
Endloop.

If sy-subrc = 0.

Message success.

Else.

Message unsuccess.

Endif.

You might also like