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: 

Formatting problem when transform to PDF

Former Member
0 Kudos

Hi all,

I've found a problem with program RSTXPDFT4 and functions CONVERT_ABAPSPOOL ... and CONVERT_OTFSPOOL...

I want to convert to PDF the spool generated by a report using "classic" list programming (write and so on).

Output format is x_65_132, which is ok while I'm in SAPGUI, but when transforming it with report RSTXPDFT4, I get a PDF file in a x_65_80 (I think) format, so I'm having half of my list cut.

I've searched for notes and forums, and I found nothing about this.

Any Ideas? Is this a limitation of these FM's? Is there any other way of converting a list spool into PDF?

Thanks in advance,

Rafa

11 REPLIES 11

Former Member
0 Kudos

Hi,

Specify the line-size and line-count in the report statement. this should work.

REPORT zka51151_test LINE-SIZE 132 LINE-COUNT 32.

Edited by: Avinash Kodarapu on Jan 28, 2009 9:30 PM

0 Kudos

Hi, Avinash

these instructions are already declared...

 
REPORT  z_test_list NO STANDARD PAGE HEADING
                    LINE-SIZE 132
                    LINE-COUNT 65
                    MESSAGE-ID zzrn_msj.

Former Member
0 Kudos

Hi,

Use convert_otf FM

specify this parameter of the fm

max_linewidth = 132

Edited by: kartik tarla on Jan 28, 2009 10:10 PM

0 Kudos

HI, Kartik

I cannon use these FM because I need to retrieve the spool order generated, as this report should be execute in batch-mode via Job.

tarangini_katta
Active Contributor
0 Kudos

Hi,

use the function module.

CONVERT_OTFSPOOLJOB_2_PDF

pass u r spool number

no_dialog = ''

dst_device = 'LOCL'.

Thanks,

0 Kudos

Hi, tarangini

I've tried as you said and still the same...

Any other idea??

0 Kudos

Hi rafel,

IN FM make no_dialog as 'X'.

then pop up will appear i think there u can change the format of the.Then u will get whole data as i know.

Thanks

0 Kudos

hi , check code here.

http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm

кu03B1ятu03B9к

Former Member
0 Kudos

hi,

can you paste your code...

0 Kudos

Hi all,

yesterday I went home and I tried the same in the MIniWas I have installed in my laptop, and the result was exactly the same!!

The test I made was: run a program in online mode, generate a spool request, and then use standard program RSTXPDFT4 to convert this request into a PDF file.

The report is defined as 65 x 132 (which should be landscape), but the PDF file appears in portrait (65 x 80 I presume).

I think the problem is in the funcions CONVERTxxx_SPOOLJOBxxx.

Did anybody have this problem? Should I think that it's not possible to convert list output spools to PDF???

Here is the code I used at home in the report.


REPORT  z_test_list NO STANDARD PAGE HEADING
                    LINE-SIZE 132
                    LINE-COUNT 65
                    MESSAGE-ID zzrn_msj.

* tablas **********************************************************************
TABLES: usr01.

* variables globales **********************************************************************
DATA: aux_usr     TYPE bapibname-bapibname,
      wa_address  TYPE bapiaddr3 ,
      it_profiles TYPE TABLE OF bapiprof,
      wa_profiles TYPE bapiprof,
      it_groups   TYPE TABLE OF bapiagr,
      wa_groups   TYPE bapiagr,
      it_return   TYPE TABLE OF bapiret2,
      wa_return   TYPE bapiret2,
      resto       TYPE i.



* pantalla de selección **********************************************************************
SELECT-OPTIONS: so_usr FOR usr01-bname.



TOP-OF-PAGE.
  FORMAT COLOR COL_HEADING.
  WRITE: /01 'LISTADO DE CARACTERISTICAS DE USUARIOS DEL SISTEMA ', SY-SYSID.
  ULINE.
  FORMAT COLOR COL_TOTAL.
  WRITE: /01 'Fecha del listado:', sy-datum, ' -- ', sy-uzeit.
  ULINE.
  SKIP 1.

START-OF-SELECTION.

  SELECT bname
    INTO aux_usr
    FROM usr01
    WHERE bname IN so_usr.

    CALL FUNCTION 'BAPI_USER_GET_DETAIL'
      EXPORTING
        username             = aux_usr
