E-Mail with Multiple Attachments (Using Web Dynpro for ABAP)

...Previous

Step8:

Map all the nodes from component controller to the context of the view ATTACHMENT.

Step 9:

Bind source attribute of the node ‘ws’ with data property of the file upload UI element and bind file attribute of the node ws with filename property of the ‘file upload’ UI element.

Step10:

Create on action methods for the buttons. And inside onactionattach write the following code.

method ONACTIONATTACH.

  
data filename type SDBAH-ACTID.
  
data extension type SDBAD-FUNCT.
  
data source type DBMSGORA-FILENAME.
  
DATA lo_nd_ws TYPE REF TO if_wd_context_node.
  
DATA lo_el_ws TYPE REF TO if_wd_context_element.
  
DATA ls_ws TYPE wd_this->element_ws.

* navigate from <CONTEXT> to <WS> via lead selection
  lo_nd_ws = wd_context->get_child_node( name = wd_this->wdctx_ws ).

* get element via lead selection
  lo_el_ws = lo_nd_ws->get_element(  ).

* get all declared attributes
  lo_el_ws->get_static_attributes(
    
IMPORTING
      static_attributes = ls_ws ).

source = ls_ws-file.

CALL FUNCTION 'SPLIT_FILENAME'
  
EXPORTING
    long_filename        = source
 
IMPORTING
   PURE_FILENAME        = filename
   PURE_EXTENSION       = extension.

  
DATA lo_nd_it TYPE REF TO if_wd_context_node.
  
DATA lo_el_it TYPE REF TO if_wd_context_element.
  
DATA ls_it TYPE wd_this->element_it.
  
data lt_it like table of ls_it.

* navigate from <CONTEXT> to <IT> via lead selection
  lo_nd_it = wd_context->get_child_node( name = wd_this->wdctx_it ).

* @TODO handle not set lead selection
  
IF lo_nd_it IS INITIAL.
  
ENDIF.

* get element via lead selection
  lo_el_it = lo_nd_it->get_element(  ).

* @TODO handle not set lead selection
  
IF lo_el_it IS INITIAL.
  
ENDIF.

CALL METHOD lo_nd_it->get_static_attributes_table
  
EXPORTING
    
from   = 1
    
to     = 2147483647
  
IMPORTING
    
table  = lt_it.

ls_it-file = filename.
ls_it-
type = extension.
ls_it-source = source.
APPEND ls_it to lt_it.

lo_nd_it->bind_table( lt_it ).

clear ls_it.
endmethod.  

method ONACTIONBACK.
    wd_this->fire_out_main_plg(
    ).
endmethod.  

Click here to continue...

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image