cancel
Showing results for 
Search instead for 
Did you mean: 

To convert ALV Grid to PDF format

Former Member
0 Kudos

Hi Experts,

We have a requirement where in the output in ALV grid display should be downloaded to PDF format.

We came across two processes.

1. To download the output to Smartform and then convert to PDF format

2. To send the ALV output directly to spool and then convert it to PDF

Please let me know which of the above two gives better performance and also please guide me through the process.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI Mallika,

Both the ways are feasible. For conversion of ALV to PDF,

1. Display ALV output as usual using factory method .

2. Create a Button 'Download to PDF' in the GUI status

3. Set the Sy-batch as 'X'.

4. Call the Factory method for list display

5. Catch the sy-spono

6. Use the FM CONVERT_ABAPSPOOLJOB_2_PDF to convert alv data to PDF.

7. Use the FM GUI_DOWNLOAD to dowload the above PDF file

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

refer the following code...

get the spool number

  • Declaration of local variables.

DATA:

LV_RQ2NAME LIKE TSP01-RQ2NAME.

CONCATENATE SY-REPID+0(8)

SY-UNAME+0(3)

INTO LV_RQ2NAME SEPARATED BY '_'.

  • Get the spool number.

SELECT * FROM TSP01 WHERE RQ2NAME = LV_RQ2NAME

ORDER BY RQCRETIME DESCENDING.

V_RQIDENT = TSP01-RQIDENT.

EXIT.

ENDSELECT.

IF SY-SUBRC NE 0.

CLEAR V_RQIDENT.

ENDIF

Hope this may help you..

Regards,

Dhanalakshmi L

Former Member
0 Kudos

Hi Mallika,

Both way it's possible but 2nd option is better.

You can much easily export spool to PDF.

Refer following link for code snippet :

https://wiki.sdn.sap.com/wiki/display/Snippets/BrowseandExportSpooltoPDFusing+ABAP

Hope this will solve your issue.

Regards,

Vivek