proc032_98

225
Reference: PROC032.DOC (Word 7.0a) Title: Common Programming Procedures Author: Richard Harper Date: November '99 Version: 5.0 SAP Version: 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. PROCEDURE FORMAT...............................................21 1.2. RUNNING THE MACRO..............................................23 2. USING THE ROUTINES.............................................24 3. DEPENDANCIES................................................... 28 4. BDC OPERATIONS.................................................29 4.1. MANDT.......................................................29 4.2. FUNCNAME....................................................29 4.3. BDCMODE.....................................................29 4.4. BDCUPMODE...................................................29 4.5. CRBATCH.....................................................29 4.6. INHIBITCHK..................................................29 4.7. DUMPBDC.....................................................30 4.8. DUMPMSG.....................................................30 4.9. GENMAIL.....................................................30 4.10............................................. MAILPROG. 30 5. 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.................................................................................................... 35 Page1

Upload: mandalprabir

Post on 02-Dec-2014

110 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: proc032_98

Reference: PROC032.DOC (Word 7.0a)Title: Common Programming Procedures Author: Richard HarperDate: November '99Version: 5.0SAP Version: 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. PROCEDURE FORMAT.........................................................................................................211.2. RUNNING THE MACRO........................................................................................................23

2. USING THE ROUTINES.......................................................................................................24

3. DEPENDANCIES................................................................................................................... 28

4. BDC OPERATIONS............................................................................................................... 29

4.1. MANDT........................................................................................................................... 294.2. FUNCNAME.................................................................................................................... 294.3. BDCMODE...................................................................................................................... 294.4. BDCUPMODE.................................................................................................................. 294.5. CRBATCH....................................................................................................................... 294.6. INHIBITCHK................................................................................................................... 294.7. DUMPBDC....................................................................................................................... 304.8. DUMPMSG...................................................................................................................... 304.9. GENMAIL........................................................................................................................ 304.10. MAILPROG...................................................................................................................... 30

5. MACROS AND FORMS........................................................................................................31

5.1. AN EXAMPLE..................................................................................................................... 31

6. DRILL DOWN REPORTS.....................................................................................................33

7. ARRAYS................................................................................................................................. 34

7.1. TABLES WITHIN TABLES....................................................................................................347.1.1. Defining An Array.....................................................................................................347.1.2. Accessing An Array...................................................................................................35

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

Page 2: proc032_98

12. INFORMATION SOURCES..............................................................................................41

13. ADDRANGE, ADDDISCRETE, ADDCONSEC - MACROS...........................................42

13.1. LOCATION......................................................................................................................... 4213.2. PURPOSE............................................................................................................................ 4213.3. ENTRY............................................................................................................................... 42

13.3.1. Item To Add........................................................................................................... 4213.3.2. Range Table to add to............................................................................................4213.3.3. Item High, Item Low.............................................................................................42

13.4. EXIT.................................................................................................................................. 4213.5. CALLED BY....................................................................................................................... 4213.6. CALLS............................................................................................................................... 4213.7. TABLES.............................................................................................................................. 4213.8. SYSTEM VARIABLES........................................................................................................... 4213.9. DESCRIPTION..................................................................................................................... 4213.10. EXAMPLES..................................................................................................................... 4213.11. SOURCE......................................................................................................................... 4313.12. SEE ALSO....................................................................................................................... 43

14. BEGIN_OF_BLOCK, END_OF_BLOCK - MACROS.....................................................44

14.1. LOCATION......................................................................................................................... 4414.2. PURPOSE............................................................................................................................ 4414.3. ENTRY............................................................................................................................... 44

14.3.1. Begin_Of_Block - Block name and Frame title......................................................4414.3.2. End_Of_Block - Block name...............................................................................44

14.4. EXIT.................................................................................................................................. 4414.5. CALLED BY....................................................................................................................... 4414.6. CALLS............................................................................................................................... 4414.7. TABLES.............................................................................................................................. 4414.8. SYSTEM VARIABLES........................................................................................................... 4414.9. DESCRIPTION..................................................................................................................... 4414.10. EXAMPLES..................................................................................................................... 4414.11. SOURCE......................................................................................................................... 4414.12. SEE ALSO....................................................................................................................... 46

15. BLANKLINE - MACRO....................................................................................................47

15.1. LOCATION......................................................................................................................... 4715.2. PURPOSE............................................................................................................................ 4715.3. ENTRY............................................................................................................................... 4715.4. EXIT.................................................................................................................................. 4715.5. CALLED BY....................................................................................................................... 4715.6. CALLS............................................................................................................................... 4715.7. TABLES.............................................................................................................................. 4715.8. SYSTEM VARIABLES........................................................................................................... 4715.9. DESCRIPTION..................................................................................................................... 4715.10. EXAMPLES..................................................................................................................... 4715.11. SOURCECODE................................................................................................................. 4715.12. SEE ALSO....................................................................................................................... 47

16. CHECKLEFT, CHECKRIGHT - MACRO.......................................................................48

16.1. LOCATION......................................................................................................................... 4816.2. PURPOSE............................................................................................................................ 4816.3. ENTRY............................................................................................................................... 48

16.3.1. Position................................................................................................................. 4816.3.2. Title Length........................................................................................................... 4816.3.3. Title....................................................................................................................... 4816.3.4. Parameter.............................................................................................................. 48

16.4. EXIT.................................................................................................................................. 4816.5. CALLED BY....................................................................................................................... 48

Page 2

Page 3: proc032_98

16.6. CALLS............................................................................................................................... 4816.7. TABLES.............................................................................................................................. 4816.8. SYSTEM VARIABLES........................................................................................................... 4816.9. DESCRIPTION..................................................................................................................... 4816.10. EXAMPLES..................................................................................................................... 4816.11. SOURCECODE................................................................................................................. 4916.12. SEE ALSO....................................................................................................................... 49

17. RADIOLEFT, RADIORIGHT - MACRO.........................................................................50

17.1. LOCATION......................................................................................................................... 5017.2. PURPOSE............................................................................................................................ 5017.3. ENTRY............................................................................................................................... 50

17.3.1. Position................................................................................................................. 5017.3.2. Title Length........................................................................................................... 5017.3.3. Title....................................................................................................................... 5017.3.4. Parameter.............................................................................................................. 5017.3.5. Group.................................................................................................................... 50

17.4. EXIT.................................................................................................................................. 5017.5. CALLED BY....................................................................................................................... 5017.6. CALLS............................................................................................................................... 5017.7. TABLES.............................................................................................................................. 5017.8. SYSTEM VARIABLES........................................................................................................... 5017.9. DESCRIPTION..................................................................................................................... 5017.10. EXAMPLES..................................................................................................................... 5017.11. SOURCECODE................................................................................................................. 5117.12. SEE ALSO....................................................................................................................... 51

18. COPYBOOK - MACRO.....................................................................................................52

18.1. LOCATION......................................................................................................................... 5218.2. PURPOSE............................................................................................................................ 5218.3. ENTRY............................................................................................................................... 52

18.3.1. Table name to use..................................................................................................5218.4. EXIT.................................................................................................................................. 5218.5. CALLED BY....................................................................................................................... 5218.6. CALLS............................................................................................................................... 5218.7. TABLES.............................................................................................................................. 5218.8. SYSTEM VARIABLES........................................................................................................... 5218.9. DESCRIPTION..................................................................................................................... 5218.10. EXAMPLES..................................................................................................................... 5218.11. SOURCECODE................................................................................................................. 5218.12. SEE ALSO....................................................................................................................... 53

19. COPY_STRUCTURE - MACRO.......................................................................................54

19.1. LOCATION......................................................................................................................... 5419.2. PURPOSE............................................................................................................................ 5419.3. ENTRY............................................................................................................................... 54

19.3.1. Structure Name to extract from the data dictionary................................................5419.3.2. Internal table name to copy strcuture to.................................................................54

19.4. EXIT.................................................................................................................................. 5419.5. CALLED BY....................................................................................................................... 5419.6. CALLS............................................................................................................................... 5419.7. TABLES.............................................................................................................................. 5419.8. SYSTEM VARIABLES........................................................................................................... 5419.9. DESCRIPTION..................................................................................................................... 5419.10. EXAMPLES..................................................................................................................... 5419.11. SOURCECODE................................................................................................................. 5419.12. SEE ALSO....................................................................................................................... 55

20. FORMAT_SELECTS - MACRO.......................................................................................56

20.1. LOCATION......................................................................................................................... 56

Page 3

Page 4: proc032_98

20.2. PURPOSE............................................................................................................................ 5620.3. ENTRY............................................................................................................................... 56

20.3.1. Select Option Tables to use....................................................................................5620.4. EXIT.................................................................................................................................. 5620.5. CALLED BY....................................................................................................................... 5620.6. CALLS............................................................................................................................... 5620.7. TABLES.............................................................................................................................. 5620.8. SYSTEM VARIABLES........................................................................................................... 5620.9. DESCRIPTION..................................................................................................................... 5620.10. EXAMPLES..................................................................................................................... 5620.11. SOURCECODE................................................................................................................. 5620.12. SEE ALSO....................................................................................................................... 57

21. INIT_FUNC - MACRO.......................................................................................................58

21.1. LOCATION......................................................................................................................... 5821.2. PURPOSE............................................................................................................................ 5821.3. ENTRY............................................................................................................................... 5821.4. EXIT.................................................................................................................................. 5821.5. CALLED BY....................................................................................................................... 5821.6. CALLS............................................................................................................................... 58

21.6.1. Functions:............................................................................................................. 5821.6.2. Forms:................................................................................................................... 58

21.7. TABLES.............................................................................................................................. 5821.8. SYSTEM VARIABLES........................................................................................................... 5821.9. DESCRIPTION..................................................................................................................... 5821.10. EXAMPLES..................................................................................................................... 5921.11. SOURCECODE................................................................................................................. 5921.12. SEE ALSO....................................................................................................................... 61

22. PSUB - MACRO................................................................................................................. 62

22.1. LOCATION......................................................................................................................... 6222.2. PURPOSE............................................................................................................................ 6222.3. ENTRY............................................................................................................................... 62

22.3.1. Select Option Tables to use....................................................................................6222.3.2. Description of data held in select options table......................................................62

22.4. EXIT.................................................................................................................................. 6222.5. CALLED BY....................................................................................................................... 6222.6. CALLS............................................................................................................................... 6222.7. TABLES.............................................................................................................................. 6222.8. SYSTEM VARIABLES........................................................................................................... 6222.9. DESCRIPTION..................................................................................................................... 6222.10. EXAMPLES..................................................................................................................... 6222.11. SOURCECODE................................................................................................................. 6322.12. SEE ALSO....................................................................................................................... 64

23. WRITETABLE - MACRO.................................................................................................65

23.1. LOCATION......................................................................................................................... 6523.2. PURPOSE............................................................................................................................ 6523.3. ENTRY............................................................................................................................... 65

23.3.1. Table to use........................................................................................................... 6523.3.2. Field name of column to put text in........................................................................65

