...

Reference: PROC032.DOC (Word 7.0a) Title:

by user

on
Category: Documents
35

views

Report

Comments

Transcript

Reference: PROC032.DOC (Word 7.0a) Title:
Reference:
Title:
Author:
Date:
Version:
SAP Version:
PROC032.DOC (Word 7.0a)
Common Programming Procedures
Richard Harper
November '99
5.0
30F...40F
Introduction.
This document details the procedures available within a series of include files called YRBINC, YREPINC, YBDCINC
and YGRAPH. They are common utilities for Reporting utilities, BDC utilities and Graphing utilities respectively.
These routines are written so that the maintenance aspect of using them within any program is minimal. Parameters are
passed to and from the routines using arguments to the procedure call. This eliminates the need to know the internal
structure of the various routines providing ‘Black Box’ programming.
The following pages of this document detail one routine per page.
Table Of Contents
1.
ABOUT THIS DOCUMENT. ...................................................................................................... 21
1.1.
1.2.
PROCEDURE FORMAT. ............................................................................................................. 21
RUNNING THE MACRO.............................................................................................................. 23
2.
USING THE ROUTINES. ........................................................................................................... 24
3.
DEPENDANCIES ......................................................................................................................... 28
4.
BDC OPERATIONS. ................................................................................................................... 29
4.1.
4.2.
4.3.
4.4.
4.5.
4.6.
4.7.
4.8.
4.9.
4.10.
5.
MANDT. ................................................................................................................................ 29
FUNCNAME .......................................................................................................................... 29
BDCMODE. ........................................................................................................................... 29
BDCUPMODE. ...................................................................................................................... 29
CRBATCH. ............................................................................................................................ 29
INHIBITCHK. ........................................................................................................................ 29
DUMPBDC. ........................................................................................................................... 30
DUMPMSG. ........................................................................................................................... 30
GENMAIL. ............................................................................................................................. 30
MAILPROG. .......................................................................................................................... 30
MACROS AND FORMS. ............................................................................................................ 31
5.1.
AN EXAMPLE. .......................................................................................................................... 31
6.
DRILL DOWN REPORTS. ......................................................................................................... 33
7.
ARRAYS. ...................................................................................................................................... 34
7.1. TABLES WITHIN TABLES. ........................................................................................................ 34
7.1.1.
Defining An Array. ......................................................................................................... 34
7.1.2.
Accessing An Array. ....................................................................................................... 34
8.
SELECT-OPTIONS. .................................................................................................................... 36
9.
AUTHORISATION CHECKS. ................................................................................................... 37
10.
SUB-TOTALS. .......................................................................................................................... 38
11.
REAL-TIME DISPLAYS......................................................................................................... 39
11.1. PUSHING KEYS IN ABAP. ........................................................................................................ 39
Page 1
12.
INFORMATION SOURCES. .................................................................................................. 40
13.
ADDRANGE, ADDDISCRETE, ADDCONSEC - MACROS ............................................. 41
13.1. LOCATION. .............................................................................................................................. 41
13.2. PURPOSE.................................................................................................................................. 41
13.3. ENTRY. .................................................................................................................................... 41
13.3.1.
Item To Add. ............................................................................................................... 41
13.3.2.
Range Table to add to. ................................................................................................ 41
13.3.3.
Item High, Item Low. ................................................................................................. 41
13.4. EXIT. ....................................................................................................................................... 41
13.5. CALLED BY. ............................................................................................................................ 41
13.6. CALLS...................................................................................................................................... 41
13.7. TABLES.................................................................................................................................... 41
13.8. SYSTEM VARIABLES. ............................................................................................................... 41
13.9. DESCRIPTION. .......................................................................................................................... 41
13.10.
EXAMPLES. .......................................................................................................................... 41
13.11.
SOURCE. .............................................................................................................................. 42
13.12.
SEE ALSO. ........................................................................................................................... 42
14.
BEGIN_OF_BLOCK, END_OF_BLOCK - MACROS ........................................................ 43
14.1. LOCATION. .............................................................................................................................. 43
14.2. PURPOSE.................................................................................................................................. 43
14.3. ENTRY ..................................................................................................................................... 43
14.3.1.
Begin_Of_Block - Block name and Frame title. ......................................................... 43
14.3.2.
End_Of_Block - Block name .................................................................................... 43
14.4. EXIT ........................................................................................................................................ 43
14.5. CALLED BY ............................................................................................................................. 43
14.6. CALLS...................................................................................................................................... 43
14.7. TABLES.................................................................................................................................... 43
14.8. SYSTEM VARIABLES. ............................................................................................................... 43
14.9. DESCRIPTION. .......................................................................................................................... 43
14.10.
EXAMPLES. .......................................................................................................................... 43
14.11.
SOURCE. .............................................................................................................................. 43
14.12.
SEE ALSO. ........................................................................................................................... 45
15.
BLANKLINE - MACRO ......................................................................................................... 46
15.1.
15.2.
15.3.
15.4.
15.5.
15.6.
15.7.
15.8.
15.9.
15.10.
15.11.
15.12.
16.
LOCATION. .............................................................................................................................. 46
PURPOSE.................................................................................................................................. 46
ENTRY. .................................................................................................................................... 46
EXIT. ....................................................................................................................................... 46
CALLED BY. ............................................................................................................................ 46
CALLS...................................................................................................................................... 46
TABLES.................................................................................................................................... 46
SYSTEM VARIABLES. ............................................................................................................... 46
DESCRIPTION. .......................................................................................................................... 46
EXAMPLES. .......................................................................................................................... 46
SOURCECODE. ..................................................................................................................... 46
SEE ALSO. ........................................................................................................................... 46
CHECKLEFT, CHECKRIGHT - MACRO ........................................................................... 47
16.1. LOCATION. .............................................................................................................................. 47
16.2. PURPOSE.................................................................................................................................. 47
16.3. ENTRY. .................................................................................................................................... 47
16.3.1.
Position. ...................................................................................................................... 47
16.3.2.
Title Length. ................................................................................................................ 47
16.3.3.
Title ............................................................................................................................. 47
16.3.4.
Parameter ................................................................................................................... 47
16.4. EXIT. ....................................................................................................................................... 47
Page 2
16.5.
16.6.
16.7.
16.8.
16.9.
16.10.
16.11.
16.12.
17.
CALLED BY. ............................................................................................................................ 47
CALLS...................................................................................................................................... 47
TABLES.................................................................................................................................... 47
SYSTEM VARIABLES. ............................................................................................................... 47
DESCRIPTION. .......................................................................................................................... 47
EXAMPLES. .......................................................................................................................... 47
SOURCECODE. ..................................................................................................................... 48
SEE ALSO. ........................................................................................................................... 48
RADIOLEFT, RADIORIGHT - MACRO ............................................................................. 49
17.1. LOCATION. .............................................................................................................................. 49
17.2. PURPOSE.................................................................................................................................. 49
17.3. ENTRY. .................................................................................................................................... 49
17.3.1.
Position. ...................................................................................................................... 49
17.3.2.
Title Length. ................................................................................................................ 49
17.3.3.
Title ............................................................................................................................. 49
17.3.4.
Parameter ................................................................................................................... 49
17.3.5.
Group. ......................................................................................................................... 49
17.4. EXIT. ....................................................................................................................................... 49
17.5. CALLED BY. ............................................................................................................................ 49
17.6. CALLS...................................................................................................................................... 49
17.7. TABLES.................................................................................................................................... 49
17.8. SYSTEM VARIABLES. ............................................................................................................... 49
17.9. DESCRIPTION. .......................................................................................................................... 49
17.10.
EXAMPLES. .......................................................................................................................... 49
17.11.
SOURCECODE. ..................................................................................................................... 50
17.12.
SEE ALSO. ........................................................................................................................... 50
18.
COPYBOOK - MACRO .......................................................................................................... 51
18.1. LOCATION. .............................................................................................................................. 51
18.2. PURPOSE.................................................................................................................................. 51
18.3. ENTRY. .................................................................................................................................... 51
18.3.1.
Table name to use. ...................................................................................................... 51
18.4. EXIT. ....................................................................................................................................... 51
18.5. CALLED BY. ............................................................................................................................ 51
18.6. CALLS...................................................................................................................................... 51
18.7. TABLES.................................................................................................................................... 51
18.8. SYSTEM VARIABLES. ............................................................................................................... 51
18.9. DESCRIPTION. .......................................................................................................................... 51
18.10.
EXAMPLES. .......................................................................................................................... 51
18.11.
SOURCECODE. ..................................................................................................................... 51
18.12.
SEE ALSO. ........................................................................................................................... 52
19.
COPY_STRUCTURE - MACRO............................................................................................ 53
19.1. LOCATION. .............................................................................................................................. 53
19.2. PURPOSE.................................................................................................................................. 53
19.3. ENTRY. .................................................................................................................................... 53
19.3.1.
Structure Name to extract from the data dictionary. .................................................. 53
19.3.2.
Internal table name to copy strcuture to. .................................................................... 53
19.4. EXIT. ....................................................................................................................................... 53
19.5. CALLED BY. ............................................................................................................................ 53
19.6. CALLS...................................................................................................................................... 53
19.7. TABLES.................................................................................................................................... 53
19.8. SYSTEM VARIABLES. ............................................................................................................... 53
19.9. DESCRIPTION. .......................................................................................................................... 53
19.10.
EXAMPLES. .......................................................................................................................... 53
19.11.
SOURCECODE. ..................................................................................................................... 53
19.12.
SEE ALSO. ........................................................................................................................... 54
Page 3
20.
FORMAT_SELECTS - MACRO ............................................................................................ 57
20.1. LOCATION. .............................................................................................................................. 57
20.2. PURPOSE.................................................................................................................................. 57
20.3. ENTRY. .................................................................................................................................... 57
20.3.1.
Select Option Tables to use. ........................................................................................ 57
20.4. EXIT. ....................................................................................................................................... 57
20.5. CALLED BY. ............................................................................................................................ 57
20.6. CALLS...................................................................................................................................... 57
20.7. TABLES.................................................................................................................................... 57
20.8. SYSTEM VARIABLES. ............................................................................................................... 57
20.9. DESCRIPTION. .......................................................................................................................... 57
20.10.
EXAMPLES. .......................................................................................................................... 57
20.11.
SOURCECODE. ..................................................................................................................... 57
20.12.
SEE ALSO. ........................................................................................................................... 58
21.
INIT_FUNC - MACRO............................................................................................................ 59
21.1. LOCATION. .............................................................................................................................. 59
21.2. PURPOSE.................................................................................................................................. 59
21.3. ENTRY. .................................................................................................................................... 59
21.4. EXIT. ....................................................................................................................................... 59
21.5. CALLED BY. ............................................................................................................................ 59
21.6. CALLS...................................................................................................................................... 59
21.6.1.
Functions: ................................................................................................................... 59
21.6.2.
Forms: ........................................................................................................................ 59
21.7. TABLES.................................................................................................................................... 59
21.8. SYSTEM VARIABLES. ............................................................................................................... 59
21.9. DESCRIPTION. .......................................................................................................................... 59
21.10.
EXAMPLES. .......................................................................................................................... 60
21.11.
SOURCECODE. ..................................................................................................................... 60
21.12.
SEE ALSO. ........................................................................................................................... 62
22.
PSUB - MACRO ....................................................................................................................... 63
22.1. LOCATION. .............................................................................................................................. 63
22.2. PURPOSE.................................................................................................................................. 63
22.3. ENTRY. .................................................................................................................................... 63
22.3.1.
Select Option Tables to use......................................................................................... 63
22.3.2.
Description of data held in select options table.......................................................... 63
22.4. EXIT. ....................................................................................................................................... 63
22.5. CALLED BY. ............................................................................................................................ 63
22.6. CALLS...................................................................................................................................... 63
22.7. TABLES.................................................................................................................................... 63
22.8. SYSTEM VARIABLES. ............................................................................................................... 63
22.9. DESCRIPTION. .......................................................................................................................... 63
22.10.
EXAMPLES. .......................................................................................................................... 63
22.11.
SOURCECODE. ..................................................................................................................... 64
22.12.
SEE ALSO. ........................................................................................................................... 65
23.
WRITETABLE - MACRO ...................................................................................................... 66
23.1. LOCATION. .............................................................................................................................. 66
23.2. PURPOSE.................................................................................................................................. 66
23.3. ENTRY. .................................................................................................................................... 66
23.3.1.
Table to use ................................................................................................................. 66
23.3.2.
Field name of column to put text in.. .......................................................................... 66
23.4. EXIT. ....................................................................................................................................... 66
23.5. CALLED BY. ............................................................................................................................ 66
23.6. CALLS...................................................................................................................................... 66
23.7. TABLES.................................................................................................................................... 66
23.8. SYSTEM VARIABLES. ............................................................................................................... 66
Page 4
23.9. DESCRIPTION. .......................................................................................................................... 66
23.10.
EXAMPLES. .......................................................................................................................... 66
23.11.
SOURCECODE. ..................................................................................................................... 66
23.12.
SEE ALSO. ........................................................................................................................... 67
24.
ZAP - MACRO ......................................................................................................................... 68
24.1. LOCATION. .............................................................................................................................. 68
24.2. PURPOSE.................................................................................................................................. 68
24.3. ENTRY. .................................................................................................................................... 68
24.3.1.
Table to clear .............................................................................................................. 68
24.4. EXIT. ....................................................................................................................................... 68
24.5. CALLED BY. ............................................................................................................................ 68
24.6. CALLS...................................................................................................................................... 68
24.7. TABLES.................................................................................................................................... 68
24.8. SYSTEM VARIABLES. ............................................................................................................... 68
24.9. DESCRIPTION. .......................................................................................................................... 68
24.10.
EXAMPLES. .......................................................................................................................... 68
24.11.
SOURCECODE. ..................................................................................................................... 68
24.12.
SEE ALSO. ........................................................................................................................... 69
25.
ALLHDRS ................................................................................................................................. 70
25.1.
25.2.
25.3.
25.4.
25.5.
25.6.
25.7.
25.8.
25.9.
25.10.
25.11.
25.12.
26.
LOCATION. .............................................................................................................................. 70
PURPOSE.................................................................................................................................. 70
ENTRY. .................................................................................................................................... 70
EXIT. ....................................................................................................................................... 70
CALLED BY. ............................................................................................................................ 70
CALLS...................................................................................................................................... 70
TABLES.................................................................................................................................... 70
SYSTEM VARIABLES. ............................................................................................................... 70
DESCRIPTION. .......................................................................................................................... 70
EXAMPLES. .......................................................................................................................... 70
SOURCECODE. ..................................................................................................................... 70
SEE ALSO. ........................................................................................................................... 71
ASCCHAR ................................................................................................................................ 72
26.1. LOCATION. .............................................................................................................................. 72
26.2. PURPOSE.................................................................................................................................. 72
26.3. ENTRY. .................................................................................................................................... 72
26.3.1.
Character to return Ascii code for .............................................................................. 72
26.4. EXIT. ....................................................................................................................................... 72
26.5. CALLED BY. ............................................................................................................................ 72
26.6. CALLS...................................................................................................................................... 72
26.7. TABLES.................................................................................................................................... 72
26.8. SYSTEM VARIABLES. ............................................................................................................... 72
26.9. DESCRIPTION. .......................................................................................................................... 72
26.10.
EXAMPLES. .......................................................................................................................... 72
26.11.
SOURCECODE. ..................................................................................................................... 72
26.12.
SEE ALSO. ........................................................................................................................... 73
27.
BUILDREPORT ....................................................................................................................... 74
27.1. LOCATION. .............................................................................................................................. 74
27.2. PURPOSE.................................................................................................................................. 74
27.3. ENTRY. .................................................................................................................................... 74
27.3.1.
Data-field name. ......................................................................................................... 74
27.3.2.
Data field title. ............................................................................................................ 74
27.3.3.
Data field length. ........................................................................................................ 74
27.3.4.
FormatType. 'Unit' or 'Currency' or Format mask. ................................................... 74
27.3.5.
Format field. ............................................................................................................... 78
27.4. EXIT. ....................................................................................................................................... 79
Page 5
27.5.
27.6.
27.7.
27.8.
27.9.
27.10.
27.11.
27.12.
28.
CALLED BY. ............................................................................................................................ 79
CALLS...................................................................................................................................... 79
TABLES.................................................................................................................................... 79
SYSTEM VARIABLES. ............................................................................................................... 79
DESCRIPTION. .......................................................................................................................... 79
EXAMPLES. .......................................................................................................................... 80
SOURCECODE. ..................................................................................................................... 80
SEE ALSO. ........................................................................................................................... 82
CENTREREPORT ................................................................................................................... 83
28.1. LOCATION. .............................................................................................................................. 83
28.2. PURPOSE.................................................................................................................................. 83
28.3. ENTRY. .................................................................................................................................... 83
28.3.1.
True or False .............................................................................................................. 83
28.4. EXIT. ....................................................................................................................................... 83
28.5. CALLED BY. ............................................................................................................................ 83
28.6. CALLS...................................................................................................................................... 83
28.7. TABLES.................................................................................................................................... 83
28.8. SYSTEM VARIABLES. ............................................................................................................... 83
28.9. DESCRIPTION. .......................................................................................................................... 83
28.10.
EXAMPLES. .......................................................................................................................... 83
28.11.
SOURCECODE. ..................................................................................................................... 83
28.12.
SEE ALSO. ........................................................................................................................... 84
29.
CHECKBOX ............................................................................................................................. 85
29.1. LOCATION. .............................................................................................................................. 85
29.2. PURPOSE.................................................................................................................................. 85
29.3. ENTRY. .................................................................................................................................... 85
29.3.1.
Data-field table. .......................................................................................................... 85
29.3.2.
Data field title. ............................................................................................................ 85
29.3.3.
Data field length. ........................................................................................................ 85
29.4. EXIT. ....................................................................................................................................... 85
29.5. CALLED BY. ............................................................................................................................ 85
29.6. CALLS...................................................................................................................................... 85
29.7. TABLES.................................................................................................................................... 85
29.8. SYSTEM VARIABLES. ............................................................................................................... 85
29.9. DESCRIPTION. .......................................................................................................................... 86
29.10.
EXAMPLES. .......................................................................................................................... 86
29.11.
SOURCECODE. ..................................................................................................................... 86
29.12.
SEE ALSO. ........................................................................................................................... 87
30.
CHECKBREAKS ..................................................................................................................... 88
30.1.
30.2.
30.3.
30.4.
30.5.
30.6.
30.7.
30.8.
30.9.
30.10.
30.11.
30.12.
31.
LOCATION. .............................................................................................................................. 88
PURPOSE.................................................................................................................................. 88
ENTRY. .................................................................................................................................... 88
EXIT. ....................................................................................................................................... 88
CALLED BY. ............................................................................................................................ 88
CALLS...................................................................................................................................... 88
TABLES.................................................................................................................................... 88
SYSTEM VARIABLES. ............................................................................................................... 88
DESCRIPTION. .......................................................................................................................... 88
EXAMPLES. .......................................................................................................................... 88
SOURCECODE. ..................................................................................................................... 88
SEE ALSO. ........................................................................................................................... 90
CHECK_DOMAIN_VALUES ................................................................................................ 91
31.1. LOCATION. .............................................................................................................................. 91
31.2. PURPOSE.................................................................................................................................. 91
31.3. ENTRY. .................................................................................................................................... 91
Page 6
31.3.1.
Domain Name To Check ............................................................................................. 91
31.3.2.
Value To Check ........................................................................................................... 91
31.4. EXIT. ....................................................................................................................................... 91
31.5. CALLED BY. ............................................................................................................................ 91
31.6. CALLS...................................................................................................................................... 91
31.7. TABLES.................................................................................................................................... 91
31.8. SYSTEM VARIABLES. ............................................................................................................... 91
31.9. DESCRIPTION. .......................................................................................................................... 91
31.10.
EXAMPLES. .......................................................................................................................... 91
31.11.
SOURCECODE. ..................................................................................................................... 91
31.12.
SEE ALSO. ........................................................................................................................... 92
32.
COLUMN_COLOUR .............................................................................................................. 93
32.1. LOCATION. .............................................................................................................................. 93
32.2. PURPOSE.................................................................................................................................. 93
32.3. ENTRY. .................................................................................................................................... 93
32.3.1.
Column width .............................................................................................................. 93
32.3.2.
Colour to set ............................................................................................................... 93
32.3.3.
Value to write.............................................................................................................. 93
32.3.4.
Actual colour code to use. .......................................................................................... 93
32.4. EXIT. ....................................................................................................................................... 93
32.5. CALLED BY. ............................................................................................................................ 93
32.6. CALLS...................................................................................................................................... 93
32.7. TABLES.................................................................................................................................... 93
32.8. SYSTEM VARIABLES. ............................................................................................................... 93
32.9. DESCRIPTION. .......................................................................................................................... 93
32.10.
EXAMPLES. .......................................................................................................................... 93
32.11.
SOURCECODE. ..................................................................................................................... 94
32.12.
SEE ALSO. ........................................................................................................................... 94
33.
DUMP_TABLE......................................................................................................................... 95
33.1. LOCATION. .............................................................................................................................. 95
33.2. PURPOSE.................................................................................................................................. 95
33.3. ENTRY. .................................................................................................................................... 95
33.3.1.
None ............................................................................................................................ 95
33.3.2.
Tables:
Unstructured table for dump .................................................................. 95
33.4. EXIT. ....................................................................................................................................... 95
33.4.1.
None ............................................................................................................................ 95
33.5. CALLED BY. ............................................................................................................................ 95
33.6. CALLS...................................................................................................................................... 95
33.7. TABLES.................................................................................................................................... 95
33.8. SYSTEM VARIABLES. ............................................................................................................... 95
33.9. DESCRIPTION. .......................................................................................................................... 95
33.10.
EXAMPLES. .......................................................................................................................... 95
33.11.
SOURCECODE. ..................................................................................................................... 96
33.12.
SEE ALSO. ........................................................................................................................... 96
33.13.
LOCATION. .......................................................................................................................... 97
33.14.
PURPOSE.............................................................................................................................. 97
33.15.
ENTRY. ................................................................................................................................ 97
33.15.1.
Direction to move the first column of the report. ........................................................ 97
33.16.
EXIT. ................................................................................................................................... 97
33.17.
CALLED BY. ........................................................................................................................ 97
33.18.
CALLS.................................................................................................................................. 97
33.19.
TABLES................................................................................................................................ 97
33.20.
SYSTEM VARIABLES. ........................................................................................................... 97
33.21.
DESCRIPTION. ...................................................................................................................... 97
33.22.
EXAMPLES. .......................................................................................................................... 97
33.23.
SOURCECODE. ..................................................................................................................... 98
33.24.
SEE ALSO. ........................................................................................................................... 98
Page 7
34.
FORMATKEY .......................................................................................................................... 99
34.1. LOCATION. .............................................................................................................................. 99
34.2. PURPOSE.................................................................................................................................. 99
34.3. ENTRY. .................................................................................................................................... 99
34.3.1.
Value to format ........................................................................................................... 99
34.4. EXIT. ....................................................................................................................................... 99
34.4.1.
Formatted value .......................................................................................................... 99
34.5. CALLED BY. ............................................................................................................................ 99
34.6. CALLS...................................................................................................................................... 99
34.7. TABLES.................................................................................................................................... 99
34.8. SYSTEM VARIABLES. ............................................................................................................... 99
34.9. DESCRIPTION. .......................................................................................................................... 99
34.10.
EXAMPLES. .......................................................................................................................... 99
34.11.
SOURCECODE. ..................................................................................................................... 99
34.12.
SEE ALSO. ......................................................................................................................... 100
35.
FORMATREPORT ................................................................................................................ 101
35.1.
35.2.
35.3.
35.4.
35.5.
35.6.
35.7.
35.8.
35.9.
35.10.
35.11.
35.12.
36.
LOCATION. ............................................................................................................................ 101
PURPOSE................................................................................................................................ 101
ENTRY. .................................................................................................................................. 101
EXIT. ..................................................................................................................................... 101
CALLED BY. .......................................................................................................................... 101
CALLS.................................................................................................................................... 101
TABLES.................................................................................................................................. 101
SYSTEM VARIABLES. ............................................................................................................. 101
DESCRIPTION. ........................................................................................................................ 101
EXAMPLES. ........................................................................................................................ 101
SOURCECODE. ................................................................................................................... 101
SEE ALSO. ......................................................................................................................... 103
GETMASK .............................................................................................................................. 104
36.1. LOCATION. ............................................................................................................................ 104
36.2. PURPOSE................................................................................................................................ 104
36.3. ENTRY. .................................................................................................................................. 104
36.3.1.
Variable or literal mask ............................................................................................ 104
36.4. EXIT. ..................................................................................................................................... 104
36.4.1.
Actual mask to use. ................................................................................................... 104
36.5. CALLED BY. .......................................................................................................................... 104
36.6. CALLS.................................................................................................................................... 104
36.7. TABLES.................................................................................................................................. 104
36.8. SYSTEM VARIABLES. ............................................................................................................. 104
36.9. DESCRIPTION. ........................................................................................................................ 104
36.10.
EXAMPLES. ........................................................................................................................ 104
36.11.
SOURCECODE. ................................................................................................................... 105
36.12.
SEE ALSO. ......................................................................................................................... 105
37.
GET_LOCAL_HOST............................................................................................................. 106
37.1. LOCATION. ............................................................................................................................ 106
37.2. PURPOSE................................................................................................................................ 106
37.3. ENTRY. .................................................................................................................................. 106
37.4. EXIT. ..................................................................................................................................... 106
37.4.1.
Host Name ................................................................................................................ 106
37.4.2.
Server Name ............................................................................................................. 106
37.5. CALLED BY. .......................................................................................................................... 106
37.6. CALLS.................................................................................................................................... 106
37.7. TABLES.................................................................................................................................. 106
37.8. SYSTEM VARIABLES. ............................................................................................................. 106
37.9. DESCRIPTION. ........................................................................................................................ 106
Page 8
37.10.
37.11.
37.12.
38.
EXAMPLES. ........................................................................................................................ 106
SOURCECODE. ................................................................................................................... 106
SEE ALSO. ......................................................................................................................... 107
GIVELINE .............................................................................................................................. 108
38.1. LOCATION. ............................................................................................................................ 108
38.2. PURPOSE................................................................................................................................ 108
38.3. ENTRY. .................................................................................................................................. 108
38.3.1.
Line Number of required line in text. ........................................................................ 108
38.3.2.
Width of column. ....................................................................................................... 108
38.3.3.
Text to split ............................................................................................................... 108
38.4. EXIT. ..................................................................................................................................... 108
38.4.1.
Line N ....................................................................................................................... 108
38.5. CALLED BY. .......................................................................................................................... 108
38.6. CALLS.................................................................................................................................... 108
38.7. TABLES.................................................................................................................................. 108
38.8. SYSTEM VARIABLES. ............................................................................................................. 108
38.9. DESCRIPTION. ........................................................................................................................ 108
38.10.
EXAMPLES. ........................................................................................................................ 108
38.11.
SOURCECODE. ................................................................................................................... 109
38.12.
SEE ALSO. ......................................................................................................................... 110
39.
ICON, SYMBOL OR GRAPHIC ......................................................................................... 111
39.1. LOCATION. ............................................................................................................................ 111
39.2. PURPOSE................................................................................................................................ 111
39.3. ENTRY. .................................................................................................................................. 111
39.3.1.
Icon: Icon Name to print ........................................................................................ 111
39.3.2.
Symbol: Symbol Name to print ............................................................................... 111
39.3.3.
Graphic: Icon/symbol name, name type ................................................................ 111
39.4. EXIT. ..................................................................................................................................... 111
39.4.1.
None .......................................................................................................................... 111
39.5. CALLED BY. .......................................................................................................................... 111
39.6. CALLS.................................................................................................................................... 111
39.7. TABLES.................................................................................................................................. 111
39.8. SYSTEM VARIABLES. ............................................................................................................. 111
39.9. DESCRIPTION. ........................................................................................................................ 111
39.10.
EXAMPLES. ........................................................................................................................ 112
39.11.
SOURCECODE. ................................................................................................................... 112
39.12.
SEE ALSO. ......................................................................................................................... 113
40.
GROUPHEADER ................................................................................................................... 114
40.1. LOCATION. ............................................................................................................................ 114
40.2. PURPOSE................................................................................................................................ 114
40.3. ENTRY. .................................................................................................................................. 114
40.3.1.
Group Header Title................................................................................................... 114
40.3.2.
Group Header Value. ............................................................................................... 114
40.4. EXIT. ..................................................................................................................................... 114
40.5. CALLED BY. .......................................................................................................................... 114
40.6. CALLS.................................................................................................................................... 114
40.7. TABLES.................................................................................................................................. 114
40.8. SYSTEM VARIABLES. ............................................................................................................. 114
40.9. DESCRIPTION. ........................................................................................................................ 114
40.10.
EXAMPLES. ........................................................................................................................ 115
40.11.
SOURCECODE. ................................................................................................................... 115
40.12.
SEE ALSO. ......................................................................................................................... 116
41.
INITBREAK ........................................................................................................................... 117
41.1. LOCATION. ............................................................................................................................ 117
41.2. PURPOSE................................................................................................................................ 117
Page 9
41.3. ENTRY. .................................................................................................................................. 117
41.3.1.
Field to break on....................................................................................................... 117
41.3.2.
Title of field. .............................................................................................................. 117
41.4. EXIT. ..................................................................................................................................... 117
41.5. CALLED BY. .......................................................................................................................... 117
41.6. CALLS.................................................................................................................................... 117
41.7. TABLES.................................................................................................................................. 117
41.8. SYSTEM VARIABLES. ............................................................................................................. 117
41.9. DESCRIPTION. ........................................................................................................................ 117
41.10.
EXAMPLES. ........................................................................................................................ 117
41.11.
SOURCECODE. ................................................................................................................... 117
41.12.
SEE ALSO. ......................................................................................................................... 118
42.
INIT_GLOBAL ...................................................................................................................... 119
42.1.
42.2.
42.3.
42.4.
42.5.
42.6.
42.7.
42.8.
42.9.
42.10.
42.11.
42.12.
43.
LOCATION. ............................................................................................................................ 119
PURPOSE................................................................................................................................ 119
ENTRY. .................................................................................................................................. 119
EXIT. ..................................................................................................................................... 119
CALLED BY. .......................................................................................................................... 119
CALLS.................................................................................................................................... 119
TABLES.................................................................................................................................. 119
SYSTEM VARIABLES. ............................................................................................................. 119
DESCRIPTION. ........................................................................................................................ 119
EXAMPLES. ........................................................................................................................ 119
SOURCECODE. ................................................................................................................... 119
SEE ALSO. ......................................................................................................................... 121
IS_SERVICE_ACTIVE ......................................................................................................... 122
43.1. LOCATION. ............................................................................................................................ 122
43.2. PURPOSE................................................................................................................................ 122
43.3. ENTRY. .................................................................................................................................. 122
43.3.1.
Service Name to Check ............................................................................................. 122
43.4. EXIT. ..................................................................................................................................... 122
43.4.1.
True - Service Active ................................................................................................ 122
43.4.2.
False - Service not available .................................................................................... 122
43.5. CALLED BY. .......................................................................................................................... 122
43.6. CALLS.................................................................................................................................... 122
43.7. TABLES.................................................................................................................................. 122
43.8. SYSTEM VARIABLES. ............................................................................................................. 122
43.9. DESCRIPTION. ........................................................................................................................ 122
43.10.
EXAMPLES. ........................................................................................................................ 122
43.11.
SOURCECODE. ................................................................................................................... 122
43.12.
SEE ALSO. ......................................................................................................................... 123
44.
NEWBDC ................................................................................................................................ 124
44.1. LOCATION. ............................................................................................................................ 124
44.2. PURPOSE................................................................................................................................ 124
44.3. ENTRY. .................................................................................................................................. 124
44.3.1.
None .......................................................................................................................... 124
44.4. EXIT. ..................................................................................................................................... 124
44.5. CALLED BY. .......................................................................................................................... 124
44.6. CALLS.................................................................................................................................... 124
44.7. TABLES.................................................................................................................................. 124
44.8. SYSTEM VARIABLES. ............................................................................................................. 124
44.9. DESCRIPTION. ........................................................................................................................ 124
44.10.
EXAMPLES. ........................................................................................................................ 124
44.11.
SOURCECODE. ................................................................................................................... 124
44.12.
SEE ALSO. ......................................................................................................................... 125
Page 10
45.
PRINTTITLES ....................................................................................................................... 126
45.1.
45.2.
45.3.
45.4.
45.5.
45.6.
45.7.
45.8.
45.9.
45.10.
45.11.
45.12.
46.
LOCATION. ............................................................................................................................ 126
PURPOSE................................................................................................................................ 126
ENTRY. .................................................................................................................................. 126
EXIT. ..................................................................................................................................... 126
CALLED BY. .......................................................................................................................... 126
CALLS.................................................................................................................................... 126
TABLES.................................................................................................................................. 126
SYSTEM VARIABLES. ............................................................................................................. 126
DESCRIPTION. ........................................................................................................................ 126
EXAMPLES. ........................................................................................................................ 126
SOURCECODE. ................................................................................................................... 126
SEE ALSO. ......................................................................................................................... 128
PRINTTOTALS...................................................................................................................... 129
46.1. LOCATION. ............................................................................................................................ 129
46.2. PURPOSE................................................................................................................................ 129
46.3. ENTRY. .................................................................................................................................. 129
46.3.1.
Data tables to print totals for ................................................................................... 129
46.3.2.
Current total level ..................................................................................................... 129
46.4. EXIT. ..................................................................................................................................... 129
46.5. CALLED BY. .......................................................................................................................... 129
46.6. CALLS.................................................................................................................................... 129
46.7. TABLES.................................................................................................................................. 129
46.8. SYSTEM VARIABLES. ............................................................................................................. 129
46.9. DESCRIPTION. ........................................................................................................................ 129
46.10.
EXAMPLES. ........................................................................................................................ 129
46.11.
SOURCECODE. ................................................................................................................... 129
46.12.
SEE ALSO. ......................................................................................................................... 131
47.
PRG_DOC_HELP .................................................................................................................. 132
47.1.
47.2.
47.3.
47.4.
47.5.
47.6.
47.7.
47.8.
47.9.
47.10.
47.11.
47.12.
48.
READ_SCREEN_VALUES ................................................................................................... 134
48.1.
48.2.
48.3.
48.4.
48.5.
48.6.
48.7.
48.8.
48.9.
48.10.
48.11.
48.12.
49.
LOCATION. ............................................................................................................................ 132
PURPOSE................................................................................................................................ 132
ENTRY. .................................................................................................................................. 132
EXIT. ..................................................................................................................................... 132
CALLED BY. .......................................................................................................................... 132
CALLS.................................................................................................................................... 132
TABLES.................................................................................................................................. 132
SYSTEM VARIABLES. ............................................................................................................. 132
DESCRIPTION. ........................................................................................................................ 132
EXAMPLES. ........................................................................................................................ 132
SOURCECODE. ................................................................................................................... 132
SEE ALSO. ......................................................................................................................... 133
LOCATION. ............................................................................................................................ 134
PURPOSE................................................................................................................................ 134
ENTRY. .................................................................................................................................. 134
EXIT. ..................................................................................................................................... 134
CALLED BY. .......................................................................................................................... 134
CALLS.................................................................................................................................... 134
TABLES.................................................................................................................................. 134
SYSTEM VARIABLES. ............................................................................................................. 134
DESCRIPTION. ........................................................................................................................ 134
EXAMPLES. ........................................................................................................................ 134
SOURCECODE. ................................................................................................................... 134
SEE ALSO. ......................................................................................................................... 135
READ_YDCSET ..................................................................................................................... 136
Page 11
49.1. LOCATION. ............................................................................................................................ 136
49.2. PURPOSE................................................................................................................................ 136
49.3. ENTRY. .................................................................................................................................. 136
49.3.1.
Function Name ......................................................................................................... 136
49.3.2.
User Name. ............................................................................................................... 136
49.4. EXIT. ..................................................................................................................................... 136
49.4.1.
YDCSET structure populated.................................................................................... 136
49.5. CALLED BY. .......................................................................................................................... 136
49.6. CALLS.................................................................................................................................... 136
49.7. TABLES.................................................................................................................................. 136
49.8. SYSTEM VARIABLES. ............................................................................................................. 136
49.9. DESCRIPTION. ........................................................................................................................ 136
49.10. EXAMPLES. ........................................................................................................................ 136
49.11.
SOURCECODE. ................................................................................................................... 137
49.12.
SEE ALSO. ......................................................................................................................... 137
50.
REPHEADER ......................................................................................................................... 138
50.1. LOCATION. ............................................................................................................................ 138
50.2. PURPOSE................................................................................................................................ 138
50.3. ENTRY. .................................................................................................................................. 138
50.3.1.
Company Code ......................................................................................................... 138
50.3.2.
Report Title ............................................................................................................... 138
50.4. EXIT. ..................................................................................................................................... 138
50.4.1.
Report header produced for current report .............................................................. 138
50.5. CALLED BY. .......................................................................................................................... 138
50.6. CALLS.................................................................................................................................... 138
50.7. TABLES.................................................................................................................................. 138
50.8. SYSTEM VARIABLES. ............................................................................................................. 138
50.9. DESCRIPTION. ........................................................................................................................ 138
50.10.
EXAMPLES. ........................................................................................................................ 138
50.11.
SOURCECODE. ................................................................................................................... 139
50.12.
SEE ALSO. ......................................................................................................................... 140
51.
RUNTOTALS ......................................................................................................................... 141
51.1.
51.2.
51.3.
51.4.
51.5.
51.6.
51.7.
51.8.
51.9.
51.10.
51.11.
51.12.
52.
LOCATION. ............................................................................................................................ 141
PURPOSE................................................................................................................................ 141
ENTRY. .................................................................................................................................. 141
EXIT. ..................................................................................................................................... 141
CALLED BY. .......................................................................................................................... 141
CALLS.................................................................................................................................... 141
TABLES.................................................................................................................................. 141
SYSTEM VARIABLES. ............................................................................................................. 141
DESCRIPTION. ........................................................................................................................ 141
EXAMPLES. ........................................................................................................................ 141
SOURCECODE. ................................................................................................................... 141
SEE ALSO. ......................................................................................................................... 142
SAVEREPORT ....................................................................................................................... 143
52.1. LOCATION. ............................................................................................................................ 143
52.2. PURPOSE................................................................................................................................ 143
52.3. ENTRY. .................................................................................................................................. 143
52.3.1.
Report Name ............................................................................................................. 143
52.4. EXIT. ..................................................................................................................................... 143
52.5. CALLED BY. .......................................................................................................................... 143
52.6. CALLS.................................................................................................................................... 143
52.7. TABLES.................................................................................................................................. 143
52.8. SYSTEM VARIABLES. ............................................................................................................. 143
52.9. DESCRIPTION. ........................................................................................................................ 143
52.10.
EXAMPLES. ........................................................................................................................ 143
Page 12
52.11.
52.12.
53.
SOURCECODE. ................................................................................................................... 144
SEE ALSO. ......................................................................................................................... 144
SETCOLOUR ......................................................................................................................... 145
53.1. LOCATION. ............................................................................................................................ 145
53.2. PURPOSE................................................................................................................................ 145
53.3. ENTRY. .................................................................................................................................. 145
53.3.1.
Colour to set ............................................................................................................. 145
53.4. EXIT. ..................................................................................................................................... 145
53.5. CALLED BY. .......................................................................................................................... 145
53.6. CALLS.................................................................................................................................... 145
53.7. TABLES.................................................................................................................................. 145
53.8. SYSTEM VARIABLES. ............................................................................................................. 145
53.9. DESCRIPTION. ........................................................................................................................ 145
53.10.
EXAMPLES. ........................................................................................................................ 145
53.11.
SOURCECODE. ................................................................................................................... 145
53.12.
SEE ALSO. ......................................................................................................................... 146
54.
SHOW_PROGRESS .............................................................................................................. 147
54.1. LOCATION. ............................................................................................................................ 147
54.2. PURPOSE................................................................................................................................ 147
54.3. ENTRY. .................................................................................................................................. 147
54.3.1.
Message to display .................................................................................................... 147
54.4. EXIT. ..................................................................................................................................... 147
54.5. CALLED BY. .......................................................................................................................... 147
54.6. CALLS.................................................................................................................................... 147
54.7. TABLES.................................................................................................................................. 147
54.8. SYSTEM VARIABLES. ............................................................................................................. 147
54.9. DESCRIPTION. ........................................................................................................................ 147
54.10.
EXAMPLES. ........................................................................................................................ 147
54.11.
SOURCECODE. ................................................................................................................... 147
54.12.
SEE ALSO. ......................................................................................................................... 148
55.
SORTREP ............................................................................................................................... 149
55.1. LOCATION. ............................................................................................................................ 149
55.2. PURPOSE................................................................................................................................ 149
55.3. ENTRY. .................................................................................................................................. 149
55.3.1.
Table to sort. ............................................................................................................. 149
55.4. EXIT. ..................................................................................................................................... 149
55.4.1.
Table Sorted. ............................................................................................................. 149
55.4.2.
Report column table sorted on .................................................................................. 149
55.4.3.
Sort direction 'A' or 'D' ............................................................................................. 149
55.5. CALLED BY. .......................................................................................................................... 149
55.6. CALLS.................................................................................................................................... 149
55.7. TABLES.................................................................................................................................. 149
55.8. SYSTEM VARIABLES. ............................................................................................................. 149
55.9. DESCRIPTION. ........................................................................................................................ 149
55.10.
EXAMPLES. ........................................................................................................................ 149
55.11.
SOURCECODE. ................................................................................................................... 150
55.12.
SEE ALSO. ......................................................................................................................... 151
56.
STRIPSTRING ....................................................................................................................... 152
56.1. LOCATION. ............................................................................................................................ 152
56.2. PURPOSE................................................................................................................................ 152
56.3. ENTRY. .................................................................................................................................. 152
56.3.1.
String to remove characters from. ............................................................................ 152
56.3.2.
String of characters to remove.................................................................................. 152
56.4. EXIT. ..................................................................................................................................... 152
56.4.1.
Entry string with strip chars removed ...................................................................... 152
Page 13
56.5.
56.6.
56.7.
56.8.
56.9.
56.10.
56.11.
56.12.
57.
SUBTITLES ............................................................................................................................ 154
57.1.
57.2.
57.3.
57.4.
57.5.
57.6.
57.7.
57.8.
57.9.
57.10.
57.11.
57.12.
58.
CALLED BY. .......................................................................................................................... 152
CALLS.................................................................................................................................... 152
TABLES.................................................................................................................................. 152
SYSTEM VARIABLES. ............................................................................................................. 152
DESCRIPTION. ........................................................................................................................ 152
EXAMPLES. ........................................................................................................................ 152
SOURCECODE. ................................................................................................................... 152
SEE ALSO. ......................................................................................................................... 153
LOCATION. ............................................................................................................................ 154
PURPOSE................................................................................................................................ 154
ENTRY. .................................................................................................................................. 154
EXIT. ..................................................................................................................................... 154
CALLED BY. .......................................................................................................................... 154
CALLS.................................................................................................................................... 154
TABLES.................................................................................................................................. 154
SYSTEM VARIABLES. ............................................................................................................. 154
DESCRIPTION. ........................................................................................................................ 154
EXAMPLES. ........................................................................................................................ 154
SOURCECODE. ................................................................................................................... 154
SEE ALSO. ......................................................................................................................... 155
TABLELINE ........................................................................................................................... 156
58.1. LOCATION. ............................................................................................................................ 156
58.2. PURPOSE................................................................................................................................ 156
58.3. ENTRY. .................................................................................................................................. 156
58.4. EXIT. ..................................................................................................................................... 156
58.4.1.
Global flag w__line printed set to true. .................................................................... 156
58.5. CALLED BY. .......................................................................................................................... 156
58.6. CALLS.................................................................................................................................... 156
58.7. TABLES.................................................................................................................................. 156
58.8. SYSTEM VARIABLES. ............................................................................................................. 156
58.9. DESCRIPTION. ........................................................................................................................ 156
58.10.
EXAMPLES. ........................................................................................................................ 156
58.11.
SOURCECODE. ................................................................................................................... 156
58.12.
SEE ALSO. ......................................................................................................................... 157
59.
UNDERLINE .......................................................................................................................... 158
59.1. LOCATION. ............................................................................................................................ 158
59.2. PURPOSE................................................................................................................................ 158
59.3. ENTRY. .................................................................................................................................. 158
59.3.1.
Start position............................................................................................................. 158
59.3.2.
Width ......................................................................................................................... 158
59.4. EXIT. ..................................................................................................................................... 158
59.4.1.
Global flag w__line printed set to true. .................................................................... 158
59.5. CALLED BY. .......................................................................................................................... 158
59.6. CALLS.................................................................................................................................... 158
59.7. TABLES.................................................................................................................................. 158
59.8. SYSTEM VARIABLES. ............................................................................................................. 158
59.9. DESCRIPTION. ........................................................................................................................ 158
59.10.
EXAMPLES. ........................................................................................................................ 158
59.11.
SOURCECODE. ................................................................................................................... 158
59.12.
SEE ALSO. ......................................................................................................................... 159
60.
USEREPORT .......................................................................................................................... 160
60.1. LOCATION. ............................................................................................................................ 160
60.2. PURPOSE................................................................................................................................ 160
60.3. ENTRY. .................................................................................................................................. 160
Page 14
60.3.1.
Report Name ............................................................................................................. 160
60.4. EXIT. ..................................................................................................................................... 160
60.5. CALLED BY. .......................................................................................................................... 160
60.6. CALLS.................................................................................................................................... 160
60.7. TABLES.................................................................................................................................. 160
60.8. SYSTEM VARIABLES. ............................................................................................................. 160
60.9. DESCRIPTION. ........................................................................................................................ 160
60.10.
EXAMPLES. ........................................................................................................................ 160
60.11.
SOURCECODE. ................................................................................................................... 160
60.12.
SEE ALSO. ......................................................................................................................... 161
61.
WLINE .................................................................................................................................... 162
61.1. LOCATION. ............................................................................................................................ 162
61.2. PURPOSE................................................................................................................................ 162
61.3. ENTRY. .................................................................................................................................. 162
61.3.1.
Dataline to print ....................................................................................................... 162
61.3.2.
Colour of line. ........................................................................................................... 162
61.4. EXIT. ..................................................................................................................................... 163
61.5. CALLED BY. .......................................................................................................................... 163
61.6. CALLS.................................................................................................................................... 163
61.7. TABLES.................................................................................................................................. 163
61.8. SYSTEM VARIABLES. ............................................................................................................. 163
61.9. DESCRIPTION. ........................................................................................................................ 163
61.10.
EXAMPLES. ........................................................................................................................ 163
61.11.
SOURCECODE. ................................................................................................................... 163
61.12.
SEE ALSO. ......................................................................................................................... 164
62.
WRITECENTRE .................................................................................................................... 165
62.1. LOCATION. ............................................................................................................................ 165
62.2. PURPOSE................................................................................................................................ 165
62.3. ENTRY. .................................................................................................................................. 165
62.3.1.
Text to centre ............................................................................................................ 165
62.4. EXIT. ..................................................................................................................................... 165
62.5. CALLED BY. .......................................................................................................................... 165
62.6. CALLS.................................................................................................................................... 165
62.7. TABLES.................................................................................................................................. 165
62.8. SYSTEM VARIABLES. ............................................................................................................. 165
62.9. DESCRIPTION. ........................................................................................................................ 165
62.10.
EXAMPLES. ........................................................................................................................ 165
62.11.
SOURCECODE. ................................................................................................................... 165
62.12.
SEE ALSO. ......................................................................................................................... 166
63.
WRITECOL ............................................................................................................................ 167
63.1. LOCATION. ............................................................................................................................ 167
63.2. PURPOSE................................................................................................................................ 167
63.3. ENTRY. .................................................................................................................................. 167
63.3.1.
Data line and column to print ................................................................................... 167
63.3.2.
Column to use. .......................................................................................................... 167
63.4. EXIT. ..................................................................................................................................... 167
63.5. CALLED BY. .......................................................................................................................... 167
63.6. CALLS.................................................................................................................................... 167
63.7. TABLES.................................................................................................................................. 167
63.8. SYSTEM VARIABLES. ............................................................................................................. 167
63.9. DESCRIPTION. ........................................................................................................................ 167
63.10.
EXAMPLES. ........................................................................................................................ 167
63.11.
SOURCECODE. ................................................................................................................... 167
63.12.
SEE ALSO. ......................................................................................................................... 168
64.
WRITELINE ........................................................................................................................... 169
Page 15
64.1. LOCATION. ............................................................................................................................ 169
64.2. PURPOSE................................................................................................................................ 169
64.3. ENTRY. .................................................................................................................................. 169
64.3.1.
Table work area containing report data ................................................................... 169
64.3.2.
Colour to use to print the data in. ............................................................................. 169
64.4. EXIT. ..................................................................................................................................... 169
64.5. CALLED BY. .......................................................................................................................... 169
64.6. CALLS.................................................................................................................................... 169
64.7. TABLES.................................................................................................................................. 169
64.8. SYSTEM VARIABLES. ............................................................................................................. 169
64.9. DESCRIPTION. ........................................................................................................................ 169
64.10.
EXAMPLES. ........................................................................................................................ 170
64.11.
SOURCECODE. ................................................................................................................... 170
64.12.
SEE ALSO. ......................................................................................................................... 172
65.
WRITESYMBOL ................................................................................................................... 173
65.1. LOCATION. ............................................................................................................................ 173
65.2. PURPOSE................................................................................................................................ 173
65.3. ENTRY. .................................................................................................................................. 173
65.3.1.
Symbol name to use. ................................................................................................. 173
65.3.2.
Hotspot flag. ............................................................................................................. 173
65.4. EXIT. ..................................................................................................................................... 173
65.5. CALLED BY. .......................................................................................................................... 173
65.6. CALLS.................................................................................................................................... 173
65.7. TABLES.................................................................................................................................. 173
65.8. SYSTEM VARIABLES. ............................................................................................................. 173
65.9. DESCRIPTION. ........................................................................................................................ 173
65.10.
EXAMPLES. ........................................................................................................................ 173
65.11.
SOURCECODE. ................................................................................................................... 173
65.12.
SEE ALSO. ......................................................................................................................... 174
66.
WRITEVALUE....................................................................................................................... 175
66.1. LOCATION. ............................................................................................................................ 175
66.2. PURPOSE................................................................................................................................ 175
66.3. ENTRY. .................................................................................................................................. 175
66.3.1.
Width of output field ................................................................................................. 175
66.3.2.
Value to write............................................................................................................ 175
66.3.3.
Conversion exit routine............................................................................................. 175
66.3.4.
Currency Field .......................................................................................................... 175
66.3.5.
Unit field ................................................................................................................... 175
66.3.6.
Other Format field. ................................................................................................... 175
66.4. EXIT. ..................................................................................................................................... 175
66.5. CALLED BY. .......................................................................................................................... 175
66.6. CALLS.................................................................................................................................... 175
66.7. TABLES.................................................................................................................................. 176
66.8. SYSTEM VARIABLES. ............................................................................................................. 176
66.9. DESCRIPTION. ........................................................................................................................ 176
66.10.
EXAMPLES. ........................................................................................................................ 176
66.11.
SOURCECODE. ................................................................................................................... 176
66.12.
SEE ALSO. ......................................................................................................................... 177
67.
ZBDC_BATCH_ON ............................................................................................................... 178
67.1.
67.2.
67.3.
67.4.
67.5.
67.6.
67.7.
Page 16
LOCATION. ............................................................................................................................ 178
PURPOSE................................................................................................................................ 178
ENTRY. .................................................................................................................................. 178
EXIT. ..................................................................................................................................... 178
CALLED BY. .......................................................................................................................... 178
CALLS.................................................................................................................................... 178
TABLES.................................................................................................................................. 178
67.8. SYSTEM VARIABLES. ............................................................................................................. 178
67.9. DESCRIPTION. ........................................................................................................................ 178
67.10.
EXAMPLES. ........................................................................................................................ 178
67.11.
SOURCECODE. ................................................................................................................... 178
67.12.
SEE ALSO. ......................................................................................................................... 178
68.
ZBDC_CLOSE_GROUP ....................................................................................................... 180
68.1. LOCATION. ............................................................................................................................ 180
68.2. PURPOSE................................................................................................................................ 180
68.3. ENTRY. .................................................................................................................................. 180
68.3.1.
None. ......................................................................................................................... 180
68.4. EXIT. ..................................................................................................................................... 180
68.4.1.
Status 0 - Ok. ........................................................................................................... 180
68.5. CALLED BY. .......................................................................................................................... 180
68.6. CALLS.................................................................................................................................... 180
68.7. TABLES.................................................................................................................................. 180
68.8. SYSTEM VARIABLES. ............................................................................................................. 180
68.9. DESCRIPTION. ........................................................................................................................ 180
68.10.
EXAMPLES. ........................................................................................................................ 180
68.11.
SOURCECODE. ................................................................................................................... 180
68.12.
SEE ALSO. ......................................................................................................................... 181
69.
ZBDC_DUMP_ON ................................................................................................................. 182
69.1. LOCATION. ............................................................................................................................ 182
69.2. PURPOSE................................................................................................................................ 182
69.3. ENTRY. .................................................................................................................................. 182
69.3.1.
None .......................................................................................................................... 182
69.4. EXIT. ..................................................................................................................................... 182
69.4.1.
None .......................................................................................................................... 182
69.5. CALLED BY. .......................................................................................................................... 182
69.6. CALLS.................................................................................................................................... 182
69.7. TABLES.................................................................................................................................. 182
69.8. SYSTEM VARIABLES. ............................................................................................................. 182
69.9. DESCRIPTION. ........................................................................................................................ 182
69.10.
EXAMPLES. ........................................................................................................................ 182
69.11.
SOURCECODE. ................................................................................................................... 182
69.12.
SEE ALSO. ......................................................................................................................... 183
70.
ZBDC_FIELD ......................................................................................................................... 184
70.1. LOCATION. ............................................................................................................................ 184
70.2. PURPOSE................................................................................................................................ 184
70.3. ENTRY. .................................................................................................................................. 184
70.3.1.
Field name ................................................................................................................ 184
70.3.2.
Field Value ............................................................................................................... 184
70.4. EXIT. ..................................................................................................................................... 185
70.5. CALLED BY. .......................................................................................................................... 185
70.6. CALLS.................................................................................................................................... 185
70.7. TABLES.................................................................................................................................. 185
70.8. SYSTEM VARIABLES. ............................................................................................................. 185
70.9. DESCRIPTION. ........................................................................................................................ 185
70.10.
EXAMPLES. ........................................................................................................................ 185
70.11.
SOURCECODE. ................................................................................................................... 185
70.12.
SEE ALSO. ......................................................................................................................... 186
71.
ZBDC_FILLSCREEN ............................................................................................................ 187
71.1. LOCATION. ............................................................................................................................ 187
71.2. PURPOSE................................................................................................................................ 187
71.3. ENTRY. .................................................................................................................................. 187
71.3.1.
Program name, ......................................................................................................... 187
Page 17
71.3.2.
Screen number/actual screen No .............................................................................. 187
71.3.3.
Structure to use. ........................................................................................................ 187
71.4. EXIT. ..................................................................................................................................... 187
71.5. CALLED BY. .......................................................................................................................... 187
71.6. CALLS.................................................................................................................................... 187
71.7. TABLES.................................................................................................................................. 187
71.8. SYSTEM VARIABLES. ............................................................................................................. 187
71.9. DESCRIPTION. ........................................................................................................................ 187
71.10.
EXAMPLES. ........................................................................................................................ 188
71.11.
SOURCECODE. ................................................................................................................... 188
71.12.
SEE ALSO. ......................................................................................................................... 190
72.
ZBDC_INSERT ...................................................................................................................... 191
72.1. LOCATION. ............................................................................................................................ 191
72.2. PURPOSE................................................................................................................................ 191
72.3. ENTRY. .................................................................................................................................. 191
72.3.1.
Transaction code ...................................................................................................... 191
72.4. EXIT. ..................................................................................................................................... 191
72.4.1.
Status of Insert .......................................................................................................... 191
72.5. CALLED BY. .......................................................................................................................... 191
72.6. CALLS.................................................................................................................................... 191
72.7. TABLES.................................................................................................................................. 191
72.8. SYSTEM VARIABLES. ............................................................................................................. 191
72.9. DESCRIPTION. ........................................................................................................................ 191
72.10.
EXAMPLES. ........................................................................................................................ 191
72.11.
SOURCECODE. ................................................................................................................... 191
72.12.
SEE ALSO. ......................................................................................................................... 192
73.
ZBDC_OPEN_GROUP .......................................................................................................... 193
73.1. LOCATION. ............................................................................................................................ 193
73.2. PURPOSE................................................................................................................................ 193
73.3. ENTRY. .................................................................................................................................. 193
73.3.1.
Group Name to use for batch .................................................................................... 193
73.4. EXIT. ..................................................................................................................................... 193
73.4.1.
Status of open: .......................................................................................................... 193
73.5. CALLED BY. .......................................................................................................................... 193
73.6. CALLS.................................................................................................................................... 193
73.7. TABLES.................................................................................................................................. 193
73.8. SYSTEM VARIABLES. ............................................................................................................. 193
73.9. DESCRIPTION. ........................................................................................................................ 193
73.10. EXAMPLES. ........................................................................................................................ 193
73.11.
SOURCECODE. ................................................................................................................... 194
73.12.
SEE ALSO. ......................................................................................................................... 194
74.
ZBDC_SCREEN ..................................................................................................................... 195
74.1. LOCATION. ............................................................................................................................ 195
74.2. PURPOSE................................................................................................................................ 195
74.3. ENTRY. .................................................................................................................................. 195
74.3.1.
Program name to run. .............................................................................................. 195
74.3.2.
Screen number to use. ............................................................................................... 195
74.4. EXIT. ..................................................................................................................................... 195
74.5. CALLED BY. .......................................................................................................................... 195
74.6. CALLS.................................................................................................................................... 195
74.7. TABLES.................................................................................................................................. 195
74.8. SYSTEM VARIABLES. ............................................................................................................. 195
74.9. DESCRIPTION. ........................................................................................................................ 195
74.10. EXAMPLES. ........................................................................................................................ 195
74.11.
SOURCECODE. ................................................................................................................... 195
74.12.
SEE ALSO. ......................................................................................................................... 196
Page 18
75.
ZBDC_SCROLL ..................................................................................................................... 197
75.1. LOCATION. ............................................................................................................................ 197
75.2. PURPOSE................................................................................................................................ 197
75.3. ENTRY. .................................................................................................................................. 197
75.3.1.
Program name. ......................................................................................................... 197
75.3.2.
Screen number. ......................................................................................................... 197
75.3.3.
BDC Code for 'One down'. ....................................................................................... 197
75.3.4.
Maximum number of lines displayed on the screen. ................................................. 197
75.3.5.
The position of the required record in the displayed table. ...................................... 197
75.4. EXIT. ..................................................................................................................................... 197
75.4.1.
The offset on the current page of the required record. ............................................. 197
75.5. CALLED BY. .......................................................................................................................... 197
75.6. CALLS.................................................................................................................................... 197
75.7. TABLES.................................................................................................................................. 197
75.8. SYSTEM VARIABLES. ............................................................................................................. 197
75.9. DESCRIPTION. ........................................................................................................................ 197
75.10.
EXAMPLES. ........................................................................................................................ 198
75.11.
SOURCECODE. ................................................................................................................... 198
75.12.
SEE ALSO. ......................................................................................................................... 199
76.
ZBDC_SUBSCRIPT ............................................................................................................... 200
76.1. LOCATION. ............................................................................................................................ 200
76.2. PURPOSE................................................................................................................................ 200
76.3. ENTRY. .................................................................................................................................. 200
76.3.1.
Field name as a string .............................................................................................. 200
76.3.2.
Subscript to use ......................................................................................................... 200
76.3.3.
Value to use .............................................................................................................. 200
76.4. EXIT. ..................................................................................................................................... 200
76.4.1.
BDC Table updated. ................................................................................................. 200
76.5. CALLED BY. .......................................................................................................................... 200
76.6. CALLS.................................................................................................................................... 200
76.7. TABLES.................................................................................................................................. 200
76.8. SYSTEM VARIABLES. ............................................................................................................. 200
76.9. DESCRIPTION. ........................................................................................................................ 200
76.10.
EXAMPLES. ........................................................................................................................ 200
76.11.
SOURCECODE. ................................................................................................................... 200
76.12.
SEE ALSO. ......................................................................................................................... 201
77.
ZDO_BDC ............................................................................................................................... 202
77.1. LOCATION. ............................................................................................................................ 202
77.2. PURPOSE................................................................................................................................ 202
77.3. ENTRY. .................................................................................................................................. 202
77.3.1.
Transaction Code ..................................................................................................... 202
77.3.2.
Mode ......................................................................................................................... 202
77.3.3.
Update Type .............................................................................................................. 202
77.3.4.
Table - p_messages - contains batch msgs ............................................................... 202
77.4. EXIT. ..................................................................................................................................... 202
77.4.1.
MsgId, Error and message if failed. ........................................................................ 202
77.5. CALLED BY. .......................................................................................................................... 202
77.6. CALLS.................................................................................................................................... 202
77.7. TABLES.................................................................................................................................. 202
77.8. SYSTEM VARIABLES. ............................................................................................................. 202
77.9. DESCRIPTION. ........................................................................................................................ 203
77.10.
EXAMPLES. ........................................................................................................................ 203
77.11.
SOURCECODE. ................................................................................................................... 203
77.12.
SEE ALSO. ......................................................................................................................... 205
78.
Z_CALL_BDC ........................................................................................................................ 206
Page 19
78.1. LOCATION. ............................................................................................................................ 206
78.2. PURPOSE................................................................................................................................ 206
78.3. ENTRY. .................................................................................................................................. 206
78.3.1.
Message Table .......................................................................................................... 206
78.3.2.
Transaction to use .................................................................................................... 206
78.3.3.
Table - p_messages - contains batch msgs ............................................................... 206
78.4. EXIT. ..................................................................................................................................... 206
78.4.1.
Table p_messages filled with BDC Messages ........................................................... 206
78.5. CALLED BY. .......................................................................................................................... 206
78.6. CALLS.................................................................................................................................... 206
78.7. TABLES.................................................................................................................................. 206
78.8. SYSTEM VARIABLES. ............................................................................................................. 206
78.9. DESCRIPTION. ........................................................................................................................ 206
78.10.
EXAMPLES. ........................................................................................................................ 206
78.11.
SOURCECODE. ................................................................................................................... 206
78.12.
SEE ALSO. ......................................................................................................................... 207
List Of Tables
Table 1 - List of Routines ....................................................................................................................... 25
Table 2 -YDCSET Table Structure ........................................................................................................ 29
Table 3 - System Variables Affected By Drill Down Reports ................................................................ 33
Table 4 - Custom Authorisation Objects ................................................................................................ 37
Table 5 Common BDC OK Codes ....................................................................................................... 185
Changes Pending.
Page 20
1.
About this document.
This document is in itself an aid to documentation, and can be used to easily document routines written by
yourself.
Within this document are a series of Macros which were used to extract and format the pages which detail the
routines shown in the following pages.
These routines are callable as a routine that will provide almost complete documentation on a specified routine.
These routines are not perfect, and in some cases contain bugs, however, they do 99% of the work in
providing procedure documentation.
1.1.
Procedure Format.
These routines rely on the SAP routines conforming to the following constraints:
Each routine has a header that is as follows:
*EJECT
********************************************************************
*
*
Procedure:
*
*
Purpose:
*
*
Entry:
*
*
Exit:
*
*
Called By:
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
The macros search for various keywords and extract the relevant text from the header. The sections
can be formatted as follows:
1.1.1.1.Procedure.
The procedure heading can only occupy one line, and is used as a trigger for the
start of all routines that require to search the procedure. This should be the same as
the name specified in the Forms Statement.
1.1.1.2.Purpose.
The Purpose header can extend across multiple lines up to the first 'Entry'
statement.. The text 'Purpose:' and all comment markers up to this line are removed
and the remaining texts concatenated into a single string. This string is then output
as a single paragraph under the 'Purpose' Sub heading.
1.1.1.3.Entry.
There must be an 'Entry:' heading for each 'TABLE' or 'USING' parameter defined
on the form. These have the comment markers stripped and the word 'Entry:'
removed from them and are used as the Level 3 sub headings under the heading
'Entry'.
Page 21
Any text below the line containing the word 'Entry:', up until the next 'Entry:', or the
first 'Exit:' line will be concatenated together, minus the comment markers and extra
spaces to form an explanation for the parameter that has just been specified.
1.1.1.4.Exit.
There must be an 'Exit:' heading for each 'CHANGING' defined on the form. These
have the comment markers stripped and the word 'Exit:' removed from them and are
used as the Level 3 sub headings under the heading 'Exit'.
Any text below the line containing the word 'Exit:', up until the next 'Exit:', or the
first 'Called By:' line will be concatenated together, minus the comment markers and
extra spaces to form an explanation for the parameter that has just been specified.
1.1.1.5.Called By.
The Called by line contains all the procedures that are dependant on the current
procedure being documentented. However... the macros DO NOT take any entries in
the 'Called By' lines as gospel, but scans the supplied source file for references to
the procedure and enters these references into the documentation instead. The
documentation also contains a 'model' procedure call for the the form being called,
however this 'model' call needs manual formating.
1.1.1.6.Calls.
The Calls Line again is not used by the macros, but can be updated by the results of
the macros if you wish. The macros scan the source code and extract and
'PERFORM' calls between the Form Declaration and the next 'ENDFORM'.
These are then output under a Level 2 heading 'CALLS'.
1.1.1.7. Other Entries.
Other entries appear in the documentation that are not required in the header. These
are:






