Show TOC

Example 1: Using the User Master RecordLocate this document in the navigation structure

 Example 1: Using the User Master Record

Use

This is an example of ABAP code that is used to read accounting data for a specific account.

The statistics of the current day are read from all the available application servers, using the user account assignment from the user master record.

Example

REPORT ZACCDEMO.

* read the accounting data using the user-account relation

* defined in the user master records

* table with cumulated statistics

DATA BEGIN OF ACCOUNT_STATISTIC OCCURS 10.

INCLUDE STRUCTURE SAPWLACCTS.

DATA END OF ACCOUNT_STATISTIC.

* read the accounting data

CALL FUNCTION 'SAPWL_ACCNT_GET_SYSTEM_USAGE'

EXPORTING

PERIODTYPE = 'D' "daily statistics

" HOSTID = "of all available servers

STARTDATE = SY-DATUM "from today

" CUMULATION_MODE = 'A' "cumulate data for accts

" CLIENT =

TABLES

STATISTIC = ACCOUNT_STATISTIC

" USER_ACCOUNT_RELATION = "use user master records

EXCEPTIONS

UNKNOWN_PERIODTYPE = 01

UNKNOWN_CUMULATION_MODE = 02

WRONG_CLIENT_DESCRIPTION = 03

WRONG_STARTDATE = 04

NO_DATA_FOUND = 05.

 

See also:

 

Example 2: Not Using the User Master Record