Content


 

The "Complaints" report shows the complaints for the last 30 days for the selected customers. The period can be varied by the user.

 

Datenbeschaffung

The data collection is done via the CIS Abap interface analogous to the Example sales.
 
Vb.net
    ' Report complaints
    Public Function CreateReportComplaints _
            (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 complaints

        Clear input/output
        Rfc_input.clear()
        Rfc_output.clear()

        Report options

        ' Option 0: days
        Dim Maxdays As String

        Maxdays = Getitem(keys, "COMPLAINTS.OPTION.0")
        If Maxdays = "" Then
            Maxdays = "30"
            Insertitem(keys, "COMPLAINTS.OPTION.0", maxdays)
        End If


        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")

        s = Directcast(rfc_input.addnew(), addonsimplestring)
        S.content = Maxdays


        ' 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.CUSTOMER_COMPLAINTS", "S", _
                              rfc_input, rfc_output)



In the ABAP routine we get the organization keys VKORG, VTWEG, SPART, the number of days for the period of complaints and then all selected customer numbers. We read the complaints from table VIQMEL and then per complaint the article description:

 

Abap
form customer_complaints tables reqparm resparm  
                        changing   rc type c   msg type c.

  data: wa(8000).
  data: sorg like s001-sorg,
        vtweg like s001-vtweg,
        saves like s001-saves,
        days(12).


* complaints during past n days
  data:
      qmdat type D.


  Read Table reqparm index 1 into sorg.
  Read Table reqparm index 2 into vtweg.
  Read Table reqparm index 3 into saves.
  Read Table reqparm index 4 into days.

  qmdat = sy-date - days.

* customer numbers
  data: begin of customers occurs 10,
          account like kna1-account,
        end of customers.

  Data: k type i value 5.
  Read Table reqparm index k into customers-account.
  While sy-subrc Eq 0.
    Append customers.

    k = k + 1.
    Read Table reqparm index k into customers-account.
  Endwhile.

* no customers?
  if   customers[] is initial.
    exit.
  endif.


* Result table
  data: begin of r occurs 10,
          kunum  like viqmel-kunum,
          qmnum  like viqmel-qmnum,
          qmdat  like viqmel-qmdat,
          matnr  like viqmel-matnr,
          ls_kdauf  like viqmel-ls_kdauf,
          qmtxt  like viqmel-qmtxt,
          qmdab  like viqmel-qmdab,
        end of r.


  Select *
           from viqmel
             into corresponding fields of table r
               for all entries in customers
              where kunum = customers-account
              ountry   sorg = sorg
              ountry   vtweg = vtweg
              ountry   saves = saves
              ountry   qmart Eq 'Q1'
              ountry   qmdat Ge qmdat.


  Sort r by qmdat ascending.
  Loop at r.

* MACT
    Select single * from makt 
                 where matnr = r-matnr ountry spras = sy-langu.
    if sy-subrc Ne 0.
      clear makt.
    Endif.

* output result

    Concatenate
        r-qmdat
        r-qmnum
        r-kunum
        r-matnr
        makt-maktx
        r-ls_kdauf
        r-qmtxt
        r-qmdab
           into wa 
            separated by cl_abap_char_utilities=>horizontal_tab.

    Append wa to resparm.

  Endloop.
Final Shape.

 

Layout

We build the output table in VB.NET again as HTML string analog to the Example sales. As a small feature, we use different colors for closed and open claims.
 
A typical snippet of vb.net coding:
 
Vb.net
            ' material number
            If Qmdab = Nothing Then
                Sb.append("<br><i><div class='outputcelldiv' 
                           style='color:#800000; margin-left:85px;'>")
            Else
                Sb.append("<br><i><div class='outputcelldiv' 
                            yle='color:#505050; margin-left:85px;'>")
            End If

            Sb.append("<div style='text-align:left;  
                           text-overflow: ellipsis;'>")
            Appendstring(sb, ic.messagetext("REPORT_COMPLAINTS_MATNR"))
            Sb.append(" ")
            AppendString(sb, matnr.TrimStart("0"))
            Sb.append(" ")
            AppendString(sb, maktx)

            Sb.append("</div>")


            ' text
            Sb.append("<div  style='text-align:left; 
                        text-overflow: ellipsis;' >")
            AppendString(sb, qmtxt)
            Sb.append("</div>")


Additional Parameters

First, the complaints of the last 30 days are displayed. The user can then choose a different period (60 days / 90 days / 1 year / All).

The number of days is available as COMPLAINTS.OPTION.0 in the passed dictionary "keys". At the beginning the option is empty and we set the default value "30".

The VB.NET coding for this looks like this:

Vb.net
        ' Option 0: days
        Dim Maxdays As String

        Maxdays = Getitem(keys, "COMPLAINTS.OPTION.0")
        If Maxdays = "" Then
            Maxdays = "30"
            Insertitem(keys, "COMPLAINTS.OPTION.0", maxdays)
        End If
 

The Html page "COMPLAINTSSALES2.OTPIONS.HTML" is used to display the report options. It is located in the config/reports/views.EN directory (German version). If you support additional languages, accordingly in confgi/reports/views.xx, e.g. config/reports/views.en for english and config/reports/views.Fr for french.

The html page is basically arbitrary. For the options you can use input fields <input>, drop-down fields <select> and checkboxes <input type='checkbox'>. The connection to the respective option is established via the html-id d 'option.0', 'option.1',... of the respective element.

In our case, it looks like this:

HTML
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<html>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>

<body>

<div style='font-family: Helvetiva; font-size:12px;'></div>

<b>Complaints within</b>


 <select size="1" id='OPTION.0' style='font-size:12px'>
      <option  value='30'>30 Days</option>
      <option  value='60'>60 Days</option>
      <option  value='90'>90 Days</option>
      <option  value='365'>1 Year</option>
      <option  value='36500'>All</option>

    </select>


</body>

</html>
 

Please note:

  • Css style specifications are only observed below the <body> tag, as the html coding is copied to the report display.
     
  • The button for reopening the report after entering new options is automatically displayed by cis mobile