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: 

How to convert ABAP list from spool to PDF in landscape

Former Member
0 Kudos

Hi
I have searched around in SCN, but haven't found a solution.

From SAP I print an ABAP list to the spool.


Afterwards, I take the spoolno, and convert it into pdf, and send the pdf by email.

The pdf I receive is in portrait mode, and not landscape, so I guess that I miss some information for the pdf document.

My FM call is:

  CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
       EXPORTING
            src_spoolid              = gd_spool_nr
            no_dialog                = c_no
            dst_device               = c_device
       IMPORTING
            pdf_bytecount            = gd_bytecount
       TABLES
            pdf                      = it_pdf_output
       EXCEPTIONS
            err_no_abap_spooljob     = 1
            err_no_spooljob          = 2
            err_no_permission        = 3
            err_conv_not_possible    = 4
            err_bad_destdevice       = 5
            user_cancelled           = 6
            err_spoolerror           = 7
            err_temseerror           = 8
            err_btcjob_open_failed   = 9
            err_btcjob_submit_failed = 10
            err_btcjob_close_failed  = 11
            OTHERS                   = 12.

* Transfer the 132-long strings to 255-long strings
  LOOP AT it_pdf_output.
    TRANSLATE it_pdf_output USING ' ~'.
    CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
  ENDLOOP.

  TRANSLATE gd_buffer USING '~ '.

  DO.
    it_mess_att = gd_buffer.
    APPEND it_mess_att.
    SHIFT gd_buffer LEFT BY 255 PLACES.
    IF gd_buffer IS INITIAL.
      EXIT.
    ENDIF.
  ENDDO.

This SCN post http://scn.sap.com/thread/174346 suggest changes in SPAD, but I don't understand, that it can solve it.

My pdf is received in portrait and not in landscape as wanted, so the question is, how do I change it, so I get the pdf in landscape.

Anyone who can help?

Thanks

Lars

1 ACCEPTED SOLUTION

former_member206650
Active Participant
0 Kudos

lars,

in main window create command and give attribute S_LZPL_SETUP = 'FWR'..

hope this will do the trick....

7 REPLIES 7

former_member206650
Active Participant
0 Kudos

Hi Lars ,

you can use the report in this link...

Convert Spool request to PDF and send as e-mail - Code Gallery - SCN Wiki

hope it helps....

vishnu

0 Kudos

Hi Vishnu

Thanks for your reply, but that's the one I am using, but I can't see where I can change from portrait to landscape.

Regards

Lars

DominikKraemer
Active Participant
0 Kudos

While creating the spool get the correct print-layout with GET_PRINT_PARAMETERS and then set the parameter for the spool with NEW-PAGE PRINT ON PARAMETERS ls_print_para.

0 Kudos

Hi
Dominik I think you got the point, but I get following issues.


My program create 2 different outputs, and I only want one of the outputs to be converted.

case 1
I insert the landscape values after the FM "GET_PRINT_PARAMETERS"
PRIPAR-linct = '65'.
PRIPAR-linsz = '200'.
PRIPAR-PAART = 'X_65_200'.
pripar-primm = 'X'.

The output is then "the wrong output".

case 2
I don't call the FM "GET_PRINT_PARAMETERS", and the submit is as
SUBMIT rfitemap to sap-spool
        spool parameters  %_print
        archive parameters %_print
        without spool dynpro
        and return

The output is the correct page, but now it is in portrait, and not landscape.

My code looks like this:


  CALL FUNCTION 'GET_PRINT_PARAMETERS'
       EXPORTING
            IN_ARCHIVE_PARAMETERS  = ARCPAR
            IN_PARAMETERS          = PRIPAR
            COPIES                 = '1'
            IMMEDIATELY            = 'X'
            COVER_PAGE             = 'X'
            NO_DIALOG              = 'X'
            RELEASE               = ' '
        IMPORTING
             OUT_ARCHIVE_PARAMETERS = ARCPAR
             OUT_PARAMETERS         = PRIPAR
       EXCEPTIONS
            ARCHIVE_INFO_NOT_FOUND = 1
            INVALID_PRINT_PARAMS   = 2
            INVALID_ARCHIVE_PARAMS = 3
            OTHERS                 = 4.


PRIPAR-linct = '65'.
PRIPAR-linsz = '200'.
PRIPAR-PAART = 'X_65_200'.
pripar-primm = 'X'.

SUBMIT rfitemap to sap-spool
        spool parameters pripar  "%_print
        archive parameters arcpar "%_print
        without spool dynpro
        and return 

0 Kudos

As far as I know you can only associate one page format with each submit. Can't think of a way of how to solve this without modifying the SAP program you are calling.

former_member206650
Active Participant
0 Kudos

lars,

in main window create command and give attribute S_LZPL_SETUP = 'FWR'..

hope this will do the trick....

0 Kudos

It is working now.

My solution is to capture the spool output number, and go into tcode SP01, where I change the output format.
After that, I call the conversion to PDF etc., and that's seems fine.