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

Get data from spool

Former Member
0 Likes
4,536

Hi everybody,

I just asking to find a solution for my project.

I want to use some data in R/3 report, which is running in background.

Is it possible we get data directly from spool (TX: SP01) and use it program?

Regards,

Steph

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,770

yes this is possible, you can take spool number from table TSP01 and read the spool data as follows:

SUBMIT rspolst2 EXPORTING LIST TO MEMORY AND RETURN

WITH rqident = Spool Number

WITH first = '1'

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = mem_tab (LIKE TABLE OF abaplist)

IF NOT mem_tab[] IS INITIAL.

CALL FUNCTION 'LIST_TO_ASCI'

EXPORTING

List_index = -1

TABLES

listasci = g_t_text (table type c length 5000)

listobject = mem_tab

ENDIF.

by this way your spool data will come into table g_t_text .

5 REPLIES 5
Read only

venkat_o
Active Contributor
0 Likes
2,770

Hi Steph, <li>Yes It is possible to use in your program. Use below function module to read spool


     CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
       EXPORTING
         src_spoolid              = g_spool_no
         no_dialog                = ' '
       IMPORTING
         pdf_bytecount            = l_no_of_bytes
         pdf_spoolid              = l_pdf_spoolid
         btc_jobname              = l_jobname
         btc_jobcount             = l_jobcount
       TABLES
         pdf                      = i_pdf
Thanks Venkat.O

Read only

former_member404244
Active Contributor
0 Likes
2,770

Hi,

First get the spool number from TSP01 table and then use the FM 'CONVERT_ABAPSPOOLJOB_2_PDF'.

Regards,

Nagaraj

Read only

0 Likes
2,770

Sorry Nagaraj and Venkat,

Is this FM use to convert spool result into PDF file?

Regards,

Steph

Read only

Former Member
0 Likes
2,771

yes this is possible, you can take spool number from table TSP01 and read the spool data as follows:

SUBMIT rspolst2 EXPORTING LIST TO MEMORY AND RETURN

WITH rqident = Spool Number

WITH first = '1'

CALL FUNCTION 'LIST_FROM_MEMORY'

TABLES

listobject = mem_tab (LIKE TABLE OF abaplist)

IF NOT mem_tab[] IS INITIAL.

CALL FUNCTION 'LIST_TO_ASCI'

EXPORTING

List_index = -1

TABLES

listasci = g_t_text (table type c length 5000)

listobject = mem_tab

ENDIF.

by this way your spool data will come into table g_t_text .

Read only

0 Likes
2,770

Thanks Sheelesh, it's work, eventhough I must separated the data one by one

it very plain text, but still separated by delimiter so that's ok...

Regards,

Steph