My Selection-screen macros for reports

My Selection-screen macros for reports

Macros that I’m using for formatting reports quicker.

Theses are declared in the TOP of report.



*====================================================================================
*   ______   ______   ______   ______   ______   ______     ______  ________  ______
* (       )(  ___  )(  ____ \(  ____ )(  ___  )(  ____ \  (  ____ \\__    _/(  ___  )
* | () () || (   ) || (    \/| (    )|| (   ) || (    \/  | (    \/   )  (  | (   ) |
* | || || || (___) || |      | (____)|| |   | || (_____   | (__       |  |  | |   | |
* | |(_)| ||  ___  || |      |     __)| |   | |(_____  )  |  __)      |  |  | |   | |
* | |   | || (   ) || |      | (\ (   | |   | |      ) |  | (         |  |  | |   | |
* | )   ( || )   ( || (____/\| ) \ \__| (___) |/\____) |  | )      |\_)  )  | (___) |
* |/     \||/     \|(_______/|/   \__/(_______)\_______)  |/       (____/   (_______)
**************************************************************************************
* Selection screen :
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
DEFINE sel_begin_block.
  selection-screen begin of block b&1 with frame title text-b&1.
END-OF-DEFINITION.
DEFINE sel_end_block.
  selection-screen end of block b&1.
END-OF-DEFINITION.
DEFINE sel_comment.
  selection-screen : begin of line,
                     comment 01(79) &1,
                     end of line.
END-OF-DEFINITION.
DEFINE sel_comment2.
  " To be used on block in another block
  selection-screen : begin of line,
                     comment 01(75) &1,
                     end of line.
END-OF-DEFINITION.
DEFINE sel_skip_line.
  selection-screen skip 1.
END-OF-DEFINITION.
DEFINE sel_comment_with_margin.
  selection-screen : begin of line,
                     comment &1(79) &2,
                     end of line.
END-OF-DEFINITION.
**************************************************************************************
* Report :
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
DEFINE write_in_red.
  format color col_negative.
  write : / &1, &2, &3, &4.
  format color col_background.
END-OF-DEFINITION.
DEFINE write_in_yellow.
  format color col_total.
  write : / &1, &2, &3, &4.
  format color col_background.
END-OF-DEFINITION.
DEFINE write_in_blue.
  format color col_heading.
  write : / &1, &2, &3, &4.
  format color col_background.
END-OF-DEFINITION.
DEFINE write_in_green.
  format color col_positive.
  write : / &1, &2, &3, &4.
  format color col_background.
END-OF-DEFINITION.
**************************************************************************************

 

Example of use of theses macros for selection screen :


*----------------------------------------------------------------------*
* SELECTION-SCREEN
*----------------------------------------------------------------------*
TABLES : mara.


*======================================================================*
sel_begin_block 01. " Titre = text-b01 = Information
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

sel_comment text-c01.
sel_comment text-c02.
sel_comment text-c03.
sel_skip_line.
sel_comment text-c04.

*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
sel_end_block 01.
*======================================================================*

*======================================================================*
sel_begin_block 02. " Titre = text-b02 = Filtres
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

sel_comment text-c11.
SELECT-OPTIONS : s_matnr FOR mara-matnr.
PARAMETERS : p_param TYPE aufnr.
sel_skip_line.

*----------------------------------------------------------------------*
sel_begin_block 03. " Titre = text-b03 = Sous bloc avec titre
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

sel_comment2 text-c21.
sel_comment2 text-c22.
sel_comment2 text-c23.
sel_comment2 text-c24.
sel_comment2 text-c25.


*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
sel_end_block 03.
*----------------------------------------------------------------------*

*----------------------------------------------------------------------*
sel_begin_block 04. " Pas de titre = text-b04 non défini
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*

sel_comment2 text-c31.

*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
sel_end_block 04.
*----------------------------------------------------------------------*

*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
sel_end_block 02.
*======================================================================*

 

Result :

Texts used :

About the author

fjourneau administrator

Hi, I'm Florian Journeau, SAP ABAP R3 Freelance, based in Toulouse, France. You want to know more about me, have a look on my CV : cv.fjourneau.net.

Leave a Reply