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: 

ALV report display online and generate in spool

Former Member
0 Kudos

Dear expert,

I have created an ALV report. I want to run this report online. After executed, the report is displayed. After display this report, I also want to generate the output report in the spool. Is there any way to do this? Thank you.

I have tried to use submit...to SAP Spool. in this way, it will generate the spool, but it will not display the report online. I want it both display online and generate a spool.

16 REPLIES 16

Sandeep_Kumar
Product and Topic Expert
Product and Topic Expert
0 Kudos

why you want to do this double -work , any specific reason?

try FM : RSPO_WRITE_SPOOLREQUEST.

0 Kudos

Hi, thank you for your reply.

The requirement is after display ALV report, send this report as attachment to email.

So first, i must convert the report to spool, and convert it to pdf, and mail it.

0 Kudos

Hi Sandeep,

I think this FM does not work. Because to use this FM, i first need to get the list from memory. but i cannot get the list.

Former Member
0 Kudos

Hi,

Try to use the fm SLVC_TABLE_PS_TO_SPOOL

Regards

Former Member
0 Kudos

Ok,

After get the spool number you can use the fm's below:

CONVERT_ABAPSPOOLJOB_2_PDF - convert to pdf

SO_DOCUMENT_SEND_API1 - send email.

Regards

0 Kudos

Hi colleague, the problem is i cannot generate the spool.

I'm here to ask how to generate the spool for the report and at the sametime the alv report should be displayed online.

0 Kudos

Hi mate,

there's one trick you could use:

1- First, encapsulate the listing in one (or several performs), just for structuring the code

2- Then, print the list on the screen (just as you have now)

3- Now, print once again the list, but surrounded by the commands "NEW-PAGE PRINT ON" and "NEW-PAGE PRINT OFF"

For example:


START-OF-SELECTION.

  WRITE: / 'Hi, this is printed on screen'.

  NEW-PAGE PRINT ON.
  WRITE: / 'now on printer'.
  NEW-PAGE PRINT OFF.

  WRITE: / 'again on screen'.

I hope this helps. Kind regards,

Alvaro

0 Kudos

Hi Mate, thank you for your reply.

In your example, there is following statement:

write 'Hi, this is printed on screen'

I hope this sentence to be displayed in the report and also be in the spool. but in the code, i want to write only once. Do you have any idea about how to do it? Thank you.

0 Kudos

Hi,

that's why I suggested to encapsulate all the printing in a form. For example:


START-OF-SELECTION.
  PERFORM print_list.  "This will print only on the screen
  NEW-PAGE PRINT ON.
  PERFORM print_list.  "This will print only on the printer, generating a SPOOL request
  NEW-PAGE PRINT OFF.

FORM print_list.
... "your listing here
ENDFORM

I hope this helps. Kind regards,

Alvaro

0 Kudos

well forget yout the new-page print on thingie, since you use ALV.

if you had a write list this trick would be cool since you just could do following:


Do 2 times.
  if sy-index GT 1.
    new page print on.
  endif.
  loop at itab into wa.
    write stuff....
  endloop.
  if sy-index GT 1.
    new page print off.
  endif.
enddo.

/edit arrrgh forgot to write further...

with your ALV you could process a write list as well after displaying but you will have layout differences between your display and your spool then and i dont think that this is what you want/need.

you could however after display process your programm a second time, in background task and give it a printer where to print to. Since ALV wont get executed in background task you will get a spool instead.

Edited by: Florian Kemmer on Sep 15, 2010 2:40 PM

0 Kudos

Hi Jing,

I think you are using grid view OOPs ALV, in that case spool can not be generated, you need to convert the grid to list then you can generate spool for this alv and then convert your spool number to pdf using programs RSTXPDF5 and RSTXPDFT5.

Thanks,

Anmol.

0 Kudos

Hi mate,

Thank you for the reply.

I want that in the output report, it write 'Hi, this is printed on screen' and this sentence should also be in the spool. But in the code, i want to write it only once. Do you know how to do this? Thank you.

0 Kudos

but you execute this subroutine twice. This will take more run time. I hope to execute it only once. Thank you.

0 Kudos

Hi mate, i'm using ALV List. I can generate spool. but i can either generate the spool or write it in the report. but i want them both.

0 Kudos

Hi Jing,

let me know one thing...You want to execute the report and show it to a user....hope am right about this otherwise there is no point showing the list output if a user is not viewing it..

If the user is going to view this report then you can ask the user to use this beautiful button provided by SAP to print the list and that should solve the purpose...I dont actually sense a real time scenario to the requirment that you have put...

Now coming to your question...I dont think there is any standard process to do online display and printing of the list one after the other without any input...if you want this then somehow you have to simulate the print command by using the SET USER COMMAND statement and let the print happen...I leave it to you to find out the rest of the details as to how to call the standard routines for executing the print of the report..

Regards,

Sitakant

Edited by: Sitakant Tripathy on Sep 15, 2010 3:13 PM

Former Member
0 Kudos

Isn't work if you pass your internal table to fm SLVC_TABLE_PS_TO_SPOOL ?