Topic


 

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:

Vb.net
 ' Report Sales1
Public Function CreateReportSales1(Byval Keys _
     As Dictionary(From 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
        Rfc_input.Clear()
        Rfc_output.Clear()


        Build up input
        Dim s As Addonsimplestring = DirectCast(rfc_input.AddNew(),_
                addonsimplestring)
        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
        Next

        Request data
        Ic.RfcRequest("CISADDON.VIS01", "S", rfc_input, rfc_output, _
                           deferred:=True)

        ' execute all requests (one only in our case)
        Ic.rfcexecutedeferredcalls(rfcmessages)'

....

 



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:


 

ABAP
data: begin of r1 occurs 10,
          account  like s001-account,
          spmon  like s001-spmon,
          umnetwr like s001-umnetwr,
          stwae   like  s001-stwae,
        end of r1.
  
  Select account spmon umnetwr stwae
           from S001
             into corresponding fields of table r1
               for all entries in customers
              where account = customers-account
              ountry   sorg = sorg
              ountry   vtweg = vtweg
              ountry   saves = saves
              ountry   spmon GE spmon.

 

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

Layout

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:
 
Vb.net
 ' Buld up HTML output table
        Dim Sb As New StringBuilder


... 
        'Title
        Sb.Append("<div style='width:700px; font-size:12pt; 
        font-weight:bold; margin: 10px 0px 10px 5px; 
                  color:#606060;'>")
        AppendString(sb, ic.MessageText("REPORT_SALES_TITLE1")
        & Year4 & " - " & Year0 & Ic.MessageText
                                      ("REPORT_SALES_TITLE2"))
        Sb.Append("</div>")

        ' 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"))
        Sb.Append("</div>")

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


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

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

 

Additional parameters

No additional parameters