23.4. EXIT.................................................................................................................................. 6523.5. CALLED BY....................................................................................................................... 6523.6. CALLS............................................................................................................................... 6523.7. TABLES.............................................................................................................................. 6523.8. SYSTEM VARIABLES........................................................................................................... 6523.9. DESCRIPTION..................................................................................................................... 6523.10. EXAMPLES..................................................................................................................... 6523.11. SOURCECODE................................................................................................................. 6523.12. SEE ALSO....................................................................................................................... 66

Page 4

Page 5: proc032_98

24. ZAP - MACRO................................................................................................................... 67

24.1. LOCATION......................................................................................................................... 6724.2. PURPOSE............................................................................................................................ 6724.3. ENTRY............................................................................................................................... 67

24.3.1. Table to clear........................................................................................................ 6724.4. EXIT.................................................................................................................................. 6724.5. CALLED BY....................................................................................................................... 6724.6. CALLS............................................................................................................................... 6724.7. TABLES.............................................................................................................................. 6724.8. SYSTEM VARIABLES........................................................................................................... 6724.9. DESCRIPTION..................................................................................................................... 6724.10. EXAMPLES..................................................................................................................... 6724.11. SOURCECODE................................................................................................................. 6724.12. SEE ALSO....................................................................................................................... 68

25. ALLHDRS........................................................................................................................... 69

25.1. LOCATION......................................................................................................................... 6925.2. PURPOSE............................................................................................................................ 6925.3. ENTRY............................................................................................................................... 6925.4. EXIT.................................................................................................................................. 6925.5. CALLED BY....................................................................................................................... 6925.6. CALLS............................................................................................................................... 6925.7. TABLES.............................................................................................................................. 6925.8. SYSTEM VARIABLES........................................................................................................... 6925.9. DESCRIPTION..................................................................................................................... 6925.10. EXAMPLES..................................................................................................................... 6925.11. SOURCECODE................................................................................................................. 6925.12. SEE ALSO....................................................................................................................... 70

26. ASCCHAR.......................................................................................................................... 71

26.1. LOCATION......................................................................................................................... 7126.2. PURPOSE............................................................................................................................ 7126.3. ENTRY............................................................................................................................... 71

26.3.1. Character to return Ascii code for.........................................................................7126.4. EXIT.................................................................................................................................. 7126.5. CALLED BY....................................................................................................................... 7126.6. CALLS............................................................................................................................... 7126.7. TABLES.............................................................................................................................. 7126.8. SYSTEM VARIABLES........................................................................................................... 7126.9. DESCRIPTION..................................................................................................................... 7126.10. EXAMPLES..................................................................................................................... 7126.11. SOURCECODE................................................................................................................. 7226.12. SEE ALSO....................................................................................................................... 72

27. BUILDREPORT................................................................................................................. 73

27.1. LOCATION......................................................................................................................... 7327.2. PURPOSE............................................................................................................................ 7327.3. ENTRY............................................................................................................................... 73

27.3.1. Data-field name.....................................................................................................7327.3.2. Data field title.......................................................................................................7327.3.3. Data field length....................................................................................................7327.3.4. FormatType. 'Unit' or 'Currency' or Format mask.................................................7327.3.5. Format field...........................................................................................................78

27.4. EXIT.................................................................................................................................. 7827.5. CALLED BY....................................................................................................................... 7827.6. CALLS............................................................................................................................... 7927.7. TABLES.............................................................................................................................. 7927.8. SYSTEM VARIABLES........................................................................................................... 7927.9. DESCRIPTION..................................................................................................................... 79

Page 5

Page 6: proc032_98

27.10. EXAMPLES..................................................................................................................... 7927.11. SOURCECODE................................................................................................................. 7927.12. SEE ALSO....................................................................................................................... 82

28. CENTREREPORT............................................................................................................. 83

28.1. LOCATION......................................................................................................................... 8328.2. PURPOSE............................................................................................................................ 8328.3. ENTRY............................................................................................................................... 83

28.3.1. True or False......................................................................................................... 8328.4. EXIT.................................................................................................................................. 8328.5. CALLED BY....................................................................................................................... 8328.6. CALLS............................................................................................................................... 8328.7. TABLES.............................................................................................................................. 8328.8. SYSTEM VARIABLES........................................................................................................... 8328.9. DESCRIPTION..................................................................................................................... 8328.10. EXAMPLES..................................................................................................................... 8328.11. SOURCECODE................................................................................................................. 8328.12. SEE ALSO....................................................................................................................... 84

29. CHECKBOX....................................................................................................................... 85

29.1. LOCATION......................................................................................................................... 8529.2. PURPOSE............................................................................................................................ 8529.3. ENTRY............................................................................................................................... 85

29.3.1. Data-field table......................................................................................................8529.3.2. Data field title.......................................................................................................8529.3.3. Data field length....................................................................................................85

29.4. EXIT.................................................................................................................................. 8529.5. CALLED BY....................................................................................................................... 8529.6. CALLS............................................................................................................................... 8529.7. TABLES.............................................................................................................................. 8529.8. SYSTEM VARIABLES........................................................................................................... 8529.9. DESCRIPTION..................................................................................................................... 8629.10. EXAMPLES..................................................................................................................... 8629.11. SOURCECODE................................................................................................................. 8629.12. SEE ALSO....................................................................................................................... 87

30. CHECKBREAKS................................................................................................................ 88

30.1. LOCATION......................................................................................................................... 8830.2. PURPOSE............................................................................................................................ 8830.3. ENTRY............................................................................................................................... 8830.4. EXIT.................................................................................................................................. 8830.5. CALLED BY....................................................................................................................... 8830.6. CALLS............................................................................................................................... 8830.7. TABLES.............................................................................................................................. 8830.8. SYSTEM VARIABLES........................................................................................................... 8830.9. DESCRIPTION..................................................................................................................... 8830.10. EXAMPLES..................................................................................................................... 8830.11. SOURCECODE................................................................................................................. 8930.12. SEE ALSO....................................................................................................................... 90

31. CHECK_DOMAIN_VALUES............................................................................................91

31.1. LOCATION......................................................................................................................... 9131.2. PURPOSE............................................................................................................................ 9131.3. ENTRY............................................................................................................................... 91

31.3.1. Domain Name To Check........................................................................................9131.3.2. Value To Check.....................................................................................................91

31.4. EXIT.................................................................................................................................. 9131.5. CALLED BY....................................................................................................................... 9131.6. CALLS............................................................................................................................... 9131.7. TABLES.............................................................................................................................. 91

Page 6

Page 7: proc032_98

31.8. SYSTEM VARIABLES........................................................................................................... 9131.9. DESCRIPTION..................................................................................................................... 9131.10. EXAMPLES..................................................................................................................... 9131.11. SOURCECODE................................................................................................................. 9131.12. SEE ALSO....................................................................................................................... 92

32. COLUMN_COLOUR.........................................................................................................93

32.1. LOCATION......................................................................................................................... 9332.2. PURPOSE............................................................................................................................ 9332.3. ENTRY............................................................................................................................... 93

32.3.1. Column width........................................................................................................ 9332.3.2. Colour to set..........................................................................................................9332.3.3. Value to write........................................................................................................9332.3.4. Actual colour code to use.......................................................................................93

32.4. EXIT.................................................................................................................................. 9332.5. CALLED BY....................................................................................................................... 9332.6. CALLS............................................................................................................................... 9332.7. TABLES.............................................................................................................................. 9332.8. SYSTEM VARIABLES........................................................................................................... 9332.9. DESCRIPTION..................................................................................................................... 9332.10. EXAMPLES..................................................................................................................... 9332.11. SOURCECODE................................................................................................................. 9432.12. SEE ALSO....................................................................................................................... 94

33. DUMP_TABLE................................................................................................................... 95

33.1. LOCATION......................................................................................................................... 9533.2. PURPOSE............................................................................................................................ 9533.3. ENTRY............................................................................................................................... 95

33.3.1. None...................................................................................................................... 9533.3.2. Tables: Unstructured table for dump..............................................................95

33.4. EXIT.................................................................................................................................. 9533.4.1. None...................................................................................................................... 95

33.5. CALLED BY....................................................................................................................... 9533.6. CALLS............................................................................................................................... 9533.7. TABLES.............................................................................................................................. 9533.8. SYSTEM VARIABLES........................................................................................................... 9533.9. DESCRIPTION..................................................................................................................... 9533.10. EXAMPLES..................................................................................................................... 9533.11. SOURCECODE................................................................................................................. 9533.12. SEE ALSO....................................................................................................................... 9633.13. LOCATION...................................................................................................................... 9733.14. PURPOSE........................................................................................................................ 9733.15. ENTRY........................................................................................................................... 97

33.15.1. Direction to move the first column of the report.....................................................9733.16. EXIT.............................................................................................................................. 9733.17. CALLED BY.................................................................................................................... 9733.18. CALLS............................................................................................................................ 9733.19. TABLES.......................................................................................................................... 9733.20. SYSTEM VARIABLES.......................................................................................................9733.21. DESCRIPTION.................................................................................................................. 9733.22. EXAMPLES..................................................................................................................... 9733.23. SOURCECODE................................................................................................................. 9833.24. SEE ALSO....................................................................................................................... 98

34. FORMATKEY.................................................................................................................... 99

34.1. LOCATION......................................................................................................................... 9934.2. PURPOSE............................................................................................................................ 9934.3. ENTRY............................................................................................................................... 99

34.3.1. Value to format......................................................................................................9934.4. EXIT.................................................................................................................................. 99

Page 7

Page 8: proc032_98

34.4.1. Formatted value.....................................................................................................9934.5. CALLED BY....................................................................................................................... 9934.6. CALLS............................................................................................................................... 9934.7. TABLES.............................................................................................................................. 9934.8. SYSTEM VARIABLES........................................................................................................... 9934.9. DESCRIPTION..................................................................................................................... 9934.10. EXAMPLES..................................................................................................................... 9934.11. SOURCECODE............................................................................................................... 10034.12. SEE ALSO..................................................................................................................... 100

35. FORMATREPORT.......................................................................................................... 101

35.1. LOCATION........................................................................................................................ 10135.2. PURPOSE.......................................................................................................................... 10135.3. ENTRY............................................................................................................................. 10135.4. EXIT................................................................................................................................ 10135.5. CALLED BY..................................................................................................................... 10135.6. CALLS............................................................................................................................. 10135.7. TABLES............................................................................................................................ 10135.8. SYSTEM VARIABLES......................................................................................................... 10135.9. DESCRIPTION.................................................................................................................... 10135.10. EXAMPLES................................................................................................................... 10135.11. SOURCECODE............................................................................................................... 10235.12. SEE ALSO..................................................................................................................... 103

36. GETMASK........................................................................................................................ 104

36.1. LOCATION........................................................................................................................ 10436.2. PURPOSE.......................................................................................................................... 10436.3. ENTRY............................................................................................................................. 104

36.3.1. Variable or literal mask.......................................................................................10436.4. EXIT................................................................................................................................ 104

36.4.1. Actual mask to use...............................................................................................10436.5. CALLED BY..................................................................................................................... 10436.6. CALLS............................................................................................................................. 10436.7. TABLES............................................................................................................................ 10436.8. SYSTEM VARIABLES......................................................................................................... 10436.9. DESCRIPTION.................................................................................................................... 10436.10. EXAMPLES................................................................................................................... 10436.11. SOURCECODE............................................................................................................... 10536.12. SEE ALSO..................................................................................................................... 105

