cancel
Showing results for 
Search instead for 
Did you mean: 

About Smartform as PDF

Former Member
0 Kudos

hi, all

I want to display the smartforms as pdf in web dynpro abap, bu there are error at runtime.

Source code:

method DISPLAYFORM .

data : l_x(1) value 'X'.

data: lv_text type char3,

lv_syucomm type char1,

ls_pdf type xstring,

lv_fm_name type rs38l_fnam,

lv_control_parameters type ssfctrlop,

lv_output_options type ssfcompop,

lv_ssf_output type ssfcrescl,

lt_otfdata type TSFOTF.

data:

node_input1 type ref to if_wd_context_node,

elem_input1 type ref to if_wd_context_element,

stru_input1 type ig_CONTROLLER_FORM=>element_pdf.

  • navigate from <CONTEXT> to <INPUT1> via lead selection

node_input1 = wd_context->get_child_node( name = 'PDF' ).

  • get element via lead selection

elem_input1 = node_input1->get_element( ).

  • get all declared attributes

elem_input1->get_static_attributes( importing static_attributes = stru_input1 ).

call function 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZFORM_TEST'

IMPORTING

fm_name = lv_fm_name

EXCEPTIONS

no_form = 1

no_function_module = 2

others = 3.

if sy-subrc <> 0.

  • Error MESSAGE

endif.

  • Set relevant control parameters

lv_control_parameters-getotf = l_x.

lv_control_parameters-no_dialog = l_x.

lv_control_parameters-preview = space.

  • Set relevant output options

lv_output_options-tdnewid = l_x.

lv_output_options-tddelete = space.

DATA: ls_book TYPE PPFTBOOK.

call function lv_fm_name

EXPORTING

control_parameters = lv_control_parameters

output_options = lv_output_options

user_settings = space

IMPORTING

job_output_info = lv_ssf_output

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.

refresh lt_otfdata.

lt_otfdata[] = lv_ssf_output-otfdata[].

call function 'SSFCOMP_PDF_PREVIEW'

EXPORTING

i_otf = lt_otfdata[]

EXCEPTIONS

convert_otf_to_pdf_error = 1

cntl_error = 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.

data: l_dummy type standard table of tline,

pdf_data type xstring,

pdf_size type i.

clear: pdf_data, pdf_size.

  • convert otf to pdf

call function 'CONVERT_OTF'

EXPORTING

format = 'PDF'

IMPORTING

bin_filesize = pdf_size

bin_file = pdf_data

TABLES

otf = lt_otfdata[]

lines = l_dummy

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 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.

data:

node_pdf type ref to if_wd_context_node,

elem_pdf type ref to if_wd_context_element,

stru_pdf type if_CONTROLLER_FORM=>element_pdf ,

item_source like stru_pdf-source.

  • navigate from <CONTEXT> to <PDF> via lead selection

node_pdf = wd_context->get_child_node( name = 'PDF' ).

  • get element via lead selection

elem_pdf = node_pdf->get_element( ).

  • set single attribute

elem_pdf->set_attribute(

exporting

name = 'SOURCE'

value = pdf_data ).

endmethod.

error:

Runtime Errors UNCAUGHT_EXCEPTION

Exception CX_WD_GENERAL

Date and Time 2007.07.30 17:24:55

What happened?

The exception 'CX_WD_GENERAL' was raised, but it was not caught anywhere along

the call hierarchy.

Since exceptions represent error situations and this error was not

adequately responded to, the running ABAP program

'CX_WD_GENERAL=================CP' has to be

terminated.

Error analysis

An exception occurred which is explained in detail below.

The exception, which is assigned to class 'CX_WD_GENERAL', was not caught and

therefore caused a runtime error.

The reason for the exception is:

WebDynpro Exception: Die URL enthält möglicherweise bösartiges Script

How to correct the error

You may able to find an interim solution to the problem

in the SAP note system. If you have access to the note system yourself,

please use the following search criteria:

"CX_WD_GENERAL=================CP" "UNCAUGHT_EXCEPTION"

If you cannot solve the problem yourself, please send the

following documents to SAP:

1. A hard copy print describing the problem.

To obtain this, select the "Print" function on the current screen.

-

2. A suitable hardcopy prinout of the system log.

To obtain this, call the system log with Transaction SM21

and select the "Print" function to print out the relevant

part.

3. If the programs are your own programs or modified SAP programs,

supply the source code.

To do this, you can either use the "PRINT" command in the editor or

print the programs using the report RSINCL00.

4. Details regarding the conditions under which the error occurred

or which actions and input led to the error.

Message was edited by:

pei li

Accepted Solutions (1)

Accepted Solutions (1)

thomas_szcs
Active Contributor
0 Kudos

Hello Pei,

Have you made all the required settings to get the so called "print scenario/pdf display" working in Adobe integration of Web Dynpro ABAP. You can find more information in the online help.

Best regards,

Thomas

Former Member
0 Kudos

How can i made the required setting?

Thanks for your help!

Answers (2)

Answers (2)

Former Member
0 Kudos

hi, all

when i run the application, the error is "WebDynpro exception: The URL possibly contains malicious Script ".

How can i solve this problem?

Thanks for your help!

thomas_szcs
Active Contributor
0 Kudos

Hello Pei,

Can you post the value of the URL from the RABAX please?

Best regards,

Thomas

Former Member
0 Kudos

hi, Thomas

Sorry i don't understand your idea, what is the RABAX?

thomas_szcs
Active Contributor
0 Kudos

Hello Pei,

A RABAX is a description of the state of program in case it terminates unexpected. You can see the details of a RABAX in transaction st22.

Best regards,

Thomas

Former Member
0 Kudos

Hi, Thomas

It's strange. the error display at runtime, but when i delete this modification, this

error display at runtime too. why?

Thanks for your help!

Former Member
0 Kudos

hi, all

I want to display the form in web dynpro abap, don't interactive form.

who can help me to answer this problem?

Thank you very much!