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

How to create a spool?

Former Member
0 Likes
2,112

Hi, some answers would be greatly appreciated.

In an ABAP program there is this internal table full of data, and I have to write its contents into a PDF. The only way it seems is to make a spool and then use CONVERT_ABAPSPOOLJOB_2_PDF function to convert that spool into PDF.

The question is how do I make a spool within the ABAP program?

Thanks!

1 ACCEPTED SOLUTION
Read only

athavanraja
Active Contributor
0 Likes
1,517

Hi Welcome to SDN.

Check out the following code sample to create spool withing program.

data: loc_dest like pri_params-pdest .
  clear : wf_listname , loc_dest , wf_listtext .
  move: 'List name' to   wf_listname .
  move: 'List header text' to   wf_listtext .

 select single spld into usr01-spld from usr01 where bname eq sy-uname .
  if sy-subrc eq 0 .
    move: usr01-spld to loc_dest .
  endif .
  call function 'GET_PRINT_PARAMETERS'
       exporting
            destination    = loc_dest
            copies         = wf_copies
            list_name      = wf_listname
            list_text      = wf_listtext
            immediately    = ' '
            release        = ' '
            new_list_id    = 'X'
            expiration     = wf_days
            line_size      = 200
            line_count     = 65
            layout         = 'X_65_200'
            sap_cover_page = 'X'
            receiver       = 'SAP*'
            department     = ''
            no_dialog      = 'X'
       importing
            out_parameters = wf_params
            valid          = wf_valid.

  if wf_valid <> space.
    new-page print on parameters wf_params no dialog.
    perform write_summary .
    new-page print off.
  endif .

within the write_summary do a normal write operation.
loop at <itab> .
write:/
endloop .

Hope this is clear.

REgards

Raja

Hi, some answers would be greatly appreciated.

In an ABAP program there is this internal table full of data, and I have to write its contents into a PDF. The only way it seems is to make a spool and then use CONVERT_ABAPSPOOLJOB_2_PDF function to convert that spool into PDF.

The question is how do I make a spool within the ABAP program?

Thanks!

6 REPLIES 6
Read only

athavanraja
Active Contributor
0 Likes
1,518

Hi Welcome to SDN.

Check out the following code sample to create spool withing program.

data: loc_dest like pri_params-pdest .
  clear : wf_listname , loc_dest , wf_listtext .
  move: 'List name' to   wf_listname .
  move: 'List header text' to   wf_listtext .

 select single spld into usr01-spld from usr01 where bname eq sy-uname .
  if sy-subrc eq 0 .
    move: usr01-spld to loc_dest .
  endif .
  call function 'GET_PRINT_PARAMETERS'
       exporting
            destination    = loc_dest
            copies         = wf_copies
            list_name      = wf_listname
            list_text      = wf_listtext
            immediately    = ' '
            release        = ' '
            new_list_id    = 'X'
            expiration     = wf_days
            line_size      = 200
            line_count     = 65
            layout         = 'X_65_200'
            sap_cover_page = 'X'
            receiver       = 'SAP*'
            department     = ''
            no_dialog      = 'X'
       importing
            out_parameters = wf_params
            valid          = wf_valid.

  if wf_valid <> space.
    new-page print on parameters wf_params no dialog.
    perform write_summary .
    new-page print off.
  endif .

within the write_summary do a normal write operation.
loop at <itab> .
write:/
endloop .

Hope this is clear.

REgards

Raja

Read only

0 Likes
1,517

Thanks, that solves part of the problem.

One last question though: how to get the spool id of that particular spool? The only thing I can think of is to get all the spool requests and get the latest request?

Thanks again.

Read only

0 Likes
1,517

just use sy-spono it will hold the spool created by you in this session.

Regards

Raja

if you find the answers helpful, click on the radio buttons to reward the answers and if the question is answered mark it as answered.

more about this at

/people/mark.finnern/blog/2004/08/10/spread-the-love

Read only

0 Likes
1,517

hi Jen,

You can retriev the spool id by doing a SELECT on TSP01 table.

Regards,

Suresh Datti

Read only

0 Likes
1,517

Hi,

Can u Plz send one complete program for 'to generate spool request for an Interal table data and then pass that spool req. to RSTXPDFT4 pgm.

Thank U

Narendra

Read only

Former Member
0 Likes
1,517

Hi, when I try to do simple write as per the instructions, i get an ABAP dump with Internal error: Invalid page number.

Illegal Page Number.

no idea why this is happening. anyclu.

thanks

Lakhbir