Skip to Content
avatar image
Former Member

Create PDF Print Forms At Runtime Web Dynpro ABAP

Hi All,

I was wondering if anyone has had experience creating a PDF Print Form entirely at Runtime? I have a requirement to create a Non Interactive Form at runtime and selecting the correct Form Template based on user Input. I have used the following code in the WDModify method but the Form only appears as a blank white box on the view.

Thanks,

Steven

**********************************************************************

  • Dynamically Generate the Form

data: lr_container type ref to cl_wd_uielement_container,

lr_form type ref to CL_WD_INTERACTIVE_FORM,

lr_grid_data type ref to cl_wd_grid_data.

data:

lo_el_context type ref to if_wd_context_element,

ls_context type wd_this->element_context,

lv_pdfsource like ls_context-pdfsource.

data lo_nd_bill_data type ref to if_wd_context_node.

data lo_el_bill_data type ref to if_wd_context_element.

data ls_bill_data type wd_this->element_bill_data.

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

lo_nd_bill_data = wd_context->get_child_node( name = wd_this->wdctx_bill_data ).

  • get element via lead selection

lo_el_context = wd_context->get_element( ).

lo_el_context->get_attribute(

exporting

name = `PDFSOURCE`

importing

value = lv_pdfsource ).

lr_form = CL_WD_INTERACTIVE_FORM=>NEW_INTERACTIVE_FORM( ).

lr_grid_data = cl_wd_grid_data=>new_grid_data( element = lr_form ).

  • Get XSTRING Variable

call method lr_form->set_pdf_source

exporting

value = lv_pdfsource

.

  • Set the Form Template at Runtime

call method lr_form->set_template_source

exporting

value = 'ZWD_BILL_FORM'

.

call method lr_form->set_enabled

exporting

value = ABAP_FALSE

.

  • Set the Data Source to a Node with Populated data that matchs the Form Interface

call method lr_form->set_data_source

exporting

value = lo_nd_bill_data

.

lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).

lr_container->add_child( lr_form ).

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    May 07, 2009 at 09:50 PM

    Problem solved. Instead of using SET_DATA_SOURCE, use the method - BIND_DATA_SOURCE.

    Steven.

    Add comment
    10|10000 characters needed characters exceeded