09-16-2008 8:10 AM
hi,
i have a requirement to group a number of PDF from the Archive into a single PDF and send it as an attachment. I want to know the possiblity of grouping multiple PDFs into a single PDF.
Thanks in advance,
Anoop R.S
09-17-2008 11:30 AM
It's possible to concatenate PDFs.
You must concatenate them when you have the OTF data.
The code in bold letters is the key to join the smartforms
*&----
*
*& Form llamar_smartforms
*&----
*
FORM llamar_smartforms.
Nombre del formulario (en la transacción SMARTFORM)
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZCARTA_CONDICIONES_EXPATRIADOS'
IMPORTING
fm_name = name_funcion.
Comprobamos que no haya ocurrido ningun error
CHECK sy-subrc = 0.
Indica que no genere pantalla de previsualizacion
control-no_dialog = 'X'.
Indica que genere el OTF
control-getotf = 'X'.
output_options-tddest = 'LOCL'.
output_options-tdnewid = 'X '.
output_options-tdimmed = 'X '.
Call function para ejecutar el smartform.
el job_info contiene la informacion del OTF
CALL FUNCTION name_funcion
EXPORTING
control_parameters = control
parametros_ext = cert_emp_est
user_settings = space
output_options = output_options
IMPORTING
document_output_info = document
job_output_info = job_info
job_output_options = job_options
TABLES
pernrdat = tab_condiciones.
hrdata = cert_emp_est.
filename = nombre_fichero
CHECK NOT job_info-otfdata IS INITIAL.
DATA: lineas_otf(9) TYPE n.
DESCRIBE TABLE job_info_global-otfdata LINES lineas_otf.
lineas_otf = lineas_otf + 1.
INSERT lines of job_info-otfdata INTO job_info_global-otfdata
INDEX lineas_otf.
*Concatenamos pdfs
data my_tabix like sy-tabix.
DATA : lv_formname TYPE tdsfname.
DATA : lv_funcname TYPE tdsfname.
DATA : t_empleado LIKE zohr_gxc_employee OCCURS 0 WITH HEADER LINE,
t_labels TYPE TABLE OF zohr_t_lan.
lv_formname = 'ZOHR_GXC_ERROR'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = lv_formname
variant = ' '
direct_call = ' '
IMPORTING
fm_name = lv_funcname
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
CHECK sy-subrc EQ 0.
CALL FUNCTION lv_funcname
EXPORTING
control_parameters = control
output_options = output_options
user_settings = space
year = '2007'
IMPORTING
document_output_info = document
job_output_info = job_info
job_output_options = job_options
TABLES
labels = t_labels
empleado = t_empleado
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
***********removing the initial and final markers from the OTF data**********
DELETE job_info-otfdata WHERE TDPRINTCOM = '//'.
*****************searching for the end-of-page in OTF table************
READ TABLE job_info_global-otfdata WITH KEY TDPRINTCOM = 'EP' transporting no fields. MY_TABIX = SY-TABIX + 1.
***
*********appending the modified OTF table to the final OTF table********
INSERT LINES OF job_info-otfdata INTO job_info_global-otfdata INDEX MY_TABIX.
Convierte de OTF a PDF los datos
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = expdfsize
TABLES
otf = job_info_global-otfdata
lines = expdfdata
EXCEPTIONS
OTHERS = 4.
nombre_fichero = 'C: emporal.pdf'.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = nombre_fichero
filetype = 'BIN'
write_field_separator = 'X'
TABLES
data_tab = expdfdata
fieldnames = tab_def_reg
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
09-17-2008 11:30 AM
It's possible to concatenate PDFs.
You must concatenate them when you have the OTF data.
The code in bold letters is the key to join the smartforms
*&----
*
*& Form llamar_smartforms
*&----
*
FORM llamar_smartforms.
Nombre del formulario (en la transacción SMARTFORM)
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZCARTA_CONDICIONES_EXPATRIADOS'
IMPORTING
fm_name = name_funcion.
Comprobamos que no haya ocurrido ningun error
CHECK sy-subrc = 0.
Indica que no genere pantalla de previsualizacion
control-no_dialog = 'X'.
Indica que genere el OTF
control-getotf = 'X'.
output_options-tddest = 'LOCL'.
output_options-tdnewid = 'X '.
output_options-tdimmed = 'X '.
Call function para ejecutar el smartform.
el job_info contiene la informacion del OTF
CALL FUNCTION name_funcion
EXPORTING
control_parameters = control
parametros_ext = cert_emp_est
user_settings = space
output_options = output_options
IMPORTING
document_output_info = document
job_output_info = job_info
job_output_options = job_options
TABLES
pernrdat = tab_condiciones.
hrdata = cert_emp_est.
filename = nombre_fichero
CHECK NOT job_info-otfdata IS INITIAL.
DATA: lineas_otf(9) TYPE n.
DESCRIBE TABLE job_info_global-otfdata LINES lineas_otf.
lineas_otf = lineas_otf + 1.
INSERT lines of job_info-otfdata INTO job_info_global-otfdata
INDEX lineas_otf.
*Concatenamos pdfs
data my_tabix like sy-tabix.
DATA : lv_formname TYPE tdsfname.
DATA : lv_funcname TYPE tdsfname.
DATA : t_empleado LIKE zohr_gxc_employee OCCURS 0 WITH HEADER LINE,
t_labels TYPE TABLE OF zohr_t_lan.
lv_formname = 'ZOHR_GXC_ERROR'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = lv_formname
variant = ' '
direct_call = ' '
IMPORTING
fm_name = lv_funcname
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
CHECK sy-subrc EQ 0.
CALL FUNCTION lv_funcname
EXPORTING
control_parameters = control
output_options = output_options
user_settings = space
year = '2007'
IMPORTING
document_output_info = document
job_output_info = job_info
job_output_options = job_options
TABLES
labels = t_labels
empleado = t_empleado
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
***********removing the initial and final markers from the OTF data**********
DELETE job_info-otfdata WHERE TDPRINTCOM = '//'.
*****************searching for the end-of-page in OTF table************
READ TABLE job_info_global-otfdata WITH KEY TDPRINTCOM = 'EP' transporting no fields. MY_TABIX = SY-TABIX + 1.
***
*********appending the modified OTF table to the final OTF table********
INSERT LINES OF job_info-otfdata INTO job_info_global-otfdata INDEX MY_TABIX.
Convierte de OTF a PDF los datos
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = expdfsize
TABLES
otf = job_info_global-otfdata
lines = expdfdata
EXCEPTIONS
OTHERS = 4.
nombre_fichero = 'C: emporal.pdf'.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = nombre_fichero
filetype = 'BIN'
write_field_separator = 'X'
TABLES
data_tab = expdfdata
fieldnames = tab_def_reg
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.