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

WRITE output to internal table?

MichiFr
Participant
0 Likes
2,857

Hi,

in one of my programs I'm using WRITE statements to write some lines out as a protocol.

This program does not run as a job or will not be called using the SUBMIT statement. Hence I cannot use the spool or the EXPORTING LIST TO MEMORY option to get this output into any internal table.

I wonder if it's possible to grab the output done by the program and put it into an internal table using an alternate approach?

Thanks,

Michael

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,993

Hi,

in one of my programs I'm using WRITE statements to write some lines out as a protocol.

This program does not run as a job or will not be called using the SUBMIT statement. Hence I cannot use the spool or the EXPORTING LIST TO MEMORY option to get this output into any internal table.

I wonder if it's possible to grab the output done by the program and put it into an internal table using an alternate approach?

Maybe stupid answer, but if it's YOUR program, then you can code whatever you want, right ?

Just add the lines that you normally would send to the output, to an internal table.

Or am I overlooking something ?

7 REPLIES 7
Read only

Former Member
0 Likes
1,993

Hello,

If i understand the issue correctly,my idea is download the output from program and upload into internal table.

Please correct me if it is wrong.\

Thanks,

Ramya.

Read only

0 Likes
1,993

Hi Ramya,

yes, you are correct:

after my program finished I see some lines on the GUI which where done using the WRITE statement and I would like to have those lines in an e.g. internal table to save the content to e.g an application log or similar.

Michael

Read only

Former Member
0 Likes
1,994

Hi,

in one of my programs I'm using WRITE statements to write some lines out as a protocol.

This program does not run as a job or will not be called using the SUBMIT statement. Hence I cannot use the spool or the EXPORTING LIST TO MEMORY option to get this output into any internal table.

I wonder if it's possible to grab the output done by the program and put it into an internal table using an alternate approach?

Maybe stupid answer, but if it's YOUR program, then you can code whatever you want, right ?

Just add the lines that you normally would send to the output, to an internal table.

Or am I overlooking something ?

Read only

0 Likes
1,993

No, certainly not a stupid answer of course!

And yes, it's my own program, however, those WRITE statements are spread all over the main source and its countless includes so it would be easier to do this task when the program finishes.

Read only

0 Likes
1,993

Hi Michael,

this sniplet shoulg help:

DATA: lin TYPE i, pag TYPE i.

DATA: gs_list TYPE string,
      gt_list TYPE TABLE OF string.

DO 30 TIMES.
  WRITE: / 'Zeile', sy-index.
ENDDO.

AT LINE-SELECTION.

  DESCRIBE LIST: NUMBER OF LINES lin INDEX 0.

  DO lin TIMES.

    READ LINE sy-index LINE VALUE INTO gs_list.

    APPEND gs_list TO gt_list.

  ENDDO.

  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename = 'C:\Temp\test.txt'
      filetype = 'ASC'
    TABLES
      data_tab = gt_list.

regards

REA

Read only

0 Likes
1,993

WOW, THAT'S IT! Works perfectly!

Thanks Ramy!

Michael

Read only

Former Member
0 Likes
1,993

check out the WRITE clauses for display data of internal table

http://help.sap.com/saphelp_46c/helpdata/EN/9f/db9e1635c111d1829f0000e829fbfe/content.htm

Also you can put internal table's data into field catalog and can display that data through ALV Grid.