Generating Blank Lines in the Output - ABAP Programming Tricks


Blank Lines in the Output Screen.

While generating a report, ABAPers need at some point of time a blank line in the output screen.
It is bit hard to achieve it as Blank Lines will be ignored by the ABAP runtime environment.

To overcome this situation, SAP has provided SET BLANK LINES statement with ON and OFF options.

Let us see this with an example code and output.

Code

WRITE '*****'.

NEW-PAGE.

SET BLANK LINES OFF.

DO 5 TIMES.
  WRITE / ' '.
ENDDO.

WRITE '*****'.

NEW-PAGE.

SET BLANK LINES ON.
DO 5 TIMES.
  WRITE / ' '.
ENDDO.
SET BLANK LINES OFF
WRITE  / '*****'.

Output



.




As you see above code and the output, SKIP statement skips 5 lines in the output screen.
But it is not the right approach. Use the SET BLANK LINES statement for any blank lines to be displayed in the output screen.


For more Tutorials, visit ABAP Tutorials, Tips & Tricks and Certification Questions

Color Format for the text in the output screen


Format the text with colors in the Output List

To format the text, color field in the WRITE statement can be used.

The Color value decides the color type for the text.
Below is the Color value for the text.


Color Value for Text Format


Code 

DATA i TYPE i VALUE 0.
DATA col(15) TYPE c.

WHILE i < 8.

  CASE i.
    WHEN 0. col = 'COL_BACKGROUND '.
    WHEN 1. col = 'COL_HEADING    '.
    WHEN 2. col = 'COL_NORMAL     '.
    WHEN 3. col = 'COL_TOTAL      '.
    WHEN 4. col = 'COL_KEY        '.
    WHEN 5. col = 'COL_POSITIVE   '.
    WHEN 6. col = 'COL_NEGATIVE   '.
    WHEN 7. col = 'COL_GROUP      '.
  ENDCASE.

  FORMAT INTENSIFIED COLOR = i.
  WRITE: /(4) i, AT 7            sy-vline,
            col,                 sy-vline,
            col INTENSIFIED OFF, sy-vline,
            col INVERSE.

  i = i + 1.


ENDWHILE.


Output





For more Tutorials, visit ABAP Tutorials, Tips & Tricks and Certification Questions

Complex Output Screens Design with Page Header and Footer


Output with Page Header and Footer


The Header and Footer is achieved by TOP-OF-PAGE and END-OF-PAGE events in the program.
Please see the below code for reference and the output it generated.


Code

TOP-OF-PAGE.
*          This event generates the Page Header Title
  WRITE: 'Page with Header and Footer'.
  ULINE AT /(27).

END-OF-PAGE.
*        This event generates the Footer for the output
  ULINE.
  WRITE: /30 'Page', sy-pagno.

START-OF-SELECTION.

  DO 6 TIMES.
    WRITE / sy-index.
  ENDDO.



Output




For more Tutorials, visit ABAP Tutorials, Tips & Tricks and Certification Questions

Know ABAP debugging



ABAP Bebugger

Classic Debugger.

The classical Debugger has always had certain limitations.
A maximum of eight data objects could be displayed, and also 4 at a time.
The layout is fixed to display the data objects.
There is no way, from within the Debugger, to look up within the repository a function module, method, or subroutine name to set a breakpoint.
ABAP Classic Debugger with fields and execution area


New ABAP Debugger

It is generally not possible to analyze programs in debugging mode that run in an ABAP processor unit.

This had made SAP releases its new version of Debugger "New Debugger". The reason for this is that the new Debugger executes in its own external mode. This allows the code to be analyzed to run with virtually no impact from the Debugger. It has more interaction with the developer and the system allowing search help use, the display of more than one internal table simultaneously, and an unlimited number of data objects.



You can set the New Debugger as the default debugger in
Utilities =>Settings=>ABAP Editor =>Debugging.

User Specific Setting for default Debugger

It is possible to switch between the classic Debugger and the new Debugger by selecting 
Debugger=> Switch to New ABAP Debugger or 
Debugger => Switch toClassic ABAP Debugger.


You can exit the new Debugger while debugging in the following ways.

1. Debugger =>Exit Debugger, which closes just the Debugger, and the application continues to run.

2. /hx” in the command field and press Enter closes just the Debugger and allows the application to continue to run.

3. Debugger =>Exit Application and Debugger, which closes both the Debugger and the application.

When the Debugger starts, It opens as – "ABAP Debugger Controls Session x (Exclusive)", where again X is the external mode of the application.




If the debugger opens in "ABAP Debugger Controls Session x (NOT Exclusive)". You can change the non-exclusive mode to exclusive mode using the option in the Debugger menu 
"Debugger Exclusive Debugging Mode On"

Exclusive Debugging Mode on



In Non-Exclusive mode, the debugger has limited functionality.
1. You cannot debug between the statements SELECT and ENDSELECT.
2. Debugging mode is not possible for conversion or field exits.
3. COMMIT statement can lead to an inconsistent datasets in the database.

New ABAP  Debugger Tools
The tools are grouped into four categories:



1. Standard Tools
2. Data Objects
3. Memory Management
4. Special Tools

New ABAP Debugger Tools


For more Tutorials, visit ABAP Tutorials, Tips & Tricks and Certification Questions