cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a multiple PDF-form outputs into one PDF?

Former Member
0 Kudos

Hi,

I`d like to create a PDF document with a few pages in it, build from different PDF-forms using many form-function calls. Where each PDF-form can use its own interface.

I`ve made a simple programme, but as the result I have a few separated documents with scrolling tab instead of one document with all pages in it.

What am I doing wrong?


*&---------------------------------------------------------------------*
*& Report  ZZ_TEST_PDF_MULTY
*&---------------------------------------------------------------------*

REPORT  zz_test_pdf_multy.

PARAMETERS:
  p_page TYPE i DEFAULT 2,
  p_row TYPE i DEFAULT 4.

END-OF-SELECTION.

  DATA:
    tb_itf TYPE tsftext,
    s_itf TYPE tline.

  DATA:
    c_fmname TYPE rs38l_fnam,
    s_outputparams TYPE sfpoutputparams,
    s_docparams TYPE sfpdocparams,
    s_formoutput TYPE fpformoutput,
    s_sfpjoboutput TYPE sfpjoboutput,
    c_page TYPE string,
    c_row TYPE string.

  CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
    EXPORTING
      i_name     = 'FP_TEST_00'
    IMPORTING
      e_funcname = c_fmname.

  s_outputparams-nodialog = 'X'.
  s_outputparams-device   = 'PRINTER'.
  s_outputparams-preview  = 'X'.
  s_outputparams-dest     = 'PDF'.
  s_outputparams-getpdf   = ' '.
  s_outputparams-title    = sy-title.
*  s_outputparams-bumode   = 'M'.

  CALL FUNCTION 'FP_JOB_OPEN'
    CHANGING
      ie_outputparams = s_outputparams
    EXCEPTIONS
      cancel          = 1
      usage_error     = 2
      system_error    = 3
      internal_error  = 4
      OTHERS          = 5.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

  s_docparams-langu   = 'R'.
  s_docparams-country = 'RU'.

  DO p_page TIMES.
    MOVE sy-index TO c_page.
    REFRESH tb_itf.
    DO p_row TIMES.
      MOVE sy-index TO c_row.
      c_row = sy-index.
      CONCATENATE
          'page' c_page 'row' c_row
        INTO s_itf-tdline SEPARATED BY space.
      APPEND s_itf TO tb_itf.
    ENDDO.
    CALL FUNCTION c_fmname
      EXPORTING
        /1bcdwb/docparams  = s_docparams
        textlines          = tb_itf
      IMPORTING
        /1bcdwb/formoutput = s_formoutput
      EXCEPTIONS
        usage_error        = 1
        system_error       = 2
        internal_error     = 3.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
  ENDDO.

  CALL FUNCTION 'FP_JOB_CLOSE'
    IMPORTING
      e_result       = s_sfpjoboutput
    EXCEPTIONS
      usage_error    = 1
      system_error   = 2
      internal_error = 3
      OTHERS         = 4.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

HI,

After each smartform call, convert the content to PDF (u will get internal table). Now append each internal table to final internal table. Write the final internal table to app server. Save to desktop in PDF format and check the doc. Only 1 PDF with multiple pages.

Former Member
0 Kudos

Sorry, but making single PDF from many smartforms is not what I want to achieve. I wold like to know how to get one PDF document made by ALC-forms.

In my example I have many PDF documents. So, how to get (or put) them all in one PDF?

ps: the way to get one PDF from smartforms is also here:

"Combining Multiple Smartform Outputs Into One PDF file"

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/62ae7fcd-0b01-0010-3e9d-a54f2694...