37. GET_LOCAL_HOST.......................................................................................................106

37.1. LOCATION........................................................................................................................ 10637.2. PURPOSE.......................................................................................................................... 10637.3. ENTRY............................................................................................................................. 10637.4. EXIT................................................................................................................................ 106

37.4.1. Host Name........................................................................................................... 10637.4.2. Server Name........................................................................................................106

37.5. CALLED BY..................................................................................................................... 10637.6. CALLS............................................................................................................................. 10637.7. TABLES............................................................................................................................ 10637.8. SYSTEM VARIABLES......................................................................................................... 10637.9. DESCRIPTION.................................................................................................................... 10637.10. EXAMPLES................................................................................................................... 10637.11. SOURCECODE............................................................................................................... 10637.12. SEE ALSO..................................................................................................................... 107

38. GIVELINE........................................................................................................................ 108

38.1. LOCATION........................................................................................................................ 10838.2. PURPOSE.......................................................................................................................... 10838.3. ENTRY............................................................................................................................. 108

Page 8

Page 9: proc032_98

38.3.1. Line Number of required line in text.....................................................................10838.3.2. Width of column...................................................................................................10838.3.3. Text to split..........................................................................................................108

38.4. EXIT................................................................................................................................ 10838.4.1. Line N.................................................................................................................. 108

38.5. CALLED BY..................................................................................................................... 10838.6. CALLS............................................................................................................................. 10838.7. TABLES............................................................................................................................ 10838.8. SYSTEM VARIABLES......................................................................................................... 10838.9. DESCRIPTION.................................................................................................................... 10838.10. EXAMPLES................................................................................................................... 10838.11. SOURCECODE............................................................................................................... 10938.12. SEE ALSO..................................................................................................................... 110

39. ICON, SYMBOL OR GRAPHIC....................................................................................111

39.1. LOCATION........................................................................................................................ 11139.2. PURPOSE.......................................................................................................................... 11139.3. ENTRY............................................................................................................................. 111

39.3.1. Icon: Icon Name to print....................................................................................11139.3.2. Symbol: Symbol Name to print...........................................................................11139.3.3. Graphic: Icon/symbol name, name type.............................................................111

39.4. EXIT................................................................................................................................ 11139.4.1. None.................................................................................................................... 111

39.5. CALLED BY..................................................................................................................... 11139.6. CALLS............................................................................................................................. 11139.7. TABLES............................................................................................................................ 11139.8. SYSTEM VARIABLES......................................................................................................... 11139.9. DESCRIPTION.................................................................................................................... 11139.10. EXAMPLES................................................................................................................... 11239.11. SOURCECODE............................................................................................................... 11239.12. SEE ALSO..................................................................................................................... 113

40. GROUPHEADER............................................................................................................. 114

40.1. LOCATION........................................................................................................................ 11440.2. PURPOSE.......................................................................................................................... 11440.3. ENTRY............................................................................................................................. 114

40.3.1. Group Header Title..............................................................................................11440.3.2. Group Header Value............................................................................................114

40.4. EXIT................................................................................................................................ 11440.5. CALLED BY..................................................................................................................... 11440.6. CALLS............................................................................................................................. 11440.7. TABLES............................................................................................................................ 11440.8. SYSTEM VARIABLES......................................................................................................... 11440.9. DESCRIPTION.................................................................................................................... 11440.10. EXAMPLES................................................................................................................... 11540.11. SOURCECODE............................................................................................................... 11540.12. SEE ALSO..................................................................................................................... 116

41. INITBREAK...................................................................................................................... 117

41.1. LOCATION........................................................................................................................ 11741.2. PURPOSE.......................................................................................................................... 11741.3. ENTRY............................................................................................................................. 117

41.3.1. Field to break on.................................................................................................11741.3.2. Title of field......................................................................................................... 117

41.4. EXIT................................................................................................................................ 11741.5. CALLED BY..................................................................................................................... 11741.6. CALLS............................................................................................................................. 11741.7. TABLES............................................................................................................................ 11741.8. SYSTEM VARIABLES......................................................................................................... 11741.9. DESCRIPTION.................................................................................................................... 117

Page 9

Page 10: proc032_98

41.10. EXAMPLES................................................................................................................... 11741.11. SOURCECODE............................................................................................................... 11741.12. SEE ALSO..................................................................................................................... 118

42. INIT_GLOBAL................................................................................................................. 119

42.1. LOCATION........................................................................................................................ 11942.2. PURPOSE.......................................................................................................................... 11942.3. ENTRY............................................................................................................................. 11942.4. EXIT................................................................................................................................ 11942.5. CALLED BY..................................................................................................................... 11942.6. CALLS............................................................................................................................. 11942.7. TABLES............................................................................................................................ 11942.8. SYSTEM VARIABLES......................................................................................................... 11942.9. DESCRIPTION.................................................................................................................... 11942.10. EXAMPLES................................................................................................................... 11942.11. SOURCECODE............................................................................................................... 12042.12. SEE ALSO..................................................................................................................... 121

43. IS_SERVICE_ACTIVE....................................................................................................122

43.1. LOCATION........................................................................................................................ 12243.2. PURPOSE.......................................................................................................................... 12243.3. ENTRY............................................................................................................................. 122

43.3.1. Service Name to Check........................................................................................12243.4. EXIT................................................................................................................................ 122

43.4.1. True - Service Active...........................................................................................12243.4.2. False - Service not available................................................................................122

43.5. CALLED BY..................................................................................................................... 12243.6. CALLS............................................................................................................................. 12243.7. TABLES............................................................................................................................ 12243.8. SYSTEM VARIABLES......................................................................................................... 12243.9. DESCRIPTION.................................................................................................................... 12243.10. EXAMPLES................................................................................................................... 12243.11. SOURCECODE............................................................................................................... 12243.12. SEE ALSO..................................................................................................................... 124

44. NEWBDC.......................................................................................................................... 125

44.1. LOCATION........................................................................................................................ 12544.2. PURPOSE.......................................................................................................................... 12544.3. ENTRY............................................................................................................................. 125

44.3.1. None.................................................................................................................... 12544.4. EXIT................................................................................................................................ 12544.5. CALLED BY..................................................................................................................... 12544.6. CALLS............................................................................................................................. 12544.7. TABLES............................................................................................................................ 12544.8. SYSTEM VARIABLES......................................................................................................... 12544.9. DESCRIPTION.................................................................................................................... 12544.10. EXAMPLES................................................................................................................... 12544.11. SOURCECODE............................................................................................................... 12544.12. SEE ALSO..................................................................................................................... 126

45. PRINTTITLES.................................................................................................................. 127

45.1. LOCATION........................................................................................................................ 12745.2. PURPOSE.......................................................................................................................... 12745.3. ENTRY............................................................................................................................. 12745.4. EXIT................................................................................................................................ 12745.5. CALLED BY..................................................................................................................... 12745.6. CALLS............................................................................................................................. 12745.7. TABLES............................................................................................................................ 12745.8. SYSTEM VARIABLES......................................................................................................... 12745.9. DESCRIPTION.................................................................................................................... 127

Page 10

Page 11: proc032_98

45.10. EXAMPLES................................................................................................................... 12745.11. SOURCECODE............................................................................................................... 12845.12. SEE ALSO..................................................................................................................... 129

46. PRINTTOTALS................................................................................................................ 130

46.1. LOCATION........................................................................................................................ 13046.2. PURPOSE.......................................................................................................................... 13046.3. ENTRY............................................................................................................................. 130

46.3.1. Data tables to print totals for...............................................................................13046.3.2. Current total level................................................................................................130

46.4. EXIT................................................................................................................................ 13046.5. CALLED BY..................................................................................................................... 13046.6. CALLS............................................................................................................................. 13046.7. TABLES............................................................................................................................ 13046.8. SYSTEM VARIABLES......................................................................................................... 13046.9. DESCRIPTION.................................................................................................................... 13046.10. EXAMPLES................................................................................................................... 13046.11. SOURCECODE............................................................................................................... 13146.12. SEE ALSO..................................................................................................................... 132

47. PRG_DOC_HELP............................................................................................................. 133

47.1. LOCATION........................................................................................................................ 13347.2. PURPOSE.......................................................................................................................... 13347.3. ENTRY............................................................................................................................. 13347.4. EXIT................................................................................................................................ 13347.5. CALLED BY..................................................................................................................... 13347.6. CALLS............................................................................................................................. 13347.7. TABLES............................................................................................................................ 13347.8. SYSTEM VARIABLES......................................................................................................... 13347.9. DESCRIPTION.................................................................................................................... 13347.10. EXAMPLES................................................................................................................... 13347.11. SOURCECODE............................................................................................................... 13347.12. SEE ALSO..................................................................................................................... 134

48. READ_SCREEN_VALUES..............................................................................................135

48.1. LOCATION........................................................................................................................ 13548.2. PURPOSE.......................................................................................................................... 13548.3. ENTRY............................................................................................................................. 13548.4. EXIT................................................................................................................................ 13548.5. CALLED BY..................................................................................................................... 13548.6. CALLS............................................................................................................................. 13548.7. TABLES............................................................................................................................ 13548.8. SYSTEM VARIABLES......................................................................................................... 13548.9. DESCRIPTION.................................................................................................................... 13548.10. EXAMPLES................................................................................................................... 13548.11. SOURCECODE............................................................................................................... 13548.12. SEE ALSO..................................................................................................................... 136

49. READ_YDCSET............................................................................................................... 137

49.1. LOCATION........................................................................................................................ 13749.2. PURPOSE.......................................................................................................................... 13749.3. ENTRY............................................................................................................................. 137

49.3.1. Function Name....................................................................................................13749.3.2. User Name...........................................................................................................137

49.4. EXIT................................................................................................................................ 13749.4.1. YDCSET structure populated...............................................................................137

49.5. CALLED BY..................................................................................................................... 13749.6. CALLS............................................................................................................................. 13749.7. TABLES............................................................................................................................ 13749.8. SYSTEM VARIABLES......................................................................................................... 137

Page 11

Page 12: proc032_98

49.9. DESCRIPTION.................................................................................................................... 13749.10. EXAMPLES................................................................................................................... 13749.11. SOURCECODE............................................................................................................... 13849.12. SEE ALSO..................................................................................................................... 139

50. REPHEADER................................................................................................................... 140

50.1. LOCATION........................................................................................................................ 14050.2. PURPOSE.......................................................................................................................... 14050.3. ENTRY............................................................................................................................. 140

50.3.1. Company Code....................................................................................................14050.3.2. Report Title..........................................................................................................140

50.4. EXIT................................................................................................................................ 14050.4.1. Report header produced for current report...........................................................140

50.5. CALLED BY..................................................................................................................... 14050.6. CALLS............................................................................................................................. 14050.7. TABLES............................................................................................................................ 14050.8. SYSTEM VARIABLES......................................................................................................... 14050.9. DESCRIPTION.................................................................................................................... 14050.10. EXAMPLES................................................................................................................... 14050.11. SOURCECODE............................................................................................................... 14150.12. SEE ALSO..................................................................................................................... 142

