专栏首页Jerry的SAP技术分享一个占据SAP BSP应用占据存储空间的小工具

一个占据SAP BSP应用占据存储空间的小工具

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:

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

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

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

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • A simple tool to calculate the total size of a BSP application

    Today Ben asks me whether there is some tool which can allow us to get a draft e...

    Jerry Wang
  • Jerry文章《浅谈Java和SAP ABAP的静态代理和动态代理,以及ABAP面向切面编程的尝试一文的源代码》

    这个类是Jerry仿照Java CGLIB(Code Generation Library)创建的, 针对传入的一个ABAP类,能创建一个生命周期只有当前会话(...

    Jerry Wang
  • Jerry 2016年5月20日到5月23日的学习笔记

    来自己debug 取数逻辑。通过这个练习,加深了CDS里query view和一般的CDS view的区别:

    Jerry Wang
  • A simple tool to calculate the total size of a BSP application

    Today Ben asks me whether there is some tool which can allow us to get a draft e...

    Jerry Wang
  • 针对B端产品,如何顺利开展workshop?

    各位B端产品/需求分析的同学一定对workshop这个名词不陌生,它的中文名是需求访谈会。个人对C端产品不熟,本文也仅就B端产品的访谈聊一聊个人经验。本文适合0...

    物流IT圈
  • 原生JS | 当兔子遇到鸡

    HTML5学堂-码匠:当兔子遇到鸡,会怎样呢?先别急,看个小视频~ 视频内容 当兔子遇到鸡 —— 不要害怕和别人不一样,在这个世界上,你就是独一无二的自己! 不...

    HTML5学堂
  • 字符串长度最大乘积

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 ...

    喜欢ctrl的cxk
  • ajax异步操作1

    ajaxTest.html <html> <head> <meta http-equiv="Content-Type" content="text/htm...

    闵开慧
  • SpringBoot中使用Freemarker构建邮件模板

    本文是vhr系列的第十三篇,项目地址:https://github.com/lenve/vhr 当邮件内容比较简单的时候,我们可能一行字符串就能表达所有意思...

    江南一点雨
  • SQL功能

    Grant语句的语义:将指定操作对象(对象类型 对象表)的指定操作权限(权限表)授予指定的用户(用户表)

    ellipse

扫码关注云+社区

领取腾讯云代金券