Tables
System Variables
Description
Example
Source Code
See Also
1.1.1.7.1.Tables:
The macros will scan the source code for the routine and parse any tables statements
between the FORM...ENDFORM statements into a comma seperated list as a Level
2 paragraph.
1.1.1.7.2.System Variables.
The next heading in the document is 'System variables'. This contains a list of all
system variables, and a truncated description, or all system variables referenced in
the form.
1.1.1.7.3.Description.
This entry in the documentation should describe the routine, how and why it works,
any funnies or occasions when it will not work. The level 2 header is entered, but
no text. This is for you to do.
Page 22
1.1.1.7.4.Examples.
The example is taken from the file that you specify for example files. In my own
copy, I have the routine run Grep, searching all directories for occurances below
the main directory, and then read the file produced to retrieve the file name. The
routine then scans this file and extracts the source code 7 lines either side of the
reference to the routine and inserts it into the document.
The number of lines that are extracted for the example can be modified by changing
the subscript in the line:
Dim SourceBuffer(7) As String
In subroutine 'Examples'.
1.1.1.7.5.Source Code.
The macro then extracts the source code from the source file and inserts it into the
document.
1.1.1.7.6.See Also.
A place where you can insert references to other similarly minded forms.
1.2.
Running the macro.
For each section in a procedure document, there is a macro. The main entry point for these routines is
a macro called 'NewRoutine', which can be seen on the menu at the top on the menu bar.
All files accessed have to have been downloaded to a directory somewhere under the 'C_HEADDIR'
directory specified in the macro codes definition module.
Clicking this button will request three items:



