Skip to Content
0
Jun 24, 2009 at 12:32 AM

Showing image on pdf through ABAP webDynpro

81 Views

Dear Experts,

My objective is to show an image on the adobe pdf through ABAP webDynpro.

I created a Form with context parameter im_pic which is an image field and also a title.

In WDA, I have the image as imported mime object and the context has an xstring attribute for the image.

I used the following code to feed the adobe form from WDDOINIT.

  DATA lo_nd_ztest_pic TYPE REF TO if_wd_context_node.
  DATA lo_el_ztest_pic TYPE REF TO if_wd_context_element.
  DATA ls_ztest_pic TYPE wd_this->element_ztest_pic.
  DATA: mr      TYPE REF TO if_mr_api,
            content TYPE        xstring,
            url     TYPE string VALUE 'sap/bc/webdynpro/sap/ztest_pic/test.bmp'.
* From code wizard 
  lo_nd_ztest_pic = wd_context->get_child_node( name = wd_this->wdctx_ztest_pic ).
  lo_el_ztest_pic = lo_nd_ztest_pic->get_element( ).
  lo_el_ztest_pic->get_static_attributes(
    IMPORTING
      static_attributes = ls_ztest_pic ).

* get content of the image from mime rep 
  mr = cl_mime_repository_api=>get_api( ).
  mr->get( EXPORTING  i_url     = url
           IMPORTING  e_content = content ).
  ls_ztest_pic-im_title = 'Test'.
  ls_ztest_pic-im_pic = content .

  lo_el_ztest_pic->set_static_attributes(
    EXPORTING
      static_attributes = ls_ztest_pic ).

I donu2019t see the image in the ADOBE pdf output. This get method returns the content as empty.

Is there any problem in the way I am passing the url? Any idea what might be wrong here?

Thanks for your help and advice.

Best regards, Rajib