Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Is this code obsolete ?

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.

replied

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.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question