BSP: BTF editor example, Non Model View Controller
Introduction
Recently I received an Email from Marco Nickel pertaining to a past weblog I had done on BSP Developer’s Journal Part XVI – Using the BTF Editor. Marco was looking for a BTF example that wasn’t implemented in Model View Controller. Quite frankly I haven’t coded much that wasn’t MVC in quite some time. Let’s hope my Non MVC BSP programming skills aren’t quite as rusty as my German is.
-
event handler for data retrieval
****If we don’t have any data coming in from a previous event,
****then we want to initialize it with some default text.
****This could also be some code to load text from the database.
IF s_documentdata-btf_doc IS INITIAL.
DATA: text(25) TYPE c.
DATA: l_text TYPE xstring.
text = ‘This is test text’.
FIELD-SYMBOLS:
-
event handler for checking and processing user input and
-
for defining navigation
****Perform this code before we handle any events. Regardless of the event,
****we have to bring the editor content back in to keep it.
-
Read data from editor:
DATA: editor TYPE REF TO cl_btf_bsp_editor.
editor ?= cl_btf_bsp_manager=>get_data( request = request
name = ‘editor’
id = ‘btf1’ ).
IF editor IS NOT INITIAL.
s_documentdata-btf_doc = editor->document.
ENDIF.
Closing
I hope that this little example has been a useful addition to the content that already exists on BTF. At the very least it might be the starting point for further questions.
pretty good, but is there any infrastructure to store these documents?
Best regards,
Stefan
The content itself can be retrieved from the document object. It is returned as a binary string. What I have always done in the past is just store this binary string in a database table.
For my company's systems I created a centralized data store for BTF content very similar to the long text tables in R/3. I have a configuration table with text types and I obscure the database access via a set of class methods very similar to the tradition READ_TEXT, SAVE_TEXT, etc. R/3 function modules. This layer that I built adds additional value by compressing the BTF content using the ABAP GZIP classes. If people are interested in BTF, perhaps I could post my code in another weblog.
Another good article.
Stefan,
For managing documents from an SAP system with external storage - research SAP Content Server an easy to use complimentary product which is fully http compatible and easy to configure and use with KPRO or DMS within SAP and KM with EP.
My company does use DMS with the SAP Content and Cache server to store these other types of documents.
In my mind these are two completly different tools with different purposes.
No argument from me, I was not commenting on the weblog only the storage options.
thanks for ideas, great extension and consequent article!
Otherwise, if I want to place btf into TabStrip (and I'm using onSlect tabStripItem property), I'm receiving JavaScript error "Object expected". Do you have any idea what's the reason and how to avoid it?
Thank a lot for your help!
Stefan
If that isn't the case and you are fairly sure that the problem is realted to the interaction of the two elements, I would open an OSS problem. To help out you might recreate the problem in as simplistic an example as possible. Meaning a page that just has the TabStrip and the inner BTF.
I can tell you that I have used BTF before within a TabStrip (but it was the phtmlb:tabStrip). That would be another option- try one of the other tabStrip implementations (PHTMLB or XHTMLB).
Hallo Thomas,<br/>thank you for your quic response, below you can see my BSPage, meantime I'll try your suggestion. I'm on WAS 7.0o SP 8.<br/>Thank you and best regards<br/>Stefan<br/><br/><br/><%@page language="abap" %><br/><%@extension name="htmlb" prefix="htmlb" %><br/><%@extension name="btf" prefix="btf" %><br/><br/><htmlb:content design="design2003" ><br/> <htmlb:page title=" " ><br/> <htmlb:form encodingType="multipart/form-data"><br/> <htmlb:tabStrip id = "myTabStrip1"<br/> selection = "1" ><br/> <htmlb:tabStripItem id = "myTabStripItem10"<br/> onSelect = "myTabStripItem10onSelect"<br/> index = "10"<br/> title = "search" ><br/> <htmlb:tabStripItemBody><br/>10<br/> </htmlb:tabStripItemBody><br/> </htmlb:tabStripItem><br/> <htmlb:tabStripItem id = "myTabStripItem20"<br/> onSelect = "myTabStripItem20onSelect"<br/> index = "20"<br/> title = "search" ><br/> <htmlb:tabStripItemBody><br/> <btf:editor id = "btf1"<br/> document = "<%= lv_btf_documentdata-btf_doc %>"<br/> height = "100px"<br/> width = "400px"<br/> navigationType = "Off"/><br/> </htmlb:tabStripItemBody><br/> </htmlb:tabStripItem><br/> </htmlb:tabStrip><br/> </htmlb:form><br/> </htmlb:page><br/></htmlb:content><br/><br/><br/>lv_btf_documentdata TYPE BTFDOCUMENTDATA