Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos


h3. Summary

This blog describes a custom ABAP program -+ Report Simulator+ - that simulates simple SAP Controls based reports from a text files containing column headers and sample data. The report column headers and sample data can be delimited by TAB character or any other delimiter except colon character; e.g., comma, semicolon, space, ...

With the+ SAP Controls Report Simulator, the functional consultants could design report layouts in matter of minutes and include their screen prints in functional specification to make it look professionally. Presenting the exact screen layouts for reports in FS documents could greatly help technical consultants when implementing them. The report layouts may use SAP Picture control to include; e.g., company logo, SAP Dynamic Document component to display; e.g., report parameters and ALV Grid control to display sample data.</p><p style="margin: 6pt 0in 0pt" class="MsoNormal">The follow up blog "Rapid ABAP Development with Report Simulator+" to be published the near future will show how to expand simulated report screens into fully functional reports by programming only data retrieval and optional event handling procedures.</p> For information on ABAP source code of the Report Simulator refer to the end of this blog h3. Adding Report Layout to Functional Specification with Report Simulator

The ABAP report implementation process starts with blueprinting and development of functional specification document. The FS document describes the business process, discusses how and where to retrieve data from. It also provides the information about output format. Often the output layout is prepared using MS Excel spreadsheet or other desktop software that is not appropriate for the task. Sometimes parts of screens form other SAP applications are cut and pasted to show what is expected. Usually, the effect of these attempts is poor quality representation of what is expected in a final report.

A custom SAP Controls Report Simulator program was developed to help functional consultants to deal with this problem. In matter of minutes without any programming, a functional consultant could create an exact representation of report output screen and include it in Functional Specification document.

The SAP Controls Report Simulator selection screen looks as follows:



The program accepts, as Simulation Data File Path parameter, the path to a delimited text file that contains sample report data with the first row representing column headers. A Field Delimiter selection screen parameter should contain a TAB for TAB delimited text files, one character delimiter; e.g., a comma, a semicolon,,, to be used as a column separator or left empty for SPACE delimited text file. A colon character should not be used as a delimiter. Its use is reserved for formatting column data.

Additionally a full path to a text file with information to be displayed in a panel above report tabular data may be provided in Simulation Header File Path parameter. The Picture Id parameter may contain URL to JPEG picture stored in MIME repository in SE80 workbench. If specified, the JPEG file will be displayed in upper left corner of the report screen. The +Picture Width and Picture Height +parameters provide percentage based dimensions of the panel were JPEG picture will be displayed; e.g., 12% width and 10% height. Enter 0 for width and/or height if you want to display ALV grid only.

On the selection screen you could enter a report title and check or uncheck several report layout self explanatory controlling parameters. You could also specify toolbar buttons if different than default ALV Grid toolbar buttons should be used.

Once you enter appropriate selection screen parameters, click on EXECUTE button and the report simulation screen will appear as defined by information in a sample text file:

!https://weblogs.sdn.sap.com/weblogs/images/5188/ZAWBRS_02.JPG|height=357|alt=|width=640|src=https://...!

The report simulation will look exactly the same as the final report. To help technical consultant, the last row of report may contain column data dictionary specification as shown on the screen above.

The above report was generated from the following header file and semi-colon delimited data file:



The first line of the file was used for displaying column headers and formatting columns data. The last line that contains field types to be used by technical consultants when programming report.

Once you decide on the final format of the report by changing its sample data file, you could cut and paste its simulation screen to your Functional Specification document as shown on the following screen:



As you can see, it is very easy to do and you can get exact representation of report output screen in few minutes greatly enhancing your documentation.

Defining Toolbar


You could define ALV Grid toolbar buttons on the selection screen:



To define standard buttons, use the following commands:

TOOLBAR EXCLUDE ALL - to exclude all standard buttons0.1.

TOOLBAR INCLUDE SELECTED - to specify selected standard buttons0.1.

TOOLBAR INCLUDE  &FIND - to include standard FIND button where &FIND is the FIND button FCODE as found in attributes of CL_GUI_ALV_GRIS ABAP class in SE24The sample Standard Button Definition select-option is shown on the following screen:

!https://weblogs.sdn.sap.com/weblogs/images/5188/ZAWBRS_06.JPG|height=187|alt=|width=319|src=https://...!

 

To define custom buttons, use the following commands:

0.1.

