For a complete list of all my blogs regarding content management, please see
I create a utility class with method CREATE_DOC. It has following four input parameters:
- iv_data type xstring – the binary data which you would like to store as attachment
- iv_bor_type type string – the BOR type of your business object. You can view view business object model in tcode SWO1
- iv_guid type raw16 – the guid of your business object instance
- iv_file_name type string – the file name which will appear in attachment assignment block.
The source code of method below: ( in fact all attributes for an attachment could be available in the input parameters of this method. For simplicity reason I
just hard code them in the sample code )
I write a piece of code to test it. After report runs I could see the generated attachment.
You can also test whether the attachment is created successfully in the backend. Test class method get_info in SE24.
Specify importing parameter BUSINESS_OBJECT:
Execute and you should get result as below: one physical object and one logical object according to
Never forget to call COMMIT WORK in your code, since the persistence of the relationship between attachment and your business object are implemented via generic object service in a update process.You could easily find this via SAT trace on your code
or switch on update debugging in your debugger settings.
来自 “ ITPUB博客 ” ，链接：http://blog.itpub.net/24475491/viewspace-2702903/，如需转载，请注明出处，否则将追究法律责任。