Disclaimer: Dies ist keine offizielle Dokumentation und nur für interne Zwecke bei 2112Portals Development bestimmt. Am Ende dieser Seite finden Sie ein Beispielprogramm zur Manipulation des Mime Repositorys. PACKAGE: SKWF FUNCTION GROUP: SKWV_KWUI_DOCUMENT
Verwenden des Webdav mit SAP Webas. Auf die Verzeichnisstruktur des SAP Webas kann mittels eines Webdav Clients zugegriffen werden. Sie können hierzu von Novell den NetDrive Client oder andere gängige Programme verwenden. Theoretisch geht es auch mit dem Internet Explorer. Hier haben wir aber die Erfahrung gemacht, daß stetig Probleme auftreten, die nicht zuverlässig zu lösen waren (Stand 1/2008). Die Fehler liegen aber im Bereich des IE und nicht beim WAS. Möglicherweise folgt hier irgendwann mal Besserung. !Beachten Sie bitte folgendes beim Gebrauch des MIME Repositorys des Webas: - Die Geschwindigkeit der Zugriffe ist i.d.R extrem langsam und das Kopieren von größeren Datenmengen(>1MB) kann sich je nach Verbindungsgeschwindigkeit von Minuten bis Stunden hinziehen.
- Aufladen in die Verzeichnisse können Sie nur Dateien, die den konfigurierten MIME-Typen des SAP MIME Repositorys bekannt sind.
Wenn Sie beispielsweise versuchen, eine Datei mit Namen xmlProvider.php hochzuladen werden Sie eine Fehlermeldung erhalten, wenn der MIME Type 'PHP' nicht gepflegt ist. Es müssen unbekannte Mime Types im SAP System dann nachgepflegt werden. Je nach Client, müssen Sie dann ein Popup bestätigen, bevor das Kopieren der anderen Dateien weitergeht.
Verbindung mit einem Windows WebDav Client herstellen. english version follows. Verwendet: Novell Netdrive 4.1 Um an das WebDav Ihrer BSP zu gelangen ist es nötig, den Umweg über den Filter /sap/bc/bsp_dev zu gehen. Dieser routet dann weiter auf die URI, die folgt - hier im Beispiel also /sap/z_net2112/2112PortalMan/. Beachten Sie, daß eine Angabe nur der BSP (/sap/z_net2112/) kein Ergebnis bringen wird. Legen Sie also in Ihrer BSP Applikation einen MIME Folder an und geben diesen der URI mit. Nach erfolgreichem Connect können Sie den MIME Folder im Windows Explorer öffnen und bearbeiten. Q: Wie finde ich den Port für den Connect an WEBAS WebDav? A: Üblicherweise derselbe Port wie für die BSP - also die BSP aufrufen und den Port dort abschreiben.
Wenn von Seiten der Administration geändert, dann muss man einen Admin konsultieren für die Info. Connecting to the WEBAS WebDav using a Windows WebDav Client.
Please refer to screenshots above. To access the MIME Directory of your BSP Application you will need to input a URL that is making use of the WebDav Filter (bsp_dev). Its URI is ' /sap/bc/bsp_dev' and it will then route the rest of the URI to your BSP Mime Folder. In this sample we input '/sap/z_net2112/2112PortalMan/'. When entering '/sap/z_net2112/' you will probably only be presented an empty directory. So if you haven't already, create a MIME Folder in your BSP Application and use it in your URL. A folder can be created by right-clicking the Node 'MIMEs' in your BSP and choosing 'Create Folder' from the context menu. Q: How do I find out about the port that is used to connect to WEBAS WebDav? A: Same port as for your BSP - so if you can run your BSP just pick the URL and edit.
Strukturierung der Verzeichnisse des SAP Webas. Wie so ziemlich alles im SAP System ist die Struktur des Mime Repositorys in Tabellen abgelegt. Die Kenntnis über die Struktur der Tabellen erleichtert das Verständnis für z.B. den Gebrauch von Funktionsbausteinen, die auf das Repository einwirken (wie etwa SKWV_KWUI_DOC_CREATE). Die Tabellen für das Mime Repository fangen mit 'SMI' an. Die Dokumentation der Tabellen ist traditionsgemäß auf eine Zeile beschränkt . Manche Information kann man dann aus den Tabellen gewinnen, hier nur exemplarisch ein paar Felder, die von Interesse sind: skwf_pkgpr - Packages SMIMPHIO - Verzeichnis der physikalischen Objekte. - LO_CLASS (Logische Klassenname, wie M_TEXT_P)
- PH_CLASS (Physikalische Klassenname, wie M_TEXT_L)
- LOIO_ID (GUID)
- PHIO_ID (GUID)
SMIMLOPR - Eigenschaften eines logischen Dokuments Interessant in Verbindung von Funktionsbausteinen, wenn man festellen muss, ob man es mit einem Ordner oder einer Datei zu tun hat. - OBJECT_ID (GUID)
- PROP_NAME (hier KW_POSITION, MIME_CACHE_EXPIRY)
- IO_CLASS (M_FOLDER, M_IMAGE_L...)
- PROP_VALUE (größer Null bei Folder)
SMIMLOIO - Logical Documents Hier können Sie beispielsweise die ID eines Ordners finden, um später einen Funktionsbaustein damit aufzurufen. Das kann nötig werden, wenn Sie eine Datei per Funktionsbaustein in das Repository übernehmen wollen, denn hierzu wird ein Parent benötigt. - LOIO_ID (ID des Objekts, GUID. Z.B.: 1157A19A8E8F7647B713D3D614075F48)
- PROP_09 (Name des Objekts. !Beachten Sie aber bitte, daß eine Datei/Ordner mehrfach vorhanden sein kann!)
Beispiel: Import einer Datei in einen Ordner mit der Funktion SKWF_LOIO_WITH_PHIO_CREATE: Wir brauchen hierzu eine Parentpos. Die Parentpos (Type SKWF_PAPOS) ist zwar optional, wir wollen aber natürlich gerne bestimmen, unter welchem Ordner die Datei eingefügt wird. Der Einfachheit halber nehmen wir an, daß es unseren Ordner nur einmal im System gibt. Felder benötigt: - PACKAGE_ID: Strange, aber wir setzen es auf 0
Hier ist noch Klärung erforderlich - OBJIDFLD: Feststellen der Ordner LOIO_ID über die Tabelle SMIMLOIO (Feld LOIO_ID)
- CLASSFLD: Übernahme des Feldes PROP02, oder Literal 'M_FOLDER'.
- TYPE: Literal 03
- INSPOS: L
- OBJTYPEFLD: F
Die Feldwerte, die hier fix eingetragen wurden beruhen auf Beobachtungen und sind nur für diesen Zweck gewählt. Hier besteht eine gewisse Unsicherheit über die Richtigkeit. Funktionsbausteine: SKWF_FIND_BY_QUERY SE37 - Testen Hier als CLASS z.B: M_FOLDER eingeben. als TYPE z.B: 'F'. Ergebnis: Liste aller FOLDER. Mit der Liste in Tabelle RESULT_OBJECTS kann dann in der IT PROPERTIES_RESULT mit dem Objektschlüssel jedes Property ausgelesen werden. Beispielsweise kann über die ParentfolderID bestimmt werden, ob es sich bei einem Folder wirklich um denjenigen handelt, den ich möchte, wenn mehrere gleichnamige Ordner existieren. Dann nämlich muß man sich an den Parentfolder IDs orientieren und zurückverfolgen, bis man eine Eindeutigkeit erkennt. Upload einer Datei Funktionsbaustein SKWF_LOIO_WITH_PHIO_CREATE wird verwendet, um ein PHIO zu erzeugen. Diese Funktion wird aber nur nötig bei einer Neuanlage, ansonsten wird der Content über die Funktion SKWF_PHIO_STORE_AS_UPDATE aktualisiert. Wichtig hier: Vorherige Methode verwenden, um die Daten für ParentPos zu füllen (s.h. Literale weiter oben). Anschliessend mit 'GUI_UPLOAD' die Daten der Datei in eine interne Tabelle übernehmen und evt. cl_gui_cfw=>flush noch aufrufen. SKWF_PHIO_STORE_CONTENT aufrufen: - Mimetype: z.B: image/bmp, application/text...
Die Mimetypes sind nicht von SAP erfunden und im Internet in RFCs oder anderen Quellen ausgewiesen. Diese können leicht recherchiert werden. - Filesize setzen
- Filename setzen (ohne slash, z.B.: banner.gif)
Sample for Manipulating the Mime Repository Hintergrund In einer Umgebung mit Business Server Pages soll eine Konfigurationsdatei abgespeichert werden. Diese Konfigurationsdatei wird von einer BSP-Seite geschrieben. Es soll vermieden werden, die Datei in das Applikationsserververzeichnis zu schreiben, da die Konfiguration und die gesamte Anwendung im Mime Repository liegen sollen. Deshalb ist ein Write Dataset nicht erwünscht. *&---------------------------------------------------------------------* *& Report ZZ_BSP_STORE * *& Author: Frank Kempf, 2112Portals.com * *&---------------------------------------------------------------------* *& Creating/Updating a File in the Mime Repository. * *& The Content of the File will be set from sy-utime. * *& This is a sample for demonstration purposes only. * *& No license, no warranty, no error checking, no complaints. * *& 2008 2112Portals.com * *&---------------------------------------------------------------------* *& Usage: * *& Pick a unique directory name from your Mime Repository and * *& an arbitrary filename. * *& Run this report and update the view of Mime Repository in SE80 * *& Doubleclick the entry of with the filename and you should see * *& the content changing from any run of the report. * *&---------------------------------------------------------------------* *& This code was developed by reengineering the ABAP Code of SE80, * *& Function Group SKWV_KWUI_DOCUMENT and * *& Package SKWF * *&---------------------------------------------------------------------*
REPORT ZZ_BSP_STORE.
PARAMETERS: selName(64) type c, selDir(64) type c, selPar(64) type c. "Parent dir
DATA: pp Type SKWF_PAPOS.
DATA: myloio type SKWF_CLS. DATA: myphio type SKWF_CLS. DATA: newLoio type SKWF_IO. DATA: tPhio type SKWF_IO. DATA: ErrData type SKWF_ERROR.
DATA: tLoioProp type SDOKPROPTY. DATA: tPhioProp type SDOKPROPTY. DATA: itLoioProps type standard table of SDOKPROPTY. DATA: itPhioProps type standard table of SDOKPROPTY.
DATA: bFileExists type i value 1. "indicator, 0=is a new File, 1=does exist already.
CONSTANTS: cFILENAME type string value '2112Portals.xml.txt'. * cFullFilename type string * value 'C:\Documents and Settings\Administrator\Local Settings\Temp\~DF10FE.tmp'. *
INITIALIZATION. selName = cFILENAME. selDir = '2112PortalMan'. selPar = 'Z_NET2112'.
tLoioProp-NAME = 'DESCRIPTION' . tLoioProp-VALUE = '2112CheckIn'. append tLoioProp to itLoioProps. clear tLoioProp. tLoioProp-NAME = 'KW_RELATIVE_URL' . tLoioProp-VALUE = selName. append tLoioProp to itLoioProps.
*KW_RELATIVE_URL equal to both tPhioProp = tLoioProp. " append tPhioProp to itPhioProps. clear tPhioProp.
tPhioProp-NAME = 'DESCRIPTION' . tPhioProp-VALUE = 'PHys 2112CheckIn'. "This String is visible later in Mime Explorer(SE80) append tPhioProp to itPhioProps. clear tPhioProp.
tPhioProp-Name = 'LANGUAGE'. tPhioProp-Value = 'E'. append tPhioProp to itPhioProps.
pp-OBJTYPEFLD = 'F'. pp-PACKAGE_ID = 'X211219675351943B0240F429535917D'. "ARBITRARILY chosen! pp-CLASSFLD = 'M_FOLDER'. pp-OBJIDFLD = ''. "LOIO ID of the Object, will be set later. pp-INSPOS = 'L'. pp-TYPE = '03'.
myloio = 'M_APP_L'. myphio = 'M_APP_P'.
start-of-selection.
*Get the Folder Perform getLOIOFolderID using selDir selPar changing pp-OBJIDFLD. "The Loio ID for ParentPos (see pp)
*When found, check if the Object already exists. tPhio-OBJTYPE = 'P'. "physical TRANSLATE selName TO LOWER CASE.
bFileExists = 1. "initialize PERFORM getLOIO using selName "the file name pp-OBJIDFLD "Folder to search changing tPhio.
if tPhio is initial. bFileExists = 0. "does not exist endif.
*As it was said: *you could use this function for uploading content from some location *of your client computer too.
*call function 'GUI_UPLOAD' * exporting * filename = l_fn * filetype = 'BIN' * importing * filelength = l_filesize * tables * data_tab = l_content * exceptions * file_open_error = 1 * file_read_error = 2 * no_batch = 3 * gui_refuse_filetransfer = 4 * invalid_type = 5 * no_authority = 6 * unknown_error = 7 * others = 8. * *call method cl_gui_cfw=>flush * exceptions * others = 1. * * *
DATA: l_FileInfos type standard table of SDOKFILACI.
DATA: skwfc_yes type c value 'X'. DATA: l_content type standard table of SDOKCNTASC. DATA: t_content type SDOKCNTASC.
DATA: l_FileSize type SDOK_FSIZE value 6. DATA: dyn_mimetype type W3CONTTYPE value 'application/octet-stream'.
DATA: l_fileinfo type SDOKFILACI.
concatenate sy-datum '/' sy-uzeit into t_content-LINE. append t_content to l_content.
l_fileinfo-file_size = strlen( t_content-LINE ). l_fileinfo-mimetype = dyn_mimetype. l_fileinfo-file_name = cFilename. *l_fileinfo-binary_flg = 'X'. append l_fileinfo to l_fileinfos.
if bFileExists = 1. call function 'SKWF_PHIO_STORE_AS_UPDATE' exporting phio = tPhio importing new_phio = tPhio error = ErrData tables file_access_info = l_fileinfos file_content_ascii = l_content. else.
call function 'SKWF_LOIO_WITH_PHIO_CREATE' exporting loio_class = myloio phio_class = myphio parentpos = pp importing error = ErrData phio = tPhio loio = newLoio tables loio_properties = itLoioProps phio_properties = itPhioProps.
call function 'SKWF_PHIO_STORE_CONTENT' exporting phio = tPhio x_raw_mode = skwfc_yes importing error = ErrData tables file_access_info = l_fileinfos file_content_ascii = l_content. endif. * * * * *STORE
write: / 'END'.
*GET LOID for a Folder (to use it as a parent). *For demonstration purposes only: *we just take the first match here since we know, *that our foldername is unique. *Anyway the Parent's foldername is an argument for *further refinement of the function. FORM getLOIOFolderID using myFolder type c "Folder to search myParentFolder type c "Parentfolder changing OBJID type SDOK_DOCID. DATA: tClass type SDOKCLASS. DATA: itClass type standard table of SDOKCLASS. DATA: tResult type SKWF_IO. DATA: itResultSet type standard table of SKWF_IO. DATA: tProperty type SDOKPROPTL. DATA: itProperties type standard table of SDOKPROPTL. DATA: itQueries type standard table of SDOKQUPROP. "empty DATA: tReq type SDOKPROPTN. DATA: itReq type standard table of SDOKPROPTN. "the properties we are interested in
tReq-NAME = 'KW_RELATIVE_URL'. append tReq to itReq. tReq-NAME = 'KW_PARENT_FOLDER_CLASS'. append tReq to itReq. tReq-NAME = 'KW_PARENT_FOLDER_ID'. append tReq to itReq.
tClass-CLASS = 'M_FOLDER'. append tClass to itClass.
CALL FUNCTION 'SKWF_FIND_BY_QUERY' * EXPORTING * CONNECTION_SPACE = * OBJ_TYPE = ' ' * PTYPE = * X_STRICT = * IMPORTING * ERROR = TABLES CLASSES = itClass QUERIES = itQueries RESULT_OBJECTS = itResultSet PROPERTIES_REQUEST = itReq PROPERTIES_RESULT = itProperties .
*editor-call for itProperties. loop at itProperties into tProperty . if tProperty-NAME = 'KW_RELATIVE_URL' and tProperty-VALUE = myFolder. OBJID = tProperty-VALUE . exit. "go on if you want to check for multiple folders. endif.
endloop.
ENDFORM.
*Get ID of an object FORM getLOIO using myObjectName type c "the file name myFolderID type c "Folder to search changing myPhio type SKWF_IO. DATA: tClass type SDOKCLASS. DATA: itClass type standard table of SDOKCLASS. DATA: tResult type SKWF_IO. DATA: itResultSet type standard table of SKWF_IO. DATA: tProperty type SDOKPROPTL. DATA: itProperties type standard table of SDOKPROPTL. DATA: itQueries type standard table of SDOKQUPROP. "empty DATA: tReq type SDOKPROPTN. DATA: itReq type standard table of SDOKPROPTN. "the properties we are interested in DATA: strProperty type string. DATA: bFound type i value 0. tReq-NAME = 'KW_RELATIVE_URL'. append tReq to itReq. tReq-NAME = 'KW_PARENT_FOLDER_CLASS'. append tReq to itReq. tReq-NAME = 'KW_PARENT_FOLDER_ID'. append tReq to itReq.
tClass-CLASS = 'M_APP_P'. append tClass to itClass.
CALL FUNCTION 'SKWF_FIND_BY_QUERY' * EXPORTING * CONNECTION_SPACE = * OBJ_TYPE = ' ' * PTYPE = * X_STRICT = * IMPORTING * ERROR = TABLES CLASSES = itClass QUERIES = itQueries RESULT_OBJECTS = itResultSet PROPERTIES_REQUEST = itReq PROPERTIES_RESULT = itProperties .
*editor-call for itProperties. loop at itProperties into tProperty . at new OBJID. myPhio-OBJID = tProperty-OBJID. "store though it may not be the right one. endat. * this would not work * if tProperty-NAME = 'KW_PARENT_FOLDER_ID' AND tProperty-VALUE = myFolderID. * bFound = 1. * exit. * endif. TRANSLATE tProperty-VALUE TO LOWER CASE. if tProperty-NAME = 'KW_RELATIVE_URL' AND tProperty-VALUE = myObjectName. bFound = 1.
exit. endif. endloop.
if bFound = 0. tPhio = space. endif. *else get the rest
select single PH_CLASS from SMIMPHIO into myPhio-CLASS where PHIO_ID = myPhio-OBJID.
ENDFORM.
Frank Kempf war Kernel-Entwickler bei SAP AG Walldorf von 1996 biss 1999. |