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

create spool in a program and read spool in same program

Former Member
0 Likes
1,279

hi all,

i have a requirement like i have to create a spool in a program and should read that spool and send a email in same program.

i m done with creating spool and sending email but the problem is when i execute a program the spool is created only after total program execution, is there a way to create a compleate spool before finishing the report execution.

thanks,

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
675

Hello Deep,

I will like to carry forward from where Nagaraj left.


IF gd_jobname IS NOT INITIAL AND gd_jobcount IS NOT INITIAL.

SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident '0000000000'.

IF sy-subrc = 0.
SORT it_tbtcp BY jobnm jobcnt stepcnt.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
message s004(zdd) with gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
MESSAGE s004(zdd) WITH gd_spool_nr.
ELSE.
MESSAGE s005(zdd).
ENDIF.
ENDIF.
ENDIF.

You will have the spool no. in gd_spool_nr.

BR,

Suhas

Edited by: Suhas Saha on Jan 13, 2009 11:39 AM

4 REPLIES 4
Read only

former_member404244
Active Contributor
0 Likes
675

Hi,

try like this

First call the FM 'SET_PRINT_PARAMETERS'.

then SUBMIT <program name>

TO SAP-SPOOL SPOOL PARAMETERS <paramters u get from the above FM>

USER sy-uname VIA JOB g_name NUMBER g_number

WITHOUT SPOOL DYNPRO..

Regards,

Nagaraj

Read only

0 Likes
675

hi,

my requirement is

im executing a zprogram and wirtten the output after this im creating spool in same program and now i have to read this created spool and send as mail. sending mail part creation of spool part is ok but the spool is created but only after the report totally finished.

thanks,

anupama.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
676

Hello Deep,

I will like to carry forward from where Nagaraj left.


IF gd_jobname IS NOT INITIAL AND gd_jobcount IS NOT INITIAL.

SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident '0000000000'.

IF sy-subrc = 0.
SORT it_tbtcp BY jobnm jobcnt stepcnt.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
message s004(zdd) with gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
MESSAGE s004(zdd) WITH gd_spool_nr.
ELSE.
MESSAGE s005(zdd).
ENDIF.
ENDIF.
ENDIF.

You will have the spool no. in gd_spool_nr.

BR,

Suhas

Edited by: Suhas Saha on Jan 13, 2009 11:39 AM

Read only

Former Member
0 Likes
675

Solution:

call function 'GET_PRINT_PARAMETERS'

exporting

destination = 'LP01'

copies = count

list_name = 'ZTEST'

list_text = 'ZTESTSPOOL'

immediately = ' '

release = 'X'

new_list_id = 'X'

expiration = days

line_size = 90

line_count = 65

layout = 'X_PAPER'

sap_cover_page = 'X'

receiver = 'SAP*'

department = 'System'

no_dialog = 'X'

importing

out_parameters = params

valid = valid.

new-page print on parameters params no dialog.

write : hi this is the test for spool.

new-page print off.

commit work.

write : / sy-spono. "system variable for spool no

solved thanks

anupama.