cancel
Showing results for 
Search instead for 
Did you mean: 

Pagebreak and Dowload to PDF in Adobe Forms

former_member628395
Active Participant
0 Kudos

Hi ,

I am working on Adobe forms. I have two requirements.

1) I am passing data to the form in form of internal table. I want to force a page break when a particular field in the internal changes.

Like as we use the 'AT' stmt in abap.

2) Can i download then generated PDF directly to the users local machine. If anyone has simple tutorials for the same, please gimme those.

Thanx in advance,

Regards,

Sagar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sagar,

1) I think this could help you http://forms.stefcameron.com/category/conditional-breaks/

2)

FUNCTION ZSAVE_FORM_TO_LOCAL.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(IV_PDF) TYPE  XSTRING
*"     VALUE(IV_DISPLAY) TYPE  XFELD DEFAULT 'X'
*"  EXCEPTIONS
*"      ERROR
*"----------------------------------------------------------------------
data: l_filename type string,
      l_path type string,
      l_fullpath type string,
      l_length   type i,
      l_default_extension type string value 'PDF'.
data: lt_data type table of x255.

cl_gui_frontend_services=>file_save_dialog(
  exporting
    default_extension = l_default_extension
    FILE_FILTER       = 'PDF files (*.pdf)|*.pdf|All Files (*.*)|*.*'
  changing
    filename = l_filename
    path     = l_path
    fullpath = l_fullpath ).
check l_fullpath is not initial.
call function 'SCMS_XSTRING_TO_BINARY'
  exporting  buffer       = iv_pdf
  importing OUTPUT_LENGTH = l_length
  tables    binary_tab    = lt_data.
cl_gui_frontend_services=>gui_download(
  exporting   bin_filesize  = l_length
              filename      = l_filename
              filetype      = 'BIN'
  changing    data_tab      = lt_data
  exceptions  others        = 24 ).
IF SY-SUBRC <> 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4
             RAISING error.
ENDIF.
IF iv_display = 'X'.
  cl_gui_frontend_services=>execute( exporting  document = l_filename
                                     exceptions others = 1 ).
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4
             RAISING error.
  ENDIF.
ENDIF.

ENDFUNCTION.

Michal

Answers (1)

Answers (1)

former_member628395
Active Participant
0 Kudos

Hi Michal,

Thanks for your help.

Regards,

Sagar