51. RUNTOTALS.................................................................................................................... 143

51.1. LOCATION........................................................................................................................ 14351.2. PURPOSE.......................................................................................................................... 14351.3. ENTRY............................................................................................................................. 14351.4. EXIT................................................................................................................................ 14351.5. CALLED BY..................................................................................................................... 14351.6. CALLS............................................................................................................................. 14351.7. TABLES............................................................................................................................ 14351.8. SYSTEM VARIABLES......................................................................................................... 14351.9. DESCRIPTION.................................................................................................................... 14351.10. EXAMPLES................................................................................................................... 14351.11. SOURCECODE............................................................................................................... 14351.12. SEE ALSO..................................................................................................................... 144

52. SAVEREPORT................................................................................................................. 145

52.1. LOCATION........................................................................................................................ 14552.2. PURPOSE.......................................................................................................................... 14552.3. ENTRY............................................................................................................................. 145

52.3.1. Report Name........................................................................................................14552.4. EXIT................................................................................................................................ 14552.5. CALLED BY..................................................................................................................... 14552.6. CALLS............................................................................................................................. 14552.7. TABLES............................................................................................................................ 14552.8. SYSTEM VARIABLES......................................................................................................... 14552.9. DESCRIPTION.................................................................................................................... 14552.10. EXAMPLES................................................................................................................... 14552.11. SOURCECODE............................................................................................................... 14652.12. SEE ALSO..................................................................................................................... 146

53. SETCOLOUR................................................................................................................... 147

53.1. LOCATION........................................................................................................................ 14753.2. PURPOSE.......................................................................................................................... 14753.3. ENTRY............................................................................................................................. 147

53.3.1. Colour to set........................................................................................................14753.4. EXIT................................................................................................................................ 14753.5. CALLED BY..................................................................................................................... 14753.6. CALLS............................................................................................................................. 14753.7. TABLES............................................................................................................................ 147

Page 12

Page 13: proc032_98

53.8. SYSTEM VARIABLES......................................................................................................... 14753.9. DESCRIPTION.................................................................................................................... 14753.10. EXAMPLES................................................................................................................... 14753.11. SOURCECODE............................................................................................................... 14753.12. SEE ALSO..................................................................................................................... 148

54. SHOW_PROGRESS......................................................................................................... 149

54.1. LOCATION........................................................................................................................ 14954.2. PURPOSE.......................................................................................................................... 14954.3. ENTRY............................................................................................................................. 149

54.3.1. Message to display...............................................................................................14954.4. EXIT................................................................................................................................ 14954.5. CALLED BY..................................................................................................................... 14954.6. CALLS............................................................................................................................. 14954.7. TABLES............................................................................................................................ 14954.8. SYSTEM VARIABLES......................................................................................................... 14954.9. DESCRIPTION.................................................................................................................... 14954.10. EXAMPLES................................................................................................................... 14954.11. SOURCECODE............................................................................................................... 14954.12. SEE ALSO..................................................................................................................... 150

55. SORTREP......................................................................................................................... 151

55.1. LOCATION........................................................................................................................ 15155.2. PURPOSE.......................................................................................................................... 15155.3. ENTRY............................................................................................................................. 151

55.3.1. Table to sort......................................................................................................... 15155.4. EXIT................................................................................................................................ 151

55.4.1. Table Sorted........................................................................................................15155.4.2. Report column table sorted on.............................................................................15155.4.3. Sort direction 'A' or 'D'........................................................................................151

55.5. CALLED BY..................................................................................................................... 15155.6. CALLS............................................................................................................................. 15155.7. TABLES............................................................................................................................ 15155.8. SYSTEM VARIABLES......................................................................................................... 15155.9. DESCRIPTION.................................................................................................................... 15155.10. EXAMPLES................................................................................................................... 15155.11. SOURCECODE............................................................................................................... 15255.12. SEE ALSO..................................................................................................................... 153

56. STRIPSTRING.................................................................................................................. 154

56.1. LOCATION........................................................................................................................ 15456.2. PURPOSE.......................................................................................................................... 15456.3. ENTRY............................................................................................................................. 154

56.3.1. String to remove characters from.........................................................................15456.3.2. String of characters to remove.............................................................................154

56.4. EXIT................................................................................................................................ 15456.4.1. Entry string with strip chars removed...................................................................154

56.5. CALLED BY..................................................................................................................... 15456.6. CALLS............................................................................................................................. 15456.7. TABLES............................................................................................................................ 15456.8. SYSTEM VARIABLES......................................................................................................... 15456.9. DESCRIPTION.................................................................................................................... 15456.10. EXAMPLES................................................................................................................... 15456.11. SOURCECODE............................................................................................................... 15456.12. SEE ALSO..................................................................................................................... 155

57. SUBTITLES...................................................................................................................... 156

57.1. LOCATION........................................................................................................................ 15657.2. PURPOSE.......................................................................................................................... 15657.3. ENTRY............................................................................................................................. 156

Page 13

Page 14: proc032_98

57.4. EXIT................................................................................................................................ 15657.5. CALLED BY..................................................................................................................... 15657.6. CALLS............................................................................................................................. 15657.7. TABLES............................................................................................................................ 15657.8. SYSTEM VARIABLES......................................................................................................... 15657.9. DESCRIPTION.................................................................................................................... 15657.10. EXAMPLES................................................................................................................... 15657.11. SOURCECODE............................................................................................................... 15657.12. SEE ALSO..................................................................................................................... 158

58. TABLELINE..................................................................................................................... 159

58.1. LOCATION........................................................................................................................ 15958.2. PURPOSE.......................................................................................................................... 15958.3. ENTRY............................................................................................................................. 15958.4. EXIT................................................................................................................................ 159

58.4.1. Global flag w__line printed set to true.................................................................15958.5. CALLED BY..................................................................................................................... 15958.6. CALLS............................................................................................................................. 15958.7. TABLES............................................................................................................................ 15958.8. SYSTEM VARIABLES......................................................................................................... 15958.9. DESCRIPTION.................................................................................................................... 15958.10. EXAMPLES................................................................................................................... 15958.11. SOURCECODE............................................................................................................... 16058.12. SEE ALSO..................................................................................................................... 160

59. UNDERLINE..................................................................................................................... 161

59.1. LOCATION........................................................................................................................ 16159.2. PURPOSE.......................................................................................................................... 16159.3. ENTRY............................................................................................................................. 161

59.3.1. Start position.......................................................................................................16159.3.2. Width................................................................................................................... 161

59.4. EXIT................................................................................................................................ 16159.4.1. Global flag w__line printed set to true.................................................................161

59.5. CALLED BY..................................................................................................................... 16159.6. CALLS............................................................................................................................. 16159.7. TABLES............................................................................................................................ 16159.8. SYSTEM VARIABLES......................................................................................................... 16159.9. DESCRIPTION.................................................................................................................... 16159.10. EXAMPLES................................................................................................................... 16159.11. SOURCECODE............................................................................................................... 16259.12. SEE ALSO..................................................................................................................... 162

60. USEREPORT.................................................................................................................... 163

60.1. LOCATION........................................................................................................................ 16360.2. PURPOSE.......................................................................................................................... 16360.3. ENTRY............................................................................................................................. 163

60.3.1. Report Name........................................................................................................16360.4. EXIT................................................................................................................................ 16360.5. CALLED BY..................................................................................................................... 16360.6. CALLS............................................................................................................................. 16360.7. TABLES............................................................................................................................ 16360.8. SYSTEM VARIABLES......................................................................................................... 16360.9. DESCRIPTION.................................................................................................................... 16360.10. EXAMPLES................................................................................................................... 16360.11. SOURCECODE............................................................................................................... 16360.12. SEE ALSO..................................................................................................................... 164

61. WLINE.............................................................................................................................. 165

61.1. LOCATION........................................................................................................................ 16561.2. PURPOSE.......................................................................................................................... 165

Page 14

Page 15: proc032_98

61.3. ENTRY............................................................................................................................. 16561.3.1. Dataline to print..................................................................................................16561.3.2. Colour of line.......................................................................................................165

61.4. EXIT................................................................................................................................ 16661.5. CALLED BY..................................................................................................................... 16661.6. CALLS............................................................................................................................. 16661.7. TABLES............................................................................................................................ 16661.8. SYSTEM VARIABLES......................................................................................................... 16661.9. DESCRIPTION.................................................................................................................... 16661.10. EXAMPLES................................................................................................................... 16661.11. SOURCECODE............................................................................................................... 16661.12. SEE ALSO..................................................................................................................... 167

62. WRITECENTRE.............................................................................................................. 168

62.1. LOCATION........................................................................................................................ 16862.2. PURPOSE.......................................................................................................................... 16862.3. ENTRY............................................................................................................................. 168

62.3.1. Text to centre.......................................................................................................16862.4. EXIT................................................................................................................................ 16862.5. CALLED BY..................................................................................................................... 16862.6. CALLS............................................................................................................................. 16862.7. TABLES............................................................................................................................ 16862.8. SYSTEM VARIABLES......................................................................................................... 16862.9. DESCRIPTION.................................................................................................................... 16862.10. EXAMPLES................................................................................................................... 16862.11. SOURCECODE............................................................................................................... 16862.12. SEE ALSO..................................................................................................................... 169

63. WRITECOL...................................................................................................................... 170

63.1. LOCATION........................................................................................................................ 17063.2. PURPOSE.......................................................................................................................... 17063.3. ENTRY............................................................................................................................. 170

63.3.1. Data line and column to print..............................................................................17063.3.2. Column to use......................................................................................................170

63.4. EXIT................................................................................................................................ 17063.5. CALLED BY..................................................................................................................... 17063.6. CALLS............................................................................................................................. 17063.7. TABLES............................................................................................................................ 17063.8. SYSTEM VARIABLES......................................................................................................... 17063.9. DESCRIPTION.................................................................................................................... 17063.10. EXAMPLES................................................................................................................... 17063.11. SOURCECODE............................................................................................................... 17063.12. SEE ALSO..................................................................................................................... 171

64. WRITELINE..................................................................................................................... 172

64.1. LOCATION........................................................................................................................ 17264.2. PURPOSE.......................................................................................................................... 17264.3. ENTRY............................................................................................................................. 172

64.3.1. Table work area containing report data...............................................................17264.3.2. Colour to use to print the data in.........................................................................172

64.4. EXIT................................................................................................................................ 17264.5. CALLED BY..................................................................................................................... 17264.6. CALLS............................................................................................................................. 17264.7. TABLES............................................................................................................................ 17264.8. SYSTEM VARIABLES......................................................................................................... 17264.9. DESCRIPTION.................................................................................................................... 17264.10. EXAMPLES................................................................................................................... 17364.11. SOURCECODE............................................................................................................... 17364.12. SEE ALSO..................................................................................................................... 175

Page 15

Page 16: proc032_98

65. WRITESYMBOL.............................................................................................................. 176

65.1. LOCATION........................................................................................................................ 17665.2. PURPOSE.......................................................................................................................... 17665.3. ENTRY............................................................................................................................. 176