The Routine to document
The file containing the routine
The file containing an example of that routine.
Enter the routine name to document. Clickng the cancel button, or leaving the input field blank will
cause the routine to exit.
Enter the name of the file containing the routine. This does not have to be the only routine in the file.
Enter the name of the file containing the example that you wish to use for the usage of the routine.
Ta-dahhhh....
Page 23
2.
Using the Routines.
The routines used have been split into functional modules as they have grown quite monolithic since they were
created. No doubt other splits will occur as time goes on. There are four include routines. One is mandatory
and contains constant definitions used by both the other include routines.
YREPINC contains routines that apperation to reporting. They include such things as formatting a report,
report breaks, title printing and so forth. YBDCINC contains routines that are aimed at BDC programming
such as loading the report table, debugging routines, and filling entire screens in one call. YGRAPH contains
macros aimed at making the writing of packages using SAP Graphics a little more pain free.
To make the routines available to your program, include the lines:
Include Yrbinc.
Include YREPINC|YBDCINC|YGRAPH.
At the top of your program after the Report statement. All three includes can be included if required.
The table below shows the split of the various functions across the include files.
Include File Routine Name
YRBINC
Constants
YREPINC
Allhdrs
Buildreport
CentreReport
Checkbox
Checkbreaks
Firstcol
Formatreport
Getmask
Giveline
Graphic
Groupheader
Icon
Initbreak
Printtitles
Printtotals
Psub
Repheader
Runtotals
Savereport
Setcolour
Sortrep
Stripstring
Subtitle.
Symbol
Tableline.
Underline
Usereport
Wline
Writecol
Writecentre
Writeline
Page 24
Function
Various constants defined here. The ones with single underscores can
be used in your own programs.
Prints all group headers for a report
Adds columns to a report definition, locates column titles and format
from data dictionary.
Centres a report or leaves it left justified
Prints a report element as a check box
Checks column breaks and prints totals if required
Sets the first column displayed
Takes a defined report and calculates the required spacing.
Gets a Unit or Currency mask
Returns the Nth line of a string of text to fit a column M characters wide.
Inserts an icon or symbol graphic on a report
Prints out group headers.
Inserts an Icon on a report
Initialises Report breaks.
Prints the column titles on a report
Prints break totals
Macro. Prints select option sub titles
Prints a Report Header
Prints the run totals for a report
Saves report format on report stack
Sets the output colour
Sorts a report by a specified column
Removes specified characters from a string
Called by PSUB to print subtitles containing selection criteria for a
report
Inserts a symbol on a report
Draws a line across the current report.
Draws a line of specified width from a specified startpoint
Uses a previously stacked report
Outputs a line to the report
Writes to a specific column on the report
Prints the specified text centrally on a defined report.
Outputs a line of data onto the report
Include File
YBDCINC
YGRAPH
Routine Name
WriteSymbol
Writevalue
Get_Local_Host
Function
Writes a symbol to the report
Writes a single value to a report
Gets the name of the local SAP host
Init_Global
Is_Service_Active
Newbdc
Read_YDCSET
Zbdc_Batch_On
Zbdc_Close_Group
Initialises Global variables
Checks to see if a named service is active
Initialises a BDC session
Reads BDC Defaults settings
Sets Batch create for BDC's on
Closes an SM35 session
Zbdc_Dump_On
Sets BDC Dump table on
Zbdc_Field
ZBDC_Fillscreen
Zbdc_Insert
Zbdc_Open_Group
Zbdc_Screen
Inserts a BDC Field
Completes a BDC screen from screen name/number and structure
Inserts a BDC session
Opens a new SM35 session
Inserts a new screen into a BDC session
Zbdc_Scroll
Zdo_BDC
Z_Call_BDC
Curve_Category
Curve_Colour
Curve_Type
Curve_Width
Legend_Text
Next_Curve
Scrolls a table in place of =POPO
Runs a BDC Transaction
Runs a BDC transaction making use of YDC Set.
Defines the typeof curve to be displayed
The colour of the curve
The type of curve – solid, dashed
The width of the line used to make up the curve
Specifies the legend text
Introduces the next curve on the graph
Table 1 - List of Routines
Below is an example of how the routines are used:
*Eject
***********************************************************************
*
*
Procedure:
Build_Revenue_Report
*
*
Purpose:
Formats the standard revenue report.
*
*
Entry:
*
*
Exit:
*
*
Called By:
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form Build_Revenue_Report.
*
Zap ReportTable.
Perform BuildReport using 'TSPACE' '' 40 '' ''.
Perform BuildReport using 'CATSDB-WORKDATE' '' 0 'DD/MM/YY' ''.
Perform BuildReport using 'CHOURS' Text-013 5 '' ''.
Perform BuildReport using 'BUYC'
Text-002 11 '' ''.
Perform BuildReport using 'BUYTOTAL' text-003 15
'CURRENCY' 'BWAERK'.
Perform BuildReport using 'BWAERK' Text-012 0 '' ''.
Page 25
Perform BuildReport using 'SELLC' Text-004 11 '' ''.
Perform BuildReport using 'SELLTOTAL' text-005 15
'CURRENCY' 'WAERK'.
Perform BuildReport using 'NETWR' text-014 15
'CURRENCY' 'WAERK'.
Perform BuildReport using 'WAERK' Text-012 0 '' ''.
Perform FormatReport.
Read Table t_revenue Index 1.
Perform InitBreak
using 'T_REVENUE-CENDNG' Text-015
Perform InitBreak
using 'T_REVENUE-VB'
Text-006
Perform InitBreak
using 'T_REVENUE-ENAME'
Text-007
Perform InitBreak
using 'T_REVENUE-ABTEI'
Text-008
Perform InitBreak
using 'T_REVENUE-KTEXT'
Text-009
Perform SaveReport using c_main_report.
*
*
*
c_no
c_no
c_no
c_no
c_no
c_yes.
c_yes.
c_yes.
c_yes.
c_yes.
And the billing report.
Zap ReportTable.
Perform BuildReport using 'VBELN0' Text-019 10 '' ''.
Perform BuildReport using 'ERDAT0' Text-020 8 'DD/MM/YY' ''.
Perform BuildReport using 'CREDT0' Text-021 11 '' ''.
Perform BuildReport using 'DEBIT0' Text-022 11 '' ''.
Perform BuildReport using 'VBELN1' Text-019 10 '' ''.
Perform BuildReport using 'ERDAT1' Text-020 8 'DD/MM/YY' ''.
Perform BuildReport using 'CREDT1' Text-021 11 '' ''.
Perform BuildReport using 'DEBIT1' Text-022 11 '' ''.
Perform BuildReport using 'VBELN2' Text-019 10 '' ''.
Perform BuildReport using 'ERDAT2' Text-020 8 'DD/MM/YY' ''.
Perform BuildReport using 'CREDT2' Text-021 11 '' ''.
Perform BuildReport using 'DEBIT2' Text-022 11 '' ''.
Perform FormatReport.
Perform SaveReport using c_billing_rep.
EndForm.
*Eject
***********************************************************************
*
*
Procedure:
Print_Revenue_Report
*
*
Purpose:
Prints the standard revenue report.
*
*
Entry:
*
*
Exit:
*
*
Called By:
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form Print_Revenue_Report.
*
Data: w_lines type i,
w_prted type i,
w_vbeln like vbak-vbeln.
*
Read Table t_revenue index 1.
*
*
Initial group headers.
*
Set pf-status '001'.
Perform UseReport using c_main_report.
Perform GroupHeader using Text-009 T_REVENUE-KTEXT.
Perform GroupHeader using Text-008 T_REVENUE-ABTEI.
Perform GroupHeader using Text-007 T_REVENUE-ENAME.
Perform GroupHeader using Text-006 T_REVENUE-VB.
Perform GroupHeader using Text-015 T_REVENUE-CENDNG.
Move t_revenue-vbeln to w_vbeln.
*
Loop at t_revenue.
*
Page 26
*
*
*
Change in Vbeln ?? Check if there are any unprinted billing
docs.
If w_vbeln <> t_revenue-vbeln.
Perform billing_rep using 0 changing w_prted.
Move t_revenue-vbeln to w_vbeln.
EndIf.
Perform CheckBreaks using t_revenue.
Perform WriteLine
using t_revenue col_normal.
*
*
*
Any billing information ?
If t_revenue-netwr <> 0.
Perform Billing_Rep using t_revenue-workdate
changing w_prted.
EndIf.
EndLoop.
Perform RunTotals.
*
*
*
Any unprinted documents ?
Describe table t_bill_rep lines w_lines.
If w_prted <> w_lines.
Perform UseReport using c_billing_rep.
Move Text-023 to sy-title.
New-Page.
Loop at t_bill_rep
Where prted = False.
Perform WriteLine using t_bill_rep col_background.
Endloop.
Perform TableLine.
EndIf.
Perform WriteCentre using Text-011.
EndForm.
Page 27
3.
Dependancies
Should it be required to track all uses of routines defined in ZBOSSINC, open a program containing references
to the routines and place the cursor on the Perform calling the routine.
Click the ‘Where Used’
display it.
Page 28
button. This will locate all occurances of that routine in any ABAP program and
4.
BDC Operations.
The BDC routines have the ability to modify their behaviour without changing any code. This enables such
operations as debugging, or e-mail notification to be carried out. Note that at the present time some options are
not operation.
In order to support this, a table called YDCSET has to be built and populated. The structure of this table is as
follows:
Field Name
Key Data Element
MANDT
X
MANDT
FUNCNAME
X
RS38L_FNAM
BDCMODE
BDCMODE
BDCUPMODE
BDCUPMODE
CRBATCH
INHIBITCHK
DUMPBDC
DUMPMSG
GENMAIL
MAILPROG
PNAME
Type Length
CHAR
3
CHAR
30
CHAR
1
CHAR
1
CHAR
1
CHAR
1
CHAR
1
CHAR
1
CHAR
64
CHAR
8
Table 2 -YDCSET Table Structure
4.1.
MANDT.
Client, the standard client field for SAP
4.2.
FUNCNAME
This is the function name of the RFC that this record applies to.
4.3.
BDCMODE.
The BDC Mode is the standard screen mode that you wish the BDC to run in. This can be:
 'A'. Display all screens and wait for <enter> between each screen
 'E'. Display only erroneous screens.
 'N'. Display no screens.
4.4.
BDCUPMODE.
This is the standard BDC database update mode for the function. This can be either:
 'A'. Asynchronous update - ie update in the back ground
 'S'. Synchronous update. Wait for the database update to occur before returning from the
BDC.
4.5.
CRBATCH.
The CRBATCH field is a single character field, and can have two values, 'X' or ' '. If the field
contains an X, the BDC routines will create an SM35 batch session should the BDC fail.
4.6.
INHIBITCHK.
In some cases, it can be helpful to inhibit validation checks within a BDC, for example where the
validation becomes too long or is not required in certain circumstances. This field is again a single
character field with a value of 'X' or ''. If the field has a value of 'X', then data validation can be
controlled using the following type of code:
If W__Ydcset-Inhibitchk = False.
Page 29
Select Lgnum From T320 Into W_Lgnm1
Up To 1 Rows
Where Werks = W_Werks And
Lgnum = W_Lgnum.
Endselect.
If Sy-Subrc <> 0.
Move C_Invalid_Warehouse To Pc_Status.
Endif.
Endif.
4.7.
DUMPBDC.
During the development of BDC sessions, it can be useful to see what is actually in the BDC table
itself prior to the call. Again, a single character field, this field determines whether a rudimentary
report detailing the contents of the BDC table should be printed out. 'X' causes the system to print the
table, '' not.
4.8.
DUMPMSG.
In the same manner that DUMPBDC causes the BDC table to be dumped to the nearest printer, this
flag causes the message table to be dumped to the printer should the BDC fail. 'X' causes the system to
dump the table, '' not.
4.9.
GENMAIL.
This field contains a procedure name. This procedure name coupled with the MailProg field is used to
call a specified procedure, passing as parameters the transaction code, the error message and the user
name. The Procedure call is error trapped so that if the procedure cannot be found, the program still
continues.
4.10. MAILPROG.
This field contains the name of the file which holds the procedure used to send mail.
Page 30
5.
Macros and Forms.
What is the difference between a macro and a Perform ?
In technical terms, macros are expanded in-line, whereas a Perform is out of line.....
Macros have to be defined in the same way that Performs have to be with ‘Define’ and ‘End-Of-Definition’.
They are generally used for short pieces of code that cannot be called using a perform.
5.1.
An Example.
The subroutine ‘Subtitles’ prints the report criteria based upon the values passed to in by the caller.
The caller has to loop around the select-options table and pass the relevant data. This is due to the fact
that although Select-Options tables have the same field names, the field definitions differ depending
on the table you have set the select options up for. As you have to specify the structure in the Perform
definition, this makes the writing of a generic routine using Performs impossible:
Form Subtitles Tables p_selects structure s_vkorg using p_title.
The actual definition is:
FORM SUBTITLES using p_text p_sign p_option p_low p_high.
This requires the calling program to loop around the relevant select options table:
Loop at s_vkorg.
Perform Subtitles using ‘Title Text’
s_vkorg-sign s_vkorg-option
s_vkorg-low s_vkorg-high.
EndLoop.
Obviously when this occurs once, the few extra lines of code are no problem, however, eight or nine
selection options can become a bore.
By using a macro, this problem can be alleviated by expanding the code in-line so that all variables etc
are available as normal.
Define PSub.
Loop at &1.
Page 31
Perform Subtitles using &2
&1-Sign &1-option
&1-low &1-high.
EndLoop.
End-Of-Definition.
The macro expands any arguments by replacing the &n parameter with the relevant parameter passed
by the calling program.
Therefore, the lines of code above become:
Psub s_vkorg Text-021.
In a real application, this would look like:
Top-Of-Page.
*
* If Only one company, use that otherwise use Boss Group Holding.
*
Describe table s_vkorg lines w_lines.
if w_lines > 1.
Perform Repheader using 'BG00' w_title.
Else.
if s_vkorg-high = ''.
Perform RepHeader using s_vkorg-low w_title.
Else.
Perform Repheader using 'BG00' w_title.
endif.
endif.
*
* Print out the selection criteria
*
Psub s_vkorg text-023.
Psub s_vkgrp text-024.
Psub s_vkbur text-025.
Psub s_vtweg text-026.
Psub s_spart text-027.
*
* Material Selections
*
Perform Matsub.
PSub s_audat text-029.
Perform PrintTitles.
See Psub (23 below) for more information.
Page 32
6.
Drill Down Reports.
SAP has the ability to provide a ‘Drill Down’ capability where clicking a column on the report provides further
information on the item clicked.
This is catered for by these routines. Clicking an item on the report will call (if present) the
At Line-Selection.
routine of the calling program.
The routines return all variables used to construct the report line to the state when the report line was produced.
In addition, the following system variables are set:
Variable Name
Runtime
SY-TITLE
List Generation
SY-COLNO
SY-LINCT
SY-LINNO
SY-LINSZ
SY-PAGNO
SY-SCOLS
SY-SROWS
Interactive Reporting
SY-CPAGE
SY-CUCOL
SY-CUROW
SY-LILLI
SY-LISEL
SY-LISTI
SY-LSIND
SY-LSTAT
SY-MSGLI
SY-STACO
SY-STARO
SY-UCOMM
Contents
The title of the report
The current column in the list.
Page length in lines
Current line in list
Page width in columns
Current page in list
Number of columns in window
Number of lines in window
Current Page Number
Cursor column position on screen.
Cursor Row position on screen.
Number of selected list line
Contents of the selected line as a string
Index of selected list (0 = base, 1=detail 1 etc)
Index of displayed list (0=base, 1=detail 1 etc)
Status information for each list level
Contents of the message line
Number of first displayed column
Number of first displayed line on this page
Command field function entry.
Table 3 - System Variables Affected By Drill Down Reports
Page 33
7.
Arrays.
Arrays are available in ABAP disguised as internal tables. However, the problem occurs when you try to
define an Array within an existing table.
This is handy when you are dealing series of data that are identical but perhaps are part of a time series for
instance. By using an array the amount of program code can be cut down quite considerably.
As a simple example, the psuedo code below shows how the invoice totals for each month can be totalled.
Assume that a record has a customer number, an invoice total and a month number.
For Each Record In The File
Do
InvoiceTotal(MonthNumber):=InvoiceTotal(MonthNumber)+This Invoice
EndDo
Without subscripts, the code would look like this:
For Each Record In The File
do
case MonthNumber
When 1
InvoiceTotal1 := InvoiceTotal1 +
When 2
InvoiceTotal2 := InvoiceTotal2 +
When 3
InvoiceTotal3 := InvoiceTotal3 +
When ....
When 12
InvoiceTotal12 := InvoiceTotal12
end case
enddo
This Invoice
This Invoice
This Invoice
+ This Invoice
As you can see, the amount of code increases dramatically without arrays.
Arrays (or tables) can be referenced like so:
Read Table t_mytab index w_index.
This will place the w_index’th record from t_mytab in the tables header line so that the information can be
accessed directly.
7.1.
Tables Within Tables.
An array can be implemented in ABAP within a table by using a second table. The methods used are
obscure and thanks goes to Harald Mauchert [[email protected]] for this information.
7.1.1. Defining An Array.
The procedure for defining an array (I’ll use the word array to denote a table within a table) is
simple (and logical) you just define another internal table...
Data:
Begin Of MyTab Occurs 0,
kunnr
like vbak-kunnr,
count
type i,
totals
type i occurs 0,
End Of MyTab.
“ Data Dict definition
“ Normal definition...
“ Internal table.
7.1.2. Accessing An Array.
Accessing these arrays is not as simple as above. Basically, the data in the array is
transferred to an internal table, any operations carried out on the internal table and then the
whole table is moved back into the array:
Page 34
Data: i_totals type i occurs 0 with header line.
Loop at MyTab.
*
*
Get at the data in the array
*
Refresh i_totals.
Move MyTab-Totals[] to i_totals[].
*
Write: / MyTab-kunnr, MyTab-Count, at 50 ‘ ‘.
Loop At i_totals
Write i_totals.
Write /50 ‘ ‘.
EndLoop.
EndLoop.
To Get data out of an array to process:
Move TableName-ArrayName[] to InternalTable[].
To store data back to the array:
Move InternalTable[] to TableName-ArrayName[].
Page 35
8.
Select-Options.
Select Options provide a very flexible method of defining the report search criteria. Select Options are
available on any field where this icon is displayed:
The user can then select a wide range of criteria. By using these criteria, reports can be produced that can
contain contiguous ranges, discrete records, exclusions and even pattern matched results.
Selection criteria are stored in a table created when the program runs. There can be many seperate selection
criteria within one selection option table.
Due to this, reports should have the selection criteria printed at the top of each page so that the user can see
what selection criteria were used to produce the report.
In order to do this, a routine called ‘Subtitle’ should be used. This will print out in plain language what the
report criteria for a specific record in the selection criteria table has.
It is not possible to actually pass the table to the routine as the structure has to be declared as a separate
statement. Each selection criteria table, although having the same field names has a different definition.
For more information on Selection criteria see below.
Page 36
9.
Authorisation Checks.
SAP has the ability to provide authorisation checks for users to enable them to access differing parts of
programs or reports based upon their access code.
To carry out an authorisation check, use the following code:
Authority-Check Object 'AuthorisationObject'
ID ‘Authorisation-id' Field 'Authorisation Field'.
if sy-subrc = 0.
*
*
User has authorised access to this object
*
Else.
*
*
User is not authorised for this object.
*
endif.
If the user has authorisation for this object, SY-SUBRC will be 0. Any other value means that the user is not
authorised. (Some values mean that the object is not present, but if you are protecting sensitive data then
treating that as unauthorised as well is good practice).
There are a huge number of predefined Authorisation Objects, so before creating one of your own, check in
Tools->Administration->Maintain Users->Authorization to see if an appropriate object exists. If one does not
exist there, create your authorisation object and complete the table below which details in house authorisations:
Authorisation
Check
Is the user a dealer ?
Object Class
Object
Sales & Distribution
Dealer Authorisation
Technical
Name
ZDEALER
Authorisation
ID
USR10_1
Table 4 - Custom Authorisation Objects
Page 37
Field
V:ZDEAL+DI
JSB
Aware
Y
10.
Sub-Totals.
The majority of reports require totals at certain places. ABAP provides the ‘AT NEW’ commands which are
difficult, if not exasperatingly impossible to use. YREPINC implements a set of routines that will provide subtotals for columnar style reports.
After formatting the report using BuildReport and FormatReport, a list of break points is setup using InitBreak.
Break points are listed in reverse order - ie the lowest break point first working up to a report total. As the
report is printed, calling CheckBreaks before the printing of each line causes the break points to be checked
and updated, with sub-totals and new group headings being printed as required.
Once the report has been printed, calling RunTotals prints the final set of totals for the report.
All numeric columns on the report will be sub-totalled.
implemented:
Perform
Perform
Perform
Perform
Perform
BuildReport
BuildReport
BuildReport
BuildReport
BuildReport
using
using
using
using
using
Perform BuildReport using
Perform BuildReport using
Perform BuildReport using
Perform BuildReport using
'TSPACE' '' 40 '' ''.
'CATSDB-WORKDATE' '' 0 'DD/MM/YY' ''.
'CHOURS' Text-013 5 '' ''.
'BUYC'
Text-002 11 '' ''.
'BUYTOTAL' text-003 15
'CURRENCY' 'BWAERK'.
'BWAERK' Text-012 0 '' ''.
'SELLC' Text-004 11 '' ''.
'SELLTOTAL' text-005 15
'CURRENCY' 'WAERK'.
'NETWR' text-014 15
'CURRENCY' 'WAERK'.
'WAERK' Text-012 0 '' ''.
Perform BuildReport using
Perform FormatReport.
Read Table t_revenue Index 1.
Perform InitBreak
using 'T_REVENUE-CENDNG'
Perform InitBreak
using 'T_REVENUE-VB'
Perform InitBreak
using 'T_REVENUE-ENAME'
Perform InitBreak
using 'T_REVENUE-ABTEI'
Perform InitBreak
using 'T_REVENUE-KTEXT'
Page 38
The code below shows how this should be
Text-015
Text-006
Text-007
Text-008
Text-009
c_no
c_no
c_no
c_no
c_no
c_yes.
c_yes.
c_yes.
c_yes.
c_yes.
11.
Real-Time Displays.
There may be occasions where a report is showing real time data (for example the status of a queue). If the
operator used the data displayed on the screen, invalid decisions may be made due to the data not being up to
date.
This can be alleviated by having a ‘Refresh’ button on the button bar which the operator must remember to
press if they require the latest information.
This however places the onus for getting the correct information on the operator.
There is however, a way to provide an ‘Auto-Refresh’ capability within a report, which can be expanded to
include other functions.
Primarily, a timer is set running as a totally separate task, even in a different processor. SAP provides the
ability to notify the calling program when this Remote Function Call (RFC) completes.
Function Z_WAIT_X_SECS has been written as an RFC capable function which waits a defined number of
seconds before it exits. As this is a remote function call, the original program continues rather than waiting for
the RFC to complete.
The call to Z_WAIT_X_SECS looks like this:
Call Function 'Z_WAIT_X_SECS'
Starting New Task 'IF'
Performing Start_Refresh On
Exporting
WAIT_TIME = w_pollrate
Exceptions
COMMUNICATION_FAILURE =
SYSTEM_FAILURE
=
OTHERS
=
End Of Task
1 Message w_RFCText
2 Message w_RFCText
3.
This introduces some new parameters to the ‘Call Function’ statement.

Starting New Task:
This addition starts a new task with the task id specified in quotes. This is a separate remote process to run
this function.

Performing …. On End Of Task
This addition signifies that a ‘call back’ is required when the task completes. The routine specified (in this
case start_refresh) is called when this routine exits.

