<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: unused custom code ABAP in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700761#M31891</link>
    <description>&lt;P&gt;"&lt;EM&gt;we've somewhat relied on a old custom-process which updates a counter 
for executions of programs in a Z-table. This is done via a modification
 in the ABAP-runtime program from where a function module gets called.&lt;/EM&gt;"&lt;/P&gt;&lt;P&gt;What modification in the ABAP-runtime have you done ? What is the name of this standard object(s) ? &lt;/P&gt;</description>
    <pubDate>Sun, 11 Nov 2018 10:28:37 GMT</pubDate>
    <dc:creator>chaouki_akir</dc:creator>
    <dc:date>2018-11-11T10:28:37Z</dc:date>
    <item>
      <title>unused custom code ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700750#M31880</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
  &lt;P&gt;Is there a way in ABAP to find unused custom code by executing any standard reports.&lt;/P&gt;
  &lt;P&gt;Regards&lt;/P&gt;
  &lt;P&gt;Jude&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2018 10:34:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700750#M31880</guid>
      <dc:creator>former_member551354</dc:creator>
      <dc:date>2018-11-08T10:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: unused custom code ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700751#M31881</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;There is nothing standard available to retrieve unused code. But if you mean within 1 report, the extended check can come up with code that is not used.&lt;/P&gt;&lt;P&gt;Please explain exactly what you want and what you're trying to achieve.&lt;/P&gt;&lt;P&gt;Kind regards, Rob Dielemans&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2018 12:15:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700751#M31881</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-11-08T12:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: unused custom code ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700752#M31882</link>
      <description>&lt;P&gt;Hi Jude,&lt;/P&gt;&lt;P&gt;you can use transaction SCMON to monitor the usage of custom code. But: you need to do it for a certain period of time.&lt;/P&gt;&lt;P&gt;See &lt;A href="https://blogs.sap.com/2017/04/06/abap-call-monitor-scmon-analyze-usage-of-your-code/"&gt;https://blogs.sap.com/2017/04/06/abap-call-monitor-scmon-analyze-usage-of-your-code/ &lt;/A&gt;for further details.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Olga.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2018 12:24:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700752#M31882</guid>
      <dc:creator>OlgaDolinskaja</dc:creator>
      <dc:date>2018-11-08T12:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: unused custom code ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700753#M31883</link>
      <description>&lt;P&gt;unused custom code means commented one or the Z Programs ?&lt;/P&gt;&lt;P&gt;K.Kiran.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2018 13:05:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700753#M31883</guid>
      <dc:creator>kiran_k8</dc:creator>
      <dc:date>2018-11-08T13:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: unused custom code ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700754#M31884</link>
      <description>&lt;P&gt;Hi Olga,&lt;/P&gt;&lt;P&gt;I have seen this blog, however my AS ABAP version is 7.40, i do have solman 7.2 but when i run through the setup i see few SAP notes to be implemented but my version does not fulfill the prerequisites hence looking for a report or a way to extract it with in the system not via solman&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Jude&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 06:10:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700754#M31884</guid>
      <dc:creator>former_member551354</dc:creator>
      <dc:date>2018-11-09T06:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: unused custom code ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700755#M31885</link>
      <description>&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;Functional team wants to remove all the unused custom codes from the system, this is what they want to achieve.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Jude&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 06:11:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700755#M31885</guid>
      <dc:creator>former_member551354</dc:creator>
      <dc:date>2018-11-09T06:11:33Z</dc:date>
    </item>
    <item>
      <title>Re: unused custom code ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700756#M31886</link>
      <description>&lt;P&gt; &lt;SPAN class="mention-scrubbed"&gt;judemelvin&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;Hi Jude,&lt;/P&gt;&lt;P&gt;we are currently having similar discussions, so here is some feedback, based on systems running on NW 750 with EHP8 on HANA-DB:&lt;/P&gt;&lt;P&gt;Removing unused custom code from the system right away just because it looks as if a program is no longer used, may not be the best approach. If it's a rarely run but important program this can cause quite a few hassles when the program is needed again. So, for starters you need at least one year's worth of runtime information before you make such a decision to ensure that you at the very least capture executions for month- and year-end-closing.&lt;/P&gt;&lt;P&gt;The way we have been tackling this, is to simply flag presumably no longer needed programs as obsolete via an entry in a Z-table. If somebody then comes along and requires the program again, all that is needed is to delete the flag which obviously is much more hassle-free than having to recreated the program from scratch (or versioning).&lt;/P&gt;&lt;P&gt;Once a program has been in this incactive-state for some time, we may make the decision to physically delete it. But that then entails to also (and as a first step) delete all the variants and transactions which may exist in the systems for the program.&lt;/P&gt;&lt;P&gt;In order to know which programs are candidates for deactivation we've somewhat relied on a old custom-process which updates a counter for executions of programs in a Z-table. This is done via a modification in the ABAP-runtime program from where a function module gets called. This however only works for report programs started via a selection-screen and - as we recently noticed - doesn't necessarily capture all executions.&lt;/P&gt;&lt;P&gt;I created a program which queries this Z-table and recently enhanced it by also retrieving data from ST03N via function module SAPWL_WORKLOAD_GET_STATISTIC. The code to do that is a bit complex due to the way the retrieved data looks (and the FM has not been released by SAP) but it works and provides better data for more programs than our Z-process.&lt;/P&gt;&lt;P&gt;My not really pretty code looks like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  DATA: lv_date LIKE sy-datum.
  DATA: lt_usertcode TYPE STANDARD TABLE OF sapwlustcx,
        ls_usertcode TYPE sapwlustcx.

  DATA: BEGIN OF ls_st03n,
          report LIKE trdir-name,
          tcode  LIKE tstc-tcode,
          count  LIKE sapwlustcx-count,
        END OF   ls_st03n.

  DATA: lt_st03n LIKE TABLE OF ls_st03n.

  DATA: ls_st03n_all LIKE gs_st03n,
        lt_st03n_all LIKE gt_st03n.

  DATA: BEGIN OF ls_tcode,
          tcode TYPE tstc-tcode,
        END OF   ls_tcode.

  DATA: lt_tcode LIKE STANDARD TABLE OF ls_tcode.

  DATA: BEGIN OF ls_tstc,
          tcode TYPE tstc-tcode,
          pgmna TYPE tstc-pgmna,
        END OF   ls_tstc,
        lt_tstc LIKE STANDARD TABLE OF ls_tstc.

  FIELD-SYMBOLS: &amp;lt;fs_st03n&amp;gt; LIKE ls_st03n.

  "You need to have a start date
  lv_date = gv_st03n_date.
  lv_date+6(2) = '01'.

  "For each month determine ST03N data - all the data will be retrieved!
  DO.

    CLEAR lt_usertcode.

    CALL FUNCTION 'SAPWL_WORKLOAD_GET_STATISTIC'
      EXPORTING
        periodtype            = 'M'
        startdate             = lv_date
        instance              = 'TOTAL'
      TABLES
        application_statistic = lt_usertcode
      EXCEPTIONS
        unknown_periodtype    = 1
        no_data_found         = 2
        no_server_given       = 3
        OTHERS                = 4.

    IF sy-subrc EQ 0.

      "Returned table lt_usertcode gives either the reportname or
      "the tcode in field entry_id. What it is needs to be determined
      "via the "T" or "R" at the end of the field
      LOOP AT lt_usertcode INTO ls_usertcode.
        CLEAR ls_st03n.
        ls_st03n-count = ls_usertcode-count.
        IF ls_usertcode-entry_id+72(1) EQ 'T' AND
           ls_usertcode-entry_id(1)    EQ 'Z'.
          "Entry is for a Z-TCode
          ls_st03n-tcode = ls_usertcode-entry_id(20).
          "Store Z-TCodes for upcoming look-up
          "of report names
          ls_tcode-tcode = ls_usertcode-entry_id(20).
          COLLECT ls_tcode INTO lt_tcode.
        ELSEIF ls_usertcode-entry_id(1)    EQ 'Z'.
          ls_st03n-report = ls_usertcode-entry_id(40).
        ENDIF.
        IF ls_st03n-report IS NOT INITIAL OR
           ls_st03n-tcode  IS NOT INITIAL.
          COLLECT ls_st03n INTO lt_st03n.
        ENDIF.
      ENDLOOP.
    ENDIF.

    "Get next month until date larger than today
    CALL FUNCTION 'MONTH_PLUS_DETERMINE'
      EXPORTING
        months  = 1
        olddate = lv_date
      IMPORTING
        newdate = lv_date.

    IF lv_date GT sy-datum.
      EXIT.
    ENDIF.

  ENDDO.

  "Get reportnames for TCodes from TSTC
  IF lt_tcode IS NOT INITIAL.

    SELECT tcode, pgmna
      FROM tstc
      INTO CORRESPONDING FIELDS OF TABLE @lt_tstc
       FOR ALL ENTRIES IN @lt_tcode
     WHERE tcode = @lt_tcode-tcode.

    IF sy-subrc EQ 0.
      SORT lt_tstc BY tcode.
    ENDIF.
  ENDIF.

  "Collect all data based on reportname into final table
  LOOP AT lt_st03n INTO ls_st03n.

    ls_st03n_all-count = ls_st03n-count.

    "Get reportname if ST03N-data contained TCode
    IF ls_st03n-tcode IS NOT INITIAL.
      READ TABLE lt_tstc INTO ls_tstc
                         WITH KEY tcode = ls_st03n-tcode
                         BINARY SEARCH.

      IF sy-subrc EQ 0 AND
         ls_tstc-pgmna IS NOT INITIAL.
        ls_st03n_all-report = ls_tstc-pgmna.
      ENDIF.
    ELSE.
      ls_st03n_all-report = ls_st03n-report.
    ENDIF.

    COLLECT ls_st03n_all INTO lt_st03n_all.

  ENDLOOP.

  SORT lt_st03n_all BY report.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;For this to work, ST03N data collection has to have been active in your system(s) for as long as possible, otherwise you'll not get anything meaningful back.&lt;/P&gt;&lt;P&gt;We are currently looking into getting "proper" data via SCMON but are facing some technical issues which are already beeing looked at. So, for the time being we keep relying on our stitched-together custom solution.&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Bärbel&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 08:14:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700756#M31886</guid>
      <dc:creator>BaerbelWinkler</dc:creator>
      <dc:date>2018-11-09T08:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: unused custom code ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700757#M31887</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;In my backend system (ST-PI 7.40 SP06), the transaction is /SDF/SCMON instead of SCMON. Did you try to run it in your ABAP system ?&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 13:45:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700757#M31887</guid>
      <dc:creator>Nicolas</dc:creator>
      <dc:date>2018-11-09T13:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: unused custom code ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700758#M31888</link>
      <description>&lt;P&gt;I'm fascinated. Why does the functional team want to remove unused code from the system? That has absolutely zero relevance to functional analysts - their work is in MM, LM, BI etc...&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 22:52:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700758#M31888</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2018-11-09T22:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: unused custom code ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700759#M31889</link>
      <description>&lt;P&gt;Hello Jude,&lt;/P&gt;&lt;P&gt;The Code Inspector is a tool that offers different static checks of program code. It can be called by right-clicking on the program name in the Object Navigator and select &lt;STRONG&gt;Check -&amp;gt; Code Inspector &lt;/STRONG&gt;from the context menu. Also, it can be called separately using transaction code &lt;STRONG&gt;SCI&lt;/STRONG&gt;. This way, you can create your own check variants. The initial screen looks like in the following picture.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/242272-b2h2g.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Inspection &lt;/STRONG&gt;field is used if the result shall be saved or execution performed in a background job. &lt;STRONG&gt;Object Set &lt;/STRONG&gt;field is used for selecting the repository objects that shall be included in the check. &lt;STRONG&gt;Check Variant &lt;/STRONG&gt;is used to define which checks shall be performed and by clicking on a new button - &lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/242274-mggpf.png" /&gt; you can choose check categories. Under the category &lt;STRONG&gt;Syntax Check/Generation &lt;/STRONG&gt;there is search function &lt;STRONG&gt;Search of ABAP-Tokens&lt;/STRONG&gt;. This way, you can search comments for a particular search string (e.g. *TODO*).&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/242275-code-inspector.jpg" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" /&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you!&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 22:53:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700759#M31889</guid>
      <dc:creator>stefan3</dc:creator>
      <dc:date>2018-11-09T22:53:54Z</dc:date>
    </item>
    <item>
      <title>Re: unused custom code ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700760#M31890</link>
      <description>&lt;P&gt;I worked on a project removing unused code. We used UPL (the predecessor to SCMON). Interesting technical side note - the data is stored in BW cubes, once extracted from the managed systems. But then the data is taken out of those cubes and put into database tables. My suspicion is that the team tasked with building these applications didn't understand how to query cubes...&lt;/P&gt;&lt;P&gt;But anyway.&lt;/P&gt;&lt;P&gt;We used 14 months of data so as to avoid removing yearly run programs. We also put the object key of the object to be delete into a transport of copies, then release that transport - and then deleted the object itself. This way, if we did delete something important, it could be recovered simply be importing the ToC. &lt;/P&gt;&lt;P&gt;Of course, when dealing with tens of thousands of objects, these tasks need some automation. Since you'll be probably storing many objects in a single backup ToC transport, so you'll want to do any recovery into a sandpit system - then just take the objects that you need from there. Interestingly, again, if you look at the code used by SOLMAN on the managed system, it looks like SAP started producing this kind of automation, but gave up - it gets &lt;EM&gt;very &lt;/EM&gt;difficult with function groups.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 23:03:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700760#M31890</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2018-11-09T23:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: unused custom code ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700761#M31891</link>
      <description>&lt;P&gt;"&lt;EM&gt;we've somewhat relied on a old custom-process which updates a counter 
