Display complex business objects using html

All R/3 business objects (customers, products, invoices, etc) can be displayed with standard transactions in a complete and hence very detailed manner.  Often a relevant subset of this data would suffice in day to day situations, and most users would prefer to have simple, direct access to the required information without having to work through several R/3 screens.

With GuiXT, InputAssistant and Viewer it is possible to implement a customized view of the business object, presenting precisely the data that the user needs, reached by a single mouse click, displayed on a single page and in his or her preferred format. 

The basic technique has already been explained in Designing display transactions with GuiXT Viewer. Here we focus on 

  • Filling HTML tables
  • Starting a new Browser window for the display

We will explain the technique using an example for transaction “Releasing a purchase requisition” (Transaction ME54). 

Here it is very likely that the person responsible for releasing the requisition would like to see all relevant data on one page.

The format that we want to produce looks like this: 

Sap Guixt htmlview1 Display complex business objects using html

 

With transaction ME53 or ME54 the user would have  to navigate through 9 screens in order to get all the data displayed above:

Sap Guixt htmlviewsap1 Display complex business objects using htmlSap Guixt htmlviewsap2 Display complex business objects using htmlSap Guixt htmlviewsap3 Display complex business objects using html

Sap Guixt htmlviewsap4 Display complex business objects using htmlSap Guixt htmlviewsap5 Display complex business objects using htmlSap Guixt htmlviewsap6 Display complex business objects using html

Sap Guixt htmlviewsap7 Display complex business objects using htmlSap Guixt htmlviewsap8 Display complex business objects using htmlSap Guixt htmlviewsap9 Display complex business objects using html

 

Using GuiXT, InputAssistant and Viewer you can offer an “Overview” button  that displays the purchase requisition in the desired form. A further advantage is that the Browser “Print” function can then be used to make a local printout of the purchase requisition.

How to proceed: We automate the process to go through the 9 R/3 screens using an InputScript. There we collect all the necessary data and store it into GuiXT variables. At the end we use the “View” command in order to start the browser with an HTML file generated by GuiXT via a template file. 

In the template file we need html tables, since we do not know the number of requisition items in advance. GuiXT offers a simple and efficient mechanism to fill such tables: In your HTML template you define only one row. In this row you use &-variables with a name containing three #-signs: ###. When generating the HTML file from your template, GuiXT will replace the ### with 1,2,3,…, and then generate new table rows as long as the  first GuiXT variable for this row is not empty. In our example (see html coding below) this is &[req_pos_###_item] . 

Nested tables are also possible (in our example they are needed for the text lines of each item). In this case you need the ### twice in the variable names, e.g &[req_pos_###_text_###].  GuiXT supports only 2 nesting levels (i.e., tables within tables). 

 Sap Guixt htmlview2 Display complex business objects using html
   HTML template requisition.html

You can create the HTML template requisition.html with an html editor of your choice (e.g. MS Frontpage), without having to modify or add anything to the generated html coding. The link to GuiXT is established by the text where you use the variable names &[req] or &[req_pos_###_item]. GuiXT replaces each variable by its content, and also adds as many rows as are required in tables in which you use a  ###-variable in the template row definition. 

With the following GuiXT script you create an “Overview” pushbutton in the first screen SAPMM06B.E0105 of transactions ME53 and ME54:

// ME53: Display purchase requisition
if Q[Transaction=ME53]
  Pushbutton (2,40) “Display overview” “process=requisition.txt”
    using REQNO = [Purchase requisition]
endif

// ME54: Release purchase requisition
if Q[Transaction=ME54]
  Pushbutton (2,40) “Display overview” “/NME53″ “process=requisition.txt”
    using REQNO = [Purchase requisition]
endif

Sap Guixt htmlview3 Display complex business objects using html

 

You also need the InputScript “requisition.txt” that processes the R/3 screens:

// InputScript requisition.txt
Parameter REQNO

//Screen SAPMM06B.0105

// Reset index
Set V[index] 0 

// Reset all req fields
Set V[req_*] “”

// Set req
uision number

Set V[req] “&U[REQNO]“

Screen SAPMM06B.0105 
Set [Purchase requisition] “&U[REQNO]“ 
Enter


Label next_item


Screen SAPMM06B.0106

// Increase position index
Set V[index] &[index] + 1

// Set position
Set V[req_pos_&[index]_item] “&cell[Table,Item,&[index]]”

// Set quantity
Set V[req_pos_&[index]_quantity] “&cell[Table,Qty requested,&[index]]”

// position left?
if V[req_pos_&[index]_quantity>0]
  Set cell[Table,0,&[index]] “X”
  Enter “/2″
else
  Set V[req_pos_&[index]_*] // Reset next line

// Invoke browser  
  View “requisition_&V[req].html” “template=requisition.html”

  Return

endif 

// Item detail
Screen SAPMM06B.0102

// Set variables
Set V[req_pos_&[index]_product] “&[Short text]“
Set V[req_pos_&[index]_price] “&[Val.price]“

// Display statistics screen
Enter “=AS”

// Statistics
Screen SAPMM06B.0110

// Set variables
Set V[req_pos_&[index]_value] “&[Total value]“
Set V[req_pos_&[index]_by] “&[created by]“
Set V[req_pos_&[index]_on] “&[changed on]“

Set V[req_totalvalue] “&[req_totalvalue]” + “&[Total value]“

// Display texts
Enter “TXP”

// Texts
Screen SAPMM06B.0103

// Text 
Set V[req_pos_&[index]_text_1] “&[Text(2)]“
Set V[req_pos_&[index]_text_2] “&[Text(3)]“
Set V[req_pos_&[index]_text_3]

// More text?
Set V[req_more] “&#[8,61]“
if V[req_more=X]
  Set C[Item text] “X”
  Enter “=TEDE”
else
  // Return from text screen
  Enter “/3″
  goto next_item
endif 

// Text Editor
Screen saplstxx.1100
Set V[req_pos_&[index]_text_1] “&F[TabCol3(2)]“
Set V[req_pos_&[index]_text_2] “&F[TabCol3(3)]“
Set V[req_pos_&[index]_text_3] “&F[TabCol3(4)]“
Set V[req_pos_&[index]_text_4] “&F[TabCol3(5)]“
Set V[req_pos_&[index]_text_5] “&F[TabCol3(6)]“
Set V[req_pos_&[index]_text_6] “&F[TabCol3(7)]“
Set V[req_pos_&[index]_text_7] “&F[TabCol3(8)]“
Set V[req_pos_&[index]_text_8] “&F[TabCol3(9)]“
Set V[req_pos_&[index]_text_9] “&F[TabCol3(10)]“
Set V[req_pos_&[index]_text_10] “&F[TabCol3(11)]“

// Return from full text screen
Enter “/3″

// Texts 
Screen SAPMM06B.0103
// Return from text screen
Enter “/3″
goto next_item
 

The InputScript will handle only those items that are shown on the first table page, without scrolling. In many cases this is all you need. If not, you can use the technique described in Excel download of selected table rows in order to scroll through the whole table.

 

 

 

Display complex business objects using html