on ‎2012 May 18 12:08 PM
Hi experts,
I'm looking for a way to add a document (only plain text) to the documents-repository (RSA1-->Documents).
Does anybody now a function-module or a class which supports this task?
I tried to finde something usefull by debugging the "create" function, but didn't find anything that would bring me to the right track.
Thanks in advance,
Kind regards,
Marco
Request clarification before answering.
Hi Marco,
The function module GUI_UPLOAD is used to upload a file from a local desktop.
Br,
Harish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Harish,
you're right - but that does not hit the point of my question.
I know how to upload a file - but I'm looking for a (non-interactive!) way to add an entry to the document-repository.
Functionmodule SDOK_LOIO_CREATE seems to be close to the thing I am looking for - just didn't understand how to use it yet.
Kind regards,
Marco
I'd like to provide some update:
The document repository (RSA1 --> documents) can be filled programmaticaly using the function-modules
SDOK_LOIO_CREATE (in order to create a logical document)
SDOK_PHIO_CREATE (in order to create a physical document)
SDOK_RELA_CREATE (for linking the logical and physical document)
SDOK_PHIO_STORE_CONTENT (for providing some plaintext-content)
In RSA1 this looks quite good and the document shows up in the reports (comments) as well.
Unfortunatelly it seems not be be perfecly clean for the report-environment since the plaintext-content cannot be found (404-error).
I'd like to ask once again: Is there anybody who did something similar (abap-based creation of BEx-comments) in the past and could lent me a hand?
Kind regards,
Marco
Hi everybody,
I'd like to share the further experiences I made the last few days:
I finally managed to create and controle documents in the document-repository.
They seem to be smoothly integrated into the system and are accessible from all 3 envirionments (RSA1-->documents, BEx-->Jump-->Documents and Portal-->KM-->bw_document-->InfoProvider-->Query).
In the end I broke with the above mentioned function-modules and used the following ones instead:
RSOD_BIRM_CREATE_RESOURCE to create documents
RSOD_SKWF_SET_CONTENT to attach and update content for the documents
RSOD_SKWF_DELETE to delete existing documents (and content)
RSOD_BIRM_QUERY to find exisiting documents
RSOD_SKWF_GET_CONTENT to get content of an existing document
The hard part of the job was finding this function-modules(group). The signatures of the fm's are quite simple and intuitive - and they seem to do their job like charm.
Now after having evaluated this information it might even be possible to create comments directly from within excel-workbooks - without the need to jump to the web-environment.
If you are interested in further details, please do not hesitate to let me know.
Best regards,
Marco
Hi Tossten,
please let me know which part of information you're interested in.
Unforuntately I do not have a detailled documentation by hand - and currently not the time to write a wiki about that.
In short words:
Query-Designer: Added a dummy-KF for getting a new column in my report.
Excel-Workbook:
- Wrote some VBA, which loops over the key's that shall be checked for existing comments.
- Wrote some VBA to trigger a backend-function-module and to handle it's result.
Backend:
- Wrote a function-module using SAP-standard-FMs to read/write comments from/to the km-repository, using the parameters passed by the VBA-code.
In the meanwhile we realized, that we have a performance-problem when this function is used from abroad-loactions. But this problem is mainly reasoned by lot's of single queries and repeated connection-build-ups beween excel and the backend. There's certainly some space for optimizing this point.
Best regards,
Marco
Hi Marco,
thank you very much for your fast reply! I am mainly interested in following topics:
- How to fill the import parameters of RSOD_BIRM_CREATE_RESOURCE
- How to fill the import parameters of RSOD_SKWF_SET_CONTENT
- Can I also upload documents (e.g. Word or PDF) as comments or only plain text?
Best regards
Torsten
Hi Torsten,
my requirement so far was only plain text - I did not evaluate binary content yet.
For the other two questions it might make sense to paste the implementation of my function-module.
I think it's quite self-explaining in the end...
FUNCTION Z_BEX_RFC_COMMENT_CC1_CREATE.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(I_INFOPROV) TYPE SDOK_PROPV
*" VALUE(I_QUERY) TYPE SDOK_PROPV
*" VALUE(I_KYFNM) TYPE SDOK_PROPV
*" VALUE(I_COAREA) TYPE SDOK_PROPV
*" VALUE(I_COMPCODE) TYPE SDOK_PROPV
*" VALUE(I_YEAR) TYPE SDOK_PROPV
*" VALUE(I_COSTCENTER) TYPE SDOK_PROPV
*" VALUE(I_COSTELEMNT) TYPE SDOK_PROPV
*" VALUE(I_COMMENT) TYPE KFM_COMMENT
*" EXPORTING
*" VALUE(E_ERRORSTR) TYPE RSPOPIRCTEXT
*"----------------------------------------------------------------------
"Ablauflogik
"1. Properties setzen
"2. Dokument erzeugen
"3. Inhalt an Dokument anhängen.
DATA: lv_tmpstr1 TYPE c LENGTH 8,
lv_tmpstr2 TYPE c LENGTH 6,
lv_descr TYPE c LENGTH 25,
lv_filename TYPE c LENGTH 30,
lt_prop TYPE STANDARD TABLE OF sdokpropty,
ls_prop TYPE sdokpropty,
lv_name TYPE skwf_urlp,
ls_loid TYPE skwf_io,
lv_errstr TYPE string,
lv_content TYPE string,
lv_xstring TYPE xstring,
lv_contentlength TYPE i,
ls_content_info TYPE rsod_s_content_info.
"1. Properties setzen
"Set Properties
ls_prop-name = 'BW_INFOPROV'.
ls_prop-value = i_infoprov.
APPEND ls_prop TO lt_prop.
ls_prop-name = 'BW_QUERY'.
ls_prop-value = i_query.
APPEND ls_prop TO lt_prop.
ls_prop-name = 'BW_KYFNM'.
ls_prop-value = i_kyfnm.
APPEND ls_prop TO lt_prop.
ls_prop-name = '/BI0/0CO_AREA'.
ls_prop-value = i_coarea.
APPEND ls_prop TO lt_prop.
ls_prop-name = '/BI0/0COMP_CODE'.
ls_prop-value = i_compcode.
APPEND ls_prop TO lt_prop.
ls_prop-name = '/BI0/0FISCYEAR'.
ls_prop-value = i_year.
APPEND ls_prop TO lt_prop.
ls_prop-name = '/BI0/0COSTCENTER'.
ls_prop-value = i_costcenter.
APPEND ls_prop TO lt_prop.
ls_prop-name = '/BI0/0COSTELMNT'.
ls_prop-value = i_costelemnt.
APPEND ls_prop TO lt_prop.
lv_tmpstr1 = sy-datum.
lv_tmpstr2 = sy-uzeit.
CONCATENATE 'Comment-' lv_tmpstr1 lv_tmpstr2 INTO lv_descr.
CONCATENATE lv_descr '.txt' INTO lv_filename.
lv_name = lv_filename.
ls_prop-name = 'DESCRIPTION'.
ls_prop-value = lv_descr.
APPEND ls_prop TO lt_prop.
ls_prop-name = 'BW_DISPLAY_NAME'.
ls_prop-value = lv_descr.
APPEND ls_prop TO lt_prop.
ls_prop-name = 'resourcetype'.
ls_prop-value = 'http://sap.com/xmlns/cm/app/bi/document/comment'.
APPEND ls_prop TO lt_prop.
"2. Dokument erzeugen
CALL FUNCTION 'RSOD_BIRM_CREATE_RESOURCE'
EXPORTING
i_name = lv_name
i_doc_class = 'TRAN'
i_t_properties = lt_prop
IMPORTING
e_s_loio = ls_loid
error_text = lv_errstr.
e_errorstr = lv_errstr.
IF lv_errstr IS INITIAL.
"3. Inhalt an Dokument anhängen.
lv_content = i_comment.
"Content muss als XString übergeben werden
CALL FUNCTION 'TREX_TEXT_TO_XSTRING'
EXPORTING
text = lv_content
IMPORTING
buffer = lv_xstring
EXCEPTIONS
conversion_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
e_errorstr = 'Error at conversion to XString'.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
lv_contentlength = XSTRLEN( lv_xstring ).
ls_content_info-file_name = lv_filename.
ls_content_info-mimetype = 'text/plain'.
ls_content_info-file_size = lv_contentlength.
ls_content_info-encoding = 'UTF-8'.
"Content zum logischen Dokument hinzufügen (oder ersetzten!)
CALL FUNCTION 'RSOD_SKWF_SET_CONTENT'
EXPORTING
i_appl = 'BW'
i_s_loio = ls_loid
i_content = lv_xstring
i_s_content_info = ls_content_info
IMPORTING
error_text = lv_errstr.
e_errorstr = lv_errstr.
ENDIF.
ENDIF.
IF lv_errstr IS INITIAL.
e_errorstr = ''.
ENDIF.
ENDFUNCTION.
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.