2009 Aug 21 11:57 AM
Hi,
I want to show Adobe Interactive Form PDF:
REPORT zz_aa_aif.
TABLES: lfa1.
DATA: wa_lfa1 TYPE lfa1.
DATA: fm_name TYPE funcname.
DATA: fp_formoutput TYPE fpformoutput,
fp_docparams TYPE sfpdocparams.
DATA: fp_outputparams TYPE sfpoutputparams.
TYPES:
BEGIN OF tls_bin,
line(69) TYPE c,
END OF tls_bin,
tlt_bin TYPE STANDARD TABLE OF tls_bin.
DATA: lt_att_content_hex TYPE SOLIX_TAB.
SELECTION-SCREEN BEGIN OF BLOCK a.
SELECT-OPTIONS: p_lifnr FOR lfa1-lifnr NO INTERVALS.
SELECTION-SCREEN END OF BLOCK a.
SELECT SINGLE lifnr name1 ort01
FROM lfa1
INTO CORRESPONDING FIELDS of wa_lfa1
WHERE lifnr = p_lifnr-low.
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = 'ZZ_AA_FORM_ABAP'
IMPORTING
e_funcname = fm_name.
fp_outputparams-nodialog = 'X'. " suppress printer dialog popup
fp_outputparams-getpdf = 'X'. " launch print preview
"fp_outputparams-PREVIEW = ' '.
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = fp_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
* Set form language and country (->form locale)
fp_docparams-langu = 'E'.
fp_docparams-country = 'US'.
fp_docparams-fillable = 'X'.
CALL FUNCTION fm_name
EXPORTING
/1bcdwb/docparams = fp_docparams
ZLFA1 = wa_lfa1
IMPORTING
/1bcdwb/formoutput = fp_formoutput
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
CALL FUNCTION 'FP_JOB_CLOSE' .
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = fp_formoutput-pdf "PDF file from function module
TABLES
binary_tab = lt_att_content_hex.
rest of the code is not relevant.
it sends lt_att_content_hex as PDF to an email adress
How to convert XSTRING or BINARY to PDF and show it ?
tnx
Hi,
I want to show Adobe Interactive Form PDF:
REPORT zz_aa_aif.
TABLES: lfa1.
DATA: wa_lfa1 TYPE lfa1.
DATA: fm_name TYPE funcname.
DATA: fp_formoutput TYPE fpformoutput,
fp_docparams TYPE sfpdocparams.
DATA: fp_outputparams TYPE sfpoutputparams.
TYPES:
BEGIN OF tls_bin,
line(69) TYPE c,
END OF tls_bin,
tlt_bin TYPE STANDARD TABLE OF tls_bin.
DATA: lt_att_content_hex TYPE SOLIX_TAB.
SELECTION-SCREEN BEGIN OF BLOCK a.
SELECT-OPTIONS: p_lifnr FOR lfa1-lifnr NO INTERVALS.
SELECTION-SCREEN END OF BLOCK a.
SELECT SINGLE lifnr name1 ort01
FROM lfa1
INTO CORRESPONDING FIELDS of wa_lfa1
WHERE lifnr = p_lifnr-low.
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = 'ZZ_AA_FORM_ABAP'
IMPORTING
e_funcname = fm_name.
fp_outputparams-nodialog = 'X'. " suppress printer dialog popup
fp_outputparams-getpdf = 'X'. " launch print preview
"fp_outputparams-PREVIEW = ' '.
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = fp_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
* Set form language and country (->form locale)
fp_docparams-langu = 'E'.
fp_docparams-country = 'US'.
fp_docparams-fillable = 'X'.
CALL FUNCTION fm_name
EXPORTING
/1bcdwb/docparams = fp_docparams
ZLFA1 = wa_lfa1
IMPORTING
/1bcdwb/formoutput = fp_formoutput
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
CALL FUNCTION 'FP_JOB_CLOSE' .
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = fp_formoutput-pdf "PDF file from function module
TABLES
binary_tab = lt_att_content_hex.
rest of the code is not relevant.
it sends lt_att_content_hex as PDF to an email adress
How to convert XSTRING or BINARY to PDF and show it ?
tnx
2009 Aug 21 12:15 PM
Instead of Xstring there is a option to get the OTF of a form.
Then you can convert to PDF and mail it.
Sorry ... not possible to convert to OTF i guess
Edited by: Keshu Thekkillam on Aug 21, 2009 4:48 PM
2009 Aug 21 12:46 PM
SOLVED:
Create screen 100 and place docking container and name id PDF.
Use this code:
*&---------------------------------------------------------------------*
*& Report ZZ_AA_AIF_1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
report zz_aa_aif_1.
tables: lfa1.
data: wa_lfa1 type lfa1.
data: fm_name type funcname.
data: fp_formoutput type fpformoutput,
fp_docparams type sfpdocparams.
data: fp_outputparams type sfpoutputparams.
data: lt_pdf type table of tline,
ls_pdf like line of lt_pdf,
lv_url type char255,
pdf_fsize type i,
lv_content type xstring,
lt_data type standard table of x255.
data: lt_att_content_hex type solix_tab.
data : l_job_output_info type ssfcrescl.
data : ls_control_param type ssfctrlop.
data : g_html_container type ref to cl_gui_custom_container,
g_html_control type ref to cl_gui_html_viewer.
data : p_vbeln type vbeln_vl.
selection-screen begin of block a.
select-options: p_lifnr for lfa1-lifnr no intervals.
selection-screen end of block a.
field-symbols <fs_x> type x.
initialization.
ls_control_param-getotf = 'X'.
ls_control_param-no_dialog = 'X'.
start-of-selection.
select single lifnr name1 ort01
from lfa1
into corresponding fields of wa_lfa1
where lifnr = p_lifnr-low.
call function 'FP_FUNCTION_MODULE_NAME'
exporting
i_name = 'ZZ_AA_FORM_ABAP'
importing
e_funcname = fm_name.
fp_outputparams-nodialog = 'X'. " suppress printer dialog popup
fp_outputparams-getpdf = 'X'. " launch print preview
"fp_outputparams-PREVIEW = ' '.
call function 'FP_JOB_OPEN'
changing
ie_outputparams = fp_outputparams
exceptions
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
others = 5.
* Set form language and country (->form locale)
fp_docparams-langu = 'E'.
fp_docparams-country = 'US'.
fp_docparams-fillable = 'X'.
call function fm_name
exporting
/1bcdwb/docparams = fp_docparams
zlfa1 = wa_lfa1
importing
/1bcdwb/formoutput = fp_formoutput
exceptions
usage_error = 1
system_error = 2
internal_error = 3
others = 4.
call function 'FP_JOB_CLOSE' .
call screen 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module status_0100 output.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
create object g_html_container
exporting
container_name = 'PDF'.
create object g_html_control
exporting
parent = g_html_container.
* Convert xstring to binary table to pass to the LOAD_DATA method
call function 'SCMS_XSTRING_TO_BINARY'
exporting
buffer = fp_formoutput-pdf "PDF file from function module
tables
binary_tab = lt_att_content_hex.
* Load the HTML
call method g_html_control->load_data(
exporting
type = 'application'
subtype = 'pdf'
importing
assigned_url = lv_url
changing
data_table = lt_att_content_hex
exceptions
dp_invalid_parameter = 1
dp_error_general = 2
cntl_error = 3
others = 4 ).
* Show it
call method g_html_control->show_url( url = lv_url
in_place = 'X' ).
endmodule. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module user_command_0100 input.
endmodule. " USER_COMMAND_0100 INPUT