65.3.1. Symbol name to use..............................................................................................17665.3.2. Hotspot flag.........................................................................................................176

65.4. EXIT................................................................................................................................ 17665.5. CALLED BY..................................................................................................................... 17665.6. CALLS............................................................................................................................. 17665.7. TABLES............................................................................................................................ 17665.8. SYSTEM VARIABLES......................................................................................................... 17665.9. DESCRIPTION.................................................................................................................... 17665.10. EXAMPLES................................................................................................................... 17665.11. SOURCECODE............................................................................................................... 17665.12. SEE ALSO..................................................................................................................... 177

66. WRITEVALUE................................................................................................................. 178

66.1. LOCATION........................................................................................................................ 17866.2. PURPOSE.......................................................................................................................... 17866.3. ENTRY............................................................................................................................. 178

66.3.1. Width of output field............................................................................................17866.3.2. Value to write......................................................................................................17866.3.3. Conversion exit routine........................................................................................17866.3.4. Currency Field.....................................................................................................17866.3.5. Unit field............................................................................................................. 17866.3.6. Other Format field...............................................................................................178

66.4. EXIT................................................................................................................................ 17866.5. CALLED BY..................................................................................................................... 17866.6. CALLS............................................................................................................................. 17866.7. TABLES............................................................................................................................ 17966.8. SYSTEM VARIABLES......................................................................................................... 17966.9. DESCRIPTION.................................................................................................................... 17966.10. EXAMPLES................................................................................................................... 17966.11. SOURCECODE............................................................................................................... 17966.12. SEE ALSO..................................................................................................................... 180

67. ZBDC_BATCH_ON.......................................................................................................... 181

67.1. LOCATION........................................................................................................................ 18167.2. PURPOSE.......................................................................................................................... 18167.3. ENTRY............................................................................................................................. 18167.4. EXIT................................................................................................................................ 18167.5. CALLED BY..................................................................................................................... 18167.6. CALLS............................................................................................................................. 18167.7. TABLES............................................................................................................................ 18167.8. SYSTEM VARIABLES......................................................................................................... 18167.9. DESCRIPTION.................................................................................................................... 18167.10. EXAMPLES................................................................................................................... 18167.11. SOURCECODE............................................................................................................... 18167.12. SEE ALSO..................................................................................................................... 182

68. ZBDC_CLOSE_GROUP..................................................................................................183

68.1. LOCATION........................................................................................................................ 18368.2. PURPOSE.......................................................................................................................... 18368.3. ENTRY............................................................................................................................. 183

68.3.1. None.................................................................................................................... 18368.4. EXIT................................................................................................................................ 183

68.4.1. Status 0 - Ok.......................................................................................................18368.5. CALLED BY..................................................................................................................... 18368.6. CALLS............................................................................................................................. 183

Page 16

Page 17: proc032_98

68.7. TABLES............................................................................................................................ 18368.8. SYSTEM VARIABLES......................................................................................................... 18368.9. DESCRIPTION.................................................................................................................... 18368.10. EXAMPLES................................................................................................................... 18368.11. SOURCECODE............................................................................................................... 18468.12. SEE ALSO..................................................................................................................... 184

69. ZBDC_DUMP_ON............................................................................................................ 185

69.1. LOCATION........................................................................................................................ 18569.2. PURPOSE.......................................................................................................................... 18569.3. ENTRY............................................................................................................................. 185

69.3.1. None.................................................................................................................... 18569.4. EXIT................................................................................................................................ 185

69.4.1. None.................................................................................................................... 18569.5. CALLED BY..................................................................................................................... 18569.6. CALLS............................................................................................................................. 18569.7. TABLES............................................................................................................................ 18569.8. SYSTEM VARIABLES......................................................................................................... 18569.9. DESCRIPTION.................................................................................................................... 18569.10. EXAMPLES................................................................................................................... 18569.11. SOURCECODE............................................................................................................... 18569.12. SEE ALSO..................................................................................................................... 186

70. ZBDC_FIELD................................................................................................................... 187

70.1. LOCATION........................................................................................................................ 18770.2. PURPOSE.......................................................................................................................... 18770.3. ENTRY............................................................................................................................. 187

70.3.1. Field name........................................................................................................... 18770.3.2. Field Value.......................................................................................................... 187

70.4. EXIT................................................................................................................................ 18870.5. CALLED BY..................................................................................................................... 18870.6. CALLS............................................................................................................................. 18870.7. TABLES............................................................................................................................ 18870.8. SYSTEM VARIABLES......................................................................................................... 18870.9. DESCRIPTION.................................................................................................................... 18870.10. EXAMPLES................................................................................................................... 18870.11. SOURCECODE............................................................................................................... 18870.12. SEE ALSO..................................................................................................................... 189

71. ZBDC_FILLSCREEN.......................................................................................................190

71.1. LOCATION........................................................................................................................ 19071.2. PURPOSE.......................................................................................................................... 19071.3. ENTRY............................................................................................................................. 190

71.3.1. Program name,....................................................................................................19071.3.2. Screen number/actual screen No..........................................................................19071.3.3. Structure to use....................................................................................................190

71.4. EXIT................................................................................................................................ 19071.5. CALLED BY..................................................................................................................... 19071.6. CALLS............................................................................................................................. 19071.7. TABLES............................................................................................................................ 19071.8. SYSTEM VARIABLES......................................................................................................... 19071.9. DESCRIPTION.................................................................................................................... 19071.10. EXAMPLES................................................................................................................... 19171.11. SOURCECODE............................................................................................................... 19171.12. SEE ALSO..................................................................................................................... 193

72. ZBDC_INSERT................................................................................................................. 194

72.1. LOCATION........................................................................................................................ 19472.2. PURPOSE.......................................................................................................................... 19472.3. ENTRY............................................................................................................................. 194

Page 17

Page 18: proc032_98

72.3.1. Transaction code.................................................................................................19472.4. EXIT................................................................................................................................ 194

72.4.1. Status of Insert.....................................................................................................19472.5. CALLED BY..................................................................................................................... 19472.6. CALLS............................................................................................................................. 19472.7. TABLES............................................................................................................................ 19472.8. SYSTEM VARIABLES......................................................................................................... 19472.9. DESCRIPTION.................................................................................................................... 19472.10. EXAMPLES................................................................................................................... 19472.11. SOURCECODE............................................................................................................... 19472.12. SEE ALSO..................................................................................................................... 195

73. ZBDC_OPEN_GROUP.....................................................................................................196

73.1. LOCATION........................................................................................................................ 19673.2. PURPOSE.......................................................................................................................... 19673.3. ENTRY............................................................................................................................. 196

73.3.1. Group Name to use for batch...............................................................................19673.4. EXIT................................................................................................................................ 196

73.4.1. Status of open:.....................................................................................................19673.5. CALLED BY..................................................................................................................... 19673.6. CALLS............................................................................................................................. 19673.7. TABLES............................................................................................................................ 19673.8. SYSTEM VARIABLES......................................................................................................... 19673.9. DESCRIPTION.................................................................................................................... 19673.10. EXAMPLES................................................................................................................... 19673.11. SOURCECODE............................................................................................................... 19773.12. SEE ALSO..................................................................................................................... 197

74. ZBDC_SCREEN............................................................................................................... 198

74.1. LOCATION........................................................................................................................ 19874.2. PURPOSE.......................................................................................................................... 19874.3. ENTRY............................................................................................................................. 198

74.3.1. Program name to run...........................................................................................19874.3.2. Screen number to use...........................................................................................198

74.4. EXIT................................................................................................................................ 19874.5. CALLED BY..................................................................................................................... 19874.6. CALLS............................................................................................................................. 19874.7. TABLES............................................................................................................................ 19874.8. SYSTEM VARIABLES......................................................................................................... 19874.9. DESCRIPTION.................................................................................................................... 19874.10. EXAMPLES................................................................................................................... 19874.11. SOURCECODE............................................................................................................... 19874.12. SEE ALSO..................................................................................................................... 199

75. ZBDC_SCROLL............................................................................................................... 200

75.1. LOCATION........................................................................................................................ 20075.2. PURPOSE.......................................................................................................................... 20075.3. ENTRY............................................................................................................................. 200

75.3.1. Program name.....................................................................................................20075.3.2. Screen number.....................................................................................................20075.3.3. BDC Code for 'One down'....................................................................................20075.3.4. Maximum number of lines displayed on the screen...............................................20075.3.5. The position of the required record in the displayed table....................................200

75.4. EXIT................................................................................................................................ 20075.4.1. The offset on the current page of the required record...........................................200

75.5. CALLED BY..................................................................................................................... 20075.6. CALLS............................................................................................................................. 20075.7. TABLES............................................................................................................................ 20075.8. SYSTEM VARIABLES......................................................................................................... 20075.9. DESCRIPTION.................................................................................................................... 200

Page 18

Page 19: proc032_98

75.10. EXAMPLES................................................................................................................... 20175.11. SOURCECODE............................................................................................................... 20175.12. SEE ALSO..................................................................................................................... 202

76. ZBDC_SUBSCRIPT..........................................................................................................203

76.1. LOCATION........................................................................................................................ 20376.2. PURPOSE.......................................................................................................................... 20376.3. ENTRY............................................................................................................................. 203

76.3.1. Field name as a string..........................................................................................20376.3.2. Subscript to use....................................................................................................20376.3.3. Value to use......................................................................................................... 203

76.4. EXIT................................................................................................................................ 20376.4.1. BDC Table updated..............................................................................................203

76.5. CALLED BY..................................................................................................................... 20376.6. CALLS............................................................................................................................. 20376.7. TABLES............................................................................................................................ 20376.8. SYSTEM VARIABLES......................................................................................................... 20376.9. DESCRIPTION.................................................................................................................... 20376.10. EXAMPLES................................................................................................................... 20376.11. SOURCECODE............................................................................................................... 20376.12. SEE ALSO..................................................................................................................... 204

77. ZDO_BDC......................................................................................................................... 205

77.1. LOCATION........................................................................................................................ 20577.2. PURPOSE.......................................................................................................................... 20577.3. ENTRY............................................................................................................................. 205

77.3.1. Transaction Code.................................................................................................20577.3.2. Mode................................................................................................................... 20577.3.3. Update Type........................................................................................................ 20577.3.4. Table - p_messages - contains batch msgs............................................................205

77.4. EXIT................................................................................................................................ 20577.4.1. MsgId, Error and message if failed.....................................................................205

77.5. CALLED BY..................................................................................................................... 20577.6. CALLS............................................................................................................................. 20577.7. TABLES............................................................................................................................ 20577.8. SYSTEM VARIABLES......................................................................................................... 20577.9. DESCRIPTION.................................................................................................................... 20677.10. EXAMPLES................................................................................................................... 20677.11. SOURCECODE............................................................................................................... 20677.12. SEE ALSO..................................................................................................................... 208

78. Z_CALL_BDC.................................................................................................................. 209

78.1. LOCATION........................................................................................................................ 20978.2. PURPOSE.......................................................................................................................... 20978.3. ENTRY............................................................................................................................. 209

