PROMO JULIO en CVOSOFT United States Of America: 💎Calidad, 🔥Bonificaciones, 🥶Precios Congelados y MÁS!

 X 

✒️ABAP La performance en ABAP

ABAP La performance en ABAP

ABAP La performance en ABAP

Performance in ABAP

Performance refers to the analysis of the execution and efficiency of ABAP programs. In this analysis, there are three fundamental aspects:

  • The processing time of the program logic.
  • The processing time of accesses to database tables.
  • The processing time of the ABAP system.

Of these three times, the most resource-consuming one is the processing time of accesses to database tables, followed by the processing of logic, and finally the processing of the ABAP system.

For this analysis, we have the transaction SE30, which evaluates how the execution and processing time of the program are distributed.

To do this, upon entry, the name of the program is indicated, and the Evaluate button is pressed. This will show us how the percentage distribution of processing times for ABAP logic, the database, and the system.

The ideal situation would be for the highest percentage of processing to be the ABAP logic and the lowest to be the database table. To achieve this, it is necessary to adhere to good programming practices.

Good and Bad Practices in Database Access

  • Avoid SELECT*: The SELECT* statement retrieves ALL data from the specified or indicated table. Instead of fetching all, it is suggested to specify which data needs to be retrieved, like so:

Wrong:

SELECT * FROM zuser_table INTO TABLE it_users.

Right:

SELECT user_id, username, email
FROM zuser_table
INTO TABLE it_users.

  • Avoid SELECT ENDSELECT: The SELECT ENDSELECT statement generates a loop to process records retrieved from another database table. However, it's more efficient to use SELECT INTO TABLE.

Wrong:

SELECT * FROM zuser_table INTO TABLE it_users.
ENDSELECT.

Right:

SELECT user_id, username, email
FROM zuser_table
INTO TABLE it_users.

  • Avoid SELECT without WHERE: When using the SELECT statement without a condition, ALL records from the database table are processed or fetched. It is ideal to use WHERE with as many specifications as possible to reduce processing to what is necessary. It is also suggested to avoid negative conditions or the use of NE.

Wrong:

SELECT * FROM zuser_table INTO TABLE it_users.

Right:

SELECT user_id, username, email
FROM zuser_table
WHERE is_active = 'X'
INTO TABLE it_users.

  • Avoid SELECT within a LOOP: Executing one or more SELECT statements within a LOOP ENDLOOP will result in selecting each record while looping through the table. It's possible to use a SELECT SINGLE with specific conditions to select the first applicable case. Or retrieve all necessary records in internal tables first, then within the LOOP, access them using the READ TABLE statement. Additionally, retrieving all records from database table executes FOR ALL ENTRIES within the SELECT to retrieve records from the database into memory.

Wrong:

LOOP AT it_orders INTO wa_order.
SELECT * FROM zuser_table INTO wa_user WHERE user_id = wa_order-user_id.
" Process user data...
ENDLOOP.

Right:

SELECT * FROM zuser_table INTO TABLE @it_users WHERE user_id IN @it_orders-user_id.

LOOP AT it_orders INTO wa_order.
" Access user data from it_users table...
ENDLOOP.

  • Avoid using INSERT, UPDATE, MODIFY, and DELETE statements within a LOOP: Doing this inside the LOOP will generate a longer table and require more resources. Instead, it is recommended to use these statements at the end or outside the LOOP.

Wrong:

LOOP AT it_items INTO wa_item.
INSERT INTO zitem_table VALUES wa_item.
ENDLOOP.

Right:

INSERT zitem_table FROM TABLE it_items.

  • SELECT vs JOIN: When data from multiple database tables is required, using SELECT after SELECT is not recommended. Instead, use the JOIN statement as necessary. For example:

Wrong:

SELECT carrid, connid FROM spfli INTO TABLE @it_spfli.
SELECT dldate, planetype FROM sflight INTO TABLE @it_sflight.

Right:

SELECT tl~carrid, tl~connid, t2~dldate, t2~planetype, tl~countryfl
FROM spfli AS tl
INNER JOIN sflight AS t2
ON tl~carrid = t2~carrid AND tl~connid = t2~connid
INTO TABLE @it_combined_data.

Good and Bad Practices in ABAP Logic Processing

  • READ TABLE BINARY SEARCH: When searching for a record in a table using the READ TABLE statement, the search is done sequentially. However, binary search partitions the table, searching in halves, offering better performance. To implement it, the search field in the internal table must be sorted ascendingly or descendingly, and add the BINARY SEARCH clause at the end of the READ TABLE:

Bad Practice:

READ TABLE it_suppliers INTO wa_suppliers WITH KEY name = 'Ariel'.

Good Practice:

SORT it_suppliers BY name ASCENDING.
READ TABLE it_suppliers INTO wa_suppliers WITH KEY name = 'Ariel' BINARY SEARCH.

  • Avoid LOOP ENDLOOP within another LOOP ENDLOOP: Performing LOOPS within another LOOP generates an exponential search for records. It's suggested to use the WHERE conditional and binary search to optimize processing, like so:

Bad Practice:

LOOP AT it_suppliers INTO wa_suppliers.
LOOP AT it_users INTO wa_users.
" Processing logic
ENDLOOP.
ENDLOOP.

Good Practice:

SORT it_users BY name ASCENDING.
LOOP AT it_suppliers INTO wa_suppliers WHERE dni GT '50000000'.
READ TABLE it_users INTO wa_user WITH KEY dni = wa_suppliers-dni BINARY SEARCH.
ENDLOOP.

  • LOOP CHECK vs LOOP WHERE: While CHECK and IF-ENDIF statements can be used as filters within a LOOP, they are not recommended as they read all records. It's optimal to implement WHERE with specific conditions.

Bad Practice:

LOOP AT it_customers INTO wa_customer.
CHECK wa_customer-status = 'Active'.
" Processing logic for active customers
ENDLOOP.

Good Practice:

LOOP AT it_customers INTO wa_customer WHERE status = 'Active'.
" Processing logic for active customers
ENDLOOP.

  • Don't forget WHEN OTHERS in CASE statement: In the CASE-ENDCASE conditional, it's crucial to specify the case where none of the indicated cases are found, as otherwise, the system will throw an error or lead to unexpected situations. Implement the alternative WHEN OTHERS.

Bad Practice:

CASE lv_condition.
WHEN 'A'.
" Case A logic
WHEN 'B'.
" Case B logic
ENDCASE.

Good Practice:

CASE lv_condition.
WHEN 'A'.
" Case A logic
WHEN 'B'.
" Case B logic
WHEN OTHERS.
" Handling unexpected conditions
ENDCASE.

  • APPEND from one internal table to another internal table: When adding records from one internal table to another of the same type, the worst option is to take the content of one table in a LOOP, transferring the information record by record to the other table. Instead, it's more efficient to use the APPEND LINES OF statement in a single line to transfer the content from one table to another, like so:

Bad Practice:

LOOP AT itab1 INTO wa_itab1.
APPEND wa_itab1 TO itab2.
ENDLOOP.

Good Practice:

APPEND LINES OF itab1 TO itab2.

  • INSERT from one internal table to another internal table: When it's necessary to insert records from one internal table to another of the same type, the worst option is to insert record by record from one table to another. Instead, it's optimal to insert the content at a specific position from one table to another using the INSERT LINES OF statement, like so:

Bad Practice:

LOOP AT itab1 INTO wa_itab1.
INSERT wa_itab1 INTO TABLE itab2.
ENDLOOP.

Good Practice:

INSERT LINES OF itab1 INTO TABLE itab2 INDEX lv_index.

  • Removing duplicate records from an internal table: When it's necessary to check and eliminate duplicate records from a table, primarily, the fields to be examined must be sorted. The worst option would be to check record by record if the first record looks like the next one and if so, delete it. However, it's possible to use the DELETE ADJACENT DUPLICATES statement along with COMPARING to compare the specified fields in this process.

Bad Practice:

DELETE ADJACENT DUPLICATES FROM itab.

Good Practice:

DELETE ADJACENT DUPLICATES FROM itab COMPARING field1 field2.

  • Copying internal tables: When it's necessary to copy records from one internal table to another of the same type, the worst option is to clear the content of one table to pass the information from the other there. However, it's optimal to assign table1[] = table2[], overriding the content of one table with another.

Bad Practice:

CLEAR itab2.

LOOP AT itab1 INTO wa_itab1.
APPEND wa_itab1 TO itab2.
ENDLOOP.

Good Practice:

itab2[] = itab1[].

  • Comparison of internal tables: When it's necessary to compare two internal tables to determine if their content is the same, the worst way is to do it manually. However, there's an optimal way to carry out this task using an IF-ENDIF within which the tables will be assigned, and in a single line, it will be determined if there's a duplicate, like so:

Bad Practice:

LOOP AT itab1 INTO wa_itab1.
READ TABLE itab2 INTO wa_itab2 WITH KEY field1 = wa_itab1-field1.

IF sy-subrc <> 0.
" Records not matching
ENDIF.
ENDLOOP.

Good Practice:

IF itab1[] = itab2[].
" Processing logic for equal tables
ENDIF.


 

 

 


Sobre el autor

Publicación académica de Jaime Eduardo Gomez Arango, en su ámbito de estudios para la Carrera Consultor ABAP.

SAP Expert


Jaime Eduardo Gomez Arango

Profesión: Ingeniero de Sistemas y Computación - España - Legajo: SW34C

✒️Autor de: 149 Publicaciones Académicas

🎓Cursando Actualmente: Consultor en SAP Fiori

🎓Egresado de los módulos:

Disponibilidad Laboral: FullTime

Presentación:

Ingeniero de sistemas y computación con 8 años de experiencia el desarrollo frontend & backend (react/node) y en cloud (aws), actualmente desarrollando habilidades en sap btp, ui5, abap y fiori.

Certificación Académica de Jaime Gomez

✒️+Comunidad Académica CVOSOFT

Continúe aprendiendo sobre el tema "La performance en ABAP" de la mano de nuestros alumnos.

SAP Master

PERFORMANCE EN PROGRAMACION ABAP El performance de un programa es el analisis del desempeño y rendimiento de un programa, para esto se va a trabajar con una herramiento de SAP estandar que es sumamente util para el analisis de la performance, esta es la transacción SE30. El objetivo del performance es poder realizar programas de alta calidad, que funcionen perfectamente en el ambiente productivo, que es donde las tablas de las bases de datos contienen millones de registros y cada micro segundo cuenta. Los tiempos de procesamiento de ABAP se dividen en tres: La base de datos, Abap y el sistema, de estos 3 item debemos tomar en cuenta en cuanto a la performance es la base de datos ya que este es el que mas recursos consumen y...

Acceder a esta publicación

Creado y Compartido por: Jesus Enrique Ramos Bello / Disponibilidad Laboral: FullTime + Carta Presentación

*** CVOSOFT - Nuestros Alumnos - Nuestro Mayor Orgullo como Academia ***

SAP Senior

En ABAP existen las buenas y malas practicas porque afectan a la performance de los programas o a la reutilización del código. Performance de los programas Performance: Analisís del desempeño y el rendimiento del programa. - Usaremos la transax. SE30 - presionamos el boton Tips & Tricks - Analizaremos las diferentes prácticas de la programación ABAP - En 2 paneles se compararán fragmentos de código. Los tiempos de procesamiento de un programa ABAP se dividen en 3: ABAP, BD y Sistema. De estos tres items el que debemos tener en cuenta principalmente cuando evaluamos la performance es el tiempo de la BD ya que este es el que mas recursos consumen y por consiguiente es el que mas...

Acceder a esta publicación

Creado y Compartido por: Jesus German Cavazos Elizondo

*** CVOSOFT - Nuestros Alumnos - Nuestro Mayor Orgullo como Academia ***

SAP Senior

Performance ABAP. Performance: Nos referimos al análisis del desempeño de un programa o transacción. Buenas o malas practicas en el performance o utilización de otro código. Transacción estándar: SE30 para el performance dar clic en el botón Tips & Tricks. Verificar todas las carpetas para verificar el performan, seleccionamos un código y ahí damos clic en el botón Medir tiempo ejec. Permite grabar en archivo los códigos que se ejecutan. Permite testear el código que se escribe. Evaluar como se distribuye en tiempo de procesamiento de un programa ABAP. Ingresar el nombre del programa, ejecutar y presionar el botón evaluar.

Acceder a esta publicación

Creado y Compartido por: Rafael Razo

*** CVOSOFT - Nuestros Alumnos - Nuestro Mayor Orgullo como Academia ***

SAP Senior

Performance en abap presionamos el boton trips & tricks y podremos ver carpetas que contienen codigos donde prodremos comparar el performance de ambos codigos. a si podremos saber cuales son las mejores practicas de codigicacion.

Acceder a esta publicación

Creado y Compartido por: Luis Eugenio Leyva Orozco

*** CVOSOFT - Nuestros Alumnos - Nuestro Mayor Orgullo como Academia ***

SAP Senior

Performance en ABAP En ABAP existen buenas y malas practicas sea por que afectan a los Performance de los programas o por que afectan a otros factores determinantes como es la utilización de código. Performance de los programas - se trata del análisis del desempeño y rendimiento del programa. Utilizamos la transacción SE30 para ver las Performance. Una vez dentro pulsamos el botón Tips & Tricks. Abrimos la carpeta SQL Interface y seleccionamos Select aggregates. Vamos a ver dos códigos distintos que dan el mismo resultado. Para evaluar la performance pulsamos el botón Medir tiempo ejecución. Hacemos lo mismo con Select with select list. Aquí podemos ver que especificando...

