Difference between revisions of "SAP ABAP PSEUDO COMMENTS"

From SapWiki
 
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
* Local Nested Reading DB OP (SELECT) found
+
==PSEUDO COMMENTS==
 +
===Local Nested Reading DB OP (SELECT) found===
  
 
   <nowiki> SELECT * INTO TABLE @DATA(lt_t001) FROM t001.
 
   <nowiki> SELECT * INTO TABLE @DATA(lt_t001) FROM t001.
Line 7: Line 8:
 
   ENDLOOP.</nowiki>
 
   ENDLOOP.</nowiki>
  
* NonLocal Nested Reading DB OP (SELECT) found
+
=== NonLocal Nested Reading DB OP (SELECT) found===
  
 
   <nowiki> LOOP AT lt_t001 INTO ls_t001.
 
   <nowiki> LOOP AT lt_t001 INTO ls_t001.
Line 15: Line 16:
 
FORM form2 USING p_adrnr.
 
FORM form2 USING p_adrnr.
 
   SELECT SINGLE city1 INTO @DATA(l_city) FROM adrc
 
   SELECT SINGLE city1 INTO @DATA(l_city) FROM adrc
                       WHERE addrnumber = @p_adrnr.   "#EC CI_SEL_NESTED
+
                       WHERE addrnumber = @p_adrnr. "#EC CI_SEL_NESTED
 +
  write:/ l_city.
 
ENDFORM.</nowiki>
 
ENDFORM.</nowiki>
 +
 +
OBSERVACION: También se puede usar recursividad
 +
<nowiki>
 +
  select adrnr into table @data(lt_t001) from kna1 WHERE kunnr BETWEEN '1000000000' and '1000000999'.
 +
 +
*  LOOP AT lt_t001 INTO data(ls_t001).
 +
*    PERFORM form2 USING ls_t001-adrnr.
 +
*  ENDLOOP.
 +
 +
  data(l_lines) = lines( lt_t001 ).
 +
  PERFORM add USING l_lines.
 +
 +
form add USING l_lines type i.
 +
  if l_lines = 0.
 +
    return.
 +
  endif.
 +
 +
  READ TABLE lt_t001 into data(ls_t001) index l_lines.
 +
  PERFORM form2 USING ls_t001-adrnr.
 +
 +
  l_lines = l_lines - 1.
 +
  PERFORM add USING l_lines.
 +
ENDFORM.
 +
 +
FORM form2 USING p_adrnr.
 +
  SELECT SINGLE city1 INTO @DATA(l_city) FROM adrc
 +
                      WHERE addrnumber = @p_adrnr.
 +
  write:/ l_city.
 +
ENDFORM.
 +
</nowiki>
 +
 +
=== Al actualizar===
 +
<nowiki>
 +
  LOOP AT gt_tabla INTO wa_tabla.
 +
      update zt_tabla set habilitado = 'N'
 +
              WHERE rut_emp = wa_tabla-rut_emp. "#EC CI_IMUD_NESTED
 +
    COMMIT WORK.
 +
  ENDLOOP.
 +
</nowiki>
 +
 +
===For all entries : Search for SELECT ... FOR ALL ENTRIES statements which can be joined with other SELECT statements===
 +
<nowiki>
 +
      SELECT i~dokar i~doknr i~dokvr i~doktl i~lfddok
 +
            i~einri i~patnr i~falnr i~orgfa i~orgpf i~orgdo
 +
        INTO TABLE lt_ndoc
 +
        FROM ndoc as i
 +
        INNER JOIN y00o007000000000 as j
 +
            on i~dokar = j~dokar and
 +
                i~doknr = j~doknr and
 +
                i~dokvr = j~dokvr and
 +
                i~doktl = j~doktl
 +
        FOR ALL ENTRIES IN lt_episodios
 +
        WHERE i~einri EQ lt_episodios-einri
 +
          AND i~falnr EQ lt_episodios-falnr
 +
          AND i~dtid  EQ 'MEDSEPREG'
 +
          AND i~storn EQ abap_false
 +
          AND i~loekz EQ abap_false
 +
          and j~znpartner in ra_partner. "#EC CI_NO_TRANSFORM</nowiki>
 +
 +
==Pragmas==
 +
