Agnostic Guides
...
Developers Guide
Useful / Common Link Enterpris...

Store and Link a Document

6min
storing and linking a document is an extremely common functionality storing be done by either providing content via a filename to upload or by providing the binary content itself the link enterprise store and link method can also create folder structures (with and without content note content is stored in the top level folder), and in that scenario optionally apply metadata to the top level folder as well (to apply metadata to subfolders or documents, use the method /dflow/cl docmanager helper=>send metadata update you can also choose which level of multi folder heirachy you create in which to place content if applicable /dflow/cl docmanager helper=>store and link document parameters parameter description sample value iv caller describes who is calling the method logged in the link enterprise api gateway as such /dflow/cl common super=> gc caller docmanager custom iv mode create can be passed file content (c), the name and path of a file to upload and store (f), as well just create folder with no content (n) 'c' = content 'f' = file 'n' = no content iv sap object archivelink sap object bkpf iv ar object archivelink doctype zinvoice01 iv object id archivelink sap key note this can be a compound key for certain sap objects or line item/company code level 300019000000012020 iv file with path determine file, content, or contentless 'c' = content 'f' = file 'n' = no content iv no create link optional does not create a link after successful document storage iv no metadata transfer optional overrides the docmanager rule of whether to send metadata iv size mandatory if file or content mode size of content in bytes iv rfc optional name of rfc to override docmanager rule iv folder metadata optional boolen to indicate if update is to a folder note that this is applied to the top level folder only x = folder metadata empty = file metadata it metadata table of key value pairs of your cms properties and the values to update sapcompanycode 3000 it content optional (if contentless or file mode) table of binary content it saplink metadata optional no used at this point future functionality it custom optional if supported by your cms repository, the list of folder(s) to create the first line is the parent folder, lines 2 and above are subfolders (optional) by default, link enterprise places the content (when applicable) in the top level folder (ie the first line) you can override this by placing a tild preceding the folder name also by default, the structure will be created as 1 parent and the rest subfolders of that parent if you wish to create a nested folder structure, set the flag iv folder nested to x sap po header 4500012349 sap po line 00010 sap po line 00020 (content will be placed in top folder) sap po header 4500012349 sap po line 00010 sap po line 00020 (content will be placed in lowest sub folder) ev document stored n/a if mode is contentless, else flag indicating whether a document was stored successfully ev document linked n/a if mode is contentless, else flag indicating whether a document was linked successfully after storage (assuming iv no create link is empty) ev arc doc id document id created in the cms repository {fc2f11ef 9ab9 c08e 86b0 74e484400000} or 124057761318 ev filename link enterprise automatically trims the extension off and passed back just the filename as a parameters et return table that indicates a success of an error the type field will contain an ‘s’ or ‘e’ respectively and the message field will contain information in the case of an error when you use the it custom folder to create folders, the return table will also pass back the folder id's created the parent folder is indicated by a ! exclamation point, all sub folders are indicated by a tild example of return table when folders are created !sap 4500017723,147811962292 sap subfolder1,938382828 sap subfolder2,938382829 sap subfolder3,938382830 refer to the below examples for more return table samples note a commit work is required example note folder creation is only if supported by your cms an easy way to see an example for the parameter is to put a breakpoint in the link enterprise docmanager code that will be triggered when storing a document from any services for object enabled transaction /dflow/cl docmanager helper=>store and link document, approximately line 713 below are sample values metadata passed custom table passed in this example, we instructed link enterprise to create a 1 level subfolder this is done by filling the custom table with the folder name to implement this folder creation with store and link, you can implement in your code that calls store and link, or, implement the badi /dflow/badi docmgr store link at the point before the document storage (ie iv caller 'b' in the badi) please refer to the badi section of this document for more information using the badi ensures that all methods of storing business documents (ie migrator, publisher, standard link enterprise docmanager via services for object, custom use of store and link) all follow the same logic return table received note in this return table, we see that we also have link enterprise configured to create a folder when this occurs, the '!' indicates the folder name and the second value is the folder id