All InfoObjects have a length limit of 60 characters. However, users often want access to longer text. Discover a workaround to display text of more than 60 characters in Web queries.
Key Concept
A Business Server Page (BSP) application is a complete functional application similar to a classic SAP R/3 transaction. Rather than viewing these applications using SAPGUI, users view them in a Web browser. HTTP or HTTPS access the application across the network, which means that you can use standard products such as firewalls and proxy servers.
BW users often turn to BW-based Web queries to display document-level details. For example, vendors often access BW reports through the Web and need to view long text stored on purchase orders or delivery documents. However, length limitations on BW InfoObjects restrict how much data users can display in BW Web queries. You can display text greater than 60 characters in BW Web queries by enhancing the context menu of Web queries and using a Business Server Page (BSP) application in the back end.
SAP Web Application Server includes BSP, a page-based programming model with server-side scripting as well as server page technology for developing, designing, and implementing Web applications. Server-side scripting enables direct access to all elements in the application server (such as function modules, database tables, ABAP Objects, and remote function modules).
To display text greater than 60 characters in BW reports, you must enhance the context (right-click) menu on BW Web queries by modifying the Web template to call the BSP application. In turn, the BSP application calls a remote function module in R/3 to retrieve the text and present it in a pop-up window. You must set up a separate BSP application for each field (such as delivery number) for which you want to display the enhanced context menu. Then, all users see the new option in their context menu.
Using this technique, you can avoid loading long text in multiple BW InfoObjects because you retrieve the data directly from R/3. Therefore, you avoid any loading problems (such as taking text into multiple InfoObjects and problems in dealing with valid character sets) due to permitted character checks. In addition, BW only retrieves necessary data for display. Users who do not have access to R/3 (e.g., external vendors) can see necessary information in BW Web queries through SAP NetWeaver Portal. We developed the application on BW 3.5, R/3 4.6, and SAP Enterprise Portal 6.0. It still worked after upgrading to SAP NetWeaver 2004s and mySAP ERP Central Component (ECC) 6.0. We expect our technique would work for any version of R/3 4.6 and up, BW 3.0B (and above), and Enterprise Portal 6.0 (and above).
Let’s examine a business scenario and walk through a step-by-step method to display long text in BW Web queries.
Business Scenario and Steps
Company X sends parts for repair to its vendors. Vendors have access to run BW queries through SAP NetWeaver Portal. Necessary authorizations are in place to allow vendors to view data only in BW reports that relate to them. The text of the deliveries stores some useful information and vendors want to view this information in their BW Web query. To do this, they must follow these steps:
Step 1. Create a BW Web query. Create a BW query in BEx and create a Web template from the BEx Query using Web Application Designer (Web AD). When you launch this query in the Web browser, the query displays a selection screen like any standard BW Web query. When you enter the desired selection such as vendor number or delivery date, the Web browser displays the output. In Figure 1, we ran the query using the vendor number and delivery date selections to restrict data to one month for one vendor. This Web query displays the delivery number and other details such as item number, delivery quantity, and confirmed quantity.

Figure 1
Web query displays the delivery number and other details
Step 2. Make HTML code enhancements in the BW report Web template. After creating the Web template, you need to change generated HTML code to add to the context menu that appears when you right- click on a BW report field. Also, you need to add code to read the delivery number where you place the cursor. In the example, we need to read the delivery number, because in the scenario report users want to view long text stored against the delivery.
Add the code shown in Figure 2 in the object tag of the Web template. Access the object tag by opening the Web template you created for the BW report in step 1. In the HTML tab, you can see the tag. In Figure 2, notice the circled lines. The first two lines that you insert enhance the context menu with an option called Display Long Text. The third line calls the DisplayText function when users select the Display Long Text action. The fourth line indicates that this is the first customer parameter. For the nth customer parameter, the value changes to n and parameter names end with n (e.g., CMENU_FUNCTION_n, where n is the customer parameter number). The fifth inserted line indicates the field on which to add the context menu on the report. The sixth line indicates that the enhanced option is visible while the seventh line indicates that the enhanced menu appears at the bottom. In Figure 2, it is the delivery number (e.g., InfoObject 0DELIV_NUMB).

Figure 2
Add this code to the HTML tab of the Web template
The code in Figure 2 added an extra entry to the parameters of the Web template called Display Long Text. When users click on this option, BW passes the control (it calls the function display text) to the JavaScript function DisplayText.
The function DisplayText contains the code in Figure 3 to call the BSP application in BW. We’ll explain how to create BSP applications through ABAP Workbench (transaction SE80) later. The code in Figure 3 shows the JavaScript function. Look for the <HEAD> tag in the HTML coding. This code calls the Web page https://WebaddressXX/z_read_text/ select.htm to pass the value of the delivery number through parameter 1. (Note that WebaddressXX stands for the server address.) At this point, the control is passed to the BSP application page in BW. The BSP application creates, writes, and generates this page (https://WebaddressXX/ z_read_text/select.htm). This code also controls the size of the pop-up window (here, 480 x 325) as well as properties such as the scrollbar.
function DisplayText(parameter, cell_type, filter, parameter1,parameter2, item, dataprovider, x, y) { var url; var url1; var url2; var flag; flag = false; url1 = (SAP_BW_URL_Get()+ "&CMD=BOOKMARK"); createCookie('URL1',url1,1); url = "https://WebaddressXX/z_read_text/select.htm?&var1=parameter1&gv_value1=" +parameter1; window.open(url,'mywin',"width=480,height=325,menubar=0,scrollbars=0,resizable=0"); var indx; var found; }
|
Figure 3 |
JavaScript function DisplayText |
Now, when users execute a query, BW adds Display Long Text to the end of the context menu (Figure 4).

