Skip to Content
In my first web log Message handling in BSP, we examined how the application log is used to handle messages within a Business Server Pages (BSP) scenario easily. This time we are going to handle another very important topic in message handling: how to retreive and display a long text of a T100 message. Introduction This web log introduces the concept of long text and its possible usage in a BSP application. Next we explain an easy approach to displaying a long text message in a BSP application using the cache of the Web Application Server (Web AS).   Long texts are used in SAP systems to explain the content of messages better. Normally a long text is used when the content of a short text of the message (See Figure. 1) is not clear enough or appropriate (e.g. when the user made an invalid entry). A long text is part of a T100 message contained in a message class.    imageFigure 1 Transaction 91.  Create and Edit Messages  If a message situation occurs within an application, a message (e.g. error message) is displayed and if this message contains a long text, it is displayed as a link next to the message so that the user can click on it. The system then displays the long text message in popup window.  Long texts are created and edited in transaction SE91. On top right of the screen you find the Long Text button which opens the long text editor.  image  Figure 2 Long Text  The long test, as seen in the Figure above, consists of four parts: “Cause”, “System Response”, “What To Do” and “Sys Admin”. These enable the user to understand the message content better, the system behavior, and how the user and administrator should respond to the said message. A long text contains more than just the text of a message. It also provides other capabilities such as the link to another long text or documentation (see transaction SE61 for document maintenance). image  Figure 3  Message Link to a Long Text in the BSP Application Implementation As we explained in last web log, the functionality of displaying long texts is not on offer for BSP applications. Now the question is how to do that? We need to read the long text of the message, create a link to it and display the message (see Figure 3 for details) in a new column of the table view for our messages. Then, when the user clicks on the link, we can catch the HTMLB event of the link in the application and execute some methods to read the long text, and create popup windows to display the text. This would mean, firstly, that we have to change our BSP application and, secondly, that we would have another roundtrip to retreive and display the long text message in the BSP application. image  Figure 4 Long Text Message Displayed as a BSP Page   A better approach seems to be to find out if a message has a long text at the same time as the message text is being processed. If the said message contains a long text, its long text is read and rendered into a separate HTMLB page, as shown in the figure above. Then we create a new URI to this page and save the content of the page and the URI in the cache of the Web AS.  For a great introduction to the usage of Web AS cache, see a milestone web log of Brian McKellar BSP Programming: Handling Of Non-HTML Documents. imageFigure 5 Enhanceing the Method read_log( ) with the New Method get_text( )  The function group SDOC provides some interesting function modules to read documentation. A long text is, as explained before, a form of documentation for the user. The description header of the documentation is stored in the table DOKH (Documentation: Headers) where all headers for these long texts are stored. Taking this into account, we are able to enhance our class cl_applog with a new method cl_applog=>get_text( ).   This new method cl_applog=>get_text( ) is also used  to enhance our method cl_applog=> read_log( ). The method cl_applog=>get_text( )  selects the newest version of the document from the database table, DOKHL, and reads the long text of the message using the function module DOCU_GET. This module delivers the long text document as a table of the SAPSCRIPT structure TLINE and the document header. As seen in the figure above, the text is formatted in SAPSCRIPT so we need to convert it to normal text and then render it to a HTMLB page. The class cl_applog acquires the method render_page( ). This method creates a new GUID used as path for the URI of the long text page and it calls the method render() which generates the HTMLB page and the link as an URL and the method get_url( ) of the class cl_render_page which is saved in the attribute lv_url.  image   Figure 6 Long Text in SAPSCRIPT   To display the long text’s link next to the message, we enhance the iterator’s method using an object of type link which is via the replacement bee injected in the right column. The long text is displayed in a new popup window. We need to insert some JavaScript coding which allows us to create a new window that displays the long text message.   imageFigure 7 Mapping Link in the Iterator  In the part II of this log, we show how the long text is displayed using a new class CL_RENDER_PAGE which renders, caches and converts the text to HTMLB. 
To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Johan von Reedtz
    Indeed, this is for sure an important topic for BSP and it has not been covered in std SAP shipment of the BSP technology.

    I did something similar with messages but used a much simpler approach without the ability to see any long text for a T100 message. I really missed that functionality (it is so “natural” in SAPGUI) but as there were some time pressure and no SAP delivered examples or BSP extensions I just skipped it then.

    Very useful blog and I am waiting for the next installment, part II, in your serie.

    BTW: Do you have any plans to develop this into a BSP extension?

    Thanks, Johan

    1. Hi Johan,

      Thanks for your comment. Yes I’m planing in the third part of this serie to put this stuff into a BSP extension but first I have to finish the second part. ๐Ÿ˜‰



Leave a Reply