Exercise 4: Display R/3 Data 

Procedure

  1. In the Visual Basic Editor, add a new module to the current project.
  2. In this module, define a new function display_customers, which as parameters contains the customer name, the output table, the first line and the last column.
    Format the output table and display the data.
    Enter the following lines:

Sub display_customers(aName As String, ByRef customers_table As Object, start_zeil As Integer, ByRef end_col As Integer)

 

'

'Show table header

'

Cells(start_zeil, 1) = "Customer number "

Cells(start_zeil, 2) = "Form "

Cells(start_zeil, 3) = "Customer name " + aName

Cells(start_zeil, 4) = "ZIP"

Cells(start_zeil, 5) = "City"

Cells(start_zeil, 6) = "Tel.No "

 

'Highlight the fonts

Range(Cells(start_zeil, 1), Cells(start_zeil, 6)).Font.Bold = True

 

'

'Display contents of customer table

'

 

bManyCustomers = False

If (bManyCustomers = False) Then

i = start_zeil + 2

For Each Customer In customers_table.Rows

Cells(i, 1) = Trim(Customer("KUNNR"))

Cells(i, 2) = Customer("ANRED")

Cells(i, 3) = Customer("NAME1")

Cells(i, 4) = Customer("PSTLZ")

Cells(i, 5) = Customer("ORT01")

Cells(i, 6) = Customer("TELF1")

i = i + 1

Next

End If

 

end_col = i

 

End Sub

 

 

How to Continue

Exercise 5: Terminate Program