Quick Tip

Quick Tip

In our ABAP programs, performance problems are often reported to us. We begin to analyze TABLES accesses. It is also very important variables or internal tables that are used in METHODS or ROUTINES that are loaded every time we execute a process. We must see, if these variables or internal tables can be loaded only once.

How do we achieve this? Declaring these variables and internal tables with STATICS, not with the DATA instruction.

Example.

STATICS: TL_RANGEUSER TYPE STANDARD TABLE OF ZFIGET_TVARVC=>TS_DATA.
STATICS: TL_RANGETX TYPE STANDARD TABLE OF ZFIGET_TVARVC=>TS_DATA.

*$. LEE USUARIO
IF LINES( TL_RANGEUSER  ) EQ 0.
  ZFIGET_TVARVC=>GET_RANGE( EXPORTING IV_NAME = 'ZR2R_USUARIO_DEVPROV'
                                IMPORTING  ER_RANGE = TL_RANGEUSER  ).
ENDIF.
* $. LEE TRANSACCIONES
IF LINES( TL_RANGETX  ) EQ 0.
  ZFIGET_TVARVC=>GET_RANGE( EXPORTING IV_NAME =  'ZR2R_TRANSACCION'
                            IMPORTING  ER_RANGE = TL_RANGETX   ).
ENDIF.        

In this case I fill 2 ranges that would only be loaded once, validating if the internal table is empty it is not necessary that every time my method is executed the ranges are loaded.

Doing this with our program we can observe that the performance improves a lot.


Sadullah TANRIKULU

ABAP || Javascript || Life Coach

1 年

First thanks for this great blog. ???? Second I have a question because not knowing it. In OOP we can use constructor method which is loaded once when the class was created, right? I suppose that some developers use this. Maybe I'm completely wrong but no matter. I'm waiting for a senior response to learn something new.

回复

要查看或添加评论,请登录

Sergio Cannelli的更多文章

  • How to Build Fiori App using CPI integration API?

    How to Build Fiori App using CPI integration API?

    Building a Fiori app using SAP Cloud Platform Integration (CPI) integration APIs involves several steps, including…

    2 条评论
  • Overview

    Overview

    Intro SAP Fiori elements is a framework that comprises the most commonly used floorplan templates and is designed to:…

    1 条评论
  • CAP vs. RAP

    CAP vs. RAP

    In this publication I share clear points of view to be able to choose between these 2 programming models. SAP…

  • SAP Developer News

    SAP Developer News

    SAP CodeJams LATAM Wrap Up Request your own SAP CodeJam: https://sap.to/6054lNo2i ABAP CDS 2408 Release & External…

  • What difference would it make to use CDS View instead of table name in select query?

    What difference would it make to use CDS View instead of table name in select query?

    In our projects, possibly at the technology or functional user level we are shown data at the table level. In the…

    1 条评论
  • 11 ERP Trends for 2024 and Beyond....

    11 ERP Trends for 2024 and Beyond....

    This last time, I have been questioning myself. What is the future of SAP?.

    2 条评论
  • SAP products: Name changes

    SAP products: Name changes

    I have been asked about three specific SAP products and their names, I am sharing a short post with a summary on this…

  • SAP BTP es igual a SAP SCP?

    SAP BTP es igual a SAP SCP?

    Muchos se preguntan qué es SAP BTP. ?Comparación con SCP?.

  • Vistas CDS basadas en diccionario y las nuevas Entity View

    Vistas CDS basadas en diccionario y las nuevas Entity View

    En esta publicación comparto el uso de ambas tecnologías y sus diferencias. ?Alguna vez has intentado desarrollar…

    1 条评论
  • Próximo SAP GUI 8.0

    Próximo SAP GUI 8.0

    Con la llegada de SAP GUI 8.0 en el primer cuatrimestre de 2023, comparto algunas notas importantes que recopile de…

社区洞察

其他会员也浏览了