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 through APAB program

Former Member
0 Likes
1,193

I want to create a file in my desktop through ABAP program.. how do i do it ??

the code give below does not work ... even if i give the full path ...

<i>

DATA: file   TYPE string VALUE `c:test.dat`.
OPEN DATASET file FOR OUTPUT IN TEXT MODE
                             ENCODING DEFAULT.

</i>

Regards

Sivakumar

6 REPLIES 6
Read only

Former Member
0 Likes
967

Hi,

the open dataset does only work for files created on a server. For creating a file on your workstation try the method cl_gui_frontend_services->gui_download.

regards

Siggi

Read only

Former Member
0 Likes
967

Hi, the command you detailed relates to creating a file on the application server...e.g. unix path. The command cannot be used to create a file on your local drive.

Use function modules WS_DOWNLOAD/DOWNLOAD or class CL_GUI_FRONTEND_SERVICES depending on your SAP release. WS_DOWNLOAD/DOWNLOAD are used on earlier releases of SAP.

Thanks, Inde

Read only

Former Member
0 Likes
967

Hi siva,

The open Dataset command is used to open a file in Application server not on the desktop.

To create a file on desktop, use function module "f4_filename".

Don't forget to give points if ur problem is solved.

Thanks.

Read only

Former Member
0 Likes
967

Hi,

In order to create a file in your desktop (presentation server)you can use the function module GUI_DOWNLOAD .

Thanks,

Pani

Read only

Former Member
0 Likes
967

Siva,

If u are familiar with the ABAP Objects, then try using a method GUI_DOWNLOAD present in the Class CL_GUI_FRONTEND_SERVICES.

CODE could look like:

<b>data: objGuiFile type ref to cl_gui_frontend_services.

create object objGuiFile.

objGuiFile->gui_download</b>

Thanks

Kam

Message was edited by: Kam

Read only

Former Member
0 Likes
967

Hi,

While creating files in application server, we use OPEN DATASET.

For creating files on desktop, we use

GUI_DOWNLOAD

WS_DOWNLOAD(Obsolete).

Regards,

Sailaja.