Tuesday, June 16, 2026

Search SAPMV45A includes for Constants and Statics

 This report can find CONSTANTS and STATICS in SAPMV45A Z-includes. We know that Constants and Statics consume global variables so identifying them can help reduce their usage and improve GV count. 






*&---------------------------------------------------------------------*
*& Report ZGB_TEST_36
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zzcoe_sd_include_search.

TYPESBEGIN OF lty_coding_ext,
         funcname      TYPE trdir-name,
         context(40)   TYPE c,
         lfdnr(5)      TYPE n,
         lineno(5)     TYPE n,
         codeline(255TYPE c,
       END OF lty_coding_ext.

TYPESBEGIN OF lty_include,
         include TYPE repid,
       END OF lty_include.

DATAlt_include            TYPE TABLE OF lty_include.
DATAlt_statement          TYPE TABLE OF lty_coding_ext.
DATAls_statement          TYPE          lty_coding_ext.
DATAls_include            TYPE          lty_include.

DATA lt_gen_limit TYPE TABLE OF progname.

DATAlv_string TYPE string.

*PARAMETERS:
* pa_text TYPE char50 DEFAULT 'CONSTANTS'.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-b01.
  PARAMETERS:
    rb_con RADIOBUTTON GROUP rb1 DEFAULT 'X',
    rb_sta RADIOBUTTON GROUP rb1.
*    rb_ref RADIOBUTTON GROUP rb1.
SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.

  IF rb_con IS NOT INITIAL.
    lv_string 'CONSTANTS'.
  ENDIF.

  IF rb_sta IS NOT INITIAL.
    lv_string 'STATICS'.
  ENDIF.

*  IF rb_ref IS NOT INITIAL.
*    lv_string = '=>'.
*  ENDIF.

*  MOVE pa_text TO lv_string.


  CALL FUNCTION 'RS_GET_ALL_INCLUDES'
    EXPORTING
      program      'SAPMV45A'
*     WITH_INACTIVE_INCLS          = ABAP_FALSE
*     WITH_RESERVED_INCLUDES       = ABAP_FALSE
*     WITH_CLASS_INCLUDES          = ABAP_TRUE
*     WITH_E_INCLUDES              = ABAP_FALSE
    TABLES
      includetab   lt_gen_limit
    EXCEPTIONS
      not_existent 1
      no_program   2
      OTHERS       3.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.

  LOOP AT lt_gen_limit ASSIGNING FIELD-SYMBOL(<lfs_gen_limit>).

    IF <lfs_gen_limit>+0(1'Y' OR <lfs_gen_limit>+0(1'Z'.
      ls_include-include <lfs_gen_limit>.
      APPEND ls_include TO lt_include.
    ENDIF.
  ENDLOOP.

*ls_include-include = 'ZOTCE0229_POE_FOR_RETURNS'.
*
*APPEND ls_include TO lt_include.

  CALL FUNCTION 'AA_CUS_SCAN_PROG_FOR_STRING'
    EXPORTING
      id_string1 lv_string
*     ID_STRING2 = lv_string
*     ID_PROGRAM =
* IMPORTING
*     EF_FOUND   =
    TABLES
      it_program lt_include
      et_coding  lt_statement.



*LOOP AT lt_statement INTO ls_statement.
*  WRITE: / ls_statement-funcname,
*           ls_statement-context,
*           ls_statement-lfdnr,
*           ls_statement-lineno,
*           ls_statement-codeline.
*ENDLOOP.



*==============Display ALV==================*
  DATAgr_table TYPE REF TO cl_salv_table.
  TRY.
      CALL METHOD cl_salv_table=>factory
        IMPORTING
          r_salv_table gr_table
        CHANGING
          t_table      lt_statement" Provide the table name
    CATCH cx_salv_msg.
  ENDTRY.
  TRY.
      gr_table->get_columns)->get_column'CODELINE' )->set_leading_spacesabap_true ).
    CATCH cx_salv_not_found.
  ENDTRY.

*... Display Table
  gr_table->display).

Monday, June 15, 2026

How to Implement SAP Clean Core in SAP System(e.g. HANA 2023 on-premise)

 To check for clean core related notes / latest updates check SAP Note

3627152 - SAP Note Analyzer Files for ATC Checks Related to Clean Core

https://me.sap.com/notes/3627152

Implement SAP Notes in your local/central check system using Note Analyzer by processing the following steps:

  1. Launch transaction SNOTE.
  2. In the menu bar, select "Goto > Other tools > Launch Note Analyzer".
  3. Upload the file SAP-NOTE-3627152-CENTRAL.xml available as attachment to this SAP Note. You can now process the notes using SAP Note Analyzer.



Implement all the notes. The lights should be green.

It is also recommended to apply SAP Notes in checked systems (i.e., systems that will be analyzed by Analyze Custom Code app or ATC). Update your checked systems using SAP Note Analyzer by processing the following steps:

  1. Launch transaction SNOTE.
  2. In the menu bar, select "Goto > Other tools > Launch Note Analyzer".

All notes need to be implemented and lights should be green.

Search SAPMV45A includes for Constants and Statics

 This report can find CONSTANTS and STATICS in SAPMV45A Z-includes. We know that Constants and Statics consume global variables so identifyi...