Skip to Content

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

Corrupt folder in cFolders

Hello we have a folder in cFOlders that can't be opened, deleted, touched. We get "Technical error."

Is there any way to 'fix' corrupt folders?

Former Member
replied

This is kind of trial code please run this for sample data..

then after successful run may be u can try for your problematic folder..

you can get the col_id topic_id and other things from the URL of the page or

by right clicking on the URL link and properties...

What i am doing in the code is using the existing COPY AND PASTE functionality in the cFolders

to copy the docs across folders...

HAPPY CODING

DATA ls_clipboard_el TYPE cfx_ts_clipboard_element.
DATA doc TYPE REF TO if_cfx_common.
DATA str TYPE REF TO cl_cfx_structure.

DATA: lp_common_folder  TYPE REF TO cl_cfx_common_folder,
      lp_folder         TYPE REF TO cl_cfx_folder,
      lp_common_folder1 TYPE REF TO cl_cfx_common_folder,
      lp_folder1        TYPE REF TO cl_cfx_folder  .
DATA lp_col_app          TYPE REF TO cl_cfx_col_application.
DATA l_folder_str        TYPE        string.
DATA i_col_id TYPE string.
DATA i_area_id TYPE string.
DATA i_topic_id TYPE string.
DATA l_fol_id TYPE sysuuid_c.

lp_col_app       = cl_cfx_col_application=>get_instance( ).
*problematic folder ids
*i_topic_id = '43D8170097961F1CE10000000A4241A6'.
i_col_id  = '43CF788859C84303E10000000A4241A6'.
i_area_id = '43CF788959C84303E10000000A4241A6'.

CALL METHOD cl_cfx_context_ui=>initialize
       EXPORTING
           i_col_id              = i_col_id
           i_area_id             = i_area_id
           i_topic_id            = i_topic_id
*           I_DOC_ID              =
           i_object_type         = 'fol'
         IMPORTING
           e_fol_id              = l_folder_str.

l_fol_id = l_folder_str.

DATA: lp_col TYPE REF TO cl_cfx_collaboration,
      oref   TYPE REF TO cx_root .
lp_col = cl_cfx_collaboration=>initialize( i_col_id ).


TRY.
    lp_common_folder = cl_cfx_folder=>get_folder_for_id( l_fol_id ).
    lp_folder ?= lp_common_folder.
    lp_folder->initialize_docs( ).

  CATCH cx_root INTO oref.

ENDTRY.

*lp_folder will have the docs that can be retrieved..from that problem folder

TRY.
    DATA str_tab TYPE cfx_t_string.
    DATA lt_item      TYPE cfx_t_string.
    DATA ls_item      TYPE string.
    DATA lp_iterator TYPE REF TO cl_cfx_iterator.
    DATA lp_iterator_elem TYPE REF TO  if_cfx_iterator_element.
    DATA obj_type TYPE cfx_t_object_type.

    lp_iterator = lp_folder->get_document_list( ).
    CALL METHOD cl_cfx_common_document=>get_doc_ids
      EXPORTING
        ip_doc_list  = lp_iterator
      IMPORTING
        et_documents = str_tab.

    DATA count TYPE i.
    DATA str_wa TYPE string.

    count = lp_iterator->get_count( ).
    DO count TIMES.
      READ TABLE str_tab INDEX sy-index INTO str_wa.
      IF sy-index = 1.
        lp_iterator_elem = lp_iterator->get_first( ).
      ELSE.
        lp_iterator_elem = lp_iterator->get_next( ).
      ENDIF.
      obj_type = lp_iterator_elem->get_object_type( ).
*    CONCATENATE 'fol' l_fol_id INTO ls_item SEPARATED BY space.

      CONCATENATE obj_type str_wa INTO ls_item SEPARATED BY space.

      APPEND ls_item TO lt_item.

    ENDDO.

*lt_item willl have the items that have to copied from in a structure..

    CALL METHOD cl_cfx_fol_ui=>copy_selected
      EXPORTING
        it_item   = lt_item
        i_col_id  = i_col_id
*          IMPORTING
*            e_msg_txt = p_msg_txt.
    .

* Destination folder
    i_col_id  = '43D816F897961F1CE10000000A4241A6'.
    i_area_id = '43D816F997961F1CE10000000A4241A6'.
    i_topic_id = '43DF3B1D362571C7E10000000A4241A6'.
    CALL METHOD cl_cfx_fol_ui=>insert
      EXPORTING
        i_col_id              = i_col_id
        i_area_id             = i_area_id
        i_topic_id            = i_topic_id
        i_role                 = ''
*  IMPORTING
*    E_MSG_TXT              =
*    E_BGROUND_PROCESS      =
*    E_BGROUND_PROCESS_INFO =
        .

  CATCH cx_root INTO oref.

ENDTRY.


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