Display complaints about an article

In this example will add information concerning quality management in CIS mobile: Complaints (e.g. due to defective, damaged, deficient, wrongly ordered or wrongly delivered goods). This information always relates to an existing product and can be displayed  via transaction QM03 in the SAP GUI. It is essential that out of office field service employees be aware of any ongoing complaints about a product.

Transaction QM03

Complaints as additional
product information

No complaints for this product


Step 1:
Show placeholders for addons

Go to settings, activate the test output for add-ons (placeholders) and then navigate to the position where you want to display additional information. In this example the placeholder "MaterialsButton2" should be replaced by the possibility for the user to display a list of complaints about a product. The method that needs to be implemented in VB.net will therefore be called "BuildMaterialButtons2".

Settings for
add-ons in CIS mobile

places for the new add-on

Step 2:
Check the keys for the request

Click on one of the colored placeholders to display a list of all keys and their values that are available in this position. We only need the number of the product (MATNR) to retrieve the information about complaints from table QMEL (Quality Notification) via RfcDatabaseSelect. 

Available keys and values for material P-103

Step 3:
Mapping SAP tables

All data that we need in this example is saved in SAP table QMEL. So we let the S10 repository generate a vb.net class from that table and add it to our add-on project. We add an example of that class (s10 folder) to the class add-on, also in the repository. We will use this folder later (step 4, line 10) in vb.net to request the data via rfcDatabaseSelect.

Show contents of a table via SE11 (menu utilities -> table contents -> display)

Generating a vb.net class with the s10 repository

Prepare and generate the class for using it in vb.net

Include the vb.net files in the project "s10cisaddon.sln"

Step 4:
Implementing the method in vb.net

The name of the method in vb.net refers to the name of the placeholder for the add-on and looks like this:

   ' Material Addon: Complaints and Stock
    Public Function BuildMaterialButtons2(ByVal keys As _
                               Dictionary(Of String, String), _ 
    ByRef buttons As String) As String

The dictionary object "keys" allows us to access the key-value pairs mentioned in step 3. The textstring "buttons" can be used to offer another (+) symbol to unfold further information, in this example complaints about a product.

We add two (+) symbols at the same time in the method; now a stock overview can be displayed as well (see example 4).

The code for creating a new (+) unfold-button looks like this:
"Name of the method to be called" | "text in CIS mobile for the button" | "text of the processingmessage" , "Method 2" | "Text2" | "processingmessage2" , etc.

The name of our method here is "BuildMaterialButtons2" and simply consists of a definition of a SELECT statement, the call and the return of an HTML5 formatted textstring. The content of the table will be saved into the object al_qmel which is an s10folder, type QMEL, that we created in step 3.

   Public Function BuildMaterialComplaints(ByVal keys As _
              Dictionary(Of String, String), ByRef buttons As String) As String

        ' where-condition for SAP Select
        Dim where As String = ""
        where &= "VKORG = '" & GetItem(keys, "VKORG") & "'"
        where &= " AND VTWEG = '" & GetItem(keys, "VTWEG") & "'"
        where &= " AND SPART = '" & GetItem(keys, "SPART") & "'"
        where &= " AND MATNR = '" & GetItem(keys, "MATNR") & "'"


        ' sort by date descending

        ' Build HTML tabular output
        Dim sb As New StringBuilder

        ' column headings
        sb.Append("<div class='colhead01' style='width:800px; 
                                          font-size:10pt; margin-bottom:4px;'>")

        ' <...>

        Return sb.ToString

    End Function