78.3.1. Message Table.....................................................................................................20978.3.2. Transaction to use................................................................................................20978.3.3. Table - p_messages - contains batch msgs............................................................209

78.4. EXIT................................................................................................................................ 20978.4.1. Table p_messages filled with BDC Messages.......................................................209

78.5. CALLED BY..................................................................................................................... 20978.6. CALLS............................................................................................................................. 20978.7. TABLES............................................................................................................................ 20978.8. SYSTEM VARIABLES......................................................................................................... 20978.9. DESCRIPTION.................................................................................................................... 20978.10. EXAMPLES................................................................................................................... 20978.11. SOURCECODE............................................................................................................... 20978.12. See Also...................................................................................................................... 210

Page 19

Page 20: proc032_98

List Of TablesTable 1 - List of Routines................................................................................................................. 25Table 2 -YDCSET Table Structure...................................................................................................29Table 3 - System Variables Affected By Drill Down Reports...........................................................33Table 4 - Custom Authorisation Objects...........................................................................................37Table 5 Common BDC OK Codes..................................................................................................188

Changes Pending.

Page 20

Page 21: proc032_98

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

Page 22: proc032_98

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

Page 23: proc032_98

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

Page 24: proc032_98

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 FunctionYRBINC Constants Various constants defined here. The ones with single underscores can

be used in your own programs.YREPINC Allhdrs Prints all group headers for a report

Buildreport Adds columns to a report definition, locates column titles and format from data dictionary.

CentreReport Centres a report or leaves it left justifiedCheckbox Prints a report element as a check boxCheckbreaks Checks column breaks and prints totals if requiredFirstcol Sets the first column displayedFormatreport Takes a defined report and calculates the required spacing.Getmask Gets a Unit or Currency maskGiveline Returns the Nth line of a string of text to fit a column M characters

wide.Graphic Inserts an icon or symbol graphic on a reportGroupheader Prints out group headers.Icon Inserts an Icon on a reportInitbreak Initialises Report breaks.Printtitles Prints the column titles on a reportPrinttotals Prints break totalsPsub Macro. Prints select option sub titlesRepheader Prints a Report HeaderRuntotals Prints the run totals for a reportSavereport Saves report format on report stackSetcolour Sets the output colourSortrep Sorts a report by a specified columnStripstring Removes specified characters from a stringSubtitle. Called by PSUB to print subtitles containing selection criteria for a

reportSymbol Inserts a symbol on a reportTableline. Draws a line across the current report.Underline Draws a line of specified width from a specified startpointUsereport Uses a previously stacked reportWline Outputs a line to the reportWritecol Writes to a specific column on the reportWritecentre Prints the specified text centrally on a defined report.Writeline Outputs a line of data onto the report

Page 24

Page 25: proc032_98

Include File Routine Name FunctionWriteSymbol Writes a symbol to the reportWritevalue Writes a single value to a report

YBDCINC Get_Local_Host Gets the name of the local SAP host

Init_Global Initialises Global variablesIs_Service_Active Checks to see if a named service is activeNewbdc Initialises a BDC sessionRead_YDCSET Reads BDC Defaults settingsZbdc_Batch_On Sets Batch create for BDC's onZbdc_Close_Group Closes an SM35 session

Zbdc_Dump_On Sets BDC Dump table on

Zbdc_Field Inserts a BDC FieldZBDC_Fillscreen Completes a BDC screen from screen name/number and structureZbdc_Insert Inserts a BDC sessionZbdc_Open_Group Opens a new SM35 sessionZbdc_Screen Inserts a new screen into a BDC session

Zbdc_Scroll Scrolls a table in place of =POPOZdo_BDC Runs a BDC TransactionZ_Call_BDC Runs a BDC transaction making use of YDC Set.

YGRAPH Curve_Category Defines the typeof curve to be displayedCurve_Colour The colour of the curveCurve_Type The type of curve – solid, dashedCurve_Width The width of the line used to make up the curveLegend_Text Specifies the legend textNext_Curve 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 '' ''. Perform BuildReport using 'SELLC' Text-004 11 '' ''.

Page 25

Page 26: proc032_98

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 c_no c_yes. Perform InitBreak using 'T_REVENUE-VB' Text-006 c_no c_yes. Perform InitBreak using 'T_REVENUE-ENAME' Text-007 c_no c_yes. Perform InitBreak using 'T_REVENUE-ABTEI' Text-008 c_no c_yes. Perform InitBreak using 'T_REVENUE-KTEXT' Text-009 c_no c_yes. Perform SaveReport using c_main_report.** 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.** Change in Vbeln ?? Check if there are any unprinted billing* docs.

Page 26

Page 27: proc032_98

* 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

Page 28: proc032_98

3. DependanciesShould 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’ button. This will locate all occurances of that routine in any ABAP program and display it.

Page 28

Page 29: proc032_98

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 Type LengthMANDT X MANDT CHAR 3FUNCNAME X RS38L_FNAM CHAR 30BDCMODE BDCMODE CHAR 1BDCUPMODE BDCUPMODE CHAR 1CRBATCH CHAR 1INHIBITCHK CHAR 1DUMPBDC CHAR 1DUMPMSG CHAR 1GENMAIL CHAR 64MAILPROG PNAME CHAR 8

Table 2 -YDCSET Table Structure

4.1. MANDT.Client, the standard client field for SAP

4.2. FUNCNAMEThis 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. Select Lgnum From T320 Into W_Lgnm1 Up To 1 Rows

Page 29

Page 30: proc032_98

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

Page 31: proc032_98

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. Perform Subtitles using &2

Page 31

Page 32: proc032_98

&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 (below) for more information.

Page 32

Page 33: proc032_98

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 ContentsRuntimeSY-TITLE The title of the reportList GenerationSY-COLNO The current column in the list.SY-LINCT Page length in linesSY-LINNO Current line in listSY-LINSZ Page width in columnsSY-PAGNO Current page in listSY-SCOLS Number of columns in windowSY-SROWS Number of lines in windowInteractive ReportingSY-CPAGE Current Page NumberSY-CUCOL Cursor column position on screen.SY-CUROW Cursor Row position on screen.SY-LILLI Number of selected list lineSY-LISEL Contents of the selected line as a stringSY-LISTI Index of selected list (0 = base, 1=detail 1 etc)SY-LSIND Index of displayed list (0=base, 1=detail 1 etc)SY-LSTAT Status information for each list levelSY-MSGLI Contents of the message lineSY-STACO Number of first displayed columnSY-STARO Number of first displayed line on this pageSY-UCOMM Command field function entry.

Table 3 - System Variables Affected By Drill Down Reports

Page 33

Page 34: proc032_98

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 + This Invoice When 2 InvoiceTotal2 := InvoiceTotal2 + This Invoice When 3 InvoiceTotal3 := InvoiceTotal3 + This Invoice When .... When 12 InvoiceTotal12 := InvoiceTotal12 + This Invoice end case enddo

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, “ Data Dict definition count type i, “ Normal definition... totals type i occurs 0, “ Internal table. End Of MyTab.

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

Page 35: proc032_98

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

Page 36: proc032_98

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

Page 37: proc032_98

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

Object Class Object Technical Name

Authorisation ID

Field JSB Aware

Is the user a dealer ? Sales & Distribution Dealer Authorisation ZDEALER USR10_1 V:ZDEAL+DI Y

Table 4 - Custom Authorisation Objects

Page 37

Page 38: proc032_98

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 sub-totals 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. The code below shows how this should be implemented:

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 '' ''. 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 c_no c_yes. Perform InitBreak using 'T_REVENUE-VB' Text-006 c_no c_yes. Perform InitBreak using 'T_REVENUE-ENAME' Text-007 c_no c_yes. Perform InitBreak using 'T_REVENUE-ABTEI' Text-008 c_no c_yes. Perform InitBreak using 'T_REVENUE-KTEXT' Text-009 c_no c_yes.

Page 38

Page 39: proc032_98

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 End Of Task Exporting WAIT_TIME = w_pollrate Exceptions COMMUNICATION_FAILURE = 1 Message w_RFCText SYSTEM_FAILURE = 2 Message w_RFCText OTHERS = 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 TaskThis 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.

MessageAny 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

Page 40: proc032_98

12. Information Sources.

http://www.sapfans.com/sapfans/ SAP User group with forums on all areas of SAPhttp://src.thehub.com.au/ SAP Resource Centre.http://207.105.30.51/simpweb/index.html SAP Simplification Centre

Harald Mauchert [email protected] Section 1.1 Information on Arrays within ABAP

Ted Hoffman [email protected] Section 5 - Z_WAIT_X_SECS

John Campbell [email protected] CHR/Ascii convertion routine in Initialise_Function.

Page 40

Page 41: proc032_98

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, 'LP' r_lbsart.

Page 41

Page 42: proc032_98

** 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

Page 43: proc032_98

14. Begin_Of_Block, End_of_Block - Macros

14.1. Location.YREPINC.

14.2. PurposeSimplifies the typing when constructing Selection screen blocks. Note these macros are used by SAP-AG (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 nameThese 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 ByBegin_Of_Block BlockName Text-012

14.6. CallsNone

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

Page 44: proc032_98

* 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* ParameterDefine 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. Selection-Screen End Of Line.End-Of-Definition.

Page 44

Page 45: proc032_98

14.12. See Also.BlankLineCheckLeftCheckRightRadioLeftRadioRight

Page 45

Page 46: proc032_98

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_BlockEnd_of_BlockCheckLeftCheckRightRadioLeftRadioRight

Page 46

Page 47: proc032_98

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.TitleThe Title or comment to be applied to the check box

16.3.4.ParameterThe 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

Page 48: proc032_98

16.11. SourceCode.See Begin_Of_Block

16.12. See Also.Begin_Of_BlockEnd_of_BlockBlankLineRadioLeftRadioRight

Page 48

Page 49: proc032_98

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.TitleThe Title or comment to be applied to the radio button

17.3.4.ParameterThe 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) 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. RadioLeft 1 19 Text-018 p_summry group_1.

Page 49

Page 50: proc032_98

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_BlockEnd_of_BlockBlankLineCheckLeftCheckRight

Page 50

Page 51: proc032_98

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.

Page 51

Page 52: proc032_98

Copy_Structure &1 &1.End-Of-Definition.

18.12. See Also.Copy_Structure

Page 52

Page 53: proc032_98

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

Page 54: proc032_98

19.12. See Also.CopyBook.

Page 54

Page 55: proc032_98

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 useThis 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.RUNTOTALSTABLELINESUBTITLESWRITECENTRE

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.*EJECTDefine End_Of_Report.

Page 55

Page 56: proc032_98

** 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

Page 57: proc032_98

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

Page 58: proc032_98

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

Page 59: proc032_98

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_GlobalRead_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.

22.10. Examples.FUNCTION Y_CHECK_PO_AND_RETURN_SPLR_RFC.

Page 59

Page 60: proc032_98

*"----------------------------------------------------------------------*"*"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*Define Init_Func.* Constants: c_param_import like catfu-paramtype value '1', "Import parameter flag

Page 60

Page 61: proc032_98

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. Else. Move t__prmtab-impdefault to <f_param>. EndIf. EndIf. EndIf.

