WD4A - Smartforms
WD4A - Smartforms
Applies to:
SAP NetWeaver 2004s.
Summary
This document explains step by step how to display a smartform as a PDF document in Web Dynpro for
ABAP. It explains how to create the Web Dynpro application and the code for displaying smartform as PDF
document.
Author(s): Nanda Kondagunta
Company: Consultantgurus Inc.
Created on: 1st February 2007
Author Bio
Nanda Kondagunta is an independent SAP consultant and President of Consultantgurus Inc. an SAP
Solution Provider.He has over 12 years of SAP consulting experience in Design, Development and support
of SAP applications. Photo should be in 65 pixels in width and 85 pixels in height.
© 2006 SAP AG 1
How to Display a Smartform as PDF document in Web Dynpro for ABAP
Table of Contents
Create Web Dynpro Application ...................................................................................................... 3
Convert OTF to PDF .................................................................................................................... 6
Create Application and Test ..................................................................................................... 7
Related Content............................................................................................................................. 10
Disclaimer and Liability Notice....................................................................................................... 11
© 2006 SAP AG 2
How to Display a Smartform as PDF document in Web Dynpro for ABAP
2) Go to component controller context and create a context node PDF with cardinality 1..1 and properties
as shown.
© 2006 SAP AG 3
How to Display a Smartform as PDF document in Web Dynpro for ABAP
Go to the view Layout and create Interactive Form element. This is available in the ADOBE elements.
As shown.
© 2006 SAP AG 4
How to Display a Smartform as PDF document in Web Dynpro for ABAP
Change the height and width in the properties of the Interactive form to 1000px.
5) Go to the context of PDFVIEW and drag and drop the controller context PDF to the View context and
map it.
Click yes on the message The PDFVIEW Context should look like this:
© 2006 SAP AG 5
How to Display a Smartform as PDF document in Web Dynpro for ABAP
5) Go to the layout and select the Source attribute from the context node PDF for the PDF source property.
7) Go to the method WDDOINIT of the PDFVIEW and call the just created component controller method
DISPLAYPDF. As shown:
method WDDOINIT .
wd_Comp_Controller->Displaypdf(
).
endmethod.
8) Select the window Z_WD_TEST_FORM and drag and drop the view PDFVIEW on to it on the left side
as shown.
© 2006 SAP AG 6
How to Display a Smartform as PDF document in Web Dynpro for ABAP
© 2006 SAP AG 7
How to Display a Smartform as PDF document in Web Dynpro for ABAP
elem_input1->get_static_attributes(
importing
static_attributes = stru_input1 ).
© 2006 SAP AG 8
How to Display a Smartform as PDF document in Web Dynpro for ABAP
lt_otfdata[] = lv_ssf_output-otfdata[].
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_componentcontroller=>element_pdf ,
item_source like stru_pdf-source.
* navigate from <CONTEXT> to <PDF> via lead selection
node_pdf = wd_context->get_child_node( name if_componentcontroller=>wdctx_pdf
).
© 2006 SAP AG 9
How to Display a Smartform as PDF document in Web Dynpro for ABAP
elem_pdf->set_attribute(
exporting
name = `SOURCE`
value = pdf_data ).
endmethod.
Related Content
Please include at least three references to SDN documents or web pages.
• Webdynpro for ABAP : Tutorials for Beginners
• Web Dynpro for ABAP : Getting Started
• Web Dynpro for ABAP Help Portal
© 2006 SAP AG 10
How to Display a Smartform as PDF document in Web Dynpro for ABAP
© 2006 SAP AG 11