on 09-25-2008 6:08 PM
Hi,
I am currently studying the book "Web Dynpro for ABAP". In the paragraph about recursive tree structure, I have been recreating the code for the method ONACTIONDO_LOAD. This method is used to load the data for a tree structure based on the MIME repository. However, I get syntax errors despite that the code is typed in from the book.
I have bolded the code lines that is not accepted in my Netweaver 2004 trial SP12.
If anyone with an updated knowledge would go through the code and tell what needs to changed due to being obsolete would be appreciated as I am in a learning phase.
Code start:
method onactiondo_load.
data lr_node type ref to if_wd_context_node.
data lr_mime_api type ref to if_mr_api.
data lt_path_entries type string_table.
data lv_index type sytabix.
data lv_is_folder type abap_bool.
data ls_io type skwf_io.
data lt_ios type skwf_ios.
data lv_url type skwf_url.
data lv_path type string.
data lv_children_loaded type string.
data ls_mime_entry type if_v_default=>element_selected. --> Does not exist
Avoid redundant loading of data
context->get_attribute( exporting name = 'CHILDREN_LOADED' ---> Should perhaps be wd_context ?
importing value = lv_children_loaded ).
check lv_children_loaded = abap_false.
context->set_attribute( exporting name = 'CHILDREN_LOADED'
value = abap_true ).
Create children elements
context->get_attribute( exporting name = 'PATH'
importing value = lv_path ).
lr_mime_api = cl_mime_repository_api=>if_mr_api~get_api( ).
lr_mime_api->get_io_for_url( exporting i_url = lv_path
importing e_loio = ls_io ).
Get all children under a specific node
call method cl_skwf_folder_util=>ios_attach_get
exporting
folder = ls_io
iotypeacc = space
x_prefetch_properties = abap_true
properties_request =
queries =
importing
ios = lt_ios.
loop at lt_ios into ls_io.
call function 'SKWF_NMSPC_IO_ADDRESS_GET'
exporting
io = ls_io
X_INCLUDE_APPL =
importing
url = lv_url.
ls_mime_entry-path = lv_url.
split ls_mime_entry-path at '/' into table lt_path_entries.
lv_index = lines( lt_path_entries ).
read table lt_path_entries index lv_index into ls_mime_entry-name.
Determine type of element
call method lr_mime_api->properties
exporting
i_url = ls_mime_entry-path
importing
e_is_folder = lv_is_folder.
if lv_is_folder = abap_true.
Create a folder element
lr_node = wd_context->get_child_node( 'MIMECONTENT' ).
else.
Create a file element
lr_node = wd_context->get_child_node( 'MIMEITEM' ).
endif.
lr_node->bind_structure( new_item = ls_mime_entry
set_initial_elements = abap_false ).
endloop.
endmethod.
This object should be generated off of the definition of your context. I would say that you either didn't name your context correctly or haven't completed the context definition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI @ all
I'm started learn wd4a too. I have the same problem like Peter. I can't find the "context_element".
I'm quite sure that the code and context is correct.
Please help
Regards
Matthias
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Now I have reached exactly the same point in the book and have the same isse as you did. I am quite certain that my CONTEXT is correct. Did you ever find what is missing in the code at this point?
I have also found the there is a missing line to populate the context_element object, but this I did find.
regards HågenH
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Yes, I investigated it and I found that I had a missing parameter (the section above the code for the method). Check that you have the required parameters.
If you want, you can download the components for the book from the link below:
[http://www.sap-press.de/katalog/buecher/titel/gp/titelID-1214?GalileoSession=52491301A3.W.5g3m.M]
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.