Page 61

Page 62: proc032_98

** 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_GlobalRead_YDCSet.

Page 62

Page 63: proc032_98

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

Page 64: proc032_98

* Data: w_sutitle(50) type c, " Sub title string. w_srttitle(50) type c, " Sorted by w_textno(3) type n, " Sort field text no w_srtfld(10) type c. " 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

Page 65: proc032_98

* 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_ReportSubTitles.

Page 65

Page 66: proc032_98

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

Page 67: proc032_98

End-Of-Definition.

24.12. See Also.WriteCol.

Page 67

Page 68: proc032_98

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.

25.12. See Also.

Page 68

Page 69: proc032_98

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. EndWhile.

Page 69

Page 70: proc032_98

EndForm.

26.12. See Also.

Page 70

Page 71: proc032_98

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 forOr 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 71

Page 72: proc032_98

* 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 72

Page 73: proc032_98

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 (only with WRITE) ... NO-GAP (only with WRITE)

... LEFT-JUSTIFIED

Page 73

Page 74: proc032_98

... 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 ... DD/MM/YY Option ... 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 ... DD/MM/YYYY Option ... 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 ... DDMMYY Option ... 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 DECIMALS 0, "output: 1 /X DECIMALS 2, "output: 1.27 /X DECIMALS 5, "output: 1.26700 /Y DECIMALS 1, "output: 1.3E+04 /Y DECIMALS 5, "output: 1.25456E+04 /Y DECIMALS 20. "output: 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 ROUND -2, "output: 1,249,397.00 /X ROUND 0, "output: 12,493,97 /X ROUND 2, "output: 124.94 /X ROUND 5, "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 74

Page 75: proc032_98

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 EXPONENT 0, "output: 12345678900,000000 /X(10) EXPONENT 0, "output: 1,235E+10 /X EXPONENT 3, "output: 12345678,90000000E+03 /Y EXPONENT -3, "output: 12345678900000,00E-03 /Y EXPONENT 9, "output: 12,34567890000000E+09 /Y EXPONENT 2 /Y DECIMALS 4. "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',

Page 75

Page 76: proc032_98

(5) 24 UNDER TEXT-002.

This produces the following output (numbers appear right-justified in their output fields!):

Name 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 right-justified output. For number fields (types I, P and F), RIGHT-JUSTIFIED is the standard output format, but LEFT-JUSTIFIED is used for all other types, as well as for templates.

Examples Output to a list (WRITE):

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

Page 76

Page 77: proc032_98

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 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. " 2,5 TDM WRITE SALES CURRENCY 'ITL' ROUND 3 DECIMALS 1. " 246,3 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 TDM WRITE SALES CURRENCY 'ITL' ROUND 3 DECIMALS 1. " 100,0 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

Sales in pfennigs: 93860 Unit 1 DM without decimal places.

SALES = 93860. WRITE SALES CURRENCY 'DEM' DECIMALS 0. " 939 DM

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. The following colours can be used by specifying the text shown:

Figure 1 - Colour Codes

28.3.5.Format field.This field is used in conjunction with the Format Type field see 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.

Page 77

Page 78: proc032_98

28.3.5.1. Abap Documentation - Unit.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 - Domainsdd03l - Table Fieldsdd04t - R/3 DD: Data element texts

28.8. System Variables.SY-SUBRC INT4 X 4 Return value after specifSY-LANGU LANG C 1 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.

Page 78

Page 79: proc032_98

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:

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,

Page 79

Page 80: proc032_98

End Of t_dd03l,* Begin Of SplitTab occurs 0, word(50) type c, End Of SplitTab,* w__table like dd03l-tabname, w__field like dd03l-fieldname, w__fmask(30) type c, w__ffield(30) type c, w__tlen type 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

Page 80

Page 81: proc032_98

where rollname = t_dd03l-rollname and ddlanguage = sy-langu and as4local = 'A'. EndSelect. 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.CheckBoxCheckBreaksFormatReportInitBreaksWriteLinePrintTotals

29.

30.

Page 81

Page 82: proc032_98

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 82

Page 83: proc032_98

* Called By: Perform CentreReport using True** Calls:** Modification History:** Date Reason Version Who**Form CentreReport using pu_centre like true. Move pu_centre to w__centre.EndForm.

31.12. See Also.

Page 83

Page 84: proc032_98

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 INT4 X 4 Return value after specifSY-TABIX INT4 X 4 Runtime: Current line of

Page 84

Page 85: proc032_98

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. if sy-subrc = 0.

Page 85

Page 86: proc032_98

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.BuildReportCheckBreaksInitBreaksWriteLinePrintTotals

Page 86

Page 87: proc032_98

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 INT4 X 4 Runtime: Current line ofSY-INDEX INT4 X 4 Number of loop passesSY-SUBRC INT4 X 4 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 87

Page 88: proc032_98

* 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. Move t__coltotals to t__carry. Modify t__carry index w__pos.

Page 88

Page 89: proc032_98

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.AllHdrsBuildReportCheckBoxInitBreaksWriteLinePrintTotals

Page 89

Page 90: proc032_98

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: The domain contains the value specifiedFalse: 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 90

Page 91: proc032_98

* Modification History:** Date Reason Version Who*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 91

Page 92: proc032_98

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

35.11. SourceCode.*EJECT

Page 92

Page 93: proc032_98

************************************************************************* 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 93

Page 94: proc032_98

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.SAVEREPORTNEWREPORTBUILDREPORT

36.7. Tables.

36.8. System Variables.SY-LINSZ INT4 X 4 Line size of listSY-INDEX INT4 X 4 Number of loop passesSY-SUBRC INT4 X 4 Return value after specifSY-LSIND INT4 X 4 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.*

36.11. SourceCode.*EJECT

Page 94

Page 95: proc032_98

************************************************************************* 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 95

Page 96: proc032_98

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 19th 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.*

37.11. SourceCode.*EJECT

Page 96

Page 97: proc032_98

************************************************************************* 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 97

Page 98: proc032_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 98

Page 99: proc032_98

** 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 99

Page 100: proc032_98

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 INT4 X 4 Runtime: Current line ofSY-LINSZ INT4 X 4 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 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 '' ''. Perform BuildReport using 'GRMNGE' Text-022 15 '' ''. Perform FormatReport.* 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************************************************************************* Procedure: FormatReport.

Page 100

Page 101: proc032_98

** 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 101

Page 102: proc032_98

39.12. See Also.BuildReportCentreReportCheckBoxCheckBreaksInitBreaksWriteLinePrintTotals

Page 102

Page 103: proc032_98

40. GETMASK

40.1. Location.YREPINC.

40.2. Purpose.Locates a currency or unit mask

40.3. Entry.

40.3.1.Variable or literal maskThis 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 103

Page 104: proc032_98

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 104

Page 105: proc032_98

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 105

Page 106: proc032_98

* 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 106

Page 107: proc032_98

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 splitThis 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 107

Page 108: proc032_98

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 108

Page 109: proc032_98

42.12. See Also.

Page 109

Page 110: proc032_98

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 typeNot callable directly by user

43.4. Exit.

43.4.1.None

43.5. Called By.ICONSYMBOL

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. For a more comprehensive set, substitute <list> in the include statement.

Page 110

Page 111: proc032_98

Below is an example report using icons.

Figure 3 Icons on a report

43.10. Examples.* Calls:** Modification History:** Date Reason Version Who*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.

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.*Form Symbol using p_True_symbol p_hotspot like True

Page 111

Page 112: proc032_98

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 112

Page 113: proc032_98

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.ALLHDRSCHECKBREAKS

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 113

Page 114: proc032_98

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. Move p_value to w__repline+w__offset.

Page 114

Page 115: proc032_98

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 115

Page 116: proc032_98

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 c_no c_yes. Perform InitBreak using 'T_REVENUE-VB' Text-006 c_no c_yes. Perform InitBreak using 'T_REVENUE-ENAME' Text-007 c_no c_yes. Perform InitBreak using 'T_REVENUE-ABTEI' Text-008 c_no c_yes. Perform InitBreak using 'T_REVENUE-KTEXT' Text-009 c_no c_yes. Perform SaveReport using c_main_report.** And the billing report.

45.11. SourceCode.*EJECT************************************************************************* Procedure: InitBreak** Purpose: Initialises report breaks table

Page 116

Page 117: proc032_98

** 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 Who*** 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 117

Page 118: proc032_98

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 like catfu-impdefault, w__name like catfu-name, w__dump(30) type c, 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

46.11. SourceCode.*EJECT************************************************************************

Page 118

Page 119: proc032_98

* 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. When 'C_'. Clear W_Clearit.

Page 119

Page 120: proc032_98

When 'RE'. Clear W_Clearit. When 'RS'. Clear W_Clearit. When 'SY'. Clear W_Clearit. When 'SC'. Clear W_Clearit. When 'TE'. Clear w_Clearit. When 'ZB'. Clear W_Clearit. When Others.** 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 120

Page 121: proc032_98

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_CONNECTIONSGET_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 121

Page 122: proc032_98

* 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 122

Page 123: proc032_98

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:** Modification History:

Page 123

Page 124: proc032_98

** Date Reason Version Who*Form NewBDC. Move False to w__BDCOpen.EndForm.

48.12. See Also.

Page 124

Page 125: proc032_98

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.*ejectStart-Of-Selection.

49.11. SourceCode.*EJECT

Page 125

Page 126: proc032_98

************************************************************************* 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 126

Page 127: proc032_98

Modify ReportTable. EndLoop. Endif. Perform TableLine.ENDFORM. " PrintTitles

49.12. See Also.

Page 127

Page 128: proc032_98

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.CHECKBREAKSRUNTOTALS.

Perform PrintTotals using sy-index.

50.6. Calls.TABLELINE SETCOLOUR WRITEVALUE

50.7. Tables.

50.8. System Variables.SY-VLINE CHAR C 1 Constant: Vertical barSY-TABIX INT4 X 4 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 128

Page 129: proc032_98

************************************************************************* 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. Write sy-vline.

Page 129

Page 130: proc032_98

EndIf.EndForm.

50.12. See Also.

Page 130

Page 131: proc032_98

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 INT4 X 4 Return value after specifSY-REPID CHAR C 8 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, drill* down to the log report.*AT LINE-SELECTION.

51.11. SourceCode.*EJECT************************************************************************* Procedure: Prg_Doc_Help** Purpose: Displays help for current program** Entry:** Exit:** Called By: Perform Prg_Doc_Help** Calls:

Page 131

Page 132: proc032_98

** Modification History:** Date Reason Version Who*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 132

Page 133: proc032_98

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, " Table for Werks lookup Werks like t001w-werks, col1(3) type c, Name1 like t001w-name1, End Of tb_werks, w_tabix like sy-tabix. " 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 133

Page 134: proc032_98

* Exit: Screen fields are available to the calling* program** Called By: Perform Read_Screen_Values** Calls:** Modification History:** Date Reason Version Who*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 134

Page 135: proc032_98

53. READ_YDCSET

53.1. Location.YBDCINC.

53.2. Purpose.Gets the BDC profile to run

53.3. Entry.