Acceder a esta publicación

Creado y Compartido por: Ana Schiau

*** CVOSOFT - Nuestros Alumnos - Nuestro Mayor Orgullo como Academia ***

SAP Senior

VIDEO - PERFORMANCE EN ABAP Performance en ABAP El objetivo de esta lección es tener bien claro que prácticas son desaconsejadas y cuales si son recomendadas, de modo de poder apuntar a realizar programas de alta calidad, que funcionen perfectamente en el ambiente productivo, donde las tablas de la BD contienen millones de registros y cada micro segundo cuenta. Los tiempos de procesamiento de un programa ABAP se divide entre ABAP, la BD y el Sistema, de estos tres items el q debemos tener en cuenta principalmente cdo evaluamos la performance es el tiempo de la BD ya q esté es el q más recurso consume y por consiguiente es el q más tiempo requiere, cdo más alto sea el porcentaje del procesamiento de...

Acceder a esta publicación

Creado y Compartido por: Mayra Maria Pino Rodriguez

*** CVOSOFT - Nuestros Alumnos - Nuestro Mayor Orgullo como Academia ***

SAP Master

Cuando Hablamos de performance nos referimos al desempeño del programa, para poder analizar la performance podemos utilizar la transacción SE30 por el botón TIPS & TRICKS donde nos orienta con cuales de las sentencia que son aconsejables utilzar. Los tiempos de procesamiento de un programa ABAP se dividen en tres: ABAP ,la base de datos y el sistema, de los tres el que mas consume recursos es el de la base de datos y es con el que tenemos tener mas cuidado.

Acceder a esta publicación

Creado y Compartido por: William Alejandro Lemus

*** CVOSOFT - Nuestros Alumnos - Nuestro Mayor Orgullo como Academia ***

SAP Senior

Performance en ABAP Para verificar el performance ingresamos a la TX SE30, Aqui presionamos Tips & Tricks en la cual nos recomiendan buenas practicas, nos daran los puntos en el cual podemos programar en ABAP de diferentes manera, y ver su performance, y podemos ver el el tipo de ejecucion. Tiempos de procesamiento se dividen en 3: ABAP: Debe ser lo más ALTO posible BBDD: Debe ser lo más BAJO posible. A tener en cuenta para la performance ya que es lo que más tpo requiere. SISTEMA:

Acceder a esta publicación

Creado y Compartido por: Ruben Dario Martucci / Disponibilidad Laboral: FullTime

*** CVOSOFT - Nuestros Alumnos - Nuestro Mayor Orgullo como Academia ***

SAP Senior

lección 8/9: Video - Performance en ABAP Accedemos a la transacción SE30 clicamos en el botón tips & tricks acáveremos carpetas que contienen archivos con código de consultas en SQL que podremos comparar la performance de ambos códigos (el resultado nos indicara en microsegundos), por sentido comun sabremos que el que tarda menos tiempo en ejecutarse sera el de mayor performance, de tal manera podremos saber cuál es la mejor práctica para desarrollar.

Acceder a esta publicación

Creado y Compartido por: Ruben Santiago Cuenca Balanza / Disponibilidad Laboral: FullTime + Carta Presentación

*** CVOSOFT - Nuestros Alumnos - Nuestro Mayor Orgullo como Academia ***

SAP Expert


PERFORMANCE EN ABAP – LECCION 7-8 PERFORMANCE, cuando hablamos de performance nos referimos al análisis de desempeño de un programa o transacción, para medir la performance de un programa o transacción realizaremos pruebas de rendimiento NOTA, los tiempos de procesamientos de un programa ABAP, se dividen entre ABAP, la base de dato y el sistema, de estos tres ítems el que debemos tener en cuenta principalmente cuando evaluamos la performance, es el tiempo de la base de dato ya que es el que más recursos consume y por consiguiente es el que más tiempo requiere, cuanto más alto sea el porcentaje del procesamiento de la base de dato en comparación a los otros dos porcentajes,...

Acceder a esta publicación

Creado y Compartido por: Cristian Darwin Arteaga Diaz / Disponibilidad Laboral: FullTime + Carta Presentación

 


 

👌Genial!, estos fueron los últimos artículos sobre más de 79.000 publicaciones académicas abiertas, libres y gratuitas compartidas con la comunidad, para acceder a ellas le dejamos el enlace a CVOPEN ACADEMY.

Buscador de Publicaciones:

 


 

No sea Juan... Solo podrá llegar alto si realiza su formación con los mejores!