for executions of programs in a Z-table. This is done via a modification
 in the ABAP-runtime program from where a function module gets called.&lt;/EM&gt;"&lt;/P&gt;&lt;P&gt;What modification in the ABAP-runtime have you done ? What is the name of this standard object(s) ? &lt;/P&gt;</description>
      <pubDate>Sun, 11 Nov 2018 10:28:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700761#M31891</guid>
      <dc:creator>chaouki_akir</dc:creator>
      <dc:date>2018-11-11T10:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: unused custom code ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700762#M31892</link>
      <description>&lt;P&gt;Hi Jude,&lt;/P&gt;&lt;P&gt;That is a valueless achievement. A good achievement would be: we want to lower TCO by 10% in 2019.&lt;/P&gt;&lt;P&gt;And reducing the number of custom coded objects is one of several means to reach that goal.&lt;/P&gt;&lt;P&gt;Kind regards, Rob Dielemans&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 11:59:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700762#M31892</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-11-12T11:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: unused custom code ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700763#M31893</link>
      <description>&lt;P&gt; &lt;SPAN class="mention-scrubbed"&gt;chaouki.akir&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;It's just a call to a Z-function module in program RSDBRUNT at the beginning of FORM %_INIT_PAI. Due to its location it only captures - as mentioned above - executions of report-programs with a selection-screen. The modification has been in there for many years without causing issues as far as I know and when it was introduced UPL/SCMON didn't yet exist. But, I don't think that anybody would (or should) approve such a modification today as standard alternatives are available, providing data which is a lot more reliable.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 12:36:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700763#M31893</guid>
      <dc:creator>BaerbelWinkler</dc:creator>
      <dc:date>2018-11-12T12:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: unused custom code ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700764#M31894</link>
      <description>&lt;P&gt;Hi Olga,&lt;/P&gt;&lt;P&gt;Currently I am working on the prerequisites based on your blog, hope i will be able to check the details via solman. &lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 07:10:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unused-custom-code-abap/m-p/700764#M31894</guid>
      <dc:creator>former_member551354</dc:creator>
      <dc:date>2018-11-14T07:10:47Z</dc:date>
    </item>
  </channel>
</rss>

