Attribute name | Type |
Content | Xstring |
File_name | String |
Mime_type | String |
Method ONACTIONONUPLOAD.
data lo_nd_file_upload type ref to if_wd_context_node.
data lo_el_file_upload type ref to if_wd_context_element.
data ls_file_upload type wd_this->element_file_upload.
* navigate from <CONTEXT> to <FILE_UPLOAD> via lead selection
lo_nd_file_upload = wd_context->get_child_node( name = wd_this->wdctx_file_upload ).
* @TODO handle non existant child
* IF lo_nd_file_upload IS INITIAL.
* ENDIF.
* get element via lead selection
lo_el_file_upload = lo_nd_file_upload->get_element( ).
* @TODO handle not set lead selection
if lo_el_file_upload is initial.
endif.
* get all declared attributes
lo_el_file_upload->get_static_attributes(
importing
static_attributes = ls_file_upload ).
Endmethod.
Give description and save it in your package.
Attribute name | Type |
File_name | String |
File_type | String |
File_size | String |
File_contents | Xstring |
Attribute name | Type |
File_name | String |
File_type | String |
File_size | String |
File_contents | Xstring |
fig-28
fig-29
fig-30
fig-31
fig-32
fig-33
METHOD ONACTIONUPLOAD .
DATA LO_ND_N_UPLOAD TYPE REF TO IF_WD_CONTEXT_NODE.
DATA LO_EL_N_UPLOAD TYPE REF TO IF_WD_CONTEXT_ELEMENT.
DATA LS_N_UPLOAD TYPE WD_THIS->ELEMENT_N_UPLOAD.
DATA LO_ND_N_FILE_DOWNLOAD TYPE REF TO IF_WD_CONTEXT_NODE.
DATA LT_N_FILE_DOWNLOAD TYPE WD_THIS->ELEMENTS_N_FILE_DOWNLOAD.
DATA LS_FILE_UPLOAD TYPE ZPB_UPLOAD.
* navigate from <CONTEXT> to <N_FILE_DOWNLOAD> via lead selection
LO_ND_N_FILE_DOWNLOAD = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_N_FILE_DOWNLOAD ).
* navigate from <CONTEXT> to <N_UPLOAD> via lead selection
LO_ND_N_UPLOAD = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_N_UPLOAD ).
* get element via lead selection
LO_EL_N_UPLOAD = LO_ND_N_UPLOAD->GET_ELEMENT( ).
* @TODO handle not set lead selection
IF LO_EL_N_UPLOAD IS NOT INITIAL.
* get all declared attributes
LO_EL_N_UPLOAD->GET_STATIC_ATTRIBUTES(
IMPORTING
STATIC_ATTRIBUTES = LS_N_UPLOAD ).
* ls_n_upload will contain the File name file type and file contents *
LS_N_UPLOAD-FILE_SIZE = XSTRLEN( LS_N_UPLOAD-FILE_CONTENTS ).
LS_FILE_UPLOAD-FILE_NAME = LS_N_UPLOAD-FILE_NAME.
LS_FILE_UPLOAD-FILE_TYPE = LS_N_UPLOAD-FILE_TYPE.
LS_FILE_UPLOAD-FILE_SIZE = LS_N_UPLOAD-FILE_SIZE.
LS_FILE_UPLOAD-FILE_CONTENTS = LS_N_UPLOAD-FILE_CONTENTS.
INSERT ZPB_UPLOAD FROM LS_FILE_UPLOAD.
IF SY-SUBRC = 0.
SELECT FILE_NAME
FILE_TYPE
FILE_SIZE
FILE_CONTENTS
FROM ZPB_UPLOAD
INTO TABLE LT_N_FILE_DOWNLOAD.
LO_ND_N_FILE_DOWNLOAD->BIND_TABLE( NEW_ITEMS = LT_N_FILE_DOWNLOAD SET_INITIAL_ELEMENTS = ABAP_TRUE ).
ENDIF.
ENDIF.
ENDMETHOD.
fig-34
fig-35
fig-36
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
10 | |
7 | |
5 | |
4 | |
4 | |
3 | |
2 | |
2 | |
2 |