=== [[SAP ABAP VARIOS#Listado_de_Pragmas|Listado de Pragmas]]===
 +
=== [https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenpragma.htm Pragmas en help.sap.com]===
 +
 +
===Ejemplos===
 +
====##NO_TEXT====
 +
<nowiki>
 +
l_string = 'Hola Mundo'          ##no_text.
 +
constants CV_T7CLCERTIFNBR type CTABNAME value 'T7CLCERTIFNBR' ##NO_TEXT.
 +
</nowiki>
 +
 +
====##NEEDED====
 +
The pragma ##NEEDED tells the check tools that even though the variable isn't used for further processing, the variable is still needed
 +
<nowiki>
 +
    LOOP AT mt_t511p INTO rs_table_row
 +
                    WHERE molga =  cl_hrpaycl_t511p_reader=>gc_molga AND
 +
                          konst =  iv_payroll_constant              AND
 +
                          begda >= iv_date                          AND
 +
                          endda <= iv_date ##NEEDED.
 +
    ENDLOOP.
 +
</nowiki>
 +
====##CALLED====
 +
Form not called
 +
FORM rp_absence_calculation USING ptabs STRUCTURE ptabs ##CALLED.

Latest revision as of 18:32, 1 February 2022

PSEUDO COMMENTS

Local Nested Reading DB OP (SELECT) found

  SELECT * INTO TABLE @DATA(lt_t001) FROM t001.

  LOOP AT lt_t001 INTO DATA(ls_t001).
    SELECT SINGLE city1 INTO @DATA(l_city) FROM adrc WHERE addrnumber = @ls_t001-adrnr. "#EC CI_SEL_NESTED
  ENDLOOP.

NonLocal Nested Reading DB OP (SELECT) found

  LOOP AT lt_t001 INTO ls_t001.
    PERFORM form2 USING ls_t001-adrnr.
  ENDLOOP.

FORM form2 USING p_adrnr.
  SELECT SINGLE city1 INTO @DATA(l_city) FROM adrc
                      WHERE addrnumber = @p_adrnr. "#EC CI_SEL_NESTED
  write:/ l_city.
ENDFORM.

OBSERVACION: También se puede usar recursividad

  select adrnr into table @data(lt_t001) from kna1 WHERE kunnr BETWEEN '1000000000' and '1000000999'.

*  LOOP AT lt_t001 INTO data(ls_t001).
*    PERFORM form2 USING ls_t001-adrnr.
*  ENDLOOP.

  data(l_lines) = lines( lt_t001 ).
  PERFORM add USING l_lines.

form add USING l_lines type i.
  if l_lines = 0.
    return.
  endif.

  READ TABLE lt_t001 into data(ls_t001) index l_lines.
  PERFORM form2 USING ls_t001-adrnr.

  l_lines = l_lines - 1.
  PERFORM add USING l_lines. 
ENDFORM.

FORM form2 USING p_adrnr.
  SELECT SINGLE city1 INTO @DATA(l_city) FROM adrc
                      WHERE addrnumber = @p_adrnr.
  write:/ l_city.
ENDFORM.

Al actualizar

  LOOP AT gt_tabla INTO wa_tabla.
       update zt_tabla set habilitado = 'N'
              WHERE rut_emp = wa_tabla-rut_emp. "#EC CI_IMUD_NESTED
    COMMIT WORK.
  ENDLOOP.

For all entries : Search for SELECT ... FOR ALL ENTRIES statements which can be joined with other SELECT statements

      SELECT i~dokar i~doknr i~dokvr i~doktl i~lfddok
             i~einri i~patnr i~falnr i~orgfa i~orgpf i~orgdo
        INTO TABLE lt_ndoc
        FROM ndoc as i
        INNER JOIN y00o007000000000 as j
             on i~dokar = j~dokar and
                i~doknr = j~doknr and
                i~dokvr = j~dokvr and
                i~doktl = j~doktl
        FOR ALL ENTRIES IN lt_episodios
        WHERE i~einri EQ lt_episodios-einri
          AND i~falnr EQ lt_episodios-falnr
          AND i~dtid  EQ 'MEDSEPREG'
          AND i~storn EQ abap_false
          AND i~loekz EQ abap_false
          and j~znpartner in ra_partner. "#EC CI_NO_TRANSFORM

Pragmas

Listado de Pragmas

Pragmas en help.sap.com

Ejemplos

##NO_TEXT

 l_string = 'Hola Mundo'           ##no_text.
 constants CV_T7CLCERTIFNBR type CTABNAME value 'T7CLCERTIFNBR' ##NO_TEXT.

##NEEDED

The pragma ##NEEDED tells the check tools that even though the variable isn't used for further processing, the variable is still needed

    LOOP AT mt_t511p INTO rs_table_row
                    WHERE molga =  cl_hrpaycl_t511p_reader=>gc_molga AND
                          konst =  iv_payroll_constant               AND
                          begda >= iv_date                           AND
                          endda <= iv_date ##NEEDED.
    ENDLOOP.

##CALLED

Form not called

FORM rp_absence_calculation USING ptabs STRUCTURE ptabs ##CALLED.