BUTTON 0 DSPL @0P@ DisplaySalesOrder - where 0 is for standard button, DSPL is button FCODE, @0P@ is buttons icon and DisplaySalesOrder is button text0.1.

SEPARATOR - is a separator between buttonThe sample Custom Button Definition select-option is shown on the following screen:





They produce the following toolbar:



You may also include the *FIND *button in Custom Button Definitionand have TOOLBAR EXCLUDE ALL in Standard Button Definition. It will produce the following toolbar with fully functional FIND button without ant additional programming:

!https://weblogs.sdn.sap.com/weblogs/images/5188/ZAWBRS_09.JPG|height=27|alt=|width=384|src=https://w...!

 

Header File Format


The Report Simulator may display header information using SAP Dynamic Document component in a panel above ALV Grid. As default, it will display as a header the path to the data file provided in+ Simulation Data File Path+ parameter. If the Simulation Header File Path is provided, its content will be displayed there. The file should contain $ command script. The following commands are available:</p><ul style="margin-top: 0in"><li class="MsoNormal" style="margin: 6pt 0in 0pt; tab-stops: list .5in left .8in">$HEADER <HEADER> - to display *$TABLE-ADD <N> - to add table with N columns0.1.

*$COLUMN-ADD <WIDTH> - to declare column *$TEXT-BOLD <TEXT> - to display *$TEXT-NORMAL <TEXT> - to display *$NEWLINE - to change line (to be used with $TEXT command</li></ul><p style="margin: 6pt 0in 0pt" class="MsoNormal">The <TEXT> text may contain formatting characters for {Bold} and  (Italic) font. The PARAGRAPH, TEXT and LINE may be displayed as table column or outside table</p><p style="margin: 6pt 0in 0pt" class="MsoNormal">The sample header file is shown on the following screen:</p><p><textarea cols="72" rows="8" name="Sample Code">$HEADER        Selection Screen Parameters

*$TABLE-ADD     2

*$COLUMN-ADD    70%

*$TEXT-BOLD     Sales Orders:

*$TEXT-NORMAL   1099221000 - 1099224999

*$COLUMN-ADD    30%

*$TEXT-BOLD     Maximum Number of Recotrds:

*$TEXT-NORMAL   1000

Data File Format


The Report Simulator accepts as input a delimited text file. A space character and any delimiter except colon could be used to separate report columns; e.g., TAB, coma, semicolon, space, ...

In general, the file contains report column header information in row 1 and sample data in subsequent rows. Optionally, the last line may contain field specification to be used when programming report. The sample data file opened with MS Notebook is shown on the following screen:

!https://weblogs.sdn.sap.com/weblogs/images/5188/ZAWBRS_10.JPG|height=165|alt=|width=641|src=https://...!

If an input file is TAB or comma delimited it might be also opened with MS Excel as shown on the following screen:

!https://weblogs.sdn.sap.com/weblogs/images/5188/ZAWBRS_11.JPG|height=264|alt=|width=642|src=https://...!

 

As already mentioned, the first row of the file contains the column headers for the report. However, to allow for more flexibility each column header might contain some additional formatting information after a colon ( :smile: character. Any combination of the following formatting characters is allowed after a colon character:

0.1.

L - for left justified column 0.1.

C - for centered column 0.1.

R - for right justified column 0.1.

H - for hotspot column 0.1.

K - +non scrollable key column +0.1.

X - checkbox column0.1.

I - +for column displaying icons. Icon data must consist of 2 character codes; as specified in ICON Type Group - transaction *SE11; surrounded by @ wrapper characters; e.g., +@1B@*. You could display a list of icons and their corresponding 2 character codes using SHOWICON standard ABAP program

A sample list of icons and their corresponding codes is shown on the following screen generated with SAP Controls Report Simulator:



You could also manipulate row colors by adding a special column with predefined name COLOR - all in capital letters. The row color might be specified in that column as 4 character code starting with letter C followed by 3 digits:

0.1.

first digit - value 1 to 7 for different colors 0.1.

second digit - 0 or 1 for INTENSIFIED OFF or ON 0.1.

third digit - 0 or for INVERSE OFF or ON

All allowed color combinations shown below were generated using Report Simulator. A text file with color codes shown beside Color Palette report was used as+ Report Simulator +input:

!https://weblogs.sdn.sap.com/weblogs/images/5188/ZAWBRS_13.JPG|height=495|alt=|width=399|src=https://...!</body>

8 Comments