Skip to Content

Today one of my colleague asks me whether there is some tool which can allow us to get a draft estimation on the size of a BSP application. As far as I know there is no such tool, so I write one by myself. This tool simply fetches source code of all artifacts belonging to a specified BSP application ( js, html, css etc ), accumulate the total number of characters returned by strlen().

You can simply create a report and paste the source code from this blog, execute it by specifying the BSP application name:

/wp-content/uploads/2016/06/clipboard1_977397.png

And the total number of characters in this BSP application is displayed:

/wp-content/uploads/2016/06/clipboard2_977399.png

According to ABAP help, in Unicode system 1 char occupies 2 bytes:

/wp-content/uploads/2016/06/clipboard3_977400.png

So in the example below the BSP application CRM_OPPRTNTY occupies at least 2011344 * 2 = 4022688 bytes.

Source code of report:

REPORT zbsp.
PARAMETERS: bspname TYPE o2pagdir-applname OBLIGATORY DEFAULT 'CRM_OPPRTNTY'.
TYPES:
     BEGIN OF ty_view_source,
       applname TYPE o2pagdir-applname,
       pagekey  TYPE o2pagdir-pagekey,
       source   TYPE o2pageline_table,
     END OF ty_view_source .
TYPES:
  tt_view_source TYPE STANDARD TABLE OF ty_view_source WITH KEY
  applname pagekey .
DATA: ls_pagecon_key TYPE o2pconkey,
  lt_view_source TYPE tt_view_source,
  lv_total TYPE i VALUE 0,
  lv_each TYPE i.
FIELD-SYMBOLS: <line> LIKE LINE OF lt_view_source.
START-OF-SELECTION.
  PERFORM main.
FORM main.
  SELECT applname pagekey FROM o2pagdir INTO CORRESPONDING FIELDS OF TABLE
     lt_view_source WHERE applname = bspname.
  ls_pagecon_key-objtype = 'PD'.
  ls_pagecon_key-version = 'A'.
  LOOP AT lt_view_source ASSIGNING <line>.
    ls_pagecon_key-applname = <line>-applname.
    ls_pagecon_key-pagekey = <line>-pagekey.
    IMPORT content    TO  <line>-source
       FROM DATABASE o2pagcon(tr) ID ls_pagecon_key
       ACCEPTING PADDING IGNORING CONVERSION ERRORS.
    PERFORM get_char_number USING <line>-source CHANGING lv_each.
    lv_total = lv_total + lv_each.
    WRITE: / <line>-pagekey COLOR COL_NEGATIVE, lv_each COLOR COL_KEY.
  ENDLOOP.
  WRITE: / 'total number of characters: ' COLOR COL_NEGATIVE , lv_total COLOR COL_GROUP.
ENDFORM.                    "MAIN
FORM get_char_number USING it_source TYPE o2pageline_table CHANGING cv_size TYPE i.
  CLEAR: cv_size.
  FIELD-SYMBOLS: <source> LIKE LINE OF it_source.
  LOOP AT it_source ASSIGNING <source>.
    cv_size = cv_size + strlen( <source> ).
  ENDLOOP.
ENDFORM.                    "GET_CHAR_NUMBER
To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply