ABAP Performance: Typed vs Untyped Parameter

 

Typed vs. untyped Parameters
Untyped parameters. Typed parameters.
PERFORM UP1 USING IX M6-DIMID PERFORM UP2 USING IX M6-DIMID
M6-ZAEHL M6-ISOCODE M6-ANDEC M6-ZAEHL M6-ISOCODE M6-ANDEC
M6-PRIMARY. M6-PRIMARY.
FORM UP1 USING FORM UP2 USING
REPEAT REPEAT TYPE I
DIMID DIMID LIKE T006-DIMID
ZAEHL ZAEHL LIKE T006-ZAEHL
ISOCODE ISOCODE LIKE T006-ISOCODE
ANDEC ANDEC LIKE T006-ANDEC
PRIMARY. PRIMARY LIKE T006-PRIMARY.
* Identical source code left and right: * Identical source code left and right:
DO REPEAT TIMES. DO REPEAT TIMES.
T006-DIMID = DIMID. T006-DIMID = DIMID.
T006-ZAEHL = ZAEHL. T006-ZAEHL = ZAEHL.
T006-ISOCODE = ISOCODE. T006-ISOCODE = ISOCODE.
T006-ANDEC = ANDEC. T006-ANDEC = ANDEC.
T006-PRIMARY = PRIMARY. T006-PRIMARY = PRIMARY.
I1 = REPEAT – SY-INDEX. I1 = REPEAT – SY-INDEX.
ENDDO. ENDDO.
ENDFORM. ENDFORM.
microsec: 98 microsec: 53
  • If you specify the type for formal parameters in your source code, the ABAP/4 compiler can optimize your code more thoroughly.
  • In addition, the risk of using the wrong sequence of parameters in a Perform statement is much less.
  • If you have large ‘untyped’ programs, use the automatic typing facility of the Development Workbench.

  

Typed vs. untyped Field-Symbols
Field-Symbol without type. Typed Field-Symbol.
FIELD-SYMBOLS: <F>. FIELD-SYMBOLS: <I> TYPE I.
ASSIGN I1 TO <F>. ASSIGN I1 TO <I>.
I2 = <F>. I2 = <I>.
I3 = <F>. I3 = <I>.
I4 = <F>. I4 = <I>.
microsec: 5 microsec: 3

 

  • If you specify the type of field-symbols and formal parameters in your source code, the ABAP/4 compiler can better optimize your code.
ABAP Performance: Typed vs Untyped Parameterultima modifica: 2009-10-06T10:22:00+02:00da pedroccda
Reposta per primo quest’articolo

2 pensieri su “ABAP Performance: Typed vs Untyped Parameter

Lascia un commento