Figure 4
Right-click on an entry in the Delivery field to see the Display Long Text option
Step 3. Create function module Z_READ_TEXT in R/3. Z_READ_TEXT calls standard function module READ_TEXT. We could not use SAP-delivered function module READ_TEXT because it is not compatible with Remote Function Calls (RFCs) and needs to be called from BW. In your R/3 system, go to transaction SE37, create function module Z_READ_TEXT, and maintain the following settings:
- Attributes tab: Select processing type Remote-Enabled Module
- Import tab: Add import parameters CLIENT, ID, LANGUAGE, NAME, OBJECT, and ARCHIVE_HANDLE (Figure 5)

Figure 5
Enter these import parameters to the function module
- Tables tab: Enter the LINES parameter (Figure 6)

Figure 6
The LINES table passes results (e.g., text about the delivery) back to the calling program
- Source code tab: Add the code in Figure 7
CALL FUNCTION 'READ_TEXT' EXPORTING * CLIENT = SY-MANDT id = ID language = language name = name object = object * ARCHIVE_HANDLE = 0 * LOCAL_CAT = ' ' * IMPORTING * HEADER = tables lines = lines * EXCEPTIONS * ID = 1 * LANGUAGE = 2 * NAME = 3 * NOT_FOUND = 4 * OBJECT = 5 * REFERENCE_CHECK = 6 * WRONG_ACCESS_TO_ARCHIVE = 7 * OTHERS = 8 . ENDIF. ENDFUNCTION.
|
Figure 7 |
Code to call standard function module READ_TEXT to get text about the delivery. The LINES table stores the text and BW passes it to the calling program, the BSP application in BW. |
Step 4. Create a BSP application. Write a BSP application using ABAP Workbench, transaction SE80. In this example, we developed an application called Z_READ_TEXT (Figure 8).

Figure 8
Choose BSP applications from the drop-down menu to create the application
Each BSP page includes several areas (Figure 9). The Layout tab contains the code that dictates the page’s appearance. The Event Handler tab manages user actions (events) on the page. The Page Attributes tab lists all data parameters the page uses and those that the system transfers to successive pages.

Figure 9
The different tabs: Properties, Layout, Event Handler, and Page Attributes
Event Handler: OnInitialization Event
The system processes the OnInitialization event handler directly after the BW report calls the page. In our example, initialization is run when the request from the Web report accesses the page (i.e., when users right-click on the context menu and click on Display Long Text). The OnInitialization event handler implements data retrieval. The Page Attributes tab stores the data so that the layout and other event handlers can access it.
The OnInitialization event calls the RFC-enabled function module Z_READ_TEXT created in step 3. Figure 10 shows ABAP code to customize the event handler to retrieve the delivery document text from R/3 using function module Z_READ_TEXT. The variable l_rfcwa stores the R/3 destination. This function module passes ID ZBUY, language EN, name gv_name (delivery number), and object VBBP.

Figure 10
ABAP code to customize the event handler to retrieve the delivery document text from R/3 using function module Z_READ_TEXT
The RFC from the function module uses the delivery number from attribute value gv_value1 passed to the BSP page through the URL of the BW Web query and fetches text for the delivery number. The text is passed by BW to the automatically defined page attribute gt_line in the form of an internal table. This page attribute is read internally in BW on the layout of the page and displays the text in a pop-up window.
In the Page Attributes tab, specify the page’s data parameters (Figure 11). Declare variables gt_line and gv_value1 as automatic page attributes by checking the Auto check box. These attributes automatically get values from calling URL or via the navigation process from other pages. Here, variable gv_value1 receives the delivery number from the Web report and gt_line stores the text read from R/3. You use page attributes to store data that the event handler determines. You can use the page attributes to make the data accessible to layout processing and the remaining event handlers.

Figure 11
Specify the page’s data parameters in the Page Attributes tab
Layout
You control page display using server-side scripting in the layout. To ensure clean development, you must separate layout and presentation from processing logic. Therefore, scripting for the static details of a page is part of layout processing, while the dynamic processing steps are set in the different event handlers.
Figure 12 specifies the page title Long Text for the Delivery with the delivery number appearing adjacent to the title. (The variable gv_value1 stores the delivery number.) You also can specify the text color. From the next line onward, the code lets you display the long text for the delivery number passed from the OnInitialization event handler.

Figure 12
Specify the page title Long Text for the Delivery
Results
When users right-click on the document number after running their query, they see the enhanced menu with Display Long Text as the last option (as Figure 4 shows). The selected delivery number is passed to the BSP application. The BSP gets the text by calling RFC in R/3 and displays text in the pop-up window (Figure 13).

Figure 13
A pop-up window appears with text associated with delivery. You can see that there is no limit on the number of characters displayed.
Nitin Kulkarni
Nitin Kulkarni is a project manager working with Patni Computer System and is an SAP-certified BW consultant. He has more than seven years of experience working on various SAP projects, including four in SAP BW. He has completed a number of BW projects in the supply chain and accounts receivable area, many as the lead BW consultant or project lead. He also has three years of experience in executing brewery and pharmaceutical projects.
You may contact the author at nitin.kulkarni@patni.com.
If you have comments about this article or publication, or would like to submit an article idea, please contact the editor.

Vikas Babbar
Vikas Babbar is an SAP BSP/ABAP consultant. He has four years of experience working on various SAP implementation and enhancement projects. He also has experience in SAP modules such as FI, MM, SD, PP, and QM.
You may contact the author at editor@BWExpertOnline.com.
If you have comments about this article or publication, or would like to submit an article idea, please contact the editor.