The "sales" report shows the annual sales for the last 5 years of chosen customers.

Getting the data

We take the data for the sales statistics from SAP table S001 which is part of the sales information system (VIS).
The materialnumber is part of the key for this standard table, but we don't need this.
In order to reduce the bulk of what we have to read we can define our own statistics table within the VIS, e.g. "S950" that looks similar to S001 but without the material number. Then we can read the sales data from that table instead.

We read the data from the CIS ABAP interface:
 ' Report Sales1
Public Function CreateReportSales1(ByVal keys _
     As Dictionary(Of String, String), _
ByVal id As String, _
ByVal customernumbers() As String, _
ByVal customernames() As String) As String

        ' We use CIS addon ABAP function to read the VIS statistics

        ' Clear input/output

        ' Build up input
        Dim s As addonsimplestring = DirectCast(rfc_input.AddNew(),_
        s.content = GetItem(keys, "VKORG")

        s = DirectCast(rfc_input.AddNew(), addonsimplestring)
        s.content = GetItem(keys, "VTWEG")

        s = DirectCast(rfc_input.AddNew(), addonsimplestring)
        s.content = GetItem(keys, "SPART")

        ' following parameters: customer numbers
        For Each cn As String In customernumbers
            s = DirectCast(rfc_input.AddNew(), addonsimplestring)
            s.content = cn

        ' Request data
        ic.RfcRequest("CISADDON.VIS01", "S", rfc_input, rfc_output, _

        ' execute all requests (one only in our case)



Within the ABAP method we recieve the organizational keys VKORG, VTWEG, SPART and then the selected customer numbers.
For performance purposes it is important not to call a select statement for each customer number, but to request all customer numbers with one single select statement. Therefore we use the option "for all entries in table" of the ABAP select statement.

The crux of our ABAP coding is the following:


data: begin of r1 occurs 10,
          kunnr  like s001-kunnr,
          spmon  like s001-spmon,
          umnetwr like s001-umnetwr,
          stwae   like  s001-stwae,
        end of r1.
  Select kunnr spmon umnetwr stwae
           from S001
             into corresponding fields of table r1
               for all entries in customers
              where kunnr = customers-kunnr
              and   vkorg = vkorg
              and   vtweg = vtweg
              and   spart = spart
              and   spmon GE spmon.


Please have a look at the ABAP function module /GUIXT/CISADDON_INTERFACE, which is shipped with CIS mobile, for more details.


The output table will be built up as an HTML string. We use CSS for choosing the font, margins, colors etc. Here is a typical part of our VB.NET coding:
 ' Buld up HTML output table
        Dim sb As New StringBuilder

        sb.Append("<div style='width:700px; font-size:12pt; 
        font-weight:bold; margin: 10px 0px 10px 5px; 
        AppendString(sb, ic.MessageText("REPORT_SALES_TITLE1")
        & year4 & " - " & year0 & ic.MessageText

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

        ' customer number
        sb.Append("<div class='colhead' style='float:left; 
              text-align:left; width:80px;'>")
        AppendString(sb, ic.MessageText("REPORT_SALES_COL1"))

        ' customer
        sb.Append("<div class='colhead' style='float:left; 
                text-align:left; width:190px; margin-right:4px;'>")
        AppendString(sb, ic.MessageText("REPORT_SALES_COL2"))

        ' year4
        sb.Append("<div class='colhead' style='float:left; 
                      text-align:right; width:80px;'>")

        ' year3
        sb.Append("<div class='colhead' style='float:left; 
                       text-align:right; width:80px;'>")


Additional parameters

No additional parameters