53.3.1.Function NameThis 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_YDCSETZ_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 above for an explanation of the YDCSET structure and table.

53.10. Examples. w__name like catfu-name, w__dump(30) type c, 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

Page 135

Page 136: proc032_98

* 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 136

Page 137: proc032_98

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 INT4 X 4 Line size of listSY-REPID CHAR C 8 Program: Name of ABAP/4 pSY-UNAME CHAR C 12 Session: SAP user from SASY-SYSID CHAR C 8 System: SAP System IDSY-SAPRL CHAR C 4 System: SAP ReleaseSY-DATUM DATS D 8 System: DateSY-PAGNO INT4 X 4 Runtime: Current page inSY-UZEIT TIMS T 6 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 137

Page 138: proc032_98

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. Position w__offset.

Page 138

Page 139: proc032_98

write: 'Time:' No-gap,sy-uzeit.* Perform UnderLine using 0 sy-linsz.ENDFORM.

54.12. See Also.

Page 139

Page 140: proc032_98

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 INT4 X 4 Runtime: Current line ofSY-SUBRC INT4 X 4 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 140

Page 141: proc032_98

* 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 141

Page 142: proc032_98

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 INT4 X 4 Return value after specifSY-TABIX INT4 X 4 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' Text-015 c_no c_yes. Perform InitBreak using 'T_REVENUE-VB' Text-006 c_no c_yes. Perform InitBreak using 'T_REVENUE-ENAME' Text-007 c_no c_yes. Perform InitBreak using 'T_REVENUE-ABTEI' Text-008 c_no c_yes. Perform InitBreak using 'T_REVENUE-KTEXT' Text-009 c_no c_yes. Perform SaveReport using c_main_report.** 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 '' ''.

56.11. SourceCode.*EJECT

Page 142

Page 143: proc032_98

************************************************************************* 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 143

Page 144: proc032_98

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.WRITELINEWLINEPRINTTOTALS

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 144

Page 145: proc032_98

* Exit:** Called By: Perform SetColour Using P_Colour** Calls:** Modification History:** Date Reason Version Who*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 145

Page 146: proc032_98

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 OTHERS = 1.

Page 146

Page 147: proc032_98

Endif.EndForm.

58.12. See Also.

Page 147

Page 148: proc032_98

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 INT4 X 4 Interact.: List displayedSY-CUCOL INT4 X 4 Cursor position (column)SY-INDEX INT4 X 4 Number of loop passesSY-SUBRC INT4 X 4 Return value after specifSY-UCOMM CHAR C 70 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 PF-STATUS call must have the sort up and sort down buttons named STUP and STDN.

59.10. Examples.*EjectAt 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 w_sortdir.

Page 148

Page 149: proc032_98

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>. Move sy-index to w__sortfd. Exit.

Page 149

Page 150: proc032_98

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 150

Page 151: proc032_98

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 INT4 X 4 Number of loop passesSY-SUBRC INT4 X 4 Return value after specifSY-FDPOS INT4 X 4 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 151

Page 152: proc032_98

* 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 152

Page 153: proc032_98

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.* Perform Subtitles Sort sign option low high

Page 153

Page 154: proc032_98

** 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 154

Page 155: proc032_98

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.GROUPHEADERPRINTTITLES.USEREPORTCHECKBREAKSPRINTTOTALSRUNTOTALS.

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 155

Page 156: proc032_98

* 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 156

Page 157: proc032_98

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.REPHEADERTABLELINE.

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 157

Page 158: proc032_98

** 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 158

Page 159: proc032_98

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.*EJECTForm 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. If w__repname <> w__currep.

Page 159

Page 160: proc032_98

** 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 160

Page 161: proc032_98

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 161

Page 162: proc032_98

65.4. Exit.

65.5. Called By.GROUPHEADERPRINTTITLES.

Perform WLine Using w__repline Col_Group.

65.6. Calls.SETCOLOUR

65.7. Tables.

65.8. System Variables.SY-VLINE CHAR C 1 Constant: Vertical barSY-SUBRC INT4 X 4 Return value after specifSY-FDPOS INT4 X 4 Location of a stringSY-LINSZ INT4 X 4 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, w__filler(255) type c,

Page 162

Page 163: proc032_98

w__offset type i, w__count 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 163

Page 164: proc032_98

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 164

Page 165: proc032_98

* Exit:** Called By: Perform WriteCentre using w__text** Calls:** Modification History:** Date Reason Version Who*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 165

Page 166: proc032_98

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 INT4 X 4 Return value after specifSY-VLINE CHAR C 1 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 166

Page 167: proc032_98

* 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 167

Page 168: proc032_98

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 CHAR C 1 Constant: Vertical barSY-TABIX INT4 X 4 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. Perform DoDl using w_pname p_outdir.

Page 168

Page 169: proc032_98

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.** Check box ?*

Page 169

Page 170: proc032_98

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 sy-tabix to w__pos. Read table ReportBreaks index 1. Move ReportBreaks-totals[] to t__coltotals[]. Read 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. EndLoop. Read table ReportTable Index 1. Compute w__pos = ReportTable-StartPos + ReportTable-MaxWidth + 1.

Page 170

Page 171: proc032_98

Write at w__pos sy-vline. Move True to w__lineprinted.EndForm.

68.12. See Also.

Page 171

Page 172: proc032_98

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 172

Page 173: proc032_98

** 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 173

Page 174: proc032_98

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 fieldThis is the width of the output field in characters.

70.3.2.Value to writeThe value to write to the report

70.3.3.Conversion exit routineIf 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 FieldThis 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 fieldIn 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 above and above for more information on this.

70.4. Exit.

70.5. Called By.WRITELINEPRINTTOTALS

Perform WriteValue using ReportTable-ColWidth <RField> ReportTable-ConvExit ReportTable-Currency ReportTable-Unit ReportTable-Format.

70.6. Calls.GETMASK

Page 174

Page 175: proc032_98

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 175

Page 176: proc032_98

** 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 176

Page 177: proc032_98

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 above and Read_YDCSet in section 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_GROUPZBDC_OPEN_GROUP

Page 177

Page 178: proc032_98

ZBDC_INSERT_GROUPZDO_BDC

Page 178

Page 179: proc032_98

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 open2 - Queue Error3 - 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 179

Page 180: proc032_98

* 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 Who*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_ONZBDC_OPEN_GROUPZBDC_INSERT_GROUPZDO_BDC

Page 180

Page 181: proc032_98

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 above and Read_YDCSet in section 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 181

Page 182: proc032_98

* Date Reason Version Who*Form ZBDC_Dump_On. Move True to w__dumpbdc.EndForm.

73.12. See Also.ZBDC_BATCH_ON

Page 182

Page 183: proc032_98

74. ZBDC_FIELD

74.1. Location.YBDCINC.

74.2. Purpose.Fills BDC Data table with field info

74.3. Entry.

74.3.1.Field nameThis is the field name that should be filled with the specified value.

74.3.2.Field ValueThe 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 Alpha FKey Action/0 =ENT Enter /1 =HELP F1 Help/2 =CS F2 Select (Previously PICK)/3 =BACK F3 Back/4 F4 List possible entries/8 F8 Execute/10 F10 Menu/11 =BU F11 Post =SICH F11 Save/12 =RW F12 Cancel or Roll Back Worl/13 =PRI F13 Print/14 DLT F14 Delete/15 =EXIT F15 Return to previous screen

%EX Exit%SC Find By=P-- Top Of List=P- Previous page=P++ Bottom of list

Page 183

Page 184: proc032_98

=P+ Next Page

Table 5 Common BDC OK Codes

74.4. Exit.

74.5. Called By.ZBDC_FILLSCREENZBDC_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:** Date Reason Version Who

Page 184

Page 185: proc032_98

*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_FILLSCREENZBDC_SCREEN

Page 185

Page 186: proc032_98

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 NoSAP 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 186

Page 187: proc032_98

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 with header line,

Page 187

Page 188: proc032_98

t__d022s like d022S occurs 0, " Flow Logic t__d023s like d023s occurs 0, " Match code* w__sfnam like d021s-fnam, " Structure name w__stble like d021s-fnam, " Table name (Dumped) w__type(1) type c, " Field type w__dfield(10) type c, " Fld for date trans w__nfield(20) type c, " Fld for nc trans w_scrn(4) type n, " Screen for BDC Data w_subscrn(4) type n. " 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. Write <f__field> to w__nfield. Condense w__nfield.

Page 188

Page 189: proc032_98

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_FIELDZBDC_SCREEN

Page 189

Page 190: proc032_98

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 190

Page 191: proc032_98

* 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_GROUPZBDC_CLOSE_GROUP

Page 191

Page 192: proc032_98

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 = 1DESTINATION_INVALID = 2GROUP_INVALID = 3GROUP_IS_LOCKED = 4HOLDDATE_INVALID = 5INTERNAL_ERROR = 6QUEUE_ERROR = 7RUNNING = 8SYSTEM_LOCK_ERROR = 9USER_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 CHAR C 12 Session: SAP user from SASY-MANDT CLNT C 3 Client number from SAP loSY-SUBRC INT4 X 4 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. Perform ZBDC_Insert using p_trans changing w__istat.

Page 192

Page 193: proc032_98

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_INSERTZBDC_CLOSE_GROUP

Page 193

Page 194: proc032_98

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_FILLSCREENZBDC_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 194

Page 195: proc032_98

* 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 195

Page 196: proc032_98

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 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 196

Page 197: proc032_98

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. Scroll down until the relevant line is on the* screen.* 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* displayable in which case the remainder (or the start) of the table* is displayed.

Page 197

Page 198: proc032_98

* 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 198

Page 199: proc032_98

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 199

Page 200: proc032_98

** 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 200

Page 201: proc032_98

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’ - Display all steps of the transaction.‘E’ - Display erroneous screens only.‘N’ - Displays no screens.

81.3.3.Update Type‘A’ - Asynchronous (Back ground)‘S’ - 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 INT4 X 4 Return value after specifSY-MSGID CHAR C 2 Message IDSY-MSGNO NUMC N 3 Message numberSY-MSGV2 CHAR C 50 Message variableSY-MSGV3 CHAR C 50 Message variableSY-MSGV4 CHAR C 50 Message variableSY-UNAME CHAR C 12 Session: SAP user from SA

Page 201

Page 202: proc032_98

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 NewBdc. Perform ZBDC_FillScreen using c_sapml03t 0101 pu_lt01. Perform ZBDC_Field using 'BDC_OKCODE' '/00'. Perform ZBDC_FillScreen using c_sapml03t 0102 pu_lt01. Perform ZBDC_Field using '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 202

Page 203: proc032_98

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 p_msgid. Move sy-msgno to p_msgno. Move sy-msgv1 to w__msgv1. Move sy-msgv2 to w__msgv2. Move sy-msgv3 to w__msgv3. Move sy-msgv4 to w__msgv4. Else.** 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. Move p_messages-msgv2 to w__msgv2.

Page 203

Page 204: proc032_98

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 204

Page 205: proc032_98

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************************************************************************ Procedure: Z_Call_BDC

Page 205

Page 206: proc032_98

** 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 206