*     CACHE_RESULTS        = 'X'
    IMPORTING
*     LOGONDATA            =
*     DEFAULTS             =
      address              = wa_address
*     COMPANY              =
*     SNC                  =
*     REF_USER             =
*     ALIAS                =
*     UCLASS               =
*     LASTMODIFIED         =
*     ISLOCKED             =
      TABLES
*       PARAMETER            =
        profiles             = it_profiles
        activitygroups       = it_groups
        return               = it_return
*        ADDTEL               =
*        ADDFAX               =
*        ADDTTX               =
*        ADDTLX               =
*        ADDSMTP              =
*        ADDRML               =
*        ADDX400              =
*        ADDRFC               =
*        ADDPRT               =
*        ADDSSF               =
*        ADDURI               =
*        ADDPAG               =
*        ADDCOMREM            =
*        PARAMETER1           =
*        GROUPS               =
*        UCLASSSYS            =
*        EXTIDHEAD            =
*        EXTIDPART            =
*        SYSTEMS              =
.


    LOOP AT it_return INTO wa_return WHERE type EQ 'E'.

      resto = sy-tabix MOD 2.
      IF resto = 0.
        FORMAT COLOR COL_NORMAL INTENSIFIED ON.
      ELSE.
        FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
      ENDIF.

      WRITE: /01 'ERROR' COLOR COL_NEGATIVE, wa_return-message.

    ENDLOOP.
    CHECK sy-subrc NE 0.


    WRITE: /01 'DATOS DEL USUARIO' COLOR COL_GROUP INTENSIFIED ON.
    ULINE.
    FORMAT COLOR COL_NORMAL INTENSIFIED ON.
    WRITE: /01  sy-vline, space,  aux_usr(10), space, sy-vline, space, wa_address-fullname(50), space, sy-vline, space, wa_address-e_mail(50), space, sy-vline.
    ULINE.

    FORMAT COLOR COL_NORMAL RESET.
    SKIP 1.

    WRITE: /01 'PERFILES ASIGNADOS' COLOR COL_GROUP INTENSIFIED ON.
    WRITE: /01(87) sy-uline.
    LOOP AT it_profiles INTO wa_profiles.
      resto = sy-tabix MOD 2.
      IF resto = 0.
        FORMAT COLOR COL_NORMAL INTENSIFIED ON.
      ELSE.
        FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
      ENDIF.

      WRITE: /01 sy-vline, space, wa_profiles-bapiprof, space, sy-vline, space, wa_profiles-bapiptext, space, sy-vline.

    ENDLOOP.
    WRITE: /01(87) sy-uline.

    FORMAT COLOR COL_NORMAL RESET.
    SKIP 1.

    WRITE:  /01 'ROLES ASIGNADOS' COLOR COL_GROUP INTENSIFIED ON.
    WRITE: /01(125) sy-uline.
    LOOP AT it_groups INTO wa_groups.
      resto = sy-tabix MOD 2.
      IF resto = 0.
        FORMAT COLOR COL_NORMAL INTENSIFIED ON.
      ELSE.
        FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
      ENDIF.

      WRITE: /01 sy-vline, space, wa_groups-agr_name, space, sy-vline, space, wa_groups-agr_text, space, sy-vline.

    ENDLOOP.
    WRITE: /01(125) sy-uline.

    NEW-PAGE.

  ENDSELECT.

Former Member
0 Kudos

Hi all,

I've finally found the solution (more or less).

I make a "submit" to the report, using a JOB (JOB_OPEN and JOB_CLOSE FM's) and I don't know why the system is changing the page layout from whatever it is (X_65_132..) to X_PAPER, so the list looses all its formating.

I've changed the way to retrieve the spool, and now I'm using "SUBMIT REPORT TO SAPSPOOL", and I'm giving this the print options as this way of submitting allows it.

It's not a smart option, but it works and it's what I need now.

Anyway, I would like to program a generic solution, so I could submit any report and retrieve the generated spool in PDF without passing the page layout (which I will probably won't know in most of cases).

So, if anybody knows any other way of doing this, of if there's a way of knowing the page layout of a report before launching it with the submit instruction, I would try to try (uff) all given ideas.

Best regards, and thanks to you all for your help!!