Skip to Content
author's profile photo Former Member
Former Member

Reading WebDAV Content from ABAP

Hello,

I like to read WebDAV Content from SAP NetWeaver Portal KM with ABAP.

For writing Content with WebDAV I found this post:

A small working example of how to use the Abap webdav client to write files

With Method GET_CONTENT from CL_SWDCL_NAMESPACE_CLIENT I can read single files, but what I need is a list with files and folders for a given path.

I also tried to use the Interface IF_SWDCL_BASIC_SEARCH_CLIENT, but I only get HTML-Errorcodes 400 or 422 since I don't know which parameters I need.

Maybe there is someone here who can help me to solve this problem.

Thank you.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Nov 10, 2014 at 09:57 AM

    Hello,

    I face the same problem, did you already find a solution you can share?

    Thanks in advance

    Stefan

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 07, 2015 at 01:53 PM

    Hi, after some time of search I found 2 possibilities to list the files of a directory with webDAV.

    1. Possibility (based on the small working example you've linked):

    DATA: mt_tab TYPE sdavc_tt_resource_data,
    ms_tab TYPE sdavc_ts_resource_data.


    prop = lo_client->get_property_client( ).

    prop->get_properties(

    EXPORTING

    i_url = '/some_directory' " URL

    i_depth = '1' " Tiefe

    RECEIVING

    rt_resources = mt_tab " Daten von WebDAV-Resourcen

    ).

    "ms_tab-url is the path of the file/dir, ms_tab-content_type is e.g. httpd/unix-directory

    LOOP AT mt_tab INTO ms_tab.

    ENDLOOP.


    2. Possibility (also based on the example)


    DATA factory TYPE REF To if_SWDCL_RESOURCE_FACTORY.
    DATA resource TYPE REF TO if_SWDCL_RESOURCE.

    factory = cl_SWDCL_RESOURCE_FACTORY=>get_instance( ).

    " read directory
    factory->get_resource(
    EXPORTING
    i_url = '/some_directory'
    ip_connection = lo_connection " DAV-Connection-Objekt
    RECEIVING
    rp_resource = resource " WebDAV-Resource
    ).

    DATA: children TYPE SDAVC_TT_RESOURCES,
    ms_directory TYPE SDAVC_TS_RESOURCE,
    mt_files TYPE SDAVC_TT_RESOURCES.

    children = resource->get_children( ).


    LOOP AT children INTO ms_directory.

    " ms_directory-resource is the child resource

    " ms_directory-url is the name of the resource: e.g. test.xml
    mt_files = ms_directory-resource->get_children( ).

    " if not initial then ms_directory is a directory with another files
    IF NOT mt_files IS INITIAL.
    LOOP AT mt_files.

    ENDLOOP.
    ENDIF.

    ENDLOOP.



    This should help.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.