Listen in html Format anzeigen

Users often need to get additional information about business objects they are dealing with in a transaction. Sometimes the SAP standard system already offers these possibilities, on a button or in the menu. In other cases the only way for the user is to open an additional mode, and to navigate to the right transaction or to call up the right report, and then, in most cases, enter the object keys again. 

With InputAssistant and Viewer there are various ways to implement an easy way to  additional information. The technique that we want to explain here is as follows:

  • You look for a standard ABAP report that displays the information you need, or you write a suitable new ABAP report
  • WIth GuiXT you add a new button on the screen that invokes an InputScript, passing the necessary key information to it
  • In the InputScript you call a function module that produces the wanted ABAP list in html format, and returns it to the script
  • With the Viewer component you finally display the list

This approach has several advantages:

  • Often there exists already a standard report that you can use, or at least that is a good basis for your own implementation
  • Only one function call is needed, no extra roundtrips between frontend and application server
  • The user can scroll the list locally, and  can work with the list independently of the SAP sessions
  • You can also easily combine several lists in one display

An alternative is to call the ABAP report via a /O… command (new session), and to use the normal SAP display. This is somewhat easier to implement, and requires no extra function call. On the other hand, the advantages of local scrolling, and ability of combining several lists into one, are then lost.   

Example:  Displaying stock overview and sales summary in VA01

In the order entry transaction VA01, we offer two new buttons in the toolbar: “Sales summary” and “Stock overview”. The first button shows, for the given customer, the sales of the past, using a standard report. The second pushbutton shows the stock overview for all materials on the current table page. It also uses a standard report, produced for each material and then combined into one list.

Sap Guixt webreport1 Listen in HTML Format anzeigen
 VA01: new pushbuttons “Sales Summary and “Stock overview” 

Sap Guixt webreport2 Listen in HTML Format anzeigen
Sales summary report in a separate browser window 

 

Sap Guixt webreport3 Listen in HTML Format anzeigen
Stock overview  in a separate browser window 

 

GuiXT script “SAPMV45A.E4001.TXT”

if Q[Transaction=VA01] and Q[Page=Sales]
  Pushbutton (toolbar) “Sales Summary”  process=”SalesSummary.txt”
  Pushbutton (toolbar) “Stock overview” process=”StockOverview.txt”
endif

InputScript “SalesSummary.txt”

Call “ZZ_GUIXT_CUSTOMER_PAYMENTS” in.KUNNR=”&F[Sold-to party]” table.HTML=htm

// Buld temp filename using Windows TMP environment variable
Set V[VA01_viewfile] “&%[TMP]\guixtview.html”

// Write to temp file
CopyText fromText=”htm” toFile=”&V[VA01_viewfile]“

// Display list (coordinates: for window sizing only)
View (0,0) (30,120) “&V[VA01_viewfile]” -floating 

InputScript “StockOverview.txt”

// Show stock overview for all materials on this page
Set V[material]

// del material number table
CopyText fromString=”material” toText=mat

Set V[i] 1

label item
Set V[material] “&cell[All items,Material,&V[i]]”
if not V[material]
  goto end_of_page
endif
CopyText fromString=”material” toText=”mat” -appendline 
Set V[i] &V[i] + 1
goto item

label end_of_page

Call “ZZ_GUIXT_STOCK_OVERVIEW” table.TMAT=mat table.HTML=htm

// Buld temp filename using Windows TMP environment variable
Set V[VA01_viewfile] “&%[TMP]\guixtlist.html”

// Write to temp file
CopyText fromText=”htm” toFile=”&V[VA01_viewfile]“ 

// Display list (coordinates: for window sizing only)
View (0,0) (30,120) “&V[VA01_viewfile]” -floating 

 

Function “ZZ_GUIXT_CUSTOMER_PAYMENTS”

FUNCTION ZZ_GUIXT_CUSTOMER_PAYMENTS.
*”———————————————————————-
*”*”Local interface:
*” IMPORTING
*” VALUE(KUNNR) TYPE KUNNR
*” TABLES
*” HTML STRUCTURE W3HTML OPTIONAL
*”———————————————————————-

* Debugging in RFC mode:
* call function ‘SYSTEM_ATTACH_GUI’.
* break-point.

data: abaplist like abaplist occurs 1 with header line.

* Add leading 000…
if kunnr co ‘ 0123456789′.
  unpack kunnr to kunnr.
endif.

* Produce report
Submit RVKUSTA1
    exporting list to memory
    and return
      with KUNNR EQ kunnr
      with VKORG EQ ’1000′.

* get list from memory
CALL FUNCTION ‘LIST_FROM_MEMORY’
     TABLES
        LISTOBJECT = abaplist.

* and convert to html
CALL FUNCTION ‘WWW_HTML_FROM_LISTOBJECT’
     TABLES
        HTML = html
        LISTOBJECT = abaplist.

ENDFUNCTION.

Function “ZZ_GUIXT_STOCK_OVERVIEW”

FUNCTION ZZ_GUIXT_STOCK_OVERVIEW.
*”————————————
———————————-
*”*”Local interface:
*” TABLES
*” HTML STRUCTURE W3HTML OPTIONAL
*” TMAT STRUCTURE W3HTML
*”———————————————————————-

* Debugging in RFC mode:
* call function ‘SYSTEM_ATTACH_GUI’.
* break-point.

data: abaplist like abaplist occurs 1 with header line.
data: lhtml like W3HTML occurs 1 with header line.

DATA: matnr like mara-matnr.

refresh html.

* Process all material numbers, append html lists
loop at tmat.
  matnr = tmat.

* Add leading 000…
  if matnr co ‘ 0123456789′.
    unpack matnr to matnr.
  endif.

* Produce report
  Submit RMMMBEST
    exporting list to memory
    and return
      with MS_MATNR EQ matnr.

* get list from memory
  CALL FUNCTION ‘LIST_FROM_MEMORY’
     TABLES
        LISTOBJECT = abaplist.

* and convert to html
  CALL FUNCTION ‘WWW_HTML_FROM_LISTOBJECT’
     TABLES
        HTML = lhtml
        LISTOBJECT = abaplist.

  Append lines of lhtml to html.

endloop.
ENDFUNCTION.

 

Listen in HTML-Format anzeigen