Message
Any explanatory text will be placed in this variable if there is an exception.
Once the time limit has been reached, the RFC exits. The calling program is then notified of this and takes
appropriate action.
11.1. Pushing Keys in ABAP.
Having set up the timer, using the statement :
Set User-Command ‘RFSH’.
Will cause the button ‘RFSH’ to be pushed. By including this statement in the ‘On End Of Task’ call
causes the program to automatically carry out whatever action is specified by the function code.
Thanks to Ted Hoffman [[email protected]] for this information
Page 39
12.
Information Sources.
http://www.sapfans.com/sapfans/
http://src.thehub.com.au/
http://207.105.30.51/simpweb/index.html
SAP User group with forums on all areas of SAP
SAP Resource Centre.
SAP Simplification Centre
Harald Mauchert [email protected]
Section 1.1 Information on Arrays within ABAP
Ted Hoffman
Section 5 - Z_WAIT_X_SECS
[email protected]
John Campbell [email protected]
The CHR/Ascii convertion routine in Initialise_Function.
Page 40
13.
AddRange, AddDiscrete, AddConsec - Macros
13.1. Location.
YREPINC.
13.2. Purpose.
Adds entries to a Range table
13.3. Entry.
13.3.1. Item To Add.
This is the range value that you wish to add to the range table. Applicable to AddRange,
AddDiscrete and AddConsec.
13.3.2. Range Table to add to.
This is the name of the range table that you want the entry added to. Applicable to AddRange,
AddDiscrete and AddConsec.
13.3.3. Item High, Item Low.
This is the range that you wish to use. Applicable to AddConsec only.
13.4. Exit.
13.5. Called By.
AddDiscrete 'ABC' r_mara.
AddConsec 'A' 'Z' r_range.
13.6. Calls.
13.7. Tables.
13.8. System Variables.
13.9. Description.
These three macros add records to a select option table. The Macro AddRange is obsolete, replaced
by AddDiscrete, however, it has been left in the code for backwards compatability.
AddDiscrete adds single entries to a range table.
AddConsec adds a consecutive Range to a range table.
13.10. Examples.
Move i_matnr to w_matnr.
Move c_ok
to w_status.
Move ''
to e_text.
Move ''
to e_xchpf.
Zap t_ekpo.
*
* Document types to include in the search:
*
Addrange: 'NB' r_fbsart,
'UB' r_fbsart,
'ZUB' r_fbsart,
Page 41
'LP' r_lbsart.
*
* Check Valid material, and that the material has been provided.
*
13.11. Source.
*Eject
***********************************************************************
*
*
macro:
AddRange, AddDiscrete, AddConsec.
*
*
Purpose:
Adds an 'EQ' entry to a range table
*
AddDiscrete - copied version of addrange for
*
backwards compatability.
*
AddConsec - adds a 'BT' entry to a range table
*
*
Entry:
Value to add,
*
Range table to use
*
*
Exit:
*
*
*
Called By:
AddRange r_value r_table.
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Define AddRange.
Move 'I' to &2-sign.
Move 'EQ' to &2-option.
Move &1
to &2-low.
Append &2.
End-Of-Definition.
*
Define AddDiscrete.
Move 'I' to &2-sign.
Move 'EQ' to &2-option.
Move &1
to &2-low.
Append &2.
End-Of-Definition.
*
Define AddConsec.
Move 'I' to &3-sign.
Move 'BT' to &3-option.
Move &1
to &3-low.
Move &2
to &3-high.
Append &3.
End-Of-Definition.
13.12. See Also.
Page 42
14.
Begin_Of_Block, End_of_Block - Macros
14.1. Location.
YREPINC.
14.2. Purpose
Simplifies the typing when constructing Selection screen blocks. Note these macros are used by SAPAG (Well….that's where I got them from….)
14.3. Entry
14.3.1.Begin_Of_Block - Block name and Frame title.
These are the standard parameters that you would use when you write the 'Selection Screen
Begin Of Block' statement in full.
14.3.2.End_Of_Block
- Block name
These are the standard parameters that you would use when you write the 'Selection Screen
End Of Block' statement in full.
14.4. Exit
14.5. Called By
Begin_Of_Block BlockName Text-012
14.6. Calls
None
14.7. Tables.
None
14.8. System Variables.
None
14.9. Description.
These two macros simplify the coding required to set up block structures within a selection screen.
14.10. Examples.
Begin_of_block PARAMS Text-001.
Selection-Screen Comment 1(17) Text-016.
Select-options: s_kdgrp
for vbkd-kdgrp,
s_kostl
for pa0001-kostl no-extension,
s_pernr
for pa0001-pernr no-extension,
s_vbeln
for vbak-vbeln
no-extension,
s_wdate
for catsdb-workdate obligatory.
BlankLine.
Selection-Screen Comment 1(17) Text-017.
CheckLeft 1 19 Text-018 p_summry.
End_Of_Block PARAMS.
14.11. Source.
*Eject
***********************************************************************
*
*
macro:
Various Macros for Selection Screens.
Page 43
*
*
Macro
Arguments
Function
*
Begin_Of_Block, Block Name
Simplifies creation of
*
Block Title
Screen blocks
*
*
BlankLine
None
Puts a line on a screen
*
*
End_Of_Block
Block Name
Simplifies creation of
*
Screen blocks
*
*
RadioLeft
Position
Places a radio button
*
Title Length
on a selection screen
*
Title
with comment to left.
*
Parameter
*
Group.
*
*
RadioRight
Position
Places a radio button
*
Title Length
on a selection screen
*
Title
with comment to right
*
Parameter
*
Group.
*
*
CheckLeft
Position
Places a check box
*
Title Length
on a selection screen
*
Title
with comment to left.
*
Parameter
*
*
CheckRight
Position
Places a check box
*
Title Length
on a selection screen
*
Title
with comment to right
*
Parameter
Define Begin_Of_Block.
Selection-Screen Begin Of Block &1 With Frame Title &2.
End-Of-Definition.
*
Define BlankLine.
Selection-Screen Uline.
Selection-Screen Skip 1.
End-Of-Definition.
*
Define End_Of_Block.
Selection-Screen End Of Block &1.
End-Of-Definition.
*
Define RadioLeft.
Selection-Screen Begin Of Line.
Selection-Screen Position &1.
Selection-Screen Comment (&2) &3
Parameter &4 as RadioButton Group &5.
Selection-Screen End Of Line.
End-Of-Definition.
*
Define RadioRight.
Selection-Screen Begin Of Line.
Selection-Screen Position &1.
Parameter &4 RadioButton Group &5.
Selection-Screen Comment (&2) &3.
Selection-Screen End Of Line.
End-Of-Definition.
*
Define CheckLeft.
Selection-Screen Begin Of Line.
Selection-Screen Position &1.
Selection-Screen Comment (&2) &3.
Parameter &4 as CheckBox.
Selection-Screen End Of Line.
End-Of-Definition.
*
Define CheckRight.
Selection-Screen Begin Of Line.
Selection-Screen Position &1.
Parameter &4 as checkbox.
Selection-Screen Comment (&2) &3.
Page 44
Selection-Screen End Of Line.
End-Of-Definition.
14.12. See Also.
BlankLine
CheckLeft
CheckRight
RadioLeft
RadioRight
Page 45
15.
BLANKLINE - Macro
15.1. Location.
YREPINC.
15.2. Purpose.
Inserts a line across a selection screen.
15.3. Entry.
15.4. Exit.
15.5. Called By.
BlankLine
15.6. Calls.
15.7. Tables.
15.8. System Variables.
15.9. Description.
This macro simplifies report screen generation by removing cimbersome commands. Itis used to place
a line on the screen.
15.10. Examples.
15.11. SourceCode.
See Begin_Of_Block.
15.12. See Also.
Begin_Of_Block
End_of_Block
CheckLeft
CheckRight
RadioLeft
RadioRight
Page 46
16.
CHECKLEFT, CHECKRIGHT - Macro
16.1. Location.
YREPINC.
16.2. Purpose.
This macro inserts a check box into a selection screen with the text to the left or right of the check box.
16.3. Entry.
16.3.1.Position.
The position in characters to the start of the comment or check box from the left edge of the
screen or block.
16.3.2.Title Length.
The length of the title in characters
16.3.3.Title
The Title or comment to be applied to the check box
16.3.4.Parameter
The parameter name for the check box.
16.4. Exit.
16.5. Called By.
CheckLeft 40 15 Text-015 p_check.
16.6. Calls.
16.7. Tables.
16.8. System Variables.
16.9. Description.
This macro handles the required screen statements to place a check box on a selection screen with the
text to the left of the check box.
16.10. Examples.
Begin_of_block PARAMS Text-001.
Selection-Screen Comment 1(17) Text-016.
Select-options: s_kdgrp
for vbkd-kdgrp,
s_kostl
for pa0001-kostl no-extension,
s_pernr
for pa0001-pernr no-extension,
s_vbeln
for vbak-vbeln
no-extension,
s_wdate
for catsdb-workdate obligatory.
BlankLine.
Selection-Screen Comment 1(17) Text-017.
CheckLeft 1 19 Text-018 p_summry.
End_Of_Block PARAMS.
Page 47
16.11. SourceCode.
See Begin_Of_Block
16.12. See Also.
Begin_Of_Block
End_of_Block
BlankLine
RadioLeft
RadioRight
Page 48
17.
RADIOLEFT, RADIORIGHT - Macro
17.1. Location.
YREPINC.
17.2. Purpose.
This macro inserts a radio button into a selection screen with the text to the left or right of the check
box.
17.3. Entry.
17.3.1.Position.
The position in characters to the start of the comment or radio button from the left edge of the
screen or block.
17.3.2.Title Length.
The length of the title in characters
17.3.3.Title
The Title or comment to be applied to the radio button
17.3.4.Parameter
The parameter name for the radio button
17.3.5. Group.
The group that the radio button belongs to.
17.4. Exit.
17.5. Called By.
RadioLeft 40 15 Text-015 p_check Group_One.
17.6. Calls.
17.7. Tables.
17.8. System Variables.
17.9. Description.
This macro handles the required screen statements to place a radio button on a selection screen with
the text to the left of the check box.
17.10. Examples.
Begin_of_block PARAMS Text-001.
Selection-Screen Comment 1(17)
Select-options: s_kdgrp
for
s_kostl
for
s_pernr
for
s_vbeln
for
s_wdate
for
BlankLine.
Selection-Screen Comment 1(17)
Page 49
Text-016.
vbkd-kdgrp,
pa0001-kostl no-extension,
pa0001-pernr no-extension,
vbak-vbeln
no-extension,
catsdb-workdate obligatory.
Text-017.
RadioLeft 1 19 Text-018 p_summry group_1.
RadioLeft 1 19 text-019 p_detail group_1.
End_Of_Block PARAMS.
17.11. SourceCode.
See Begin_Of_Block
17.12. See Also.
Begin_Of_Block
End_of_Block
BlankLine
CheckLeft
CheckRight
Page 50
18.
COPYBOOK - Macro
18.1. Location.
YRBINC.
18.2. Purpose.
This macro copys the structure of an SAP table into an internal table of the same name prefixed by tb_.
18.3. Entry.
18.3.1. Table name to use.
This is the table name that should be copied from the data dictionary
18.4. Exit.
18.5. Called By.
CopyBook Lqua.
18.6. Calls.
18.7. Tables.
18.8. System Variables.
18.9. Description.
This macro takes the repetitiveness out of creating an internal table for a dictionary structure.
18.10. Examples.
Form Unload_Docs Using Pu_Funcname Pu_Outdir Pu_Program.
*
CopyBook: dokhl,
doktl.
18.11. SourceCode.
*eject
***********************************************************************
*
*
macro:
CopyBook
*
*
Purpose:
Copies the structure of a specified table into
*
an internal table of the same name prefixed with
*
t_
*
*
Entry:
Table name to copy
*
*
Exit:
Declaration for table t_nnnnnn
*
*
Called By:
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Define CopyBook.
Copy_Structure &1 &1.
Page 51
End-Of-Definition.
18.12. See Also.
Copy_Structure
Page 52
19.
COPY_STRUCTURE - Macro
19.1. Location.
YRBINC.
19.2. Purpose.
Copies a data dictionary structure into a specified internal table
19.3. Entry.
19.3.1.Structure Name to extract from the data dictionary.
19.3.2.Internal table name to copy strcuture to.
19.4. Exit.
19.5. Called By.
Copy_Structure Lqua Lqua_Copy.
19.6. Calls.
19.7. Tables.
19.8. System Variables.
19.9. Description.
19.10. Examples.
19.11. SourceCode.
*eject
***********************************************************************
*
*
macro:
Copy_Structure
*
*
Purpose:
Copies the structure of a specified table into
*
an internal table of a specified name prefixed
*
with a t_
*
*
Entry:
Table name to copy
*
Internal declaration name minus t_ prefix
*
*
Exit:
Declaration for table t_nnnnnn
*
*
Called By:
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Define Copy_Structure.
Data Begin of t_&1 occurs 0.
Include Structure &2.
Data End Of t_&1.
End-Of-Definition.
Page 53
19.12. See Also.
CopyBook.
Page 54
20.
END_OF_REPORT - Macro
20.1. Location.
YREPINC.
20.2. Purpose.
Performs End of Report Processing.
20.3. Entry.
20.3.1.Select option table to use
This parameter is the select option table the code is to process. These are the same arguments
that are used in PSUB.
20.3.2.Title for this selection block.
The title used for the selection block
20.4. Exit.
20.4.1.Report Footer printed
20.5. Called By.
End_Of_Report s_selopt t_title.
20.6. Calls.
RUNTOTALS
TABLELINE
SUBTITLES
WRITECENTRE
20.7. Tables.
20.8. System Variables.
SY-SUBRC
20.9. Description.
This macro performs all end of report processing, including the printing of select option values that
have more than 5 entries. This prevents a recursive call to the page heading routines due to the
subtitles filling complete pages.
20.10. Examples.
*
Read Table t_sflight index 1.
Perform InitBreak using 'T_SFLIGHT-CARRID' Text-002 c_no c_yes.
Loop at t_sflight.
Perform CheckBreaks using t_sflight.
Perform WriteLine
using t_sflight col_normal.
EndLoop.
End_Of_Report: s_carrid text-002.
20.11. SourceCode.
*EJECT
Define End_Of_Report.
Page 55
*
*
*
*
If there are any totals to print then reportbrreaks record count
will be > 1......
Read Table Reportbreaks index 2.
If sy-subrc = 0.
Perform RunTotals.
Else.
Perform TableLine.
EndIf.
Perform WriteCentre using 'End Of Report'.
*
*
*
Any select options ?
Describe table &1 lines w__sublines.
If w__sublines > 4.
Skip 1.
If w__eor_done = False.
Write :/ 'The following select options were also used',
'during the selection process:'.
Move True to w__eor_done.
Else.
Perform TableLine.
Skip 1.
EndIf.
Loop at &1.
Perform Subtitles using &2
&1-Sign &1-option
&1-low &1-high
true.
EndLoop.
EndIf.
End-Of-Definition.
20.12. See Also.
Psub
Page 56
21.
Format_Selects - Macro
21.1. Location.
YREPINC.
21.2. Purpose.
Formats a select table using 'FormatKey'.
21.3. Entry.
21.3.1.Select Option Tables to use.
21.4. Exit.
All select options for that specified table formatted
21.5. Called By.
Format_Selects select-optionstable.
21.6. Calls.
FormatKey
21.7. Tables.
21.8. System Variables.
21.9. Description.
Select Options tables although they have the same field names, have a structure dependant on the table
specified in the select options statement and therefore cannot be passed to a generic subroutine as the
structure of the passed table has to be specified.
Format_Selects provides the loop to call FormatKey so that the programmer does not have to be
concerned with this.
21.10. Examples.
21.11. SourceCode.
*Eject
***********************************************************************
*
*
macro:
Format_Selects
*
*
Purpose:
Formats Select options using fornmat key
*
*
Entry:
Select option to format
*
*
Exit:
Select options formatted as per format key
*
*
Called By:
Format_Selects s_options
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Define Format_Selects.
Page 57
Loop at &1.
Perform formatkey using &1-low changing &1-low.
Perform formatkey using &1-high changing &1-high.
Modify &1.
EndLoop.
End-Of-Definition.
21.12. See Also.
Psub.
FormatKey.
SubTitles.
Page 58
22.
INIT_FUNC - Macro
22.1. Location.
YBDCINC.
22.2. Purpose.
Initialises a function's parameters when called via RFC from a different language other than SAP.
22.3. Entry.
The Function name to be initialised in Quotes
22.4. Exit.
Entry parameters to the function that are optional, have a proposed value and are passed in empty are
set to the proposed value. Entry parameters that are strings are changed to upper case. Exit
parameters are cleared to their initial state. Global parameters are initialised.
22.5. Called By.
Init_Func 'Y_MOVE_FIBER_TO_BIN_RFC'.
22.6. Calls.
22.6.1.Functions:
Function_Get.
22.6.2.Forms:
Init_Global
Read_YDCSet
22.7. Tables.
22.8. System Variables.
SY-UNAME
CHAR C
12
Session: SAP user from SA
22.9. Description.
Functions can be called with a variety of parameters. These parameters can be optional, they can also
have a proposal or default associated with them, so that if they are not provided by the calling routine,
then SAP provides them with the value defined in the proposal.
However, when functions are called as RFC's, from another language, more often than not, the
languages do not support named parameters, rather they support positional parameters in which the
meaning of the parameter is defined by it's position in the argument list rather than the name.
As all the parameters must be specified in the call to the RFC, SAP does not carry out the default
processing correctly.
This macro will carry out that default processing and also, initailise any exported parameters with
INITIAL.
Many thanks to John Campbell, ([email protected]) for the Ascii/Char
translation.
Page 59
22.10. Examples.
FUNCTION Y_CHECK_PO_AND_RETURN_SPLR_RFC.
*"---------------------------------------------------------------------*"*"Local interface:
*"
IMPORTING
*"
VALUE(I_EBELN) LIKE YFIBER-EBELN
*"
EXPORTING
*"
VALUE(E_LIFNR) LIKE YFIBER-LIFNR
*"
EXCEPTIONS
*"
X_NO_PO_NUMBER
*"
X_PO_NOT_FOUND
*"---------------------------------------------------------------------*
*
Data: w_status type status_code,
" RFC Status
w_ebeln
like i_ebeln,
" P/O Number
w_lifnr
like e_lifnr,
" Supplier code
w_text
type status_text.
*
Init_func 'Y_CHECK_PO_AND_RETURN_SPLR_RFC'.
*
Move c_ok
to w_status.
Move i_ebeln
to w_ebeln.
Move ''
to w_lifnr.
*
22.11. SourceCode.
*Eject
***********************************************************************
*
*
macro:
Init_Func
*
*
Purpose:
Initialises a function where it is called by
*
an RFC that uses positional parameters.
*
*
ABAP uses named parameters when communicating
*
with a function. If any of these parameters are
*
specified as optional they do not need to be
*
passed. If these parameters also have a
*
Proposal, then the value of the parameter that
*
has not been passed is set to the value of the
*
proposal.
*
*
However, when calling RFC's, many languages
*
do not have named parameters. As such these
*
languages which use positional parameters cannot
*
exclude any parameters at all.
*
*
This then causes SAP to think that the parameter
*
has been passed (which it has), and that it is
*
blank (which it is), and not substitute the
*
proposal.
*
*
This macro will collect the various optional
*
parameters and if the parameter passed is initial
*
will set it to the default.
*
*
Additionally all export variables are initialised
*
*
Entry:
'Function Name'
*
*
Exit:
*
*
Called By:
Init_Func 'FUNCTION_NAME'
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Page 60
Define Init_Func.
*
Constants: c_param_import
like catfu-paramtype value '1',
"Import parameter flag
c_param_export
like catfu-paramtype value '2',
"Export parameter flag.
*
c_apostrophe type x value 39.
" String delimiter
*
Field-Symbols: <f_param>.
*
Data: Begin of t__prmtab occurs 0.
Include Structure CatFu.
Data: End Of t__prmtab,
*
w__impdefault like catfu-impdefault,
w__name
like catfu-name,
w__dump(30)
type c,
w__apost
like c_apostrophe,
w__fname
like tfdir-funcname.
*
Perform Init_Global.
Move &1 to w__fname.
Translate w__fname to upper case.
Perform Read_YDCSET using w__fname sy-uname changing w__ydcset.
Zap t_bdcmsg.
*
* Get the function details and loop through the parameter list. If
* the variable is an export variable then initialise it. If it is an
* import variable that is optional with a proposal, set the variable
* to the value of the proposal if the value passed is blank.
*
Call Function 'FUNCTION_GET'
Exporting
Funcname
= W__Fname
Tables
Prmtab
= T__Prmtab
Exceptions
Fm_Not_Found
= 1
Nametab_Fault
= 2
Ref_Field_Missing
= 3
Ref_Structure_Missing = 4
Others
= 5.
If sy-subrc <> 0.
Message E000 with 'FUNCTION_GET Failure ' &1 '' ''.
Exit.
EndIf.
Loop at t__prmtab.
*
*
If this parameter is an export parameter then initialise it.
*
If it's an import, check the proposal...
*
Case t__prmtab-paramtype.
When c_param_import.
*
*
Proposal here ??
*
Assign (t__prmtab-name) to <f_param>.
If not t__prmtab-impdefault is initial.
If <f_param> is initial.
*
*
Is this a quote ? (The start of a string)
*
Perform AscChar using t__prmtab-impdefault+0(1)
changing w__apost.
If w__apost = c_apostrophe.
*
*
This is a string. Get rid of the quotes...
*
Move t__prmtab-impdefault+1 to w__impdefault.
Split w__impdefault
at t__prmtab-impdefault+0(1)
into <f_param> w__dump.
Page 61
Else.
Move t__prmtab-impdefault to <f_param>.
EndIf.
EndIf.
EndIf.
*
*
*
*
If this parameter has a character component then
change it to upper case.
If not C__Numeric Cs T__Prmtab-Inttype.
Translate <f_param> to upper case.
EndIf.
When c_param_export.
Assign (t__prmtab-name) to <f_param>.
Clear <f_param>.
EndCase.
EndLoop.
End-of-Definition.
22.12. See Also.
Init_Global
Read_YDCSet.
Page 62
23.
PSUB - Macro
23.1. Location.
YREPINC.
23.2. Purpose.
Prints all select options for a given select-options table.
23.3. Entry.
23.3.1.Select Option Tables to use.
23.3.2.Description of data held in select options table.
23.4. Exit.
All select options for that specified table printed.
23.5. Called By.
Psub select-optionstable Datadescription.
23.6. Calls.
SubTitles
23.7. Tables.
23.8. System Variables.
23.9. Description.
Select Options tables although they have the same field names, have a structure dependant on the table
specified in the select options statement and therefore cannot be passed to a generic subroutine as the
structure of the passed table has to be specified.
Psub provides the loop to call Subtitles so that the programmer does not have to be concerned with
this. Psub will not print select options with more than 5 entries. (See End_Of_Report).
23.10. Examples.
*eject
**********************************************************************
*
*
Procedure:
RHeader
*
*
Purpose:
Prints report header/sub titles etc
*
*
Entry:
*
*
Exit:
*
*
Called By:
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form RHeader using p_sortby p_sortdir.
Page 63
*
Data: w_sutitle(50)
w_srttitle(50)
w_textno(3)
w_srtfld(10)
type
type
type
type
c,
c,
n,
c.
"
"
"
"
Sub title string.
Sorted by
Sort field text no
Sort by text field
*
Field-Symbols <F_ColText>.
" Sort text pointer.
*
Perform RepHeader Using c_vkorg sy-title.
*
*
*
Search Criteria
Psub s_kondm text-019.
Concatenate Text-007 p_pltyp into w_sutitle separated by ' '.
Perform WriteCentre using w_sutitle.
Psub s_lifnr Text-024.
Psub s_ekgrp Text-025.
Psub s_maabc Text-026.
*
*
*
Exceptions.
If Not p_prat9 is Initial.
Perform WriteCentre using text-011.
Endif.
If Not p_prata is Initial.
Perform WriteCentre using Text-012.
EndIf.
If Not p_nil is Initial.
Perform WriteCentre using Text-013.
EndIf.
*
*
*
Sorted By ...
Compute w_textno = p_sortby + 16.
Concatenate 'TEXT-' w_textno into w_srtfld.
Assign (w_srtfld) to <F_ColText>.
Concatenate Text-014 <F_ColText>
Into w_srttitle
Separated by ' '.
if w_sortdir = 'A'.
Concatenate w_srttitle text-015
into w_srttitle
separated by ' '.
else.
Concatenate w_srttitle text-016
into w_srttitle
separated by ' '.
endif.
Perform WriteCentre using w_srttitle.
Perform TableLine.
Skip 1.
Perform PrintTitles.
Perform GHeader using p_sortby.
EndForm.
23.11. SourceCode.
*Eject
***********************************************************************
*
*
macro:
Psub.
*
*
Purpose:
Prints a set of sub titles.
*
*
Entry:
Select option table to use
*
Entry:
Title for this selection block.
*
*
Exit:
Report header produced for current report
*
*
*
Called By:
Psub s_vkorg text-021
*
*
Calls:
Subtitles.
Page 64
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Define PSub.
*
*
Note that these are normally printed in the top of page event.
*
*
In some cases where there are loads of criteria (more than a page
*
length then this will cause a top of page longer than one page
*
which means that the top of page is called again... and so on and
*
so forth.
*
*
Check how many lines there are and if there are more than a
*
pages worth then display them at the end of the report.
*
Describe table &1 lines w__sublines.
If w__sublines < 5.
Loop at &1.
Perform Subtitles using &2
&1-Sign &1-option
&1-low &1-high
False.
EndLoop.
Else.
*
*
Too many options here - print them at the end of the report.
*
Perform Param_Subtitle using &2
'See option list at end of report'
.
EndIf.
End-Of-Definition.
23.12. See Also.
Ednd_Of_Report
SubTitles.
Page 65
24.
WRITETABLE - Macro
24.1. Location.
YREPINC.
24.2. Purpose.
Writes an entire table to a specified column on a report
24.3. Entry.
24.3.1.Table to use
24.3.2. Field name of column to put text in..
24.4. Exit.
24.5. Called By.
WriteTable TableName fieldname.
24.6. Calls.
WriteCol
24.7. Tables.
24.8. System Variables.
24.9. Description.
This Macro will write a sub-table to a defined column on a report. The macro loops around the table
calling WriteCol for each entry.
24.10. Examples.
24.11. SourceCode.
*eject
**********************************************************************
*
*
Procedure:
WriteTable
*
*
Purpose:
Writes a table into asingle column
*
*
Entry:
Table to print
*
Column to use.
*
Exit:
*
*
Called By:
WriteTable t_table 'vbeln'.
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Define WriteTable.
Loop at &1.
Perform WriteCol using &1 &2.
EndLoop.
Page 66
End-Of-Definition.
24.12. See Also.
WriteCol.
Page 67
25.
ZAP - Macro
25.1. Location.
YREPINC.
25.2. Purpose.
Clears the header area and the table area of an internal user defined table.
25.3. Entry.
25.3.1.Table to clear
25.4. Exit.
25.5. Called By.
Zap internal_table.
25.6. Calls.
25.7. Tables.
25.8. System Variables.
25.9. Description.
Two statements are required completely clear an internal table. These are Clear (for the header area)
and refresh for the main table. Zap allows these to be specified in one go.
25.10. Examples.
Zap t_vbbp.
25.11. SourceCode.
*Eject
***********************************************************************
*
*
macro:
Zap.
*
*
Purpose:
Clears and refreshes a table
*
*
Entry:
Table to clear
*
*
Exit:
Table header cleared
*
Table contents deleted
*
*
Called By:
Zap t_table
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Define Zap.
Clear &1.
Refresh &1.
End-Of-Definition.
Page 68
25.12. See Also.
Page 69
26.
ALLHDRS
26.1. Location.
YREPINC.
26.2. Purpose.
Prints all group headers
26.3. Entry.
26.4. Exit.
26.5. Called By.
26.6. Calls.
GROUPHEADER
26.7. Tables.
26.8. System Variables.
26.9. Description.
Prints any group headers defined by InitBreak
26.10. Examples.
26.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
AllHdrs.
*
*
Purpose:
Prints all group headers
*
*
Entry:
*
*
Exit:
*
*
Called By:
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
FORM AllHdrs.
*
Data w__lines type i.
Describe Table ReportBreaks Lines w__lines.
*
*
Don't print run totals here.
*
While w__lines > 0.
Read table ReportBreaks Index w__lines.
Perform GroupHeader
Using ReportBreaks-Title ReportBreaks-Value.
Compute w__lines = w__lines - 1.
Page 70
EndWhile.
EndForm.
26.12. See Also.
Page 71
27.
ASCCHAR
27.1. Location.
YRBINC.
27.2. Purpose.
Ascii(C$) or Chr$(N)
27.3. Entry.
27.3.1.Character to return Ascii code for
Or Number to return character for
27.4. Exit.
Opposite of above
27.5. Called By.
27.6. Calls.
27.7. Tables.
27.8. System Variables.
27.9. Description.
This routine provides the same facility as that provided by the "ASC" and the "CHR$" functions in
Basic. ie it returns the Ascii value of a character or the character associated with an Ascii value.
In ALL languages that enable structures to be used, the value of a structure is always a character
string. The values of the individual fields within the structure are always the correct type.
By defining a structure of a single byte, Asc/Char conversion becomes easy. By assigning a character
to the structure, and reading the field you obtain the ascii value. By assigning the field a value and
reading the structure you obtain the character.
27.10. Examples.
*
Assign (t__prmtab-name) to <f_param>.
If not t__prmtab-impdefault is initial.
If <f_param> is initial.
*
*
*
Is this a quote ? (The start of a string)
Perform AscChar using t__prmtab-impdefault+0(1)
changing w__apost.
If w__apost = c_apostrophe.
*
*
*
This is a string.
Get rid of the quotes...
Move t__prmtab-impdefault+1 to w__impdefault.
Split w__impdefault
27.11. SourceCode.
*EJECT
***********************************************************************
Page 72
*
*
Procedure:
AscChar
*
*
Purpose:
Ascii(C$) or Chr$(N)
*
*
Entry:
Character to return Ascii code for
*
Or Number to return character for
*
*
Exit:
Opposite of above
*
*
*
Called By:
Perform AscChar using 98 changing w_char
*
Perform AscChar using 'A' changing w_num.
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form AscChar Using pu_in changing pc_out.
*
Data: Begin of t__chr,
"ASCII/CHR Converter
asc type x,
End of t__chr,
*
w__len
type i,
w__type(1) type c.
*
*
If pu_in is a character, return the ascii value, if it's
*
a value return the character.
*
Move 0 to pc_out.
Describe field pu_in type w__type.
Case w__type.
When 'C'.
Compute w__len = strlen( pu_in ).
If w__len = 1.
Move pu_in to t__chr.
Move t__chr-asc to pc_out.
EndIf.
When Others.
If pu_in > 0
and pu_in < 256.
Move pu_in to t__chr-asc.
Move t__chr to pc_out.
EndIf.
EndCase.
EndForm.
27.12. See Also.
Page 73
28.
BUILDREPORT
28.1. Location.
YREPINC.
28.2. Purpose.
Adds report data field to table
28.3. Entry.
28.3.1.Data-field name.
This is the name of the table field that should be included in the report. If you include a valid
SAP table name as part of the field name, the routine matches up the field with the
corresponding field in the data table, but at the same time obtains default values from the
Data Dictionary for the full Table-Field combination. If the field does not occur anywhere
other than in the internal table, then the only specification required is the field name
28.3.2.Data field title.
This parameter contains the title that you wish to apply to the column. If this field is blank
and the field name contains a valid table-field combination, then a title is supplied from the
SAP data Dictionary.
28.3.3.Data field length.
This parameter contains the output length for the field. If this field is zero, and the field
name contains a valid table-field combination, then a length is supplied from the SAP data
Dictionary.
28.3.4.FormatType. 'Unit' or 'Currency' or Format mask.
This field defines the format of the output field. If the field is blank, then the output is via
the conversion exit defined for the data-type of the field name in the Data Dictionary.
If the format type is a valid format type, then the format is applied to the data field value
before output.
When the keyword 'Unit' or 'Currency' is specified, the Format Field (See 24.3.5 below)
specifies the Unit or Currency format code. This may either be a literal code such as 'M', or a
field which contains the relevant code within either the internal table used provide the report
data, or a global variable.
This field is optional and can be left blank if required.
28.3.4.1. Abap Documentation - Format Types.
WRITE - Formatting options
Options:
...
...
...
...
...
...
...
...
...
...
...
...
...
...
NO-ZERO
NO-SIGN
DD/MM/YY
MM/DD/YY
DD/MM/YYYY
MM/DD/YYYY
DDMMYY
MMDDYY
YYMMDD
CURRENCY w
DECIMALS d
ROUND r
UNIT u
EXPONENT e
... USING EDIT MASK mask
... USING NO EDIT MASK
... UNDER g
... NO-GAP
(only with WRITE)
(only with WRITE)
... LEFT-JUSTIFIED
Page 74
... CENTERED
... RIGHT-JUSTIFIED
Note
The formatting options UNDER g and NO-GAP are intended only
output to lists and therefore cannot be used with WRITE ... TO.
Option
... NO-ZERO
Effect
If the contents of f are equal to zero, only blanks are output;
if f is of type C or N, leading zeros are replaced by blanks.
Option
... NO-SIGN
Effect
The leading sign is not output if f is of type I, P or F.
Option
Option
... DD/MM/YY
... MM/DD/YY
Effect
If f is a date field (type D), the date is output with a
2-character year as specified in the user's master record. Both
of these formatting options have the same value.
Option
Option
... DD/MM/YYYY
... MM/DD/YYYY
Effect
If f is a date field (type D), the date is output with a
4-character year as specified in the user's master record. Both
of these formatting options have the same value.
Option
Option
... DDMMYY
... MMDDYY
Effect
Date formatting like the additions ... DD/MM/YY and ...
MM/DD/YY, but without separators.
Option
... YYMMDD
Effect
If f is a date field (type D), the date is output in the format
YYMMDD (YY = year, MM = month, DD = Day).
Option
... CURRENCY w
Effect
Correct format for currency specified in the field w.
Treats the contents of f as a currency amount. The currency
specified in w determines how many decimal places this amount
should have.
The contents of w are used as a currency key for the table
TCURX; if there is no entry for w, the system assumes that the
currency amount has 2 decimal places.
Option
... DECIMALS d
Effect
d specifies the number of decimal places for a number field
(type I, P or F) in d. If this value is smaller than the number
of decimal places in the number, the number is rounded. If the
value is greater, the number is padded with zeros.
Since accuracy with floating point arithmetic is up to about 15
decimal places (see ABAP/4 number types), up to 17 digits are
output with floating point numbers (type F). (In some
circumstances, 17 digits are needed to differentiate between
two neighboring floating point numbers.) If the output length
is not sufficient, as many decimal places as possible are
output. Negative DECIMALS specifications are treated as
DECIMALS 0.
Example
Effect of different DECIMALS specifications:
DATA: X TYPE P DECIMALS 3 VALUE '1.267',
Y TYPE F
VALUE '125.456E2'.
WRITE: /X
/X
/X
/Y
/Y
/Y
DECIMALS
DECIMALS
DECIMALS
DECIMALS
DECIMALS
DECIMALS
0,
2,
5,
1,
5,
20.
"output:
"output:
"output:
"output:
"output:
"output:
1
1.27
1.26700
1.3E+04
1.25456E+04
1.25456000000000E+04
Option
... ROUND r
Effect
Scaled output of a field of type P.
The decimal point is first moved r places to the left (r > 0)
or to the right (r < 0); this is the same as dividing with the
appropriate exponent 10**r. The value determined in this way is
output with the valid number of digits before and after the
decimal point. If the decimal point is moved to the left, the
number is rounded.
For further information about the interaction between the
formatting options CURRENCY and DECIMALS, see the notes below.
Effect of different ROUND specifications:
DATA: X TYPE P DECIMALS 2 VALUE '12493.97'.
WRITE: /X
/X
/X
/X
ROUND -2,
ROUND 0,
ROUND 2,
ROUND 5,
"output: 1,249,397.00
"output:
12,493,97
"output:
124.94
"output:
0.12
Option
... UNIT u
Effect
Formats a value according to the unit specified in the field u.
The contents of f are treated as a quantity. The unit specified
in u determines how many decimal places should be output.
If f has more places after the decimal point than determined in
u, the output value will only have the number of decimal places
determined by u, unless the operation truncates digits other
than zero.
If f has fewer places after the decimal point than determined
by u, the option has no effect.
The contents of u are used as a unit in the table T006, but if
there is no entry, the formatting option has no effect.
The field f which is to be output must have the type P. This
option is used for table fields which have the Dictionary type
QUAN, or for fields defined with reference to such fields (DATA
... LIKE ...).
This formatting option excludes the options DECIMALS and ROUND.
Example
Suppose the unit 'STD' has 3 decimals
DATA HOUR TYPE P DECIMALS 3 VALUE '1.200'.
WRITE (6) HOUR UNIT 'STD'. "output:
1,2
HOUR = '1.230'.
WRITE (6) HOUR UNIT 'STD'. "output: 1,230
Page 75
Option
... EXPONENT e
Effect
The field e defines a fixed exponent for a floating point
number (type F). The mantissa is adjusted to the exponent by
moving the decimal point and padding with zeros. With EXPONENT
0, the exponent specification is suppressed.
However, if the output length is too short to accommodate all
digits before the decimal point, the standard output format is
used.
Example
Effect of different EXPONENT specifications:
DATA: X TYPE P VALUE '123456789E2'.
WRITE: /X
/X(10)
/X
/Y
/Y
/Y
/Y
EXPONENT
EXPONENT
EXPONENT
EXPONENT
EXPONENT
EXPONENT
DECIMALS
0,
0,
3,
-3,
9,
2
4.
"output:
"output:
"output:
"output:
"output:
12345678900,000000
1,235E+10
12345678,90000000E+03
12345678900000,00E-03
12,34567890000000E+09
"output:
123456789,0000E+02
Option
... USING EDIT MASK mask
Effect
Outputs f according to the formatting template mask.
Without this addition, f is output in the standard format for
that particular type or with a format defined in the ABAP/4
Dictionary. The addition allows you to define a different
format.
You can specify the formatting template as follows:
-
'_'
represents one character of the field f
or one digit with type P or I
-
'V'
only with fields of type P or I:
output of leading sign
-
'LL'
at beginning of template:
left justify (standard)
-
'RR'
at beginning of template:
right justify
-
'==conv'
perform output conversion conv
-
':', ...
separator
-
(all other characters)
When formatting, the characters '_' in the template are
replaced from the left ('LL') or from the right ('RR') by the
characters or digits (type P or I) of the field f.
Notes
1. When using a template, you must specify the an explicit
output length because otherwise the implicit output length
of the field f is used. Usually, the template is longer than
the implicit output length.
2. If the leading sign is to be output with a field of type P
or I, you must specify the wildcard character V at the
desired place. If this character does not appear in the
template, no leading sign will be output if the value of f
is negative.
3. When formatting a field of type P with decimal places, the
value is not aligned with a character in the template
representing the decimal point (either a period or a comma).
If you want to have this character in the output, you must
insert it in the correct position in the template and define
the formatting from the right. If there is no character for
the decimal point in the template, no such character is
output.
4. Fields of type F are first converted to the standard format
and the resulting sequence is then copied to the template in
the case of a field of type C.
5. You implement the user-specific conversion conv with a
function module called CONVERSION_EXIT_conv_OUTPUT, e.g.
COONVERSION_EXIT_ALPHA_OUTPUT for the conversion of numeric
values with leading zeros to a format without leading zeros
for type C fields. If a Dictionary field is output and the
domain of that field defines a conversion routine, this is
executed automatically. For a description of the conversion,
refer to the documentation of the appropriate function
module.
Example
Formatted output of the time:
DATA TIME TYPE T VALUE '154633'.
WRITE (8) TIME USING EDIT MASK '__:__:__'.
"Output: 15:46:33
If the output length "(8)" was not specified here, the output
would be "15:46:" because the implicit output length for the
type T is 6.
Option
... USING NO EDIT MASK
Effect
Switches off a conversion routine specified in the ABAP/4
Dictionary.
Option
... UNDER g
Effect
Output of the field f begins at the column from which the field
g was output. If this happens in the same output line, the
output of the field g is overwritten.
Note
After UNDER, the field g must be written exactly as the
reference field in the previous WRITE statement, i.e. with an
offset and length if necessary. The exception to this rule is
if g is a text symbol. In this case, the reference field is
determined by the number of the text symbol (not by the text
stored there).
Example
Align output to the reference fields:
FIELD-SYMBOLS <FNAME>.
ASSIGN 'First Name' TO <FNAME>.
WRITE: /3 'Name'(001), 15 <FNAME>, 30 'RoomNo', 40 'Age'(002).
...
WRITE: /
'Peterson' UNDER 'Name'(001),
'Ron'
UNDER <FNAME>,
'5.1'
UNDER 'RoomNo',
(5) 24
UNDER TEXT-002.
This produces the following output (numbers appear
right-justified in their output fields!):
Name
Page 76
First Name
RoomNo
Age
Peterson
Ron
5.1
24
Option
... NO-GAP
Effect
Suppresses the blank after the field f. Fields output one after
the other are then displayed without gaps.
Example
Output several literals without gaps:
WRITE: 'A' NO-GAP, 'B' NO-GAP, 'C'.
"Output: ABC
If NO-GAP was not specified here, the output would have been "A
B C" because one blank is always implicitly generated between
consecutive output fields.
Option
... LEFT-JUSTIFIED
... CENTERED
... RIGHT-JUSTIFIED
Effect
Left-justified, centered or
For number fields (types I,
standard output format, but
other types, as well as for
Examples
Output to a list (WRITE):
right-justified output.
P and F), RIGHT-JUSTIFIED is the
LEFT-JUSTIFIED is used for all
templates.
DATA: FIELD(10) VALUE 'abcde'.
WRITE: / '|' NO-GAP, FIELD LEFT-JUSTIFIED NO-GAP, '|',
/ '|' NO-GAP, FIELD CENTERED
NO-GAP, '|',
/ '|' NO-GAP, FIELD RIGHT-JUSTIFIED NO-GAP, '|'.
* Output: |abcde
|
*
| abcde
|
*
|
abcde|
Formatting in a program field (WRITE...TO...)
DATA: TARGET_FIELD1(10),
TARGET_FIELD2 LIKE TARGET-FIELD1,
TARGET_FIELD3 LIKE TARGET-FIELD1.
WRITE: '123' LEFT-JUSTIFIED TO TARGET-FIELD1,
'456' CENTERED
TO TARGET-FIELD2,
'789' RIGHT-JUSTIFIED TO TARGET-FIELD3.
WRITE: / '|' NO-GAP, TARGET_FIELD1 NO-GAP, '|',
/ '|' NO-GAP, TARGET-FIELD2 NO-GAP, '|',
/ '|' NO-GAP, TARGET_FIELD3 NO-GAP, '|'.
* Output: |123
|
*
|
456
|
*
|
789|
Note
Setting date format und decimal character
Every user can specify in his/her master record (User defaults)
how the date is to be formatted on output and whether the
decimal character should be a comma or a period. You can also
set these output parameters for a particular program by using
the statement SET COUNTRY.
Notes
Specifying several formatting options
You can use the additions of the first group (NO-ZERO, NO-SIGN,
DD/MM/YY etc., CURRENCY, DECIMALS, ROUND, EXPONENT)
simultaneously, provided it makes sense. You can combine the
additions UNDER and NO-GAP with all other additions in any
permutation; however, they are not taken into account until the
field f has been formatted according to all the other options.
Templates, conversion routines and alignment
If you want to format a field using a special conversion
routine, all the other additions (apart from UNDER and NO-GAP)
are ignored. This also applies if the conversion routine is not
explicitly specified, but comes from the ABAP/4 Dictionary.
If you want to format a field using a template, the system
first takes into account the options of the first group, and
then places the result in the template. However, if you specify
one of the date-related formatting options (DD/MM/YY etc.), the
template is ignored.
Finally, the formatted field or the template is copied to the
target field according to the requested alignment. For type C
fields, it is the occupied length that is relevant, not the
defined length; this means that trailing blanks are not taken
into account.
Combined usage of CURRENCY, DECIMALS and ROUND
The rounding factor (from the right) in
WRITE price CURRENCY c ROUND r DECIMALS d
results from the formula
rounding factor = c + r - d.
If DECIMALS is not specified, d = c applies.
You read this formula in the following manner:
The field price is supposed to be of ABAP/4 type P (or I); it
contains a currency amount. The CURRENCY specification
expresses how many decimal places price is to have and may
differ from the definition of price (the decimal point is not
stored internally, but comes from the type attributes of
price). Normally, price is output with as many decimal places
as the field has internally according to the type attributes or
the CURRENCY specification. You can override this number of
output decimal places with DECIMALS. The addition ROUND
addition moves the decimal point r places to the left, if r is
positive, otherwise to the right. This means that a $ amount is
output with ROUND 3 in the unit 1000 $.
According to the above formula, there can also be a "negative"
rounding factor; then, the corresponding number of zeros is
appended to the amount price on the right using the "rounding
factor". However, the value of "rounding factor" must be at
least equal to -14.
Currency fields and DATA with DECIMALS
If the field price is normally formatted with decimal places
(e.g. fields for currency amounts), these are treated like a
CURRENCY specification when rounding, if CURRENCY was not
expressly specified.
If present, the DECIMALS specification defines how many decimal
Page 77
places are to be output after rounding.
If the DECIMALS and the (explicit or implicit) CURRENCY
specifications are different, rounding takes place according to
the above formula, even if no ROUND specification was made
(i.e. r = 0).
If a field in the DATA statement was declared with DECIMALS n,
WRITE treats it like a currency field with n decimal places.
Examples
Sales in pfennigs or lira: 246260
Unit TDM or TLira with 1 decimal place.
DATA SALES TYPE P VALUE 246260.
WRITE SALES CURRENCY 'DEM' ROUND 3 DECIMALS 1. "
WRITE SALES CURRENCY 'ITL' ROUND 3 DECIMALS 1. "
2,5
246,3
TDM
TLira
Sales in pfennigs or lira: 99990
Unit TDM or TLira with 1 decimal place.
SALES = 99990.
WRITE SALES CURRENCY 'DEM' ROUND 3 DECIMALS 1. "
1,0
WRITE SALES CURRENCY 'ITL' ROUND 3 DECIMALS 1. " 100,0
TDM
TLira
Sales in pfennigs or lira: 93860
Unit 100 DM or 100 lira with 2 decimal places:
SALES = 93860.
WRITE SALES CURRENCY 'DEM' ROUND 2 DECIMALS 2. "
9,38 HDM
WRITE SALES CURRENCY 'ITL' ROUND 2 DECIMALS 2. " 938,60 HLira
Sales in pfennigs: 93840
Unit 1 DM without decimal places.
SALES = 93860
WRITE SALES CURRENCY 'DEM'
DECIMALS 0. " 938
DM
DECIMALS 0. " 939
DM
Sales in pfennigs: 93860
Unit 1 DM without decimal places.
SALES = 93860.
WRITE SALES CURRENCY 'DEM'
Note
Runtime errors:
-
WRITE_CURRENCY_ILLEGAL_TYPE: CURRENCY parameter with WRITE
is not type C
WRITE_ROUND_TOO_SMALL: Rounding parameter is less than -14
WRITE_UNIT-ILLEGAL_TYPE: UNIT parameter with WRITE is not
type C
Return ->
ABAP/4 Editor
Other additional formats are available. These are generally colour specifications.
following colours can be used by specifying the text shown:
The
Figure 1 - Colour Codes
28.3.5.Format field.
This field is used in conjunction with the Format Type field see 28.3.4 above. If the Format
type field contains the words 'Unit' or 'Currency', then this field should contain either a valid
Unit or Currency Code, or a variable that contains one of these codes. The variable may
either be a field in the same record of the internal table that holds the data being reported on,
or a variable defined within the report itself.
28.3.5.1.Abap Documentation - Unit.
Page 78
Option
... UNIT u
Effect
Formats a value according to the unit specified in the field u.
The contents of f are treated as a quantity. The unit specified
in u determines how many decimal places should be output.
If f has more places after the decimal point than determined in
u, the output value will only have the number of decimal places
determined by u, unless the operation truncates digits other
than zero.
If f has fewer places after the decimal point than determined
by u, the option has no effect.
The contents of u are used as a unit in the table T006, but if
there is no entry, the formatting option has no effect.
The field f which is to be output must have the type P. This
option is used for table fields which have the Dictionary type
QUAN, or for fields defined with reference to such fields (DATA
... LIKE ...).
This formatting option excludes the options DECIMALS and ROUND.
Example
Suppose the unit 'STD' has 3 decimals
DATA HOUR TYPE P DECIMALS 3 VALUE '1.200'.
WRITE (6) HOUR UNIT 'STD'. "output:
1,2
HOUR = '1.230'.
WRITE (6) HOUR UNIT 'STD'. "output: 1,230
28.3.5.2. Abap Documentation - Currency.
Option
... CURRENCY w
Effect
Correct format for currency specified in the field w.
Treats the contents of f as a currency amount. The currency
specified in w determines how many decimal places this amount
should have.
The contents of w are used as a currency key for the table
TCURX; if there is no entry for w, the system assumes that the
currency amount has 2 decimal places.
28.4. Exit.
None
28.5. Called By.
CHECKBOX
Perform BuildReport using p_name p_title p_length '' ''.
28.6. Calls.
28.7. Tables.
dd01l
dd03l
dd04t
-
Domains
Table Fields
R/3 DD: Data element texts
28.8. System Variables.
SY-SUBRC
SY-LANGU
INT4 X
LANG C
4
1
Return value after specif
SAP logon language key
28.9. Description.
BuildReport populates an internal table prior to using the data stored in the table to format a report.
Field and table names are converted to upper case before being stored in the table. The Table name if
present and the field name are then used to locate the field entry in the SAP Data dictionary.
The Data dictionary provides a ‘Domain’ name for the variable which is used to access the Domains
table. The domains table provides the physical attributes of the field such as print width and
conversion routines.
The routine also uses information obtained from the Data dictionary to locate the field title. If the title
parameter passed to the routine is blank, then the title retrieved is stored for use.
In any case, the print parameters (Width and conversion routines) are stored in the table.
The routine then examines the title of the field (either that passed, or that retrieved) to make sure that
the column width is at least wide enough to accommodate the longest word in the title.
The table used by this routine must be initialised before adding the first entry by using:
Page 79
Refresh ReportTable.
There must be one call to this routine for each column of information in the report.
28.10. Examples.
Form Report_BadData Tables t_zisid Structure t_zisid.
*
Data: w_ermsg like t_zisid-ermsg,
" Group heading....
w_matnr like t_zisid-matnr,
w_text like dd04t-ddtext.
" Concatenate Group hdr
*
Zap ReportTable.
Perform BuildReport using 'ZISID-ZZSHIPNO' '' 0 '' ''.
Perform BuildReport using 'ZISID-PRONU'
'' 0 '' ''.
Perform BuildReport using 'ZISID-EBELN'
'' 0 '' ''.
Perform BuildReport using 'ZISID-EBELP'
'' 0 '' ''.
Perform BuildReport using 'EKBE-MENGE'
'' 0 '' ''.
Perform BuildReport using 'MSEG-MBLNR'
'' 0 '' ''.
Perform BuildReport using 'MSEG-MJAHR'
'' 0 '' ''.
Perform BuildReport using 'MSEG-ZEILE'
'' 0 '' ''.
28.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
BuildReport.
*
*
Purpose:
Adds report data field to table
*
*
Entry:
Data-field name
*
Data field title
*
Data field length
*
FormatType. 'Unit' or 'Currency' or format mask
*
Format field
*
*
Exit:
None
*
*
Called By:
Perform BuildReport
*
using field title format field
*
Format-field
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
FORM BUILDREPORT using p_field
p_title
like dd04t-ddtext
p_len
like dd03l-leng
p_formattype
like datatype-char0016
p_formatfield
like dd03l-fieldname.
*
Tables: dd01l, dd03l, dd04t.
Data: Begin Of t_dd01l occurs 0,
DataType like dd01l-datatype,
Convexit like dd01l-convexit,
End Of t_dd01l,
*
Begin of t_dd03l occurs 0,
Domname like dd03l-domname,
As4local like dd03l-as4local,
As4vers like dd03l-as4vers,
Rollname like dd03l-rollname,
leng
like dd03l-leng,
End Of t_dd03l,
*
Begin Of SplitTab occurs 0,
word(50) type c,
End Of SplitTab,
Page 80
*
w__table
w__field
w__fmask(30)
w__ffield(30)
w__tlen
like
like
type
type
type
dd03l-tabname,
dd03l-fieldname,
c,
c,
i.
*
clear ReportTable.
*
*
*
Check for table-field name or just field name.....
Search p_field for '-'.
If sy-subrc = 0.
Split p_field at '-' into w__table w__field.
Else.
Move p_field to w__field.
EndIf.
Translate w__table to upper case.
Translate w__field to upper case.
*
Move p_formattype to w__fmask.
Translate w__fmask to upper case.
Move p_formatfield to w__ffield.
Translate w__ffield to upper case.
*
ReportTable-Table = w__table.
ReportTable-FieldName = w__field.
ReportTable-Title = p_title.
ReportTable-ColWidth = p_len.
ReportTable-Startpos = 0.
ReportTable-ConvExit = ''.
ReportTable-DataType = ''.
Case w__fmask.
When 'UNIT'.
Move w__ffield to ReportTable-Unit.
When 'CURRENCY'. Move w__ffield to ReportTable-Currency.
When Others.
Move w__fmask to ReportTable-Format.
EndCase.
*
*
*
Get the details from the data dictionary ?
if w__table <> ' '.
Zap t_dd01l.
Zap t_dd03l.
Select domname as4local as4vers rollname leng
into corresponding fields of table t_dd03l
from dd03l
where tabname
= w__table
and fieldname = w__field
and as4local = 'A'
and as4vers
= '0000'.
*
*
*
Variable Characteristics
Read Table t_dd03l index 1.
Select single datatype convexit
into corresponding fields of t_dd01l
from dd01l
where domname = t_dd03l-domname
and as4local = t_dd03l-as4local
and as4vers = t_dd03l-as4vers.
*
*
*
Title Texts
Read Table t_dd01l index 1.
if ReportTable-Title = ' '.
Select ddtext
Up to 1 rows
Into ReportTable-Title
From dd04t
where rollname
= t_dd03l-rollname
and ddlanguage = sy-langu
and as4local
= 'A'.
EndSelect.
Page 81
endif.
if p_len = 0.
Move t_dd03l-leng
to ReportTable-ColWidth.
else.
Move p_len
to ReportTable-ColWidth.
EndIf.
If not t_dd01l-convexit is initial.
Concatenate '==' t_dd01l-convexit into ReportTable-Convexit.
EndIf.
Move t_dd01l-datatype to ReportTable-DataType.
endif.
*
*
*
Is column width less than an individual word in the title ?
Clear SplitTab.
Split ReportTable-Title at ' ' into table SplitTab.
Loop at SplitTab.
Compute w__tlen = strlen( SplitTab-Word ).
if w__tlen >= ReportTable-ColWidth.
ReportTable-ColWidth = w__tlen + 2.
endif.
endloop.
Append ReportTable.
ENDFORM.
"BUILDREPORT.
28.12. See Also.
CheckBox
CheckBreaks
FormatReport
InitBreaks
WriteLine
PrintTotals
29.
30.
Page 82
31.
CENTREREPORT
31.1. Location.
YREPINC.
31.2. Purpose.
Sets a flag to tell formatreport to centre the report on the page or not.
31.3. Entry.
31.3.1.True or False
31.4. Exit.
31.5. Called By.
NEWREPORT.
Perform CentreReport using True.
31.6. Calls.
31.7. Tables.
31.8. System Variables.
31.9. Description.
31.10. Examples.
*
Modification History:
*
*
Date
Reason
Version Who
*
Form NewReport.
Zap ReportTable.
Zap ReportBreaks.
Perform CentreReport using True.
Move True to w__runtotal.
Move False to w__grouphdr.
Move False to w__lineprinted.
EndForm.
*Eject
***********************************************************************
*
31.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
CentreReport.
*
*
Purpose:
Sets a flag to tell formatreport to centre the
*
report on the page or not.
*
*
Entry:
True or False
*
*
Exit:
*
Page 83
*
Called By:
Perform CentreReport using True
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
*
*
Form CentreReport using pu_centre like true.
Move pu_centre to w__centre.
EndForm.
31.12. See Also.
Page 84
Version
Who
32.
CHECKBOX
32.1. Location.
YREPINC.
32.2. Purpose.
Adds report data field to table as a check box .
Figure 2Report With Check Boxes.
32.3. Entry.
32.3.1.Data-field table.
This is the name of the table field that should be included in the report. If you include a valid
SAP table name as part of the field name, the routine matches up the field with the
corresponding field in the data table, but at the same time obtains default values from the
Data Dictionary for the full Table-Field combination. If the field does not occur anywhere
other than in the internal table, then the only specification required is the field name
32.3.2.Data field title.
This parameter contains the title that you wish to apply to the column. If this field is blank
and the field name contains a valid table-field combination, then a title is supplied from the
SAP data Dictionary.
32.3.3.Data field length.
This is the width of the column you wish the Check box to be centred in. The minimum (and
the default width is 3)
32.4. Exit.
None
32.5. Called By.
32.6. Calls.
BUILDREPORT
32.7. Tables.
32.8. System Variables.
SY-SUBRC
SY-TABIX
Page 85
INT4 X
INT4 X
4
4
Return value after specif
Runtime: Current line of
32.9. Description.
CheckBox inserts a check box onto a report. The check box will appear in a column with a minimum
width of three spaces. The check box can be used to allow end-users to select multiple lines from a
report.
32.10. Examples.
EndIf.
Psub s_bname 'Developer'.
Perform PrintTitles.
EndForm.
*
Form UserRep.
Zap ReportTable.
Perform CheckBox
using 'Selct' 'Process' 3.
Perform BuildReport using 'usr01-bname' '' 0 '' ''.
Perform BuildReport using 'Fulln' 'Full Name' 40 '' ''.
Perform FormatReport.
Set Pf-Status 'ZDLARTHR'.
Move '0' to w_state.
Loop at t_users.
Perform WriteLine using t_users col_normal.
32.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
CheckBox.
*
*
Purpose:
Adds report data field to table as a check box
*
*
Entry:
Data-field table
*
Data field title
*
Data field length
*
*
Exit:
None
*
*
Called By:
Perform CheckBox
*
using table name title length
*
*
Calls:
BuildReport
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form CheckBox using p_name
like dd03l-fieldname
p_title like dd04t-ddtext
p_length like dd03l-leng.
*
Constants: c__cboxwidth type i value 3.
*
Data: w__table(20) type c,
w__name(20) type c.
*
Perform BuildReport using p_name p_title p_length '' ''.
*
*
Locate this record and set the check box flag.
*
Search p_name for '-'.
If sy-subrc = 0.
Split p_name at '-' into w__table w__name.
Else.
Move p_name to w__name.
EndIf.
Translate w__table to upper case.
Translate w__name to upper case.
Read Table ReportTable with key Table
= w__table
FieldName = w__name.
Page 86
if sy-subrc = 0.
Move True to ReportTable-CheckBox.
If ReportTable-ColWidth < c__cboxwidth.
Move c__cboxwidth to ReportTable-ColWidth.
EndIf.
Modify ReportTable Index sy-tabix.
EndIf.
EndForm.
32.12. See Also.
BuildReport
CheckBreaks
InitBreaks
WriteLine
PrintTotals
Page 87
33.
CHECKBREAKS
33.1. Location.
YREPINC.
33.2. Purpose.
Checks and prints total breaks
33.3. Entry.
ReportData Table.
33.4. Exit.
33.5. Called By.
Perform CheckBreaks tables datatable.
33.6. Calls.
TABLELINE
GROUPHEADER
33.7. Tables.
33.8. System Variables.
SY-TABIX
SY-INDEX
SY-SUBRC
INT4 X
INT4 X
INT4 X
4
4
4
Runtime: Current line of
Number of loop passes
Return value after specif
33.9. Description.
CheckBreaks examines the table initialised by sequential calls to InitBreak. The values stored against
the various break levels are checked. If these are the same as the current data line the numeric values
on the data line are accumulated against the relevant break level.
If a value in the break table is different from the corresponding value in the data line, the search
terminates and all sub totals up to and including the subtotal check value that has changed are printed
and the variables reset.
The initial call to CheckBreaks also prints any group headers required.
If any subtotals are printed, the corresponding group headers are then printed.
33.10. Examples.
*
if w_repid = c_zso0620.
Perform CheckBreaks tables t_repdata.
Endif.
Perform Writeline tables t_repdata using Col_Normal.
EndLoop.
*
*
*
Final totals.
Perform RunTotals Tables t_repdata.
33.11. SourceCode.
*Eject
***********************************************************************
Page 88
*
*
Procedure:
Checkbreaks
*
*
Purpose:
Checks and prints total breaks
*
*
Entry:
breakTotals table established
*
Entry
ReportData Table.
*
*
Exit:
*
*
Called By:
Perform CheckBreaks using p_datatable.
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form Checkbreaks using p_datatable.
*
Field-Symbols: <F_Group>.
Data: t__coltotals type Decimal_Value occurs 0 with header line,
t__carry
type Decimal_Value occurs 0 with header line,
w__breaklevel type i value -1,
w__totprint
type i,
W__Pos
Type i,
W__Ffeed
like c_yes,
w__datatable(2000) type c.
*
Move p_datatable to w__datatable.
If w__allhdr_done = False.
Perform AllHdrs.
Move True to w__allhdr_done.
EndIf.
Loop at ReportBreaks.
*
*
Any value from a lower sub total ?
*
Don't do run totals here....
*
if ReportBreaks-Title <> 'Run Total:'.
Assign (ReportBreaks-field) to <F_Group>.
if <F_group> <> ReportBreaks-value.
*
*
Print a group total.
*
Move sy-tabix to w__breaklevel.
*
*
Form Feed ?
*
If ReportBreaks-Ffeed = c_yes.
Move c_yes to w__ffeed.
Endif.
Endif.
Endif.
EndLoop.
*
*
Break at what level ?
*
If w__breaklevel <> -1.
Zap t__carry.
Compute w__totprint = w__breaklevel + 1.
do w__totprint times.
*
*
Add the totals from the previous level.
*
Read Table ReportBreaks Index sy-index.
Move Reportbreaks-Totals[] to t__coltotals[].
Loop at t__coltotals.
Move sy-tabix to w__pos.
Read Table t__carry index w__pos.
if sy-subrc = 0.
Compute t__coltotals = t__coltotals + t__carry.
Modify t__coltotals index w__pos.
Page 89
Move t__coltotals to t__carry.
Modify t__carry index w__pos.
else.
Clear t__carry.
Move t__coltotals to t__carry.
Append t__carry.
Endif.
EndLoop.
Move t__coltotals[] to ReportBreaks-Totals[].
Modify ReportBreaks Index sy-index.
*
*
*
Print the totals at this level.
if sy-index <= w__breaklevel.
Perform PrintTotals using sy-index.
Read Table ReportBreaks Index sy-index.
*
*
*
Update the break value and set the totals to 0.
Assign (ReportBreaks-field) to <F_Group>.
Move <F_group> to ReportBreaks-value.
Loop at t__coltotals.
Clear t__coltotals.
Modify t__coltotals.
EndLoop.
Move t__coltotals[] to Reportbreaks-totals[].
Modify ReportBreaks index sy-index.
EndIf.
EndDo.
*
*
*
Form feed required ?
If w__ffeed = c_yes.
Perform TableLine.
New-Page.
EndIf.
*
*
*
Group Headers.
Compute w__totprint = w__breaklevel.
while w__totprint > 0.
Read Table ReportBreaks Index w__totprint.
Perform GroupHeader
using ReportBreaks-Title ReportBreaks-Value.
Compute w__totprint = w__totprint - 1.
EndWhile.
EndIf.
Move w__datatable to p_datatable.
EndForm.
33.12. See Also.
AllHdrs
BuildReport
CheckBox
InitBreaks
WriteLine
PrintTotals
Page 90
34.
CHECK_DOMAIN_VALUES
34.1. Location.
YRBINC.
34.2. Purpose.
This routine checks a domains entities to see if the specified value exists is one of those entities.
34.3. Entry.
34.3.1. Domain Name To Check
34.3.2. Value To Check
34.4. Exit.
One parameter is returned by this routine and can have the following values:
True:
False:
The domain contains the value specified
The Domain name is wrong, or the value does not exist
34.5. Called By.
34.6. Calls.
34.7. Tables.
34.8. System Variables.
SY-SUBRC
INT4 X
4
Return value after specif
34.9. Description.
This routine can be used to check values passed into functionns and forms via RFC's and so forth,
rather than the more normal method of entry via a screen.
34.10. Examples.
34.11. SourceCode.
*Exit
**********************************************************************
*
*
Procedure:
Check_Domain_Values
*
*
Purpose:
Checks that a value exists in the
*
specified domain
*
*
Entry:
Domain name to use
*
Value to check
*
*
Exit:
True - domain contains value
*
False - domain does not contain value
*
*
Called By:
Perform Check_Domain_Values
*
using w_domain w_value
*
changing w_valid.
*
*
Calls:
Page 91
*
*
Modification History:
*
*
Date
Reason
Version
*
Form check_domain_values using pu_domain like dd07l-domname
pu_value like dd07l-domvalue_l
Changing pc_valid like true.
*
Call Function 'CHECK_DOMAIN_VALUES'
Exporting
domname
= pu_domain
value
= pu_value
Exceptions
no_domname
= 1
wrong_value
= 2
dom_not_found = 3
Others
= 4.
If sy-subrc = 0.
Move true To pc_valid.
Else.
Move false To pc_valid.
Endif.
Endform.
34.12. See Also.
Page 92
Who
35.
COLUMN_COLOUR
35.1. Location.
YREPINC.
35.2. Purpose.
Sets the colour of a specific column
35.3. Entry.
35.3.1.Column width
35.3.2.Colour to set
35.3.3.Value to write
35.3.4.Actual colour code to use.
35.4. Exit.
35.5. Called By.
WRITEVALUE
Perform Column_Colour using p_width p_value p_format col_heading.
35.6. Calls.
SETCOLOUR
35.7. Tables.
35.8. System Variables.
35.9. Description.
This procedure sets the back ground colour for the currently selected column.
35.10. Examples.
*
*
Colours....
When 'COL_BACKGROUND' or 'GREY'.
Perform Setcolour using Col_background.
Write at (p_width) p_value no-gap.
Perform SetColour using w__last_colour.
When 'COL_HEADING' or 'BLUE' or 'DARK_BLUE'.
Perform Column_Colour using p_width
p_value
p_format
col_heading.
When 'COL_NORMAL' or 'WHITE' or 'BEIGE'.
If p_format <> 'BEIGE'.
Perform Column_Colour using p_width
p_value
Page 93
35.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
Column_Colour
*
*
Purpose:
Sets the colour of a specific column
*
*
Entry:
Column width
*
Entry:
Colour to set
*
Entry:
Value to write
*
Entry:
Actual colour code to use.
*
*
Exit:
Actual mask to use.
*
*
Called By:
Perform Getmask using mask_in changing mask_out
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form Column_Colour using p_width p_value p_format p_colour.
*
*
Need to set intensified on for dark colours ??
*
Data w__format(20) type c.
*
Move p_format to w__format.
If w__format+0(4) = 'DARK'.
Format Intensified on.
Else.
Format Intensified off.
EndIf.
*
Perform Setcolour using p_colour.
Write at (p_width) p_value no-gap.
*
*
Ok, put intensity back to what it should be.....
*
*
w__intense_flag is the NEXT not the CURRENT intensity setting
*
for the line....so if it's False, intensity is already on,
*
If it's True then intensity is off.....
*
*
oh my gawd.....
*
If w__format+0(4) = 'DARK'.
If w__intense_flag = True.
Format Intensified off.
EndIf.
Else.
If w__intense_flag = False.
Format Intensified on.
EndIf.
EndIf.
Perform SetColour using w__last_colour.
EndForm.
35.12. See Also.
Page 94
36.
DUMP_TABLE
36.1. Location.
YREPINC.
36.2. Purpose.
This routine dumps the specified table one full record at a time.
36.3. Entry.
36.3.1.None
36.3.2. Tables:
Unstructured table for dump
36.4. Exit.
36.4.1.None
36.5. Called By.
36.6. Calls.
SAVEREPORT
NEWREPORT
BUILDREPORT
36.7. Tables.
36.8. System Variables.
SY-LINSZ
SY-INDEX
SY-SUBRC
SY-LSIND
INT4
INT4
INT4
INT4
X
X
X
X
4
4
4
4
Line size of list
Number of loop passes
Return value after specif
Number of secondary list
36.9. Description.
A debugging tool that will dump as much of the table as possible to the screen.
36.10. Examples.
SELECT SINGLE WRKST
FROM MARA
INTO T_COLOR_LIST-WRKST
WHERE MATNR = TB_RESERVE-PMTNR.
APPEND T_COLOR_LIST.
ENDIF.
ENDLOOP.
PERFORM DUMP_TABLE TABLES TB_RESERVE.
EXIT.
*
*
Send any non-coloured fiber to the colouring shop.
*
*
Find the coloring shop order first. Take the first shop order
*
that has an order type of CLOR and the dates are this month.
*
Page 95
36.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
Dump_Table
*
*
Purpose:
This routine dumps the specified table
*
one full record at a time.
*
*
Entry:
None
*
*
Tables:
Unstructured table for dump
*
*
Exit:
None
*
*
Called By:
Perform DumpTable Tables t_tabname.
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form Dump_Table tables t_dumptable.
*
Field-Symbols <f_table_field>.
*
Data: w__fwidth like dd03l-leng,
w__twidth like w__fwidth,
w__nwidth like w__fwidth,
w__linsz like sy-linsz.
*
Move sy-linsz to w__linsz.
Perform SaveReport using 'DumpTab'.
Perform NewReport.
*
*
Get the table field details.
*
Read Table t_dumptable index 1.
Do.
Assign component sy-index
of structure t_dumptable
to <f_table_field>.
If sy-subrc = 0.
Describe field <f_table_field> output-length w__fwidth.
Compute w__nwidth = w__twidth + w__fwidth + 2.
If w__nwidth < 255.
Perform BuildReport using sy-index '' w__fwidth '' ''.
Move w__nwidth to w__twidth.
Else.
Exit.
EndIf.
Else.
Exit.
EndIf.
EndDo.
New-page line-size 255.
Perform FormatReport.
*
Loop at t_dumptable.
Perform WriteLine using t_dumptable col_normal.
EndLoop.
Move 1 to sy-lsind.
New-Page line-size w__linsz.
EndForm.
36.12. See Also.
Page 96
37.
FIRSTCOL
37.1. Location.
YREPINC.
37.2. Purpose.
Sets the first column of the report
37.3. Entry.
37.3.1. Direction to move the first column of the report.
The first column displayed for the report is set in a relative fashion. Either the first or last
column on the report, or plus or minus one column. These movements are decided upon by
the value of this parameter:




'<<' - Move to the left margin.
'<' - Move Left 0ne column
'>' - Move Right one column.
'>>' - Move to Right margin.
37.4. Exit.
37.5. Called By.
37.6. Calls.
37.7. Tables.
37.8. System Variables.
37.9. Description.
This routine sets the first column displayed at the left edge of the screen. This is the Report Column,
rather than the column of characters. If for example the 2 nd column of the report starts at physical
column 20 of the display, then perfoming Firstcol once with a value of '>' will display the 19 th actual
column as the first column of the display.
37.10. Examples.
Case w_ucomm.
When 'PROCESS'.
Perform Process_Selections using w_mode.
Perform Message_Report.
Perform Setup_Proposal.
When 'PICK'.
Break-Point.
When 'SELECT'.
Perform Chngall using 'X'.
When 'DESELECT'.
Perform Chngall using ' '.
When 'LEFTMARGIN'. Perform FirstCol using '<<'.
When 'ONEL'.
Perform FirstCol using '<'.
When 'ONER'.
Perform FirstCol using '>'.
When 'RIGHTMARGI'. Perform FirstCol using '>>'.
EndCase.
*
Start-Of-Selection.
*
Page 97
37.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
FirstCol.
*
*
Purpose:
Sets the first column of the report
*
*
Entry:
'<<' - Move to the left margin.
*
'<' - Move Left 0ne column
*
'>' - Move Right one column.
*
'>>' - Move to Right margin.
*
*
Exit:
*
*
Called By:
Perform FirstCol using '>>'.
*
*
Calls:
*
*
Modification History:
*
Form FirstCol using p_action.
*
Statics: w__macol like sy-macol,
" Current Margin
w__Cols type i.
" Number of columns
*
Data:
w__newm like sy-macol.
" New column
*
Move 0 to w__newm.
if w__macol is Initial.
Move 1 to w__macol.
Describe Table reportTable lines w__cols.
EndIf.
Case p_action.
When '<<'. Move 0 to w__macol.
" Left Margin
When '<'. If w__macol > 0.
Subtract 1 from w__macol.
EndIf.
When '>'. If w__macol < w__cols.
Add 1 to w__macol.
EndIf.
When '>>'. Move w__cols to w__macol.
" Right Margin
EndCase.
If w__macol <> 0.
Read Table ReportTable Index w__macol.
Compute w__newm = ReportTable-StartPos + 2.
Scroll List To Column w__newm.
Else.
Scroll List to Column 0.
EndIf.
EndForm.
37.12. See Also.
Page 98
38.
FORMATKEY
38.1. Location.
YRBINC.
38.2. Purpose.
Formats a key. If it is all zeroes, then it is right justfied and padded with zeroes If it is alpha-numeric
then it is left justified and padded with spaces
38.3. Entry.
38.3.1.Value to format
38.4. Exit.
38.4.1.Formatted value
38.5. Called By.
38.6. Calls.
38.7. Tables.
38.8. System Variables.
38.9. Description.
When reading rows from SAP tables, it can happen that even though you specifiy a valid key, the
relevant rows are not returned. This is due to the formatting of the key, and primarily happens with
numeric type variables that are prefixed with zeroes.
Having checked if the string contains only numbers, the routine then puts the key in an N type
variable, and then takes the rightmost number of characters upto the key length. If the key contains
alpha characters then it is placed in a C type variable and the left most keylength characters will be
taken.
38.10. Examples.
Move text-020 to t_zisid-ermsg.
Modify t_zisid.
Move True to w_baddata.
Else.
*
*
*
Check that the 902 bin is empty for this item...
Perform FormatKey using t_zisid-matnr
changing w_lgpla.
Zap t_lqua.
Select lgnum lqnum letyp matnr
from lqua
into table t_lqua
where lgpla = w_lgpla.
EndIf.
38.11. SourceCode.
*EJECT
Page 99
**********************************************************************
*
*
Procedure:
FormatKey
*
*
Purpose:
Formats a key. If it is all zeroes, then
*
it is right justfied and padded with
*
zeroes
*
*
If it is alpha-numeric then it is left
*
justified and padded with spaces
*
*
Entry:
Value to format
*
*
Exit:
Formatted value
*
*
Called By:
Perform FormatKey using w_key changing
*
w_newkey.
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form FormatKey using pu_key changing pc_key.
*
Data: w_flen
type i,
" Field Length
w_nkey(132) type n,
" Numeric Key
w_ckey(132) type c,
" Character
w_start
type i.
" Read key from
*
Describe field pu_key length w_flen.
If pu_key co c_numbers.
Move pu_key to w_nkey.
*
*
This is right justified.....
*
Compute w_start = 132 - w_flen.
Move w_nkey+w_start(w_flen) to pc_key.
Else.
Move pu_key to w_ckey.
Move W_Ckey+0(w_flen) to pc_key.
Translate pc_key to upper case.
EndIf.
EndForm.
38.12. See Also.
Page 100
39.
FORMATREPORT
39.1. Location.
YREPINC.
39.2. Purpose.
Calculates the positions of the report columns specified in table reptab.
39.3. Entry.
39.4. Exit.
39.5. Called By.
39.6. Calls.
39.7. Tables.
39.8. System Variables.
SY-TABIX
SY-LINSZ
INT4 X
INT4 X
4
4
Runtime: Current line of
Line size of list
39.9. Description.
This routine calculates the positioning of columns of information based upon column widths retrieved
from the SAP Data dictionary or passed during calls to BuildReport.
Having calculated the maximum width of the report, the routine then checks that width against the
current report width, aborting with an error if the calculated report width is larger.
If the report will fit in the currently defined report width, the system then calculates the offsets
required to provide a columnar report centralised on the page.
The FormatReport should be called once all the BuildReport calls for the columns have been
processed.
39.10. Examples.
Perform
Perform
Perform
Perform
Perform
Perform
Perform
Perform
BuildReport using
BuildReport using
BuildReport using
BuildReport using
BuildReport using
BuildReport using
BuildReport using
FormatReport.
'ZISID-EBELN'
'ZISID-EBELP'
'EKBE-MENGE'
'MSEG-MBLNR'
'MSEG-MJAHR'
'MSEG-ZEILE'
'GRMNGE'
'' 0 '' ''.
'' 0 '' ''.
'' 0 '' ''.
'' 0 '' ''.
'' 0 '' ''.
'' 0 '' ''.
Text-022 15 '' ''.
*
Sort t_zisid by ermsg zzshipno matnr ebeln ebelp.
Loop at t_zisid
Where ErMsg <> ''.
If t_zisid-ErMsg <> w_ErMsg.
Perform GroupHeader Using Text-019 t_zisid-ErMsg.
Move t_zisid-ErMsg to w_ErMsg.
39.11. SourceCode.
*Eject
***********************************************************************
*
Page 101
*
Procedure:
FormatReport.
*
*
Purpose:
Calculates the positions of the report columns
*
specified in table reptab.
*
*
Entry:
None Reptable is global
*
*
Exit:
None
*
*
Called By:
Perform FormatReport.
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
FORM FORMATREPORT.
Data: w__maxlen type i,
w__numcols type i,
w__prevpos type i,
w__width
type i,
w__gap
type i,
w__first
type i.
*
*
Find the maximum width of the report. Allow for vertical lines
*
Move 0 to w__maxlen.
Move 1 to w__numcols.
*
*
Centralise the report or not ??
*
Loop At ReportTable.
if sy-tabix = 1.
Compute ReportTable-StartPos = 1.
else.
Compute ReportTable-StartPos = w__prevpos + w__Width + 1.
endif.
Modify ReportTable.
w__prevpos = ReportTable-StartPos.
w__width
= ReportTable-ColWidth.
Compute w__maxlen = w__maxlen + ReportTable-ColWidth + 1.
Endloop.
*
if w__maxlen > sy-linsz.
Message id 'SU' type 'E' number 0
with 'Report Width > Defined Width:'
w__maxlen
sy-linsz.
endif.
*
*
Centralise the report
*
Compute w__numcols = w__numcols + 1.
Compute w__gap = ( sy-linsz - w__maxlen ) / 2.
Read Table ReportTable Index 1.
If w__centre = True.
Move w__gap to w__first.
Else.
Move 1 to w__first.
EndIf.
Loop at ReportTable.
If w__centre = True.
Compute ReportTable-StartPos
= ReportTable-StartPos + w__gap.
EndIf.
Move w__first to ReportTable-First.
Move w__maxlen to ReportTable-Maxwidth.
Modify ReportTable.
Endloop.
ENDFORM.
"FORMATREPORT
Page 102
39.12. See Also.
BuildReport
CentreReport
CheckBox
CheckBreaks
InitBreaks
WriteLine
PrintTotals
Page 103
40.
GETMASK
40.1. Location.
YREPINC.
40.2. Purpose.
Locates a currency or unit mask
40.3. Entry.
40.3.1.Variable or literal mask
This parameter can be either a literal mask - a string defining the mask directly, or a variable
(in both cases these are strings) which contains a mask string.
40.4. Exit.
40.4.1.Actual mask to use.
40.5. Called By.
WRITEVALUE
Perform GetMask using p_currency changing w__fcode.
40.6. Calls.
40.7. Tables.
40.8. System Variables.
SY-SUBRC
INT4 X
4
Return value after specif
40.9. Description.
Unit and Currency values have a format mask applied to them prior to output. The reporting routines
can accept either literal masks, or variables containing a mask. This routine attempts to assign the
passed variable to a field symbol. If an error occurs then this means that the value passed must be a
literal. In that case the literal is passed straight back to the calling routine, otherwise the contents of
the variable are passed back to the caller.
40.10. Examples.
*
*
Now write out the value.
If Not p_ConvExit is initial.
Write at (p_width) p_value no-gap
using edit mask p_ConvExit.
Else.
If Not p_Currency is Initial.
Perform GetMask using p_currency changing w__fcode.
Write at (p_width) p_value Currency w__fcode no-gap.
Else.
If Not p_Unit is Initial.
Perform GetMask using p_unit changing w__fcode.
Write at (p_width) p_value Unit w__fcode no-gap.
Else.
If p_format is initial.
Page 104
40.11. SourceCode.
***********************************************************************
*
*
Procedure:
GetMask
*
*
Purpose:
Locates a currency or unit mask
*
*
Entry:
Variable or literal mask
*
*
Exit:
Actual mask to use.
*
*
Called By:
Perform Getmask using mask_in changing mask_out
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form getMask using p_mvin changing p_mvout.
*
Field-Symbols <f_fcode>.
*
Move '' to p_mvout.
If not p_mvin is initial.
Assign (p_mvin) to <f_Fcode>.
*
*
Is this a variable or a literal...
*
If sy-subrc = 0.
Move <F_Fcode> to p_mvout.
" Is a variable.
Else.
Move p_mvin
to p_mvout.
" Is a literal.
EndIf.
EndIf.
EndForm.
40.12. See Also.
Page 105
41.
GET_LOCAL_HOST
41.1. Location.
YBDCINC.
41.2. Purpose.
Gets / returns the current local host
41.3. Entry.
41.4. Exit.
41.4.1.Host Name
41.4.2.Server Name
41.5. Called By.
IS_SERVICE_ACTIVE
Perform Get_Local_Host Changing W__Local_Host W__Local_Serv.
41.6. Calls.
GWY_READ-CONNECTIONS
41.7. Tables.
41.8. System Variables.
SY-SUBRC
INT4 X
4
Return value after specif
41.9. Description.
This function returns the local server hosting the SAP system.
41.10. Examples.
Data: End Of T__Conn,
*
W__Local_Host Like Gwy_Struct-Gwhost,
W__Local_Serv Like Gwy_Struct-Gwserv,
W__Tp
Like Pu_Tp.
*
Move False To Pc_Active.
Perform Get_Local_Host Changing W__Local_Host W__Local_Serv.
Call Function 'GWY_READ-CONNECTIONS'
Exporting
Gwhost
= W__Local_Host
Gwserv
= W__Local_Serv
Tables
Connections
= T__Conn
Exceptions
41.11. SourceCode.
*EJECT
**********************************************************************
*
*
Procedure:
Get_Local_Host
Page 106
*
*
Purpose:
Gets / returns the current local host
*
*
Entry:
*
*
Exit:
Host Name
*
Server Name
*
*
Called By:
Perform Get_Local_Host
*
changing w_host w_server
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form Get_Local_Host Changing Pc_Local_Host Like Gwy_Struct-Gwhost
Pc_Local_Serv Like Gwy_Struct-Gwserv.
Data: W__Sapsys(2).
Call 'C_Sapgparam' Id 'NAME' Field 'SAPLOCALHOST'
Id 'VALUE' Field Pc_Local_Host.
Call 'C_Sapgparam' Id 'NAME' Field 'SAPSYSTEM'
Id 'VALUE' Field W__Sapsys.
Pc_Local_Serv = 'SAPGW'.
Pc_Local_Serv+5 = W__Sapsys.
Endform.
41.12. See Also.
Page 107
42.
GIVELINE
42.1. Location.
YRBINC.
42.2. Purpose.
Provides text on line number 'N' from a line of text within a specified column width
42.3. Entry.
42.3.1.Line Number of required line in text.
This is the logical line number that you require. The lines are made up of the text split into
the column width specified below.
42.3.2.Width of column.
This is the width of the column that the line has to fit into.
42.3.3.Text to split
This is the string of text that has to be split into lines of the specified width.
42.4. Exit.
42.4.1.Line N
Line Nof specified text within a specified column width
42.5. Called By.
YREPINC
42.6. Calls.
42.7. Tables.
42.8. System Variables.
42.9. Description.
42.10. Examples.
Move Space to w__repline.
Move False to w__more.
Loop At ReportTable.
Move Space to w__title.
*
*
*
Get a title for this column
Perform GiveLine
using
w__hdrline
ReportTable-ColWidth
ReportTable-Title
changing w__title.
Compute w__offset = ReportTable-StartPos.
Move Sy-Vline to w__repline+w__offset.
if w__title <> ' '.
Page 108
42.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
GiveLine.
*
*
Purpose:
Provides text on line number 'N' from a line of
*
text within a specified column width
*
*
Entry:
Line Number of required line in text
*
Width of column
*
Text to split
*
*
Exit:
Line N of specified text within a specified
*
Line width
*
*
Called By:
Perform GiveLine
*
Using
LineNo ColWidth FullText
*
Changing Text
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form GiveLine using
p_lineno
type i
p_colwidth type i
p_fulltext
changing p_text.
Data: Begin of w__TextTable occurs 0,
Word(20) type c,
End Of w__TextTable,
w__linecount type i,
w__linelen
type i,
w__wordlen
type i,
w__totallen type i.
*
*
Split the incoming text into seperate words.
*
Clear w__Texttable.
split p_fulltext at ' ' into table w__TextTable.
Move 1 to w__linecount.
Move Space to p_text.
Loop at w__TextTable.
Compute w__linelen = Strlen( p_text ).
Compute w__wordlen = Strlen( w__TextTable-Word ).
Compute w__totallen = w__linelen + w__wordlen + 1.
*
*
Space to add this word onto the line ?
*
if w__Totallen < p_colwidth.
if w__linelen <> 0.
Compute w__linelen = w__linelen + 1.
endif.
Move w__TextTable-Word to p_text+w__linelen.
else.
Compute w__linecount = w__linecount + 1.
if w__linecount > p_lineno.
Exit.
else.
Move w__TextTable-Word to p_text.
endif.
endif.
endloop.
*
*
End of the table ?
*
if w__linecount < p_lineno.
move space to p_text.
endif.
Endform.
Page 109
42.12. See Also.
Page 110
43.
ICON, SYMBOL or GRAPHIC
43.1. Location.
YREPINC.
43.2. Purpose.
Adds an icon or a symbol to a report
43.3. Entry.
43.3.1.Icon: Icon Name to print
43.3.2.Symbol: Symbol Name to print
43.3.3.Graphic: Icon/symbol name, name type
Not callable directly by user
43.4. Exit.
43.4.1.None
43.5. Called By.
ICON
SYMBOL
Perform Graphic using p_iconname True.
43.6. Calls.
43.7. Tables.
43.8. System Variables.
43.9. Description.
The routine makes an entry into the internal report definition table ReportTable and flags the entry as
either an icon or a symbol. When the report is printed, Writeline prints the data using the correct
formatting process.
The graphics can be also described as hot spots or check boxes. Hot spots are items in a report that
can be activated by the click of a mouse button and are standard SAP items.
However, Checkboxes are limited in that you cannot cause an 'At Line Selection' event using them.
The best way is to use hot spot graphics.
Additional files need to be included in your program before you can use this facility. If you wish to
print only icons, include the following line in your program:
Include <icon>.
If you wish to use just symbols, insert ‘Include <Symbol>.’ In your program.
comprehensive set, substitute <list> in the include statement.
Page 111
For a more
Below is an example report using icons.
Figure 3 Icons on a report
43.10. Examples.
*
Calls:
*
*
Modification History:
*
*
Date
Reason
*
Form Icon using p_iconname p_hotspot.
Perform Graphic using p_iconname True.
EndForm.
*
Form Symbol using p_symbolname.
Perform Graphic Using p_symbolname False.
EndForm.
*
Form Graphic using p_name p_icon.
Version
Who
43.11. SourceCode.
*Eject
***********************************************************************
*
*
Procedure:
Icon, Symbol, Graphic
*
*
Purpose:
Adds an icon or a symbol to a report
*
*
Entry:
Icon:
Icon Name to print
*
Entry:
Symbol:
Symbol Name to print when check field
*
is true.
*
Entry:
Graphic:
Icon/symbol name, name type
*
Not callable directly by user
*
*
Entry:
Hotspot - True or False
*
Entry:
Symbol:
Field for symbol value check
*
Entry:
Symbol:
Symbol Name to print when check fld is
*
false.
*
Exit:
None
*
*
Called By:
Perform Icon using ICON_CHANGE.
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form Icon using p_iconname
p_hotspot like true.
Perform Graphic using p_iconname
True
p_hotspot
''
''.
EndForm.
*
Page 112
Form Symbol using p_True_symbol
p_hotspot like True
p_check_field
p_False_symbol.
Perform Graphic Using p_True_symbol
False
p_hotspot
p_check_field
p_false_symbol.
EndForm.
*
Form Graphic using p_name
p_icon
p_hotspot like true
p_check_field
p_false_symbol.
Clear ReportTable.
if p_icon = True.
Move True to ReportTable-Icon.
Else.
Move True to ReportTable-Symbol.
Endif.
Move p_hotspot
to ReportTable-hotspot.
Move p_false_symbol to ReportTable-FalseSym.
Move p_name
to ReportTable-Isyname.
Move p_check_field to ReportTable-FieldName.
Move 3
to ReportTable-ColWidth.
Append ReportTable.
EndForm.
43.12. See Also.
Page 113
44.
GROUPHEADER
44.1. Location.
YREPINC.
44.2. Purpose.
Prints a Group Header line. The group header line is the purple line shown on the report extract
below:
Figure 4 A Report Group Header Line
44.3. Entry.
44.3.1. Group Header Title.
This is the title of the header. Normally a column title, this is printed to the left of the group
header.
44.3.2. Group Header Value.
This is the value associated with this group header
44.4. Exit.
44.5. Called By.
ALLHDRS
CHECKBREAKS
Perform GroupHeader using ReportBreaks-Title ReportBreaks-Value.
44.6. Calls.
TABLELINE
WLINE
44.7. Tables.
44.8. System Variables.
SY-VLINE
CHAR C
1
Constant: Vertical bar
44.9. Description.
The SAP GUI performs various actions when scrolling based upon the colour of the line. Using Group
headings will cause all the data lines under that group heading to scroll up, keeping the existing group
heading in view until it is superseded by another group header.
This routine formats a data line with the relevant information and vertical lines to enable it to be
integrated into the current report format then outputs that line using the Col_Group colour.
Page 114
44.10. Examples.
*
*
Single field....
Compute w_textno = 16 + p_sortby.
Concatenate 'TEXT-' w_textno into w_hdrt.
Assign (w_hdrt) to <f_hdrtext>.
*
Assign Component p_sortby of Structure t_repdata to <f_hdrval>.
Perform GroupHeader using <F_Hdrtext> <F_HdrVal>.
Else.
*
*
*
Material...
if p_sortby = 1.
Concatenate text-017 t_repdata-matnr '(' t_repdata-maktx ')'
into w_hdrtitle separated by ' '.
44.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
GroupHdr.
*
*
Purpose:
Prints a Group Header line
*
*
Entry:
Group Header Title
*
Entry:
Group Header value
*
*
Exit:
None
*
*
Called By:
Perform GroupHeader using Title Value.
*
*
Calls:
wline
*
PrintTitles
*
*
Modification History:
*
*
Date
Reason
Version Who
*
FORM GROUPHEADER using p_title
p_value.
Data: w__repline(255) type c,
w__offset
type i,
w__required
type i.
*
If w__lineprinted = True.
Perform TableLine.
EndIf.
*
*
Have we enough room to print this plus column titles
*
*
*
If MaxTline is 0, then the titles have not been printed, and
*
we must be at the top of the page so we don't really care anyway.
*
*
However, if MaxTline<>0 then the titles have been printed at
*
least once and we can be anywhere on the page....
*
if w__grouphdr = False.
Read Table ReportTable Index 1.
Move True to w__grouphdr.
If ReportTable-MaxTline <> 0.
Compute w__Required = ReportTable-MaxTLine + 3.
Reserve w__Required Lines.
Endif.
Move space to w__repline.
Compute w__offset = ReportTable-StartPos.
Move sy-vline to w__repline+w__offset.
Compute w__offset = w__offset + 1.
Move p_title to w__repline+w__offset.
Compute w__offset = w__offset + Strlen( p_title ) + 1.
Page 115
Move p_value to w__repline+w__offset.
Compute w__offset = ReportTable-StartPos + ReportTable-MaxWidth.
Move sy-vline to w__repline+w__offset.
Perform WLine Using w__repline Col_Group.
Perform TableLine.
Move False to w__grouphdr.
Move False to w__lineprinted.
Endif.
ENDFORM.
" Group Header.
44.12. See Also.
Page 116
45.
INITBREAK
45.1. Location.
YREPINC.
45.2. Purpose.
Initialises report breaks table
45.3. Entry.
45.3.1.Field to break on.
45.3.2.Title of field.
45.4. Exit.
45.5. Called By.
WRITELINE
Perform Initbreak using '*' 'Run Total:' c_no c_yes.
45.6. Calls.
45.7. Tables.
45.8. System Variables.
45.9. Description.
The routine makes an entry in an internal tables containing the field name of the report break, it’s title
and initial value. The routine then scans the report data table and provides an entry for each numeric
column in the report so that totals can be stored at each break level.
45.10. Examples.
Perform BuildReport using 'SELLTOTAL' text-005 15
'CURRENCY' 'WAERK'.
Perform BuildReport using 'NETWR' text-014 15
'CURRENCY' 'WAERK'.
Perform BuildReport using 'WAERK' Text-012 0 '' ''.
Perform FormatReport.
Read Table t_revenue Index 1.
Perform InitBreak
using 'T_REVENUE-CENDNG' Text-015
Perform InitBreak
using 'T_REVENUE-VB'
Text-006
Perform InitBreak
using 'T_REVENUE-ENAME'
Text-007
Perform InitBreak
using 'T_REVENUE-ABTEI'
Text-008
Perform InitBreak
using 'T_REVENUE-KTEXT'
Text-009
Perform SaveReport using c_main_report.
*
*
c_no
c_no
c_no
c_no
c_no
c_yes.
c_yes.
c_yes.
c_yes.
c_yes.
And the billing report.
45.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
InitBreak
*
Page 117
*
Purpose:
Initialises report breaks table
*
*
Entry:
Field to break on.
*
Entry:
Title of field.
*
*
Exit:
*
*
Called By:
Perform InitBreak using 'fieldname'
*
'title'
*
FormFeed Yes/No
*
Print Break Yes/No
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version
*
*
* Initialise a report break.
*
Form InitBreak Using p_field p_title p_formfeed p_print.
Field-Symbols <TField>.
*
Data: t__cols like vbak-netwr occurs 0 with header line.
*
*
Get access to the field value to set the initial break value
*
clear ReportBreaks.
*
*
Get the table name....
*
Move p_field
to ReportBreaks-field.
Move p_title
to ReportBreaks-title.
Move p_formfeed to ReportBreaks-Ffeed.
Move p_print
to ReportBreaks-Print.
If p_field <> '*'.
Assign (p_field) to <TField>.
Move <TField>
to ReportBreaks-value.
Else.
Move '*' to ReportBreaks-Value.
EndIf.
*
*
Set up the totals columns.
*
Zap T__Cols.
Loop at ReportTable.
Clear T__Cols.
Move 0 to t__cols.
Append t__cols.
EndLoop.
Move t__cols[] to ReportBreaks-Totals[].
Append ReportBreaks.
EndForm.
45.12. See Also.
Page 118
Who
46.
INIT_GLOBAL
46.1. Location.
YBDCINC.
46.2. Purpose.
Initialises all globally declared variables
46.3. Entry.
46.4. Exit.
Global variables (with some exceptions) set to Initial values
46.5. Called By.
Init_Func - macro
Perform Init_Global.
46.6. Calls.
46.7. Tables.
46.8. System Variables.
SY-SUBRC
INT4 X
4
Return value after specif
46.9. Description.
This routine scans the current SAP Instance's memory space for variables that are defined at a global
level. If these variable names are not found in the list of exceptions defined in the routine, then these
variables are cleared.
The reason behind this occured when a large group of programmers were working on a project. One of
the programmers insisted on using global variables, which the others did not. Instead of having to
keep track of what this one programmer was upto, this routine was written so that he could be
forgotten.....
46.10. Examples.
Data: End Of t__prmtab,
*
w__impdefault
w__name
w__dump(30)
w__fname
like
like
type
like
catfu-impdefault,
catfu-name,
c,
tfdir-funcname.
*
Perform Init_Global.
Move &1 to w__fname.
Translate w__fname to upper case.
Perform Read_YDCSET using w__fname sy-uname changing w__ydcset.
Zap t_bdcmsg.
*
*
*
Get the function details and loop through the parameter list. If
the variable is an export variable then initialise it. If it is an
46.11. SourceCode.
*EJECT
***********************************************************************
*
Page 119
*
Procedure:
Init_Global
*
*
Purpose:
Initialises all globally declared variables
*
*
Entry:
*
*
Exit:
Global variables (with some exceptions) set to
*
Initial values
*
*
Called By:
Perform Init_Global
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form INIT_GLOBAL.
*
Field-Symbols: <F_GLOBAL>,
<F_LITL>.
" This occurs in 40A and above it
" specifies that a field is a
" fixed literal. For systems <40a
" assign it to a dummy var
" that is always false.
*
Data: Begin Of T_Fieldlist Occurs 0.
Include Structure Rfieldlist.
Data: End Of T_Fieldlist,
*
W_Clearit(1) Type C,
W_Strlen
Type I,
W_First2(2) Type C,
W_Flitl(18) Type C.
*
*
Get A List Of Global Variables For The Zabaco Function Module.
*
The Program Name For This Is Saplzabaco
*
Call Function 'GET_GLOBAL_SYMBOLS'
Exporting
Program
= C_Main_Program
Tables
Fieldlist = T_Fieldlist
Exceptions
Others
= 1.
If Sy-Subrc = 0.
*
*
Set Up The Fixed Literal Field Symbol.
*
If Sy-Saprl+0(2) < '40'.
Move 'False' To W_Flitl.
Else.
Move 'T_Fieldlist-Flitl' To W_Flitl.
Endif.
Assign (W_Flitl) To <F_Litl>.
*
Loop At T_Fieldlist.
*
*
Only Look At W_ Or Wt_ Style Variables, Or Tables.
*
Move True To W_Clearit.
Move T_Fieldlist-Name+0(2) To W_First2.
*
*
If The Variable Is A Fixed Literal Ignore It (A Constant)
*
If <F_Litl> Is Initial.
*
*
Clear It Unless.....
*
Case W_First2.
When '$$'.
Clear W_Clearit.
When '%_'.
Clear W_Clearit.
When '<%'.
Clear W_Clearit.
Page 120
When
When
When
When
When
When
When
When
*
*
*
*
*
'C_'.
'RE'.
'RS'.
'SY'.
'SC'.
'TE'.
'ZB'.
Others.
Clear
Clear
Clear
Clear
Clear
Clear
Clear
W_Clearit.
W_Clearit.
W_Clearit.
W_Clearit.
W_Clearit.
w_Clearit.
W_Clearit.
Check To See If The 2nd & 3rd Characters Are
__. If So These Are Zbdccinc Variables So
Don't Clear Them.
Search T_Fieldlist-Name For '__'.
If Sy-Subrc = 0
And Sy-Fdpos = 1.
Clear W_Clearit.
Else.
If T_Fieldlist-Name+0(1) = '?'.
Clear W_Clearit.
Else.
If T_Fieldlist-Name+0(4) = 'COL_'.
Clear W_Clearit.
Else.
If T_Fieldlist-Name = 'TRUE'
Or T_Fieldlist-Name = 'FALSE'
Or T_Fieldlist-Name = 'SPACE'.
Clear W_Clearit.
Endif.
Endif.
Endif.
Endif.
Endcase.
If W_Clearit = True.
Assign (T_Fieldlist-Name) To <F_Global>.
Clear <F_Global>.
Endif.
Endif.
Endloop.
Endif.
Endform.
46.12. See Also.
Page 121
47.
IS_SERVICE_ACTIVE
47.1. Location.
YBDCINC.
47.2. Purpose.
Check to see if a specified service is Active.
NOTE: This routine checks to see if the specified service is active. If that service is loaded but
currently stopped then it is still considered active by SAP (RSMONGWY) However, if the service is
unloaded then this function returns false.
47.3. Entry.
47.3.1.Service Name to Check
47.4. Exit.
47.4.1.True - Service Active
47.4.2.False - Service not available
47.5. Called By.
47.6. Calls.
GWY_READ_CONNECTIONS
GET_LOCAL_HOST
47.7. Tables.
47.8. System Variables.
SY-SUBRC
INT4 X
4
Return value after specif
47.9. Description.
This procedure verifies if a given system is active or not.
47.10. Examples.
FUNCTION Z_IS_ABACO_ACTIVE.
*"---------------------------------------------------------------------*"*"Local interface:
*"
EXPORTING
*"
VALUE(E_ACTIVE) LIKE DATATYPE-CHAR0001
*"---------------------------------------------------------------------*
PERFORM IS_SERVICE_ACTIVE USING 'ABACO' CHANGING E_ACTIVE.
ENDFUNCTION.
47.11. SourceCode.
*EJECT
**********************************************************************
*
*
Procedure:
Is_Service_Active
*
Page 122
*
Purpose:
Check to see if a specified service is
*
Active.
*
*
NOTE: This routine checks to see if the
*
specified service is active. If
*
that service is loaded but
*
currently stopped then it is still
*
considered active by SAP (RSMONGWY)
*
However, if the service is
*
unloaded then this function returns
*
false.
*
*
Entry:
Service Name to Check
*
*
Exit:
True - Service Active
*
false - Service not available
*
*
Called By:
Perform Is_Service_Active using 'ABACO'
*
changing w_active.
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form Is_Service_Active Using Pu_Tp Like Gwy_Conn-Tp
Changing Pc_Active Like True.
*
Data: Begin Of T__Conn Occurs 0.
Include Structure Gwy_Conn.
Data: End Of T__Conn,
*
W__Local_Host Like Gwy_Struct-Gwhost,
W__Local_Serv Like Gwy_Struct-Gwserv,
W__Tp
Like Pu_Tp.
*
Move False To Pc_Active.
Perform Get_Local_Host Changing W__Local_Host W__Local_Serv.
Call Function 'GWY_READ_CONNECTIONS'
Exporting
Gwhost
= W__Local_Host
Gwserv
= W__Local_Serv
Tables
Connections
= T__Conn
Exceptions
Gwy_Unknown_Opcode
= 01
Gwy_Communication_Failure = 02
Gwy_Get_Tab_Failed
= 03
Gwy_Newline_Failed
= 04
Gwy_Tablen_Too_Short
= 05
Gwy_Get_Opcode_Failed
= 06
Gwy_Get_Gwhost_Failed
= 07
Gwy_Get_Gwserv_Failed
= 08.
If Sy-Subrc = 0.
Move Pu_Tp To W__Tp.
Translate W__Tp To Upper Case.
Loop At T__Conn
Where Tp
= W__Tp And
State = 'CONNECTED'.
Move True To Pc_Active.
Endloop.
Endif.
Endform.
47.12. See Also.
Page 123
48.
NEWBDC
48.1. Location.
YBDCINC.
48.2. Purpose.
Starts a new BDC session
48.3. Entry.
48.3.1.None
48.4. Exit.
48.5. Called By.
48.6. Calls.
48.7. Tables.
48.8. System Variables.
48.9. Description.
Just sets a flag.....
48.10. Examples.
C_LT12
Type Transaction_Code Value 'LT12',
C_SAPML03T Type Program_Name VALUE 'SAPML03T'.
*
Data: w_trans type Transaction_Code,
w_text like t100-text,
w_tanum like ltap-tanum.
*
Perform NewBdc.
If not pu_lt01-Matnr is initial.
Perform ZBDC_FillScreen using c_sapml03t 0101 pu_lt01.
Perform ZBDC_Field
using 'BDC_OKCODE' c_enter.
Perform ZBDC_FillScreen using c_sapml03t 0102 pu_lt01.
Perform ZBDC_Field
using 'BDC_OKCODE' c_enter.
Perform Z_Call_bdc tables t_bdcmsg using c_lt01.
Else.
48.11. SourceCode.
**********************************************************************
*
*
Procedure:
NewBDC
*
*
Purpose:
Starts a new BDC session
*
*
Entry:
None
*
*
Exit:
*
*
Called By:
Perform NewBDC
*
*
Calls:
*
Page 124
*
Modification History:
*
*
Date
Reason
*
Form NewBDC.
Move False to w__BDCOpen.
EndForm.
48.12. See Also.
Page 125
Version
Who
49.
PRINTTITLES
49.1. Location.
YREPINC.
49.2. Purpose.
Prints titles for the columns of the report
49.3. Entry.
49.4. Exit.
49.5. Called By.
49.6. Calls.
TABLELINE
GIVELINE
WLINE
49.7. Tables.
49.8. System Variables.
SY-VLINE
CHAR C
1
Constant: Vertical bar
49.9. Description.
Using data previously built up from calls to BuildReport and FormatReport, this routine loops through
the table constructed by these calls, printing one line of each column title.
This process continues until nothing is printed across all columns.
PrintTitles should only be called after all calls to BuildReport and FormatReport have been processed.
49.10. Examples.
Perform WriteCentre using w_title.
EndIf.
*
Describe table r_vbeln lines w_lines.
if w_lines <> 0.
Psub r_vbeln Text-011.
EndIf.
*
Describe table r_bwart lines w_lines.
if w_lines <> 0.
Psub r_bwart Text-016.
EndIf.
*
Write p_close to w_title.
Concatenate Text-017 w_title into w_title.
Perform WriteCentre using w_title.
Perform PrintTitles.
*eject.
End-Of-Page.
Perform TableLine.
*eject
Start-Of-Selection.
49.11. SourceCode.
*EJECT
***********************************************************************
Page 126
*
*
Procedure:
PrintTitles.
*
*
Purpose:
Prints titles for the columns of the report
*
*
Entry:
*
*
Exit:
None
*
*
Called By:
Perform PrintTitles
*
*
Calls:
wline
*
GiveLine
*
*
Modification History:
*
*
Date
Reason
Version Who
*
FORM PRINTTITLES.
data: w__repline(255) type c,
" Data line to print
w__title like dd04t-ddtext,
" Column title
w__offset
type i,
" Offset to start of column
w__hdrline
type i,
" Number of title line
w__lastpos
type i,
" Last column of report
w__more
like
" More to print ?
datatype-char0001.
*
Perform TableLine.
Move 1 to w__hdrline.
*
*
Get the last report column position
*
Read Table ReportTable Index 1.
Compute w__LastPos = ReportTable-StartPos + ReportTable-MaxWidth.
do.
Move Space to w__repline.
Move False to w__more.
Loop At ReportTable.
Move Space to w__title.
*
*
Get a title for this column
*
Perform GiveLine
using
w__hdrline
ReportTable-ColWidth
ReportTable-Title
changing w__title.
Compute w__offset = ReportTable-StartPos.
Move Sy-Vline to w__repline+w__offset.
if w__title <> ' '.
Compute w__offset = w__offset + 1.
Move w__title to w__repline+w__offset.
Move True to w__more.
endif.
EndLoop.
*
*
Anything to print ?
*
if w__more = True.
Compute w__hdrline = w__hdrline + 1.
Move sy-vline to w__repline+w__lastpos.
Perform WLine Using w__repline Col_Heading.
else.
exit.
endif.
enddo.
*
*
Update the max title line field ?
*
Read Table ReportTable Index 1.
if ReportTable-MaxTline = 0.
Loop At ReportTable.
Compute ReportTable-MaxTline = w__hdrline + 1.
Page 127
Modify ReportTable.
EndLoop.
Endif.
Perform TableLine.
ENDFORM.
" PrintTitles
49.12. See Also.
Page 128
50.
PRINTTOTALS
50.1. Location.
YREPINC.
50.2. Purpose.
Prints break level totals.
50.3. Entry.
50.3.1.Data tables to print totals for
50.3.2.Current total level
50.4. Exit.
50.5. Called By.
CHECKBREAKS
RUNTOTALS.
Perform PrintTotals using sy-index.
50.6. Calls.
TABLELINE
SETCOLOUR WRITEVALUE
50.7. Tables.
50.8. System Variables.
SY-VLINE
SY-TABIX
CHAR C
INT4 X
1
4
Constant: Vertical bar
Runtime: Current line of
50.9. Description.
PrintTotals prints the totals accumulated during calls to Checkbreaks upto and including the break
level passed.
50.10. Examples.
*
*
*
*
Don't do a run total here - as run totals are not required.
Force a check break.
Describe Table ReportBreaks lines w_lines.
Subtract 1 from w_lines.
Do w_lines times.
Perform PrintTotals tables t_adjust using sy-index.
EndDo.
Perform TableLine.
Perform WriteCentre using Text-019.
Else.
Message W000 with Text-022.
EndIf.
*Eject
50.11. SourceCode.
*EJECT
Page 129
***********************************************************************
*
*
Procedure:
PrintTotals
*
*
Purpose:
Prints break level totals.
*
*
Entry:
Data tables to print totals for
*
Entry:
Current total level
*
*
Exit:
*
*
Called By:
Perform PrintTotals
*
using p_totallevel
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form PrintTotals using p_totallevel.
*
Data: t__coltotals like vbak-netwr occurs 0 with header line,
w__pos
type i,
w__pos1
type i,
w__title(50) type c.
*
*
Loop around the totals tables at the specified level.
*
Read table ReportBreaks index p_totallevel.
*
*
Print this Break ?
*
If ReportBreaks-Print = c_yes.
If w__lineprinted = True.
Perform TableLine.
EndIf.
Write /001 ''.
Read table ReportTable index 1.
Compute w__pos = ReportTable-StartPos + 1.
Compute w__pos1 = ReportTable-First + ReportTable-MaxWidth + 1.
If ReportBreaks-Title <> 'Run Total:'.
Concatenate ReportBreaks-Title
ReportBreaks-Value
'Total:' into w__title separated by ' '.
Else.
Move ReportBreaks-Title to w__title.
EndIf.
Write: At w__pos sy-vline no-gap,
w__title no-gap,
at w__pos1 sy-vline no-gap.
Move ReportBreaks-Totals[] to t__coltotals[].
Loop at t__coltotals.
If not t__coltotals is initial.
*
*
Get the column positions to print at and also the
*
decimal places.
*
Read table ReportTable index sy-tabix.
Compute w__pos = ReportTable-StartPos + 1.
Write At w__pos sy-vline no-gap.
Perform SetColour using Col_Total.
Perform WriteValue using ReportTable-ColWidth
t__coltotals
ReportTable-ConvExit
ReportTable-Currency
ReportTable-Unit
ReportTable-Format.
Write sy-vline no-gap.
Format Color Off.
Endif.
EndLoop.
Position w__pos1.
Page 130
Write sy-vline.
EndIf.
EndForm.
50.12. See Also.
Page 131
51.
PRG_DOC_HELP
51.1. Location.
YRBINC.
51.2. Purpose.
Displays help for current program
51.3. Entry.
51.4. Exit.
51.5. Called By.
51.6. Calls.
51.7. Tables.
TTCDS
51.8. System Variables.
SY-SUBRC
SY-REPID
INT4 X
CHAR C
4
8
Return value after specif
Program: Name of ABAP/4 p
51.9. Description.
This procedure displays the help associated with a program in a pop up window.
51.10. Examples.
WHEN 'FUN8'.
IF IT_STAT-STATUS = C_FINISHED.
SUBMIT YUPDSEQ AND RETURN WITH P_JOBNO = JOBNO.
ELSE.
MESSAGE W000 WITH TEXT-401.
ENDIF.
WHEN 'FUN9'.
PERFORM PRG_DOC_HELP.
* Update current job
ENDCASE.
*
* If a user double clicks a line and the line status is failed,
* down to the log report.
*
AT LINE-SELECTION.
drill
51.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
Prg_Doc_Help
*
*
Purpose:
Displays help for current program
*
*
Entry:
*
*
Exit:
*
*
Called By:
Perform Prg_Doc_Help
*
Page 132
*
Calls:
*
*
Modification History:
*
*
Date
Reason
*
form prg_doc_help.
*
Tables: ttcds.
*
Data: w_abapname
like dokhl-object,
w_pf15
type c,
w_hometext
like dsygh-doktitle,
*
begin of t_pline occurs 100,
text(80),
end of t_pline.
*
Select single * from ttcds where
progname = sy-repid .
If sy-subrc = 0.
Call function 'DSYS_SHOW'
Exporting
dokclass
= ttcds-dokclass
doklangu
= space
dokname
= ttcds-dokname
doktitle
= ' '
hometext
= w_hometext
outline
= ttcds-dsysgldrg
Importing
pf15 = w_pf15
Exceptions
class_unknown
= 01
object_not_found = 02.
else.
*
*
Display ABAP documentation text
*
Move sy-repid to w_abapname.
Call function 'DOCU_PRINT'
exporting
dialog
= 'X'
form
= 'S'
id
= 'RE'
langu
= sy-langu
new_page = space
object
= w_abapname
operation = 'P'
printer
= space
typ
= 'E'
tables
line = t_pline.
Endif.
Endform.
51.12. See Also.
Page 133
Version
Who
52.
READ_SCREEN_VALUES
52.1. Location.
YREPINC.
52.2. Purpose.
Provides access to screen fields before users presses enter.....
52.3. Entry.
52.4. Exit.
52.5. Called By.
Perform Read_Screen_Values
52.6. Calls.
52.7. Tables.
52.8. System Variables.
52.9. Description.
During the entry of report parameters, the parameters themselves are not accessable to variables
within the program until the user either hits the return key, or the process button. This is because that
that moment in time, the action is all happening on the presentation server and has not been passed to
SAP.
This procedure forces the values in the parameter variables to become available for use by other
procedures before return is hit, or the process button clicked.
52.10. Examples.
Data: Begin of tb_werks Occurs 0,
Werks
like t001w-werks,
col1(3) type c,
Name1
like t001w-name1,
End Of tb_werks,
w_tabix
like sy-tabix.
" Table for Werks lookup
" Selected row in table.
*
Perform Read_Screen_Values.
Zap tb_werks.
Move &3 to tb_werks-werks.
Move &4 to tb_werks-name1.
Append tb_werks.
Move sy-uline to tb_werks-werks.
Move sy-uline to tb_werks-col1.
Move sy-uline to tb_werks-name1.
52.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
Read_Screen_Values
*
*
Purpose:
Provides access to screen fields before users
*
presses enter.....
*
*
Entry:
Page 134
*
*
Exit:
Screen fields are available to the calling
*
program
*
*
Called By:
Perform Read_Screen_Values
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version
*
Form Read_Screen_Values.
*
Field-Symbols <f_fieldname>.
*
Data: Begin of t_dynpread occurs 0.
Include Structure dynpread.
Data: End of t_Dynpread.
*
Zap t_dynpread.
Call Function 'DYNP_VALUES_READ'
Exporting
Dyname
= syst-cprog
Dynumb
= syst-dynnr
Request
= 'A'
Tables
Dynpfields
= t_dynpread
Exceptions
Invalid_Abapworkarea = 1
Invalid_Dynprofield = 2
Invalid_Dynproname
= 3
Invalid_Dynpronummer = 4
Invalid_Request
= 5
No_Fielddescription = 6
Invalid_Parameter
= 7
Undefind_Error
= 8
Others
= 9.
Loop at t_dynpread.
Assign (t_dynpread-fieldname) to <f_fieldname>.
Move t_dynpread-fieldvalue to <f_fieldname>.
EndLoop.
EndForm.
52.12. See Also.
Page 135
Who
53.
READ_YDCSET
53.1. Location.
YBDCINC.
53.2. Purpose.
Gets the BDC profile to run
53.3. Entry.
53.3.1.Function Name
This is the function name to get settings for.
53.3.2.User Name.
Settings for a particular user only.
53.4. Exit.
53.4.1.YDCSET structure populated
53.5. Called By.
READ_YDCSET
Z_CALL_BDC
Perform Read_YDCSET using w__fname sy-uname changing w__ydcset.
53.6. Calls.
53.7. Tables.
53.8. System Variables.
SY-SUBRC
INT4 X
4
Return value after specif
53.9. Description.
The BDC Routines that are processed through these routines can be controlled by settings made in
thable YDCSET. The table is keyed by RFC/Transaction name and user name.
If during initialisation an entry is found for the current RFC or Transaction, then the various entries in
the YDCSET structure are completed. See section 4 above for an explanation of the YDCSET
structure and table.
53.10. Examples.
w__name
w__dump(30)
w__fname
like catfu-name,
type c,
like tfdir-funcname.
*
Perform Init_Global.
Move &1 to w__fname.
Translate w__fname to upper case.
Perform Read_YDCSET using w__fname sy-uname changing w__ydcset.
Zap t_bdcmsg.
*
*
Page 136
Get the function details and loop through the parameter list.
If
*
*
*
*
the variable is an export variable then initialise it. If it is an
import variable that is optional with a proposal, set the variable
to the value of the proposal if the value passed is blank.
53.11. SourceCode.
*EJECT
**********************************************************************
*
*
Procedure:
Read_YDCSet
*
*
Purpose:
Gets the BDC profile to run
*
*
Entry:
Function Name
*
This is the function name to get settings
*
for.
*
*
User Name.
*
Settings for a particular user only
*
*
Exit:
YDCSET structure populated
*
*
Called By:
Perform Read_YDCSET using w_fname sy-uname
*
changing w_ydcset.
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
*
Form Read_YDCSET using pu_funcname like tfdir-funcname
pu_uname
like sy-uname
changing pc_ydcset
structure ydcset.
*
Select single * from ydcset
into pc_ydcset
where funcname = pu_funcname and
uname
= pu_uname.
*
*
No setting for a particular function/programmer. Look for the
*
generic function......
*
If sy-subrc <> 0.
Select single * from ydcset
into pc_ydcset
where funcname = pu_funcname and
uname
= ''.
*
*
No entry - use the default...
*
If sy-subrc <> 0.
Select single * from ydcset
into pc_ydcset
where funcname = 'DEFAULT'.
Endif.
EndIf.
If pc_ydcset-bdcmode is initial.
Move 'N' to pc_ydcset-bdcmode.
EndIf.
If w__ydcset-bdcupmode is initial.
Move 'S' to pc_ydcset-bdcupmode.
EndIf.
EndForm.
53.12. See Also.
Page 137
54.
REPHEADER
54.1. Location.
YREPINC.
54.2. Purpose.
Provides a standardized report header for use in printed reports
54.3. Entry.
54.3.1.Company Code
54.3.2.Report Title
54.4. Exit.
54.4.1.Report header produced for current report
54.5. Called By.
54.6. Calls.
UNDERLINE
54.7. Tables.
T001
54.8. System Variables.
SY-LINSZ
SY-REPID
SY-UNAME
SY-SYSID
SY-SAPRL
SY-DATUM
SY-PAGNO
SY-UZEIT
INT4
CHAR
CHAR
CHAR
CHAR
DATS
INT4
TIMS
X
C
C
C
C
D
X
T
4
8
12
8
4
8
4
6
Line size of list
Program: Name of ABAP/4 p
Session: SAP user from SA
System: SAP System ID
System: SAP Release
System: Date
Runtime: Current page in
System: Time
54.9. Description.
54.10. Examples.
*
*
Modification History:
*
Form Top_Of_Page.
*
Data: w_title(60) type c.
*
Perform RepHeader using '' sy-title.
Concatenate Text-018 ':' p_lgnum into w_title.
Perform WriteCentre using w_title.
Psub s_matnr Text-022.
Psub s_charg Text-023.
Psub s_vltyp Text-024.
Psub s_vlpla Text-025.
Case c_on.
Page 138
54.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
Repheader.
*
*
Purpose:
Provides a standardized report header for use
*
in printed reports
*
*
Entry:
Company Code
*
Entry:
Report Title
*
*
Exit:
Report header produced for current report
*
*
*
Called By:
Perform Repheader using Company Code Title.
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form RepHeader using p_cocode
like t001-bukrs
p_reptitle like sy-title.
Tables: T001.
Data:
w__offset
type i.
Move False to w__grouphdr.
Move False to w__lineprinted.
*
*
Top Line - Report - co - User
*
Perform UnderLine using 0 sy-linsz.
Write: / 'Report:' no-gap,sy-repid.
*
*
Get the company name and centralise this within the report line
*
width
*
Select single * from T001 where bukrs = P_COCODE.
compute w__offset = ( sy-linsz - strlen( t001-butxt ) ) / 2.
Position w__offset.
Write T001-butxt.
*
*
User Details
*
compute w__offset = sy-linsz - 17.
Position w__offset.
Write: 'User:' no-gap,sy-uname.
*
*
Line 2 - SysID and Date.
*
Write: / ' Sysid:' no-gap, sy-sysid.
compute w__offset = ( sy-linsz - 10 ) / 2.
Position w__offset.
Write: 'SAP R/' no-gap, sy-saprl.
Compute w__offset = sy-linsz - 17.
Position w__offset.
Write: 'Date:' no-gap,sy-datum.
*
*
Line 3 - Page - Report Title - time.
*
write: / ' Page:' no-gap,sy-pagno.
*
*
Report title.
*
compute w__offset = ( sy-linsz - STRLEN( p_reptitle ) ) / 2.
Position w__offset.
Write p_reptitle.
*
*
Time
*
compute w__offset = sy-linsz - 17.
Page 139
Position w__offset.
write: 'Time:' No-gap,sy-uzeit.
*
Perform UnderLine using 0 sy-linsz.
ENDFORM.
54.12. See Also.
Page 140
55.
RUNTOTALS
55.1. Location.
YREPINC.
55.2. Purpose.
Prints All sub total levels and a final run total
55.3. Entry.
55.4. Exit.
55.5. Called By.
55.6. Calls.
PRINTTOTALS
TABLELINE
55.7. Tables.
55.8. System Variables.
SY-TABIX
SY-SUBRC
INT4 X
INT4 X
4
4
Runtime: Current line of
Return value after specif
55.9. Description.
RunTotals loops around the table of report break points initialised by calls to INITBREAK. The
current values are printed out for each numeric column on the report and then these values are added to
the next highest break level. This continues until the last record in the Break table is processed where
upon the the totals for the entire report will be printed.
55.10. Examples.
Perform CheckBreaks tables t_repdata.
Endif.
Perform Writeline tables t_repdata using Col_Normal.
EndLoop.
*
*
*
Final totals.
Perform RunTotals Tables t_repdata.
*
*
*
Any Error reports ?
Perform DisplayErrors.
Perform Writecentre using Text-013.
ENDFORM.
" DISPLAYREPORT
*&---------------------------------------------------------------------*
55.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
RunTotals
*
*
Purpose:
Prints All sub total levels and a final run total
*
*
Entry:
Report data table
*
*
Exit:
Page 141
*
*
Called By:
Perform RunTotals.
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form RunTotals.
*
Data: w__pos
type i,
w__breaklevel type i,
t__coltotals like vbak-netwr occurs 0 with header line,
t__carry
like vbak-netwr occurs 0 with header line.
*
Zap t__coltotals.
Zap t__carry.
Loop at ReportBreaks.
*
*
Carry forward previous level totals
*
Move sy-tabix to w__breaklevel.
Move ReportBreaks-Totals[] to t__carry[].
Loop at t__carry.
Move sy-tabix to w__pos.
Read Table t__coltotals index w__pos.
if sy-subrc = 0.
Compute t__coltotals = t__coltotals + t__carry.
Modify t__coltotals index w__pos.
Else.
Move t__carry to t__coltotals.
Append T__Coltotals.
EndIf.
EndLoop.
Move t__coltotals[] to ReportBreaks-totals[].
Modify ReportBreaks index w__breaklevel.
Perform PrintTotals using w__breaklevel.
EndLoop.
Perform TableLine.
EndForm.
55.12. See Also.
Page 142
56.
SAVEREPORT
56.1. Location.
YREPINC.
56.2. Purpose.
Takes the currently defined report and places it in the report stack. If the report already exists in the
stack then the current record is overwritten
56.3. Entry.
56.3.1.Report Name
56.4. Exit.
56.5. Called By.
USEREPORT
Perform SaveReport using w__currep.
56.6. Calls.
56.7. Tables.
56.8. System Variables.
SY-SUBRC
SY-TABIX
INT4 X
INT4 X
4
4
Return value after specif
Runtime: Current line of
56.9. Description.
The reporting routines can only use one report format at a time, however, in some cases a second or
third format is required, for example where a ledger listing is being produced and the user requires a
list of all the sub-items that make up the account total.
This routine takes the currently defined report and saves it in a table, along with other information
defined in the current break tables. This ensures that the total breaks are not disturbed when report
formats are switched back and forth.
56.10. Examples.
Perform FormatReport.
Read Table t_revenue Index 1.
Perform InitBreak
using 'T_REVENUE-CENDNG'
Perform InitBreak
using 'T_REVENUE-VB'
Perform InitBreak
using 'T_REVENUE-ENAME'
Perform InitBreak
using 'T_REVENUE-ABTEI'
Perform InitBreak
using 'T_REVENUE-KTEXT'
Perform SaveReport using c_main_report.
*
*
*
Text-015
Text-006
Text-007
Text-008
Text-009
c_no
c_no
c_no
c_no
c_no
c_yes.
c_yes.
c_yes.
c_yes.
c_yes.
And the billing report.
Zap ReportTable.
Perform BuildReport using 'VBELN0' Text-019 10 '' ''.
Perform BuildReport using 'ERDAT0' Text-020 8 'DD/MM/YY' ''.
Perform BuildReport using 'CREDT0' Text-021 11 '' ''.
Page 143
56.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
SaveReport
*
*
Purpose:
Takes the currently defined report
*
and places it in the report stack. If the
*
report already exists in the stack then
*
the current record is overwritten
*
*
Entry:
Report Name
*
*
Exit:
*
*
Called By:
Perform Namereport using 'RepName'
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form SaveReport using pu_repname like t__reportstack-repname.
*
Data: w__repname like t__reportstack-repname.
*
*
IS the report already here ?
*
Move pu_repname to w__repname.
Translate w__repname to upper case.
Read Table t__reportstack with key repname = w__repname.
If sy-subrc = 0.
Move ReportTable[] to t__reportstack-reports[].
Move ReportBreaks[] to t__reportstack-repbreaks[].
Modify t__reportstack index sy-tabix.
Else.
Move w__repname to t__reportstack-repname.
Move ReportTable[] to t__reportstack-reports[].
Move ReportBreaks[] to t__reportstack-repbreaks[].
Append t__reportstack.
EndIf.
Move w__repname to w__currep.
EndForm.
56.12. See Also.
UseReport
Page 144
57.
SETCOLOUR
57.1. Location.
YREPINC.
57.2. Purpose.
Sets the output colour
57.3. Entry.
57.3.1.Colour to set
57.4. Exit.
57.5. Called By.
WRITELINE
WLINE
PRINTTOTALS
Perform SetColour using P_Colour.
57.6. Calls.
57.7. Tables.
57.8. System Variables.
57.9. Description.
Sets the output colour to one of the standard pre-defined reporting colours used by ABAP.
57.10. Examples.
Else.
If ReportTable-Symbol = True.
Write: ' ' no-gap, ReportTable-Isyname as Symbol.
Else.
*
*
*
Set the output colour.
Perform SetColour using P_Colour.
Perform WriteValue using ReportTable-ColWidth
<RField>
ReportTable-ConvExit
ReportTable-Currency
ReportTable-Unit
ReportTable-Format.
Hide <RField>.
57.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
SetColour
*
*
Purpose:
Sets the output colour
*
*
Entry:
Colour to set
Page 145
*
*
Exit:
*
*
Called By:
Perform SetColour Using P_Colour
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
*
Form SetColour using P_Colour.
*
Data: w_colour like col_heading.
*
Move p_colour to w_colour.
Format Color = w_colour.
EndForm.
57.12. See Also.
Page 146
Version
Who
58.
SHOW_PROGRESS
58.1. Location.
YREPINC.
58.2. Purpose.
Displays a progress message on the status line
58.3. Entry.
58.3.1.Message to display
58.4. Exit.
58.5. Called By.
Perform Show_Progress using text-023.
58.6. Calls.
58.7. Tables.
58.8. System Variables.
58.9. Description.
This routine outputs a text message to the status bar, only doing so if the message has changed.
58.10. Examples.
58.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
Show_Progress
*
*
Purpose:
Displays a progress message on the status line
*
*
Entry:
Message to display
*
*
Exit:
*
*
Called By:
Perform Show_Progress
*
*
Calls:
*
*
Modification History:
*
Form Show_Progress using pu_text.
*
Statics w_text like t100-text.
*
If w_text <> pu_text.
Move pu_text to w_text.
Call Function 'SAPGUI_PROGRESS_INDICATOR'
Exporting
*
PERCENTAGE = 0
TEXT
= w_text
Exceptions
Page 147
OTHERS
Endif.
EndForm.
58.12. See Also.
Page 148
= 1.
59.
SORTREP
59.1. Location.
YREPINC.
59.2. Purpose.
Sorts a report based upon at user-command.
59.3. Entry.
59.3.1.Table to sort.
59.4. Exit.
59.4.1.Table Sorted.
59.4.2.Report column table sorted on
59.4.3.Sort direction 'A' or 'D'
59.5. Called By.
WLINE
59.6. Calls.
59.7. Tables.
59.8. System Variables.
SY-STACO
SY-CUCOL
SY-INDEX
SY-SUBRC
SY-UCOMM
INT4
INT4
INT4
INT4
CHAR
X
X
X
X
C
4
4
4
4
70
Interact.: List displayed
Cursor position (column)
Number of loop passes
Return value after specif
Interact.: Command field
59.9. Description.
By placing this call in the ‘At User-Command’ section of the program, the routine will detect the
actual report column that the user wishes to sort on and then sort the report.
The report displaying procedure must then be called once more to re-display the report.
The calling program is responsible for setting ‘PF-STATUS’. The GUI named in the SET PFSTATUS call must have the sort up and sort down buttons named STUP and STDN.
59.10. Examples.
*Eject
At User-Command.
Data w_ucomm like sy-ucomm.
*
Move sy-ucomm to w_ucomm.
Case w_ucomm.
When 'STUP'.
Perform SortRep Tables T_Repdata changing w_sortfield
Page 149
w_sortdir.
When 'STDN'.
Perform SortRep Tables t_repdata changing w_sortfield
w_sortdir.
When 'SELA'.
Perform Selects using 'X'.
When 'DSEL'.
59.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
SortRep
*
*
Purpose:
Sorts a report based upon at user-command.
*
*
Entry:
Table to sort.
*
*
Exit:
Table Sorted.
*
Exit:
Report column table sorted on
*
Exit:
Sort direction 'A' or 'D'
*
*
Called By:
At user-Command.
*
Perform SortRep
*
Tables RData
*
changing p_field p_dir
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
* Get the column to sort by.
*
Form SortRep Tables p_table changing p_sortfd p_sortdir.
Field-Symbols: <SortField>, <TestField>.
Data: w__fpos
type i,
" Position on screen where field is.
w__sortfd type i,
" Number of sort field in data table.
w__dist
type i,
" Distance between fields
w__cucol like sy-cucol." Cursor position on report
*
*
Find the report column they want to sort on. Sy-cucol is the
*
current screen cursor position.
*
Move 0 to w__sortfd.
*
*
add the first displayed column + the actual column on screen
*
Compute w__cucol = sy-staco + sy-cucol.
Loop At ReportTable.
Compute w__fpos = ReportTable-StartPos + ReportTable-ColWidth.
if w__fpos >= w__cucol.
Assign Component ReportTable-FieldName
of Structure p_table to <SortField>.
Exit.
EndIf.
EndLoop.
*
*
If this is a valid sort field then translate the report field
*
to the data table.
*
Do.
Assign Component sy-index of Structure p_table to <TestField>.
if sy-subrc <> 0.
exit.
Endif.
Describe Distance between <SortField>
and <TestField>
into w__dist.
if w__dist = 0.
If <TestField> = <SortField>.
Page 150
Move sy-index to w__sortfd.
Exit.
EndIf.
EndIf.
EndDo.
If not w__sortfd is Initial.
*
*
*
Retrieve the field name from ReportTable and Sort on it.
Move w__sortfd to p_sortfd.
Assign component ReportTable-FieldName
of structure p_table to <SortField>.
Case sy-ucomm.
When 'STUP'. Sort p_table By <SortField>.
Move 'A' to p_sortdir.
When 'STDN'. Sort p_table Descending By <SortField>.
Move 'D' to p_sortdir.
EndCase.
Endif.
EndForm.
59.12. See Also.
Page 151
60.
STRIPSTRING
60.1. Location.
YRBINC.
60.2. Purpose.
Removes specified characters from string
60.3. Entry.
60.3.1.String to remove characters from.
60.3.2.String of characters to remove
60.4. Exit.
60.4.1.Entry string with strip chars removed
60.5. Called By.
60.6. Calls.
60.7. Tables.
60.8. System Variables.
SY-INDEX
SY-SUBRC
SY-FDPOS
INT4 X
INT4 X
INT4 X
4
4
4
Number of loop passes
Return value after specif
Location of a string
60.9. Description.
The routine loops around the string containing the list of characters to remove.
For each character in the ‘Remove’ string, the input string is searched. If the character exists in the
input string, then the character is removed from the input string, shortening the input string by one
character. This continues until the character from the ‘Remove’ string no longer exists in the input
string. The routine then moves onto the next character in the ‘remove’ string.
60.10. Examples.
60.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
StripString.
*
*
Purpose:
Removes specified characters from string
*
*
Entry:
String to remove characters from.
*
Entry:
String of characters to remove
*
*
Exit:
Entry string with strip chars removed
*
*
Called By:
Perform striptring
*
using
p_string p_remove
*
changing p_out
Page 152
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form StripString using
p_string p_remove
changing p_out.
Data: w__remchar(1) type c,
" The character to remove
w__rempos
type i,
" remove character pos
w__remlen
type i,
" length of p_remove
w__fdpos
like sy-fdpos,
" position of remchar
w__cpstr(255) type c.
*
Move p_string to p_out.
Compute w__remlen = Strlen( p_remove ).
Do w__remlen times.
*
*
Get the character to remove from the string.
*
Compute w__rempos = sy-index - 1.
Move p_remove+w__rempos to w__remchar.
Search p_out for w__remchar.
While sy-subrc = 0.
Compute w__fdpos = sy-fdpos.
Move p_out to w__cpstr+0(w__fdpos).
Compute w__fdpos = sy-fdpos + 1.
Move p_out+w__fdpos to w__cpstr+sy-fdpos.
Move w__cpstr to p_out.
Search p_out for w__remchar.
EndWhile.
EndDo.
EndForm.
60.12. See Also.
Page 153
61.
SUBTITLES
61.1. Location.
YREPINC.
61.2. Purpose.
Prints a list of search criteria. This routine should not be called via a user program.
61.3. Entry.
61.4. Exit.
61.5. Called By.
SORTREP
61.6. Calls.
WRITECENTRE
61.7. Tables.
61.8. System Variables.
61.9. Description.
The routine looks at the option field passed by the calling program. This contains a code which
specifies the search criteria to apply. This is then changed into words and topped/tailed with parameter
information. This is then written out.
61.10. Examples.
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Define PSub.
Loop at &1.
Perform Subtitles using &2
&1-Sign &1-option
&1-low &1-high.
EndLoop.
End-Of-Definition.
*Eject
***********************************************************************
*
61.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
SubTitle
*
*
Purpose:
Prints a list of search criteria
*
*
Entry:
Search Criteria
*
*
Exit:
*
*
Called By:
loop at t_opts.
Page 154
*
Perform Subtitles Sort sign option low high
*
*
Calls:
WriteCentre
*
ReportLine
*
*
Modification History:
*
*
Date
Reason
Version Who
*
FORM SUBTITLES using p_text p_sign p_option p_low p_high.
*
* Get the column to sort by.
*
Data: w__subtitle(150) type c,
w__option(50)
type c,
w__join(4)
type c,
w__sign(20)
type c,
w__plural(60)
type c,
w__low(150)
type c,
w__high(150)
type c.
*
*
Format the input parameters.
*
Write p_low
to w__low.
Write p_high to w__high.
*
*
Decide on the initial wording.
*
move 'that' to w__join.
Case p_option.
When 'EQ'. Move 'are equal to' to w__option.
When 'NE'. Move 'are not equal to' to w__option.
When 'CP'. Move 'contains pattern' to w__option.
When 'NP'. Move 'does not contain pattern' to w__option.
When 'GE'. Move 'are greater than or equal to' to w__option.
When 'LT'. Move 'are less than' to w__option.
When 'LE'. Move 'are less than or equal to' to w__option.
When 'GT'. Move 'are greater than' to w__option.
When 'BT'. Move 'are between' to w__option.
When 'NB'. Move 'are not between' to w__option.
EndCase.
*
* Inclusive or exclusive.
*
if p_sign = 'I'.
Move 'Inclusive' to w__sign.
else.
Move 'Exclusive' to w__sign.
endif.
*
*
Form the sentence.
*
Concatenate p_text 's' into w__plural.
if p_option <> 'BT'
and p_option <> 'NB'.
Concatenate 'For all' w__plural w__join w__option
w__low w__sign
into w__subtitle
separated by ' '.
else.
Concatenate 'For all' w__plural w__join w__option
w__low 'and' w__high w__sign
into w__subtitle
separated by ' '.
Endif.
Perform WriteCentre using w__subtitle.
EndForm.
61.12. See Also.
Psub
Page 155
62.
TABLELINE
62.1. Location.
YREPINC.
62.2. Purpose.
Places a line on a report spanning the current report.
62.3. Entry.
62.4. Exit.
62.4.1.Global flag w__line printed set to true.
62.5. Called By.
GROUPHEADER
PRINTTITLES.
USEREPORT
CHECKBREAKS
PRINTTOTALS
RUNTOTALS.
Perform TableLine.
62.6. Calls.
UNDERLINE
62.7. Tables.
62.8. System Variables.
62.9. Description.
Prints an underline from the start position of the currently defined table to the last column of the
currently defined table.
62.10. Examples.
FORM GROUPHEADER using p_title
p_value.
Data: w__repline(255) type c,
w__offset
type i,
w__required
type i.
*
If w__lineprinted = True.
Perform TableLine.
EndIf.
*
*
Have we enough room to print this plus column titles
*
*
*
If MaxTline is 0, then the titles have not been printed, and
*
we must be at the top of the page so we don't really care anyway.
62.11. SourceCode.
*EJECT
***********************************************************************
Page 156
*
*
Procedure:
Tableline.
*
*
Purpose:
Places a line on a report spanning the current
*
report.
*
*
Entry:
none
*
*
Exit:
Global flag w__line printed set to true.
*
*
Called By:
Perform TableLine
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
FORM TABLELINE.
Data: w__maxwidth type i.
Read Table ReportTable Index 1.
Compute w__maxwidth = ReportTable-Maxwidth + 1.
Perform UnderLine using ReportTable-StartPos w__MaxWidth.
ENDFORM.
62.12. See Also.
Underline
Page 157
63.
UNDERLINE
63.1. Location.
YREPINC.
63.2. Purpose.
Places a line on a report
63.3. Entry.
63.3.1.Start position
63.3.2.Width
63.4. Exit.
63.4.1.Global flag w__line printed set to true.
63.5. Called By.
REPHEADER
TABLELINE.
Perform UnderLine using 0 sy-linsz.
63.6. Calls.
63.7. Tables.
63.8. System Variables.
SY-ULINE
CHAR C
255
Constant: Underline (----
63.9. Description.
Prints a line on the report from absolute co-ordinates.
63.10. Examples.
Tables: T001.
Data:
w__offset
type i.
Move False to w__grouphdr.
Move False to w__lineprinted.
*
*
*
Top Line - Report - co - User
Perform UnderLine using 0 sy-linsz.
Write: / 'Report:' no-gap,sy-repid.
*
*
*
*
Get the company name and centralise this within the report line
width
Select single * from T001 where bukrs = P_COCODE.
compute w__offset = ( sy-linsz - strlen( t001-butxt ) ) / 2.
63.11. SourceCode.
*EJECT
Page 158
***********************************************************************
*
*
Procedure:
Underline.
*
*
Purpose:
Places a line on a report
*
*
Entry:
Startposition
*
Entry:
Width
*
*
Exit:
Global flag w__line printed set to true.
*
*
Called By:
Perform Underline using Start,Width.
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
FORM UNDERLINE using p_start type i
p_width type i.
*
Statics: w__lastline
like sy-linno,
" last underline
w__lastwidth
type i.
" and length
*
Data: w__repline(255) type c.
*
*
If the current line is an underline,
*
don't do another one. This aids in joining up reports of
*
different formats, unless the last line was shorter than the
*
current line.
*
If w__lastline <> sy-linno
or w__lastwidth < p_width.
Move space to w__repline.
Move sy-uline to w__repline+p_start(P_width).
Move sy-linno to w__lastline.
Move p_width to w__lastwidth.
If w__lastline = sy-linno.
Write / w__repline.
Else.
Position 1.
write w__repline.
EndIf.
Else.
Skip 2.
EndIf.
ENDFORM.
"UNDERLINE
63.12. See Also.
TableLine
Page 159
64.
USEREPORT
64.1. Location.
YREPINC.
64.2. Purpose.
Retreives a specified report from the report stack after saving the current report
64.3. Entry.
64.3.1.Report Name
64.4. Exit.
64.5. Called By.
64.6. Calls.
TABLELINE
SAVEREPORT
64.7. Tables.
64.8. System Variables.
SY-SUBRC
INT4 X
4
Return value after specif
64.9. Description.
This procedure readies the reporting routines to start prining a report format that has previously been
saved using SaveReport. The break-points and totals are all restored to their previous state, and the
report formating is also save to the state prior to the call to save report.
This enables multi-format reports to be produced whilst keeping the run totals and so forth intact.
64.10. Examples.
w_vbeln like vbak-vbeln.
*
Read Table t_revenue index 1.
*
*
*
Initial group headers.
Set pf-status '001'.
Perform UseReport using c_main_report.
Perform GroupHeader using Text-009 T_REVENUE-KTEXT.
Perform GroupHeader using Text-008 T_REVENUE-ABTEI.
Perform GroupHeader using Text-007 T_REVENUE-ENAME.
Perform GroupHeader using Text-006 T_REVENUE-VB.
Perform GroupHeader using Text-015 T_REVENUE-CENDNG.
Move t_revenue-vbeln to w_vbeln.
*
64.11. SourceCode.
*EJECT
Form UseReport using pu_repname like t__reportstack-repname.
*
Data: w__repname like t__reportstack-repname.
*
Move pu_repname to w__repname.
Translate w__repname to upper case.
Page 160
If w__repname <> w__currep.
*
*
*
Save the current report.
If not w__currep is initial.
*
*
*
Underline the current report,
but don't cause a new line
If w__lineprinted = True.
Perform TableLine.
EndIf.
Perform SaveReport using w__currep.
EndIf.
Read Table t__reportstack with key repname = w__repname.
If sy-subrc = 0.
Zap: ReportTable, ReportBreaks.
Move t__reportstack-Reports[]
to ReportTable[].
Move t__reportstack-Repbreaks[] to ReportBreaks[].
Move w__repname
to w__currep.
EndIf.
EndIf.
EndForm.
64.12. See Also.
Page 161
65.
WLINE
65.1. Location.
YREPINC.
65.2. Purpose.
Prints the supplied data line to the report
65.3. Entry.
65.3.1.Dataline to print
65.3.2.Colour of line.
The colour of the line should be specified using one of the colour constants defined by SAP:








col_background
col_heading
col_normal
col_total
col_key
col_positive
col_negative
col_group
The default colours supplied by SAP are:
Figure 5 Default Colours Provided By SAP
Page 162
65.4. Exit.
65.5. Called By.
GROUPHEADER
PRINTTITLES.
Perform WLine Using w__repline Col_Group.
65.6. Calls.
SETCOLOUR
65.7. Tables.
65.8. System Variables.
SY-VLINE
SY-SUBRC
SY-FDPOS
SY-LINSZ
CHAR
INT4
INT4
INT4
C
X
X
X
1
4
4
4
Constant: Vertical bar
Return value after specif
Location of a string
Line size of list
65.9. Description.
This routine outputs data to the report, making certain that the colour attributs work correctly and do
not extend back to the start of the line.
65.10. Examples.
Move sy-vline to w__repline+w__offset.
Compute w__offset = w__offset + 1.
Move p_title to w__repline+w__offset.
Compute w__offset = w__offset + Strlen( p_title ) + 1.
Move p_value to w__repline+w__offset.
Compute w__offset = ReportTable-StartPos + ReportTable-MaxWidth.
Move sy-vline to w__repline+w__offset.
Perform WLine Using w__repline Col_Group.
Perform TableLine.
Move False to w__grouphdr.
Move False to w__lineprinted.
Endif.
ENDFORM.
" Group Header.
*Eject
***********************************************************************
65.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
WLine.
*
*
Purpose:
Prints the supplied data line to the report
*
*
Entry:
Dataline to print
*
Entry:
colour of line
*
*
Exit:
*
*
Called By:
Perform WLine using w__dataline Col_Group
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
FORM WLINE Using p_dataline p_colour.
Data: w__repline(255) type c,
Page 163
w__filler(255)
w__offset
w__count
*
*
*
*
*
*
*
type c,
type i,
type i.
When you write data lines to the screen the colour formatting
extends back to column 1. This routine attempts to get rid of it
And you can't specify parameters for the colour statement.
Another byte yer bum from SAP!
Search p_dataline for sy-vline.
if sy-subrc = 0.
compute w__offset = sy-fdpos + 1.
Move p_dataline+0(w__offset) to w__filler.
Move p_dataline to w__repline.
*
*
*
Add on a final vertical line.
Read Table ReportTable Index 1.
compute w__offset = ReportTable-First + ReportTable-Maxwidth.
Move sy-vline to w__repline+w__offset.
else.
Move p_dataline to w__repline.
endif.
Perform Setcolour using P_Colour.
Write: / w__repline.
Format Color Off.
*
*
*
*
*
*
*
*
*
*
Here's another bum byter. You can't specify a variable position
in a write statement - like write varpos variable......
However, there is the 'POSITION' statement which I've only just
discovered after writing this the hard way.
All I want to do is clear a few spaces at the start of the line
and at the end of the line.
compute w__count = strlen( w__repline ) + 1.
do.
Position w__count.
write ' ' no-gap.
compute w__count = w__count + 1.
if w__count > sy-linsz.
exit.
endif.
enddo.
*
write 001 ' ' no-gap.
compute w__count = sy-fdpos - 1.
do w__count times.
write ' ' no-gap.
enddo.
ENDFORM.
65.12. See Also.
Page 164
66.
WRITECENTRE
66.1. Location.
YREPINC.
66.2. Purpose.
Centres and writes the text across the current report width
66.3. Entry.
66.3.1.Text to centre
66.4. Exit.
66.5. Called By.
SUBTITLES
Perform WriteCentre using w__subtitle.
66.6. Calls.
66.7. Tables.
66.8. System Variables.
SY-LINSZ
INT4 X
4
Line size of list
66.9. Description.
This routine centres the specified text below the current report.
66.10. Examples.
separated by ' '.
else.
Concatenate 'For all' w__plural w__join w__option
w__low 'and' w__high w__sign
into w__subtitle
separated by ' '.
Endif.
Perform WriteCentre using w__subtitle.
EndForm.
*Eject
***********************************************************************
*
*
Procedure:
Checkbreaks
*
*
Purpose:
Checks and prints total breaks
66.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
WriteCentre.
*
*
Purpose:
Centres and writes the text across the current
*
report width
*
*
Entry:
Text to centre
*
Page 165
*
Exit:
*
*
Called By:
Perform WriteCentre using w__text
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version
*
FORM WRITECENTRE using p_text.
Data: w__offset
type i,
w__repline(255) type c.
Move space to w__repline.
Compute w__offset = ( sy-linsz - strlen( p_text ) ) / 2.
Move p_text to w__repline+w__offset.
Write /001 w__repline.
ENDFORM.
66.12. See Also.
Page 166
Who
67.
WRITECOL
67.1. Location.
YREPINC.
67.2. Purpose.
Writes a single column.
67.3. Entry.
67.3.1.Data line and column to print
67.3.2.Column to use.
67.4. Exit.
67.5. Called By.
INITBREAK
Perform WriteCol using &1 &2.
67.6. Calls.
67.7. Tables.
67.8. System Variables.
SY-SUBRC
SY-VLINE
INT4 X
CHAR C
4
1
Return value after specif
Constant: Vertical bar
67.9. Description.
This subroutine takes a line of text and places it in a specific column on the current report.
67.10. Examples.
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Define WriteTable.
Loop at &1.
Perform WriteCol using &1 &2.
EndLoop.
End-Of-Definition.
*eject
**********************************************************************
*
*
Procedure:
WriteColumn
*
67.11. SourceCode.
*EJECT
**********************************************************************
*
*
Procedure:
WriteColumn
*
Page 167
*
Purpose:
Writes a single column.
*
*
Entry:
Data line and column to print
*
Entry:
Column to use.
*
*
Exit:
*
*
Called By:
Perform WriteCol using p_column p_data.
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form WriteCol using p_data p_fieldname.
*
Data: w__fieldname(10) type c,
" Upper case column name
w__data(255) type c,
" Data to print
w__pos type i.
*
Move p_fieldname to w__fieldname.
Move p_data to w__data.
Translate w__fieldname to upper case.
*
*
Find the Report table entry for this column.
*
if sy-subrc = 0.
Write /001 ''.
Loop at ReportTable.
Compute w__pos = ReportTable-StartPos + 1.
Write at w__pos sy-vline no-gap.
If ReportTable-FieldName = w__fieldname.
Format Color Col_Normal.
Write at (ReportTable-ColWidth) w__data.
Format Color Off.
EndIf.
EndLoop.
Read table ReportTable Index 1.
Compute w__pos = ReportTable-StartPos
+ ReportTable-MaxWidth + 1.
Write at w__pos sy-vline no-gap.
EndIf.
EndForm.
67.12. See Also.
Page 168
68.
WRITELINE
68.1. Location.
YREPINC.
68.2. Purpose.
Writes a data line to the screen, creating hide fields at the same time.
68.3. Entry.
68.3.1.Table work area containing report data
68.3.2.Colour to use to print the data in.
68.4. Exit.
68.5. Called By.
68.6. Calls.
68.7. Tables.
68.8. System Variables.
SY-VLINE
SY-TABIX
CHAR C
INT4 X
1
4
Constant: Vertical bar
Runtime: Current line of
68.9. Description.
Looping through a table structure defined by successive calls to BuildReport the WriteLine routine
takes positioning information and places the relevant information on the report.
This is achieved by using ASSIGN to indirectly access the fields in the table structure itself. An entire
line is output complete with vertical bars.
At the same time this is occuring, the routine 'Hides' the variables output to the report for later use
should the report have drill-down capabilities.
'Hidden' variables can be recalled in the following manner:
At Line-Selection.
*
* If the user selects a line, take them to the programmers screen.
*
Data: w_bname like usr02-bname,
w_pname like trdir-name.
*
If w_state = '0'.
Move '' to w_bname.
Read Line sy-lilli field value t_users-bname into w_bname.
if not w_bname is initial.
Perform DoUsers using w_bname.
EndIf.
Else.
Move '' to w_pname.
Read Line sy-lilli field value t_programs-name into w_pname
t_programs-bname into w_gname.
if not w_pname is initial.
Page 169
Perform DoDl using w_pname p_outdir.
EndIf.
EndIf.
*
68.10. Examples.
Sort t_lqua by matnr.
Loop at t_lqua.
If w_matnr <> t_lqua-matnr.
Concatenate t_lqua-matnr ':' t_lqua-maktx into w_text.
Perform GroupHeader using Text-022 w_text.
Move t_lqua-matnr to w_matnr.
EndIf.
Perform WriteLine using t_lqua Col_Normal.
EndLoop.
Perform EndReport.
EndForm.
*
Form EndReport.
Perform TableLine.
Perform WriteCentre using text-015.
68.11. SourceCode.
*Eject
***********************************************************************
*
*
Procedure:
WriteLine
*
*
Purpose:
Writes a data line to the screen, creating
*
hide fields at the same time.
*
*
Entry:
Table containing report data
*
Entry:
Colour to use to print the data in.
*
*
Exit:
*
*
Called By:
Perform WriteLine using TableName P_Colour
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form WriteLine using P_DataTable P_Colour.
*
Constants: c__blanks(100) type c value ' '.
*
Data: t__coltotals like vbak-netwr occurs 0 with header line,
w__pos
Type i,
w__spaces
type i,
w__type(1)
type c,
w__symbol(2) type c.
*
*
Do we need to add a run total break ?
*
If w__runtotal = True.
Perform Initbreak using '*' 'Run Total:' c_no c_yes.
Move False to w__runtotal.
EndIf.
Write /001 ''.
Loop at ReportTable.
*
*
Point to the relevant field.
*
Assign Component ReportTable-FieldName
of structure P_DataTable to <RField>.
Compute w__pos = reportTable-StartPos + 1.
Position w__Pos.
Write: sy-vline no-gap.
*
Page 170
*
*
Check box ?
Case True.
When ReportTable-CheckBox.
*
*
*
Centre the check box within the column
w__spaces = ( ReportTable-ColWidth - 1 ) / 2.
Write at (w__spaces) c__blanks no-gap.
Write <RField> as CheckBox no-gap.
Hide <Rfield>.
When ReportTable-Icon.
If ReportTable-hotspot <> True.
Write: ' ' no-gap, ReportTable-Isyname as icon.
Else.
Write: ' ' no-gap, ReportTable-Isyname
as icon Hotspot on.
EndIf.
When ReportTable-Symbol.
*
*
*
*
Check to see if this is a variable symbol and
set the symbol value accordingly.
If ReportTable-FieldName is initial.
Perform WriteSymbol using ReportTable-Isyname
ReportTable-Hotspot.
Else.
*
*
*
*
*
This is a variable symbol. The symbol to
use for true is in Isyname, false_Sym is false
The field to check the value of is in FieldName
If <Rfield> is initial.
Perform WriteSymbol using ReportTable-falsesym
ReportTable-hotspot.
Else.
Perform WriteSymbol using ReportTable-Isyname
ReportTable-hotspot.
EndIf.
EndIf.
When Others.
*
*
*
Set the output colour.
Perform SetColour using P_Colour.
Perform WriteValue using ReportTable-ColWidth
<RField>
ReportTable-ConvExit
ReportTable-Currency
ReportTable-Unit
ReportTable-Format.
Hide <RField>.
EndCase.
Format Color Off.
*
*
*
Total Breaks ?
Describe field <RField> type w__type.
if c__numeric cs w__type.
*
*
*
Update report totals at level 1.
Move
Read
Move
Read
sy-tabix to w__pos.
table ReportBreaks index 1.
ReportBreaks-totals[] to t__coltotals[].
Table t__coltotals index w__pos.
*
Compute t__coltotals = t__coltotals + <RField>.
Modify t__coltotals index w__pos.
Move t__coltotals[] to ReportBreaks-Totals[].
Modify ReportBreaks index 1.
EndIf.
Page 171
EndLoop.
Read table ReportTable Index 1.
Compute w__pos = ReportTable-StartPos + ReportTable-MaxWidth + 1.
Write at w__pos sy-vline.
Move True to w__lineprinted.
EndForm.
68.12. See Also.
Page 172
69.
WRITESYMBOL
69.1. Location.
YREPINC.
69.2. Purpose.
Writes symbol to the screen. The symbol can be written as a hotspot.
69.3. Entry.
69.3.1.Symbol name to use.
This is one of the symbols declared by the standard ABAP include <symbols>
69.3.2.Hotspot flag.
This should either be True or False. True enables the symbol as a hotspot.
69.4. Exit.
69.5. Called By.
WRITELINE
Perform WriteSymbol using ReportTable-Isyname ReportTable-Hotspot.
69.6. Calls.
69.7. Tables.
69.8. System Variables.
69.9. Description.
This routine writes a pre-defined symbol to the screen or report. If required, the symbo, can also be
designated as a hotspot.
69.10. Examples.
EndIf.
When ReportTable-Symbol.
*
*
*
*
Check to see if this is a variable symbol and
set the symbol value accordingly.
If ReportTable-FieldName is initial.
Perform WriteSymbol using ReportTable-Isyname
ReportTable-Hotspot.
Else.
*
*
*
*
*
This is a variable symbol. The symbol to
use for true is in Isyname, false_Sym is false
The field to check the value of is in FieldName
69.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
WriteSymbol
Page 173
*
*
Purpose:
Writes symbol to the screen. The symbol can
*
be written as a hotspot.
*
*
Entry:
Symbol name to use
*
Entry:
Hotspot flag.
*
*
Exit:
*
*
Called By:
Perform WriteSymbol using w_symbol w_hotspot.
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form WriteSymbol using p_symbol p_hotspot.
If p_hotspot <> True.
Write: ' ' no-gap, p_symbol
as Symbol.
Else.
Write: ' ' no-gap, p_symbol
as Symbol Hotspot on.
EndIf.
EndForm.
69.12. See Also.
Page 174
70.
WRITEVALUE
70.1. Location.
YREPINC.
70.2. Purpose.
Outputs a specific value to the report paying attention to formatting masks etc
70.3. Entry.
70.3.1.Width of output field
This is the width of the output field in characters.
70.3.2.Value to write
The value to write to the report
70.3.3.Conversion exit routine
If you wish to use a conversion -exit routine to modify the data before it is output, then the
routine should be specified here. This and the following three fields are exclusive. Only one
of these options will be used to output the variable.
70.3.4.Currency Field
This parameter must be a string, however, it can either specify a currency mask literal or a
variable or field name containing a currency mask
70.3.5.Unit field
In the same manner as the currency field above, this field specifies a Unit mask to use when
writing the value to the report.
70.3.6.Other Format field.
This can be a standard ABAP format string. See section 28.3.4 above and 28.3.5 above for
more information on this.
70.4. Exit.
70.5. Called By.
WRITELINE
PRINTTOTALS
Perform WriteValue using ReportTable-ColWidth
<RField>
ReportTable-ConvExit
ReportTable-Currency
ReportTable-Unit
ReportTable-Format.
70.6. Calls.
GETMASK
Page 175
70.7. Tables.
70.8. System Variables.
70.9. Description.
This routine outputs a report variable to a specific column on the report. In doing so, any formatting
options specified are applied.
70.10. Examples.
If ReportTable-Symbol = True.
Write: ' ' no-gap, ReportTable-Isyname as Symbol.
Else.
*
*
*
Set the output colour.
Perform SetColour using P_Colour.
Perform WriteValue using ReportTable-ColWidth
<RField>
ReportTable-ConvExit
ReportTable-Currency
ReportTable-Unit
ReportTable-Format.
Hide <RField>.
EndIf.
70.11. SourceCode.
*EJECT
***********************************************************************
*
*
Procedure:
WriteValue
*
*
Purpose:
Outputs a specific value to the report paying
*
attention to formatting masks etc
*
*
Entry:
Width of output field
*
Entry:
Value to write
*
Entry:
Conversion exit routine
*
Entry:
Currency Field
*
Entry:
Unit field
*
Entry:
Other Format field.
*
*
Exit:
*
*
Called By:
Perform WriteValue using p_width
*
p_value
*
p_convexit
*
p_currency
*
p_unit
*
p_format.
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
*
*
Print Hierachy.
*
*
1. If there is a convexit use that
*
2. Check currency - use if present
*
3. Check Unit - use if present
*
4. Just print it.
*
Form Writevalue using p_width
p_value p_convexit
p_currency p_unit p_format.
*
Data w__fcode(10) type c.
" Unit/Currency code
Page 176
*
*
*
Now write out the value.
If Not p_ConvExit is initial.
Write at (p_width) p_value no-gap
using edit mask p_ConvExit.
Else.
If Not p_Currency is Initial.
Perform GetMask using p_currency changing w__fcode.
Write at (p_width) p_value Currency w__fcode no-gap.
Else.
If Not p_Unit is Initial.
Perform GetMask using p_unit changing w__fcode.
Write at (p_width) p_value Unit w__fcode no-gap.
Else.
If p_format is initial.
Write at (p_width) p_value no-gap.
Else.
Case p_format.
When 'NO-ZERO'.
Write at (p_width) p_value no-gap no-zero.
When 'NO-SIGN'.
Write at (p_width) p_value no-gap no-sign.
*
When 'NO GROUPING'.
*
Write at (p_width) p_value no-gap
*
no-grouping.
When 'DD/MM/YY'.
Write at (p_width) p_value no-gap DD/MM/YY.
When 'MM/DD/YY'.
Write at (p_width) p_value no-gap MM/DD/YY.
When 'DD/MM/YYYY'.
Write at (p_width) p_value no-gap DD/MM/YYYY.
When 'MM/DD/YYYY'.
Write at (p_width) p_value no-gap MM/DD/YYYY.
EndCase.
EndIf.
EndIf.
EndIf.
EndIf.
EndForm.
70.12. See Also.
Page 177
71.
ZBDC_BATCH_ON
71.1. Location.
YBDCINC.
71.2. Purpose.
Sets a flag that causes the BDC routines to create a batch table if the BDC errors
71.3. Entry.
71.4. Exit.
71.5. Called By.
71.6. Calls.
71.7. Tables.
71.8. System Variables.
71.9. Description.
Signifies that should this BDC session fail, a Batch (SM35) session should be created. This applies
for this one BDC call only.
This routine is now obsolete, but is here for backwards compatability. See BDC Options in section 4
above and Read_YDCSet in section 53 above
71.10. Examples.
71.11. SourceCode.
*EJECT
**********************************************************************
*
*
Procedure:
ZBDC_Batch_On
*
*
Purpose:
Sets a flag that causes the BDC routines
*
to create a batch table if the BDC errors
*
*
Entry:
None
*
*
Exit:
None
*
*
Called By:
Perform ZBDC_Batch_On
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form ZBDC_Batch_On.
Move True to w__bdcbatch.
EndForm.
71.12. See Also.
ZBDC_CLOSE_GROUP
Page 178
ZBDC_OPEN_GROUP
ZBDC_INSERT_GROUP
ZDO_BDC
Page 179
72.
ZBDC_CLOSE_GROUP
72.1. Location.
YBDCINC.
72.2. Purpose.
Closes a BDC Batch group
72.3. Entry.
72.3.1.None.
72.4. Exit.
72.4.1.Status 0 - Ok.
1 - BDC Group not open
2 - Queue Error
3 - Other problems
72.5. Called By.
ZDO_BDC
Perform ZBDC_Close_Group changing w__istat.
72.6. Calls.
72.7. Tables.
72.8. System Variables.
SY-SUBRC
INT4 X
4
Return value after specif
72.9. Description.
After creating a BDC session this routine should be called to close the group.
72.10. Examples.
If w__bdcbatch = True.
Get Time.
Concatenate p_trans '_' sy-uname sy-uzeit+0(5) into w__group.
Perform ZBDC_Open_Group using w__group changing w__istat.
If w__istat = 0.
Perform ZBDC_Insert using p_trans changing w__istat.
If w__istat = 0.
Perform ZBDC_Close_Group changing w__istat.
EndIf.
EndIf.
EndIf.
*
*
*
Mail a user ?
If not w__ydcset-genmail is initial.
72.11. SourceCode.
*EJECT
**********************************************************************
*
Page 180
*
Procedure:
ZBDC_CLOSE_GROUP
*
*
Purpose:
Closes a BDC Batch group
*
*
Entry:
None.
*
*
Exit:
Status 0 - Ok.
*
1 - BDC Group not open
*
2 - Queue Error
*
3 - Other problems
*
*
Called By:
Perform ZBDC_Close_Group
*
changing w_status
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version
*
Form ZBDC_Close_Group changing p_status like sy-subrc.
Move 0 to p_status.
Call Function 'BDC_CLOSE_GROUP'
Exceptions
NOT_OPEN
= 1
QUEUE_ERROR = 2
OTHERS
= 3.
Move sy-subrc to p_status.
Endform.
" BDC_CLOSE_GROUP
72.12. See Also.
ZBDC_BATCH_ON
ZBDC_OPEN_GROUP
ZBDC_INSERT_GROUP
ZDO_BDC
Page 181
Who
73.
ZBDC_DUMP_ON
73.1. Location.
YBDCINC.
73.2. Purpose.
Sets a flag that causes the BDC routines to dump the BDC table to the printer before running it. As it's
reset at the start of each new bdc the 'off' is not required.
73.3. Entry.
73.3.1.None
73.4. Exit.
73.4.1.None
73.5. Called By.
73.6. Calls.
73.7. Tables.
73.8. System Variables.
73.9. Description.
Sets a flag that causes the BDC routines to dump the BDC table to the printer before running it. As it's
reset at the start of each new bdc the 'off' is not required.
This routine is now obsolete, but is here for backwards compatability. See BDC Options in section 4
above and Read_YDCSet in section 53 above
73.10. Examples.
73.11. SourceCode.
*EJECT
**********************************************************************
*
*
Procedure:
ZBDC_Dump_on
*
*
Purpose:
Sets a flag that causes the BDC routines
*
to dump the BDC table to the printer
*
before running it. As it's reset at the
*
start of each new bdc the 'off' is
*
not required.
*
*
Entry:
None
*
*
Exit:
None
*
*
Called By:
Perform ZBDC_Dump_On
*
*
Calls:
*
*
Modification History:
Page 182
*
*
Date
Reason
*
Form ZBDC_Dump_On.
Move True to w__dumpbdc.
EndForm.
73.12. See Also.
ZBDC_BATCH_ON
Page 183
Version
Who
74.
ZBDC_FIELD
74.1. Location.
YBDCINC.
74.2. Purpose.
Fills BDC Data table with field info
74.3. Entry.
74.3.1.Field name
This is the field name that should be filled with the specified value.
74.3.2.Field Value
The value field contains the value to be placed on the screen. Note that numeric data fields of
types F, P and I should be written to a character field first before calling this routine, as
should date fields.
The command line can be accessed using the field name 'BDC_OKCODE'.
74.3.2.1. BDC_OKCODES.
BDC Ok codes are used to 'press buttons' on screens displayed by SAP. Various
codes can be specified, either as numeric codes in the form '/nn', or as alpha codes
of the format '=aaaa'.
BDC Codes can be found by running the relevant transaction to the point just prior
to clicking the button you want to use in the session.
Enter the command '/H' in the command line and press the enter key.
Click the button you are interested in. The program will then break.
Examine variable sy-ucomm. This normally contains the code you require. The
table below contains some commonly used BDC codes.
Numeric
/0
/1
/2
/3
/4
/8
/10
/11
/12
/13
/14
/15
Page 184
Alpha
=ENT
=HELP
=CS
=BACK
=BU
=SICH
=RW
=PRI
DLT
=EXIT
%EX
%SC
=P-=P-
FKey
F1
F2
F3
F4
F8
F10
F11
F11
F12
F13
F14
F15
Action
Enter
Help
Select (Previously PICK)
Back
List possible entries
Execute
Menu
Post
Save
Cancel or Roll Back Worl
Print
Delete
Return to previous screen
Exit
Find By
Top Of List
Previous page
=P++
=P+
Bottom of list
Next Page
Table 5 Common BDC OK Codes
74.4. Exit.
74.5. Called By.
ZBDC_FILLSCREEN
ZBDC_SCROLL
Perform ZBDC_Field using t__d021s-fnam <f__field>.
74.6. Calls.
74.7. Tables.
74.8. System Variables.
74.9. Description.
This routine checks to see if there is an open BDC session. If not, the BDC tables used to contain the
BDC data are cleared.
Then the standard BDC using the field name and value provided are entered into the table.
74.10. Examples.
*
* Ok to proceed with this ?
*
If w_status = c_ok.
Zap t_bdcmsg.
Perform NewBdc.
Perform ZBDC_Screen using 'SAPLCORU'
0100.
Perform ZBDC_Field using 'CORUF-AUFNR' w_aufnr.
Perform ZBDC_Field using 'CORUF-VORNR' w_vornr.
Perform ZBDC_Field using 'BDC_OKCODE' c_enter.
Perform ZBDC_Screen using 'SAPLCORU'
0150.
If not w_endru is initial.
Perform ZBDC_Field using 'CORUF-ENDRU' True.
Else.
Perform ZBDC_Field using 'CORUF-TEILR' True.
74.11. SourceCode.
*EJECT
**********************************************************************
*
*
Procedure:
ZBDC_Field
*
*
Purpose:
Fills BDC Data table with field info
*
*
Entry:
Field name
*
Field Value
*
Exit:
*
*
Called By:
Perform BDC_field using 'FIELD' 'VALUE'
*
*
Calls:
*
*
Modification History:
Page 185
*
*
Date
Reason
*
Form ZBDC_Field using p_fname p_fvalue.
*
*
New BDC Session ??
*
If W__BDCOpen = False.
Zap ZBDC_Table.
Move True to w__BDCOpen.
EndIf.
Clear ZBDC_Table.
Move p_fname to zbdc_table-fnam.
Move p_fvalue to zbdc_table-fval.
Append zbdc_table.
EndForm.
74.12. See Also.
ZBDC_FILLSCREEN
ZBDC_SCREEN
Page 186
Version
Who
75.
ZBDC_FILLSCREEN
75.1. Location.
YBDCINC.
75.2. Purpose.
Creates a screen group and then the relevant field entries from a structure
75.3. Entry.
75.3.1.Program name,
This is the program name of the Transaction you are calling. This is normally of the form
'SAPLY.....'.
75.3.2.Screen number/actual screen No
SAP has the ability to provide sub-screens and so forth. In some cases, the batch screen
number actaully uses another screen definition.
Therefore in the above, the first screen number is the number to use in the BDC calls, the
second is the number where the actual fields are defined.
75.3.3.Structure to use.
This is the screen structure that is used by the transaction as it populates the fields on the
screen.
75.4. Exit.
75.5. Called By.
75.6. Calls.
75.7. Tables.
75.8. System Variables.
SY-SUBRC
INT4 X
4
Return value after specif
75.9. Description.
The routine first retrieves the dynpro field listing for the relevant screen. This details all the fields on
the screen.
Using this field list, the routine first checks to see if the field is editable. This is signalled by two flags
in the d021 structure:
Dependant on the bits set in t__d021s-flg1 and t_-d021s-fmb1, the field is either editable or not. If the
field is editable, the routine then checks to see if there is a value for the field.
If a value is found, the value is formatted accordingly (Dates and numbers written to char fields etc)
and then output to the field.
The routine also recognises the differences between 3.x and 4.x screen fields and acts accordingly.
Page 187
75.10. Examples.
*
Data: w_trans type Transaction_Code,
w_text like t100-text,
w_tanum like ltap-tanum.
*
Perform NewBdc.
If not pu_lt01-Matnr is initial.
Perform ZBDC_FillScreen using c_sapml03t 0101 pu_lt01.
Perform ZBDC_Field
using 'BDC_OKCODE' c_enter.
Perform ZBDC_FillScreen using c_sapml03t 0102 pu_lt01.
Perform ZBDC_Field
using 'BDC_OKCODE' c_enter.
Perform Z_Call_bdc tables t_bdcmsg using c_lt01.
Else.
*
*
LT09 - create su. No Werks....
75.11. SourceCode.
*EJECT
**********************************************************************
*
*
Procedure:
ZBDC_FillScreen
*
*
Purpose:
Creates a screen group and then the
*
relevant field entries from a structure
*
*
Entry:
Program name,
*
Screen number/actual screen No
*
*
SAP has the ability to provide sub-screens
*
and so forth. In some cases, the batch
*
screen number actaully uses another
*
screen definition.
*
*
Therefore in the above, the first screen
*
number is the number to use in the BDC
*
calls, the second is the number where the
*
actual fields are defined.
*
*
Structure to use.
*
*
Exit:
*
*
Called By:
Perform ZBDC_FillScreen using 'SAPML04I'
*
'0223'
*
w_stru.
*
*
Calls:
ZBDC_Screen
*
ZBDC_Field
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form ZBDC_FillScreen using p_program type Program_Name
p_screen
p_struc.
*
Constants: c_flg1edt type x value '80',
" Field edit flags
c_fmb1ges type x value '20'.
*
Data: Begin Of w__dynpro_30,
" Screen name FOR 30+
Name(8) type c,
Scrn(4) type n,
End of w__dynpro_30,
Begin Of w__dynpro_40,
" Screen name FOR 40+
Name(40) type c,
Scrn(4) type n,
End of w__dynpro_40,
w__d020s
like d020s,
" Screen header
t__d021s
like d021s occurs 0
" Field List
Page 188
t__d022s
t__d023s
with header line,
like d022S occurs 0,
like d023s occurs 0,
" Flow Logic
" Match code
*
w__sfnam
w__stble
w__type(1)
w__dfield(10)
w__nfield(20)
w_scrn(4)
w_subscrn(4)
like d021s-fnam,
like d021s-fnam,
type c,
type c,
type c,
type n,
type n.
"
"
"
"
"
"
"
Structure name
Table name (Dumped)
Field type
Fld for date trans
Fld for nc trans
Screen for BDC Data
Actual screen def
*
Field-Symbols <f__field>.
*
*
*
Get the screen information.
If p_screen ca '/'.
Split p_screen at '/' into w_scrn w_subscrn.
Else.
Move p_screen to w_scrn.
Move p_screen to w_subscrn.
Endif.
If sy-saprl+0(1) = 3.
Move p_program to w__dynpro_30-name.
Move w_subscrn to w__dynpro_30-scrn.
Import Dynpro w__d020s t__d021s t__d022s t__d023s
id w__dynpro_30.
Else.
Move p_program to w__dynpro_40-name.
Move w_subscrn to w__dynpro_40-scrn.
Import Dynpro w__d020s t__d021s t__d022s t__d023s
id w__dynpro_40.
EndIf.
*
*
*
Set up the screen bdc record.
Perform ZBDC_Screen using p_program w_scrn.
*
*
*
And loop round the field list.
Loop at t__d021s.
*
*
*
Process this field ?
if t__d021s-flg1 o c_flg1edt.
if t__d021s-fmb1 z c_fmb1ges.
*
*
*
Get the actual field name....
Split t__d021s-fnam at '-' into w__stble w__sfnam.
If not w__sfnam is Initial.
Assign component w__sfnam
of structure p_struc to <f__field>.
If sy-subrc = 0.
If not <f__field> is initial.
*
*
*
*
If this is a numeric or a date field then it
needs to be written to a character field first.
Describe field <f__field> type w__type.
Case w__type.
When 'C'.
Perform ZBDC_Field
using t__d021s-fnam
<f__field>.
Move '' to <f__field>.
When 'D'.
Write <f__field> to w__dfield.
Perform ZBDC_Field
using t__d021s-fnam
w__dfield.
Move '' to <f__field>.
When others.
Page 189
Write <f__field> to w__nfield.
Condense w__nfield.
Perform ZBDC_Field
using t__d021s-fnam
w__nfield.
Move 0 to <f__field>.
Endcase.
EndIf.
EndIf.
EndIf.
Endif.
Endif.
EndLoop.
EndForm.
75.12. See Also.
ZBDC_FIELD
ZBDC_SCREEN
Page 190
76.
ZBDC_INSERT
76.1. Location.
YBDCINC.
76.2. Purpose.
Starts a new BDC session
76.3. Entry.
76.3.1.Transaction code
76.4. Exit.
76.4.1.Status of Insert
76.5. Called By.
ZDO_BDC
Perform ZBDC_Insert using p_trans changing w__istat.
76.6. Calls.
76.7. Tables.
76.8. System Variables.
SY-SUBRC
INT4 X
4
Return value after specif
76.9. Description.
This function creates a new BDC batch session.
76.10. Examples.
*
*
Make a batch of this session ??
If w__bdcbatch = True.
Get Time.
Concatenate p_trans '_' sy-uname sy-uzeit+0(5) into w__group.
Perform ZBDC_Open_Group using w__group changing w__istat.
If w__istat = 0.
Perform ZBDC_Insert using p_trans changing w__istat.
If w__istat = 0.
Perform ZBDC_Close_Group changing w__istat.
EndIf.
EndIf.
EndIf.
*
*
Mail a user ?
76.11. SourceCode.
*eject
**********************************************************************
*
*
Procedure:
ZBDC_INSERT
*
*
Purpose:
Starts a new BDC session
*
Page 191
*
Entry:
Transaction code,
*
BDC Table is full.
*
*
Exit:
Status of Insert!
*
*
Called By:
Perform ZBDC_INSERT using w_trans
*
Changing w_status
*
FORM ZBDC_INSERT using p_trans Like TSTC-TCODE
changing p_status like sy-subrc.
Move 0 to p_status.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE
= p_trans
TABLES
DYNPROTAB
= ZBDC_Table
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN
= 2
QUEUE_ERROR
= 3
TCODE_INVALID = 4
OTHERS
= 5.
Move sy-subrc to p_status.
ENDFORM.
" BDC_INSERT
76.12. See Also.
ZBDC_OPEN_GROUP
ZBDC_CLOSE_GROUP
Page 192
77.
ZBDC_OPEN_GROUP
77.1. Location.
YBDCINC.
77.2. Purpose.
Starts a new BDC session
77.3. Entry.
77.3.1.Group Name to use for batch
77.4. Exit.
77.4.1.Status of open:
CLIENT_INVALID
=1
DESTINATION_INVALID = 2
GROUP_INVALID
=3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR
=6
QUEUE_ERROR
=7
RUNNING
=8
SYSTEM_LOCK_ERROR = 9
USER_INVALID
= 10
OTHERS
= 11.
77.5. Called By.
ZDO_BDC
Perform ZBDC_Open_Group using w__group changing w__istat.
77.6. Calls.
77.7. Tables.
77.8. System Variables.
SY-UNAME
SY-MANDT
SY-SUBRC
CHAR C
CLNT C
INT4 X
12
3
4
Session: SAP user from SA
Client number from SAP lo
Return value after specif
77.9. Description.
Starts a new BDC Session.
77.10. Examples.
Importing MESSAGE_TEXT_OUTPUT = p_text.
*
*
*
Make a batch of this session ??
If w__bdcbatch = True.
Get Time.
Concatenate p_trans '_' sy-uname sy-uzeit+0(5) into w__group.
Perform ZBDC_Open_Group using w__group changing w__istat.
If w__istat = 0.
Page 193
Perform ZBDC_Insert using p_trans changing w__istat.
If w__istat = 0.
Perform ZBDC_Close_Group changing w__istat.
EndIf.
EndIf.
EndIf.
77.11. SourceCode.
*EJECT
**********************************************************************
*
*
Procedure:
ZBDC_Open_Group
*
*
Purpose:
Starts a new BDC session
*
*
Entry:
Group Name to use for batch
*
*
Exit:
Status of open!
*
*
Called By:
Perform ZBDC_OPEN_GROUP using w_group
*
Changing p_status
*
Form ZBDC_OPEN_GROUP using p_group like apqi-groupid
changing p_status like sy-subrc.
*
Data: w_user like apqi-userid.
" Avoid ex check errors
*
Move 0 to p_status.
Move sy-uname to w_user.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
*
CLIENT
= SY-MANDT
*
DEST
= FILLER8
GROUP
= p_group
*
HOLDDATE
= FILLER8
KEEP
= True
USER
= w_user
EXCEPTIONS
CLIENT_INVALID
= 1
DESTINATION_INVALID = 2
GROUP_INVALID
= 3
GROUP_IS_LOCKED
= 4
HOLDDATE_INVALID
= 5
INTERNAL_ERROR
= 6
QUEUE_ERROR
= 7
RUNNING
= 8
SYSTEM_LOCK_ERROR
= 9
USER_INVALID
= 10
OTHERS
= 11.
Move sy-subrc to p_status.
EndForm.
77.12. See Also.
ZBDC_INSERT
ZBDC_CLOSE_GROUP
Page 194
78.
ZBDC_SCREEN
78.1. Location.
YBDCINC.
78.2. Purpose.
Starts a new screen in a BDC Session
78.3. Entry.
78.3.1.Program name to run.
78.3.2.Screen number to use.
78.4. Exit.
78.5. Called By.
ZBDC_FILLSCREEN
ZBDC_SCROLL
Perform ZBDC_Screen using p_program w_scrn.
78.6. Calls.
78.7. Tables.
78.8. System Variables.
78.9. Description.
Adds a new Screen to a BDC table.
78.10. Examples.
EndIf.
*
* Ok to proceed with this ?
*
If w_status = c_ok.
Zap t_bdcmsg.
Perform NewBdc.
Perform ZBDC_Screen using 'SAPLCORU'
0100.
Perform ZBDC_Field using 'CORUF-AUFNR' w_aufnr.
Perform ZBDC_Field using 'CORUF-VORNR' w_vornr.
Perform ZBDC_Field using 'BDC_OKCODE' c_enter.
Perform ZBDC_Screen using 'SAPLCORU'
0150.
If not w_endru is initial.
Perform ZBDC_Field using 'CORUF-ENDRU' True.
Else.
78.11. SourceCode.
*EJECT
**********************************************************************
*
*
Procedure:
ZBDC_Screen
*
*
Purpose:
Starts a new screen in a BDC Session
Page 195
*
*
Entry:
Program name to run.
*
Screen number to use.
*
Exit:
*
*
Called By:
Perform BDC_Screen using 'SAPSSYM0' ,0103'
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form ZBDC_Screen using p_program like bdcdata-program
p_dynpro like bdcdata-dynpro.
*
*
New BDC Session ??
*
If W__BDCOpen = False.
Zap ZBDC_Table.
Move True to w__bdcopen.
EndIf.
Clear zbdc_table.
Move p_program to zbdc_table-program.
Move p_dynpro to zbdc_table-dynpro.
Move True to zbdc_table-dynbegin.
Append zbdc_table.
EndForm.
78.12. See Also.
Page 196
79.
ZBDC_SCROLL
79.1. Location.
YBDCINC.
79.2. Purpose.
Scrolls a screen so that the relevant row of the displayed table becomes visible.
79.3. Entry.
79.3.1.Program name.
The program name that would be specified for ZBDC_Screen (See 78 above)
79.3.2.Screen number.
The screen number for the BDC Screen as would be specified for ZBDC Screen.
79.3.3.BDC Code for 'One down'.
This is the alpha code placed in the command field when the relevant button on the screen is
pressed. Common codes and methods for finding these codes are outlined in section 74.3.2.1
above.
79.3.4.Maximum number of lines displayed on the screen.
This is the maximum number of lines that are displayed on the table.
79.3.5.The position of the required record in the displayed table.
Note: The position of the required record in the table must be found by constructing the
table in the same manner that SAP uses.
79.4. Exit.
79.4.1.The offset on the current page of the required record.
79.5. Called By.
79.6. Calls.
ZBDC_FIELD
ZBDC_SCREEN
79.7. Tables.
79.8. System Variables.
79.9. Description.
This function produces the relevant BDC Table entries to scroll a table to a required position. The
function then returns the offset into the table display for the required row that was being sought.
In order for this to work, the data has to be collated in the same manner as it is in the table field.
The routine calculates the 'page' in which the required record lies by using the maximum number of
displayed lines. The remainder from that calculation is the offset into the displayed table, which is
passed back tot he calling routine.
Page 197
Note, you should always check to make certain there is not a 'Move To' function available with the
command. This is generally called '=POPO'.
79.10. Examples.
*
PERFORM ZBDC_SCREEN USING C_SAPML03T '0142'.
if w_lgpla_ix <> 0.
*
*
*
*
Direct match.
screen.
Scroll down until the relevant line is on the
PERFORM ZBDC_SCROLL USING C_SAPML03T '0142' '=P+' C_MAXLINES
w_lgpla_ix
changing w_offset.
Perform Write_Selkz using w_offset w_menge.
Else.
*
*
*
Use the bins listed in t_binindex.
79.11. SourceCode.
*EJECT
**********************************************************************
*
*
Procedure:
ZBDC_Scroll
*
*
Purpose:
Scrolls a screen so that the relevant row
*
of the displayed table becomes visible.
*
*
Entry:
Program name,
*
Screen number,
*
BDC Code for 'One down'
*
Maximum number of lines displayed on the
*
screen.
*
The position of the required record in
*
the displayed table.
*
*
Note:
The position of the required record in the
*
table must be found by constructing the
*
table in the same manner that SAP uses.
*
*
Exit:
The offset on the current page of the
*
required record
*
*
Called By:
Perform ZBDC_scroll 'SAPML04I'
*
'0223'
*
"=Down"
*
15
*
31
*
*
Calls:
ZBDC_Screen
*
ZBDC_Field
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form ZBDC_Scroll using p_prog
type Program_Name
p_screen
p_down
p_maxlines
type i
p_index
like sy-tabix
changing p_offset
type i.
*
*
Scrolling behaviour.
*
*
When a table is scrolled up or down using the scroll buttons the
*
table moves up or down one page at a time unless the number of
*
lines left in the table is less than the number of lines
Page 198
*
*
*
displayable in which case the remainder (or the start) of the table
is displayed.
Data: w__pages type i.
" No of lines to scrol
*
Compute w__pages = p_index / p_maxlines.
Compute p_offset = p_index - ( w__pages * p_maxlines ).
*
If w__pages > 0.
Subtract 1 from p_offset.
*
do.
Perform Zbdc_Field using 'BDC_OKCODE' p_down.
Perform Zbdc_Screen using p_prog p_screen.
Subtract 1 from w__pages.
If w__pages <= p_maxlines.
Exit.
EndIf.
enddo.
EndIf.
*
EndForm.
79.12. See Also.
Page 199
80.
ZBDC_SUBSCRIPT
80.1. Location.
YBDCINC.
80.2. Purpose.
Creates a subscripted entry in the BDC table.
80.3. Entry.
80.3.1.Field name as a string
80.3.2.Subscript to use
80.3.3.Value to use
80.4. Exit.
80.4.1.BDC Table updated.
80.5. Called By.
80.6. Calls.
ZBDC_FIELD
USING W_FIELD
P_VALUE
80.7. Tables.
80.8. System Variables.
80.9. Description.
Formats a subscripted variable for use in a BDC.
80.10. Examples.
*
*
*
And scroll the BDC...back to the top of the page first
Perform Zbdc_field using 'BDC_OKCODE' 'P--'.
Perform ZBDC_Screen using c_saplcomk 0120.
Perform zbdc_scroll using c_saplcomk '0120' 'P+' 8 w_fiber
changing w_offset.
Perform ZBDC_Subscript using 'RC27X-FLG_SEL' w_offset True.
Perform zbdc_field using 'BDC_OKCODE' c_batch_splt.
Add 1 to w_offset.
Write t_allocations-plen to w_char using no edit mask.
Condense w_char.
Perform ZBDC_Subscript using 'RESBD-MENGE' w_offset w_char.
Perform ZBDC_Subscript using 'RESBD-CHARG' w_offset
t_allocations-charg.
80.11. SourceCode.
*EJECT
**********************************************************************
*
*
Procedure:
ZBDC_Subscript
Page 200
*
*
Purpose:
Creates a subscripted entry in the
*
BDC table.
*
*
Entry:
Field name as a string
*
Entry:
Subscript to use
*
Entry:
Value to use
*
*
Exit:
BDC Table updated.
*
*
Called By:
Perform ZBDC_Subscript using 'RM07M-SELKZ'
*
7
*
w_selkz.
*
*
Calls:
ZBDC_Field.
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form ZBDC_Subscript using p_fname p_subscript p_value.
*
Data: w_subscript(2) type n,
w_field(30)
type c.
*
Move p_subscript to w_subscript.
Concatenate p_fname '(' w_subscript ')' into w_field.
Perform ZBDC_Field using w_field p_value.
EndForm.
80.12. See Also.
Page 201
81.
ZDO_BDC
81.1. Location.
YBDCINC.
81.2. Purpose.
Runs a specified BDC Session
81.3. Entry.
81.3.1.Transaction Code
81.3.2.Mode
‘A’
‘E’
‘N’
-
Display all steps of the transaction.
Display erroneous screens only.
Displays no screens.
81.3.3.Update Type
‘A’
‘S’
-
Asynchronous (Back ground)
Synchronous (Foreground)
81.3.4.Table - p_messages - contains batch msgs
81.4. Exit.
81.4.1.MsgId, Error and message if failed.
81.5. Called By.
Z_CALL_BDC
Perform ZDo_BDC
Tables tb_messages
using pu_trans
w__ydcset-bdcmode
w__ydcset-bdcupmode
changing
w__msgid
w__msgno
w__text.
81.6. Calls.
ZBDC_OPEN_GROUP
ZBDC_INSERT ZBDC_CLOSE_GROUP
81.7. Tables.
81.8. System Variables.
SY-SUBRC
SY-MSGID
SY-MSGNO
SY-MSGV2
SY-MSGV3
SY-MSGV4
SY-UNAME
Page 202
INT4
CHAR
NUMC
CHAR
CHAR
CHAR
CHAR
X
C
N
C
C
C
C
4
2
3
50
50
50
12
Return value after specif
Message ID
Message number
Message variable
Message variable
Message variable
Session: SAP user from SA
81.9. Description.
Using the ‘Call transaction’ command the specifed transaction is run. If there are any errors, signified
by sy-subrc not being zero, then the appropriate text message is retrieved.
If sy-subrc is zero, then the message log is scanned for any Error ('E' class) messages, or aborts. ('A'
class). If one is found then the appropriate message is extracted from the message table.
If an error occurs and the batch create flag is set then a batch is created automatically.
81.10. Examples.
*
Perform
Perform
Perform
Perform
Perform
NewBdc.
ZBDC_FillScreen
ZBDC_Field
ZBDC_FillScreen
ZBDC_Field
using
using
using
using
c_sapml03t 0101 pu_lt01.
'BDC_OKCODE' '/00'.
c_sapml03t 0102 pu_lt01.
'BDC_OKCODE' '/00'.
*
Perform Zdo_bdc tables t_bdcmsg
using c_lt01 pu_bdcmode pu_bdcupmode
changing w_msgid w_err w_text.
EndForm.
*Eject
***********************************************************************
*
*
Procedure:
LT01_FNC
81.11. SourceCode.
*EJECT
**********************************************************************
*
*
Procedure:
ZDo_BDC
*
*
Purpose:
Runs a specified BDC Session
*
*
Entry:
Transaction Code
*
Mode:
*
Update Type
*
*
Table - p_messages - contains batch msgs
*
*
Exit:
MsgId, Error and message if failed.
*
*
Called By:
Perform ZDo_BDC Using 'MM02' 'N' 'S'
*
Changing w_msgid w_err w_errt
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form ZDo_BDC Tables p_messages structure bdcmsgcoll
using p_trans like tstc-tcode
p_mode
like bdc_struc-bdcmode
p_update like bdc_struc-bdcupmode
changing p_msgid like sy-msgid
p_msgno like sy-msgno
p_text
type status_text.
*
Data: w__msgv1 like sy-msgv1,
" Message variables
w__msgv2 like sy-msgv2,
w__msgv3 like sy-msgv3,
w__msgv4 like sy-msgv4,
w__subrc like sy-subrc,
w__exmsg type status_text,
w__group like apqi-groupid,
" BDC Group name
w__istat type i.
" BDC Insert status
*
Zap p_messages.
Page 203
Clear p_msgid.
Clear p_msgno.
Clear p_text.
*
*
*
Dump the contents of the BDC table ?
If w__dumpbdc = True.
New-page print on immediately True
with-title
with-heading
Line-size 255
Line-count 64.
Loop at zbdc_table.
Write :/ zbdc_table-Program,
zbdc_table-dynpro,
zbdc_table-dynbegin.
Write :/ zbdc_table-fnam.
Write :/ zbdc_table-fval.
EndLoop.
New-page print off.
EndIf.
Call Transaction p_trans using ZBDC_Table
Mode p_mode
Update p_update
Messages into p_messages.
Move sy-subrc to w__subrc.
*
*
*
Dump the message table ?
If w__ydcset-dumpmsg = True.
New-page print on immediately True
with-title
with-heading
Line-size 255
Line-count 64.
Loop at p_messages.
Call Function 'MESSAGE_TEXT_BUILD'
Exporting Msgid = p_messages-msgid
Msgnr = p_messages-msgnr
Msgv1 = p_messages-msgv1
Msgv2 = p_messages-msgv2
Msgv3 = p_messages-msgv3
Msgv4 = p_messages-msgv4
Importing Message_Text_Output = w__exmsg.
Write :/ p_messages-tcode, p_messages-dyname,
p_messages-dynumb, p_messages-msgtyp,
p_messages-msgid, p_messages-msgnr, w__exmsg.
EndLoop.
New-Page Print Off.
EndIf.
*
*
*
Did the BDC work ?
If w__subrc <> 0.
Move sy-msgid to
Move sy-msgno to
Move sy-msgv1 to
Move sy-msgv2 to
Move sy-msgv3 to
Move sy-msgv4 to
Else.
*
*
*
p_msgid.
p_msgno.
w__msgv1.
w__msgv2.
w__msgv3.
w__msgv4.
Scan the messages for A or E class messages ?
Read Table p_messages with key msgtyp = 'E'.
If sy-subrc <> 0.
Read Table p_messages with key msgtyp = 'A'.
EndIf.
If sy-subrc = 0.
Move p_messages-msgid to p_msgid.
Move p_messages-msgnr to p_msgno.
Move p_messages-msgv1 to w__msgv1.
Page 204
Move p_messages-msgv2 to w__msgv2.
Move p_messages-msgv3 to w__msgv3.
Move p_messages-msgv4 to w__msgv4.
EndIf.
EndIf.
*
*
*
Do we need to build an error message ?
If not p_msgno is initial.
*
*
*
Get the message text.
Call Function 'MESSAGE_TEXT_BUILD'
Exporting MSGID = p_msgid
MSGNR = p_msgno
MSGV1 = w__msgv1
MSGV2 = w__msgv2
MSGV3 = w__msgv3
MSGV4 = w__msgv4
Importing MESSAGE_TEXT_OUTPUT = p_text.
*
*
*
Make a batch of this session ??
If w__bdcbatch = True.
Get Time.
Concatenate p_trans '_' sy-uname sy-uzeit+0(5) into w__group.
Perform ZBDC_Open_Group using w__group changing w__istat.
If w__istat = 0.
Perform ZBDC_Insert using p_trans changing w__istat.
If w__istat = 0.
Perform ZBDC_Close_Group changing w__istat.
EndIf.
EndIf.
EndIf.
*
*
*
Mail a user ?
If not w__ydcset-genmail is initial.
If not w__ydcset-mailprog is initial.
Perform (w__ydcset-genmail)
in program (w__ydcset-mailprog)
using p_trans p_text sy-uname if found.
EndIf.
EndIf.
EndIf.
EndForm.
81.12. See Also.
Page 205
82.
Z_CALL_BDC
82.1. Location.
YBDCINC.
82.2. Purpose.
Runs BDC with new style parameters and taking default settings from ydcset
82.3. Entry.
82.3.1.Message Table
82.3.2.Transaction to use
82.3.3.Table - p_messages - contains batch msgs
82.4. Exit.
82.4.1.Table p_messages filled with BDC Messages
82.5. Called By.
82.6. Calls.
READ_YDCSET
ZDO_BDC
82.7. Tables.
82.8. System Variables.
SY-UNAME
CHAR C
12
Session: SAP user from SA
82.9. Description.
82.10. Examples.
*
Perform NewBdc.
If not pu_lt01-Matnr is initial.
Perform ZBDC_FillScreen using c_sapml03t 0101 pu_lt01.
Perform ZBDC_Field
using 'BDC_OKCODE' c_enter.
Perform ZBDC_FillScreen using c_sapml03t 0102 pu_lt01.
Perform ZBDC_Field
using 'BDC_OKCODE' c_enter.
Perform Z_Call_bdc tables t_bdcmsg using c_lt01.
Else.
*
*
*
LT09 - create su. No Werks....
Move '' to pu_lt01-werks.
Condense pu_lt01-lenum.
Perform ZBDC_FillScreen using c_sapml03t 0173 pu_lt01.
82.11. SourceCode.
*eject
**********************************************************************
*
Page 206
*
Procedure:
Z_Call_BDC
*
*
Purpose:
Runs BDC with new style parameters and
*
taking default settings from ydcset
*
*
Entry:
Message Table
*
Transaction to use
*
*
Table - p_messages - contains batch msgs
*
*
Exit:
Table p_messages filled with BDC Messages
*
*
Called By:
Perform Z_Call_BDC
*
Tables t_messages using w_tcode
*
*
Calls:
*
*
Modification History:
*
*
Date
Reason
Version Who
*
Form z_Call_BDC Tables tb_messages structure bdcmsgcoll
using pu_trans type Transaction_Code.
*
Data: w__msgid like sy-msgid,
" BDC Status result
w__msgno like sy-msgno,
w__fname like tfdir-funcname,
w__text
like t100-text.
*
*
BDC Defaults set ??
*
If w__ydcset-funcname is initial.
Move pu_trans to w__fname.
Perform Read_YDCSET using w__fname sy-uname changing w__ydcset.
Move False to w__BDCBatch.
Move False to w__dumpbdc.
Else.
Move w__ydcset-crbatch to w__BDCBatch.
Move w__ydcset-dumpbdc to w__dumpbdc.
EndIf.
*
Perform ZDo_BDC Tables tb_messages using pu_trans
w__ydcset-bdcmode
w__ydcset-bdcupmode
changing w__msgid
w__msgno
w__text.
*
EndForm.
82.12. See Also.
Page 207
Fly UP