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: 

Write to a text file from an ABAP routine

Former Member
0 Kudos

Hi,

I am doing Business Warehouse stuff and need to write some ABAP update routines.

As i am not too familiar with ABA debugging capabilities, i was wondering what is the syntax i should use in order to write from the routine to a text log file.

I would like to use this file as a debugging tool.

I would like to write variables values etc'.

Can someone provide me with the syntax i should use in order to wite a variable to a text file that i will place in my sapworkdir.

Many thanks,

Xibi

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi ,

fill in all the variables into an internal table and call the FM GUI_DOWNLOAD.

regards

satesh

5 REPLIES 5

Former Member
0 Kudos

Hi xibi,

1. Use this kind of code :

2.

REPORT abc.

DATA : BEGIN OF itab OCCURS 0,

var1(15) TYPE c,

var2(15) TYPE c,

END OF itab.

itab-var1 = 'amit'.

itab-var2 = 'mittal'.

APPEND itab.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'D:\PP.TXT'

TABLES

data_tab = itab

.

regards,

amit m.

0 Kudos

Hi Amit

I liked your code and works perfect if u run in SE38.

But the issue is if i write this code in DSO Transformation start routine (or any routine), load fails saying process with error as its Std message. So i was wondering that is this due to Application folder or GUI_Download FM

Thanks

0 Kudos

Hello,

This code directly writes the document in D driver.

What should we do if the user wants to select the path to copy this file?

Former Member
0 Kudos

Hi ,

fill in all the variables into an internal table and call the FM GUI_DOWNLOAD.

regards

satesh

Former Member
0 Kudos

Hi xibi,

The best thing you can do is use SAP's standard logging tools.

You can create a new log object using transaction SLG0.

Here is a helpful example on how to implement the code:

http://wiki.sdn.sap.com/wiki/display/Snippets/UsingApplicationLog

Another option is using transaction SAAB. Create a new check point group and use statement LOG-POINT or ASSERT to fill the log. The help function can help you out here.

It is really simple: create a new checkpoint f.i. ZTEST. Activate it for log points on the activation tab.

Add statement to programme, f.i.


REPORT zs00_test.

DATA: tp_var TYPE vbeln VALUE 'Order01'.

LOG-POINT ID ztest FIELDS tp_var.

Go back to SAAB and check the results under tab "Log" .

Roy