Difference between revisions of "SAP ABAP DICTIONARY"

From SapWiki
Line 1: Line 1:
 
==Tablas==
 
==Tablas==
 
===Eventos en SE11-->Utilidades-->Generador actualiz.tab.===
 
===Eventos en SE11-->Utilidades-->Generador actualiz.tab.===
 +
Ver tabla TVIMF
 
* Ejemplo Evento 01
 
* Ejemplo Evento 01
 
  <nowiki>
 
  <nowiki>

Revision as of 22:19, 14 December 2021

Tablas

Eventos en SE11-->Utilidades-->Generador actualiz.tab.

Ver tabla TVIMF

  • Ejemplo Evento 01
FORM check_resolucion_ini.
  TYPES: BEGIN OF ty_data,    "campos de Mi tabla
           perca   TYPE zseg_ds67_1000-perca,
           nresini TYPE zseg_ds67_1000-nresini,
           nresfin TYPE zseg_ds67_1000-nresfin,
         END OF ty_data.

  DATA lt_data TYPE TABLE OF ty_data.
  DATA lt_data2 TYPE TABLE OF ty_data.
  DATA ls_data LIKE LINE OF lt_data.
  DATA ls_data2 LIKE LINE OF lt_data.

  DATA: fieldname1 TYPE fieldname VALUE 'PERCA'.
  DATA: fieldname2 TYPE fieldname VALUE 'NRESINI'.
  DATA: fieldname3 TYPE fieldname VALUE 'NRESFIN'.

  FIELD-SYMBOLS: <fs1> TYPE any.
  FIELD-SYMBOLS: <fs2> TYPE any.
  FIELD-SYMBOLS: <fs3> TYPE any.

  LOOP AT total.
    ASSIGN COMPONENT fieldname1 OF STRUCTURE <vim_total_struc> TO <fs1>.
    ASSIGN COMPONENT fieldname2 OF STRUCTURE <vim_total_struc> TO <fs2>.
    ASSIGN COMPONENT fieldname3 OF STRUCTURE <vim_total_struc> TO <fs3>.

    ls_data-perca   = <fs1>.
    ls_data-nresini = <fs2>.
    ls_data-nresfin = <fs3>.

    APPEND ls_data TO lt_data.

  ENDLOOP.

  SORT lt_data BY perca.
  DATA: l_string  TYPE string,
        l_string2 TYPE string.

* verificar Nr.Res.Fin >= Nr.Res.Ini
  LOOP AT lt_data INTO ls_data.
    IF ls_data-nresfin < ls_data-nresini and ls_data-nresfin is NOT INITIAL.
      l_string = |Para Período { ls_data-perca } Nr.Res.Fin { ls_data-nresfin } menor a|.
      MESSAGE e000(0k) WITH l_string 'Nr.Res.Ini' ls_data-nresini.
      vim_abort_saving = 'X'.
    ENDIF.
  ENDLOOP.
  CLEAR sy-subrc.

  lt_data2[] = lt_data[].

  SORT lt_data2 BY perca DESCENDING.
  SORT lt_data BY perca ASCENDING.

* verificar Nr.Res.Ini > Nr.Res.Fin de períodos anteriores
  LOOP AT lt_data INTO ls_data.
    LOOP AT lt_data2 INTO ls_data2 WHERE perca < ls_data-perca.
      if ls_data2-nresfin is INITIAL.
        ls_data2-nresfin = ls_data2-nresini.
      endif.

      IF ls_data-nresini <= ls_data2-nresfin.
        l_string = |Para Período { ls_data-perca } Nr.Res.Ini { ls_data-nresini } menor/igual a|.
        l_string2 = |Nr.Res.Fin { ls_data2-nresfin } de Período { ls_data2-perca }|.
        MESSAGE e000(0k) WITH l_string l_string2.
      ENDIF.
    ENDLOOP.
  ENDLOOP.


ENDFORM.

  • Ejemplo evento 05
FORM check_resolucion_ini_new.

  TYPES:  BEGIN OF ty_total.
      INCLUDE STRUCTURE zseg_ds67_1000.  "Mi tabla
      INCLUDE STRUCTURE vimtbflags.
  TYPES:  END OF ty_total.

  TYPES: BEGIN OF ty_data,
           perca   TYPE zseg_ds67_1000-perca,
           nresini TYPE zseg_ds67_1000-nresini,
           nresfin TYPE zseg_ds67_1000-nresfin,
         END OF ty_data.

  DATA lt_data TYPE TABLE OF ty_data.
  DATA ls_data LIKE LINE OF lt_data.

  DATA: l_string TYPE string.
  DATA: l_string2 TYPE string.
  FIELD-SYMBOLS: <ls_data>  TYPE zseg_ds67_1000,
                 <ls_total> TYPE ty_total.

  ASSIGN <table1> TO <ls_data>.

  IF <ls_data>-nresfin < <ls_data>-nresini and <ls_data>-nresfin is NOT INITIAL.
    l_string = |Para Período { <ls_data>-perca } Nr.Res.Fin { <ls_data>-nresfin } menor a|.
    MESSAGE e000(0k) WITH l_string 'Nr.Res.Ini' <ls_data>-nresini.
  ENDIF.

  LOOP AT total ASSIGNING <ls_total> CASTING.
    MOVE-CORRESPONDING <ls_total> TO ls_data.
    APPEND ls_data TO lt_data.
  ENDLOOP.

  SORT lt_data BY perca DESCENDING.

  data l_res type ZSEG_DS67_1000-nresfin.

  LOOP AT lt_data INTO ls_data WHERE perca < <ls_data>-perca.
    if ls_data-nresfin is INITIAL.
      ls_data-nresfin = ls_data-nresini.
    endif.

    IF <ls_data>-nresini <= ls_data-nresfin.
      l_string = |Para Período { <ls_data>-perca } Nr.Res.Ini { <ls_data>-nresini } menor/igual a|.
      l_string2 = |Nr.Res.Fin { ls_data-nresfin } de Período { ls_data-perca }|.
      MESSAGE e000(0k) WITH l_string l_string2.
    ENDIF.
  ENDLOOP.

ENDFORM.