on 11-30-2009 9:26 PM
Hi All,
I need to open a smartform output in a PDF format in WDA. Could you suggest me the best option to do that?
I tried creating a Interactive form element and map it to xstring source created in the Context, but the output is coming as blank.
I followed below example with some minor code changes, used my smartform to call with internal table changes.
But when i exectuted the application, it is showing blank in the output.
Can someone help me out with this regard with your inputs?
I tried searching the forum to find the answer, but i was a bit confused about some of the solutions around Spools and Conversion to Bit mode. Please provide your inputs.
FYI: I Checked components WDR_TEST_ADOBE_PDF_ONLY or WDR_TEST_ADOBE for reference, they are working fine in output to display PDF from MIME objects. So the problem is in conversion in my case?
Thanks in advance,
Candru
Edited by: p332537 on Nov 30, 2009 10:28 PM
Instead you can covnert a smartform to PDF directly at runtime.
lv_func_mod_name is the FM of the smartform.
LS_SSFCTRLOP-NO_DIALOG = LC_MARK.
LS_SSFCTRLOP-GETOTF = LC_MARK.
CALL FUNCTION LV_FUNC_MOD_NAME
EXPORTING
CONTROL_PARAMETERS = LS_SSFCTRLOP
OUTPUT_OPTIONS = LS_OUTPUT_OPTIONS
USER_SETTINGS = ' '
RRNUM = IM_RRNUM
GS_HEADER = GS_HEADER
IMPORTING
JOB_OUTPUT_INFO = LT_RETURN
TABLES
GT_ITEM = LT_DATA
GT_ATTACH = LT_ATTACH
GT_AUDIT = LT_AUDIT
GT_APPROVER = LT_APPROVE
GT_ORDER = GT_ORDER
GT_COMMENT = LT_COMMENT
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
RETURN.
ENDIF.
convert the OTF to xstring in PDF format using
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
BIN_FILESIZE = LV_LENGTH
BIN_FILE = LV_XSTRING
TABLES
OTF = LT_RETURN-OTFDATA
LINES = LT_TLINE
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
RETURN.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Experts,
My problem is still not solved. I have been trying to work with multiple options but still no success.
Below is the process i have followed and next post has the code to get the OTF data for the Interactive form (smartform output).
Context: Source type Xstring. which is under a node
UI Element: Interactive form - PDFSource - 'Source' attribute of View Context which is mapped to component controller.
In the WDDOINIT method of the View, i have a method call to component controller method to execute the business logic.
There i get the Smarform FM name, make a call to FM, Convert to OTF, bind the Xstring output of the OTF conversion FM to 'Source' attribute of the context.
But the output is BLANK, which sometime shows busy status.
I am still not able to figure out what could be the problem for this cause. Please help me out.
As an other option, Can we use UI element for File download? Could someone guide me about how to use it?
Following post has the code used.
Thanks,
Chandru
DATA :
lv_fnam TYPE rs38l_fnam,
gs_control TYPE ssfctrlop,
gs_output_options TYPE ssfcompop,
gs_otfdata TYPE itcoo,
gs_job_output_info TYPE ssfcrescl,
gt_otfdata TYPE STANDARD TABLE OF itcoo INITIAL SIZE 0.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZPU_ECM_COMP_STATEMENT'
IMPORTING
fm_name = lv_fnam
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 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.
CLEAR gs_job_output_info.
CLEAR gs_job_output_info-otfdata.
MOVE :
'X' TO gs_control-no_dialog,
'X' TO gs_control-getotf,
'LP01'(047) TO gs_output_options-tddest.
data: l_comp_struc TYPE zps_ecm_compstat_data.
l_comp_struc-crevi = '2009'.
l_comp_struc-pernr = '00243307'.
CALL FUNCTION lv_fnam
EXPORTING
control_parameters = gs_control
output_options = gs_output_options
user_settings = space
l_comp_struc = l_comp_struc
IMPORTING
job_output_info = gs_job_output_info
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 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.
*Populate OTF data table
LOOP AT gs_job_output_info-otfdata INTO gs_otfdata.
APPEND gs_otfdata TO gt_otfdata.
CLEAR gs_otfdata.
ENDLOOP. " LOOP AT t_outtab-otfdata
DATA: lv_bytes TYPE p,
lv_bin_file TYPE xstring,
gt_pdfdata TYPE STANDARD TABLE
OF tline
INITIAL SIZE 0.
Convert OTF into PDF
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 255
IMPORTING
bin_filesize = lv_bytes
bin_file = bin_file
TABLES
otf = gt_otfdata
lines = gt_pdfdata
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
User | Count |
---|---|
84 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.