[55426] in SAPr3-news

home help back first fref pref prev next nref lref last post

Re: ALV Grit

daemon@ATHENA.MIT.EDU (Heike.Boelow@web.de)
Mon Sep 12 19:29:53 2005

To: sapr3-news@mit.edu
Date: 8 Sep 2005 02:54:34 -0700
From: Heike.Boelow@web.de
Message-ID: <1126173274.925442.142310@g44g2000cwa.googlegroups.com>

Hallo, habe das Programm mal geschrieben, aber es funktioniert noch
nicht so richtig???

Die Felder erschrinen nicht alle im Grid und eine Datenausgabe bekomme
ich auch nicht!

*&---------------------------------------------------------------------*
*& Report  ZHEIKE
*
*&
*
*&---------------------------------------------------------------------*
*&
*
*&
*
*&---------------------------------------------------------------------*

REPORT  ZHEIKE                                                      .

* DEKLARATIONSTEIL


Tables: pernr,t555v.

data:Dienstj(3) type n,
     Alter(3) type n,
     Geschlecht type c,
     Abwesenheit type c value 'Y',
     Datum type d.

Infotypes: 0000,
           0001,
           0002,
           0041,
           0007,
           2001 Mode n.

* DEKLARATION F=DCR ALV
type-pools: slis.

data: begin of dtype,
Dienst like Dienstj,
Abwes like p2001-subty,
end of dtype.

types: begin of data_struc,
Pernr like p0002-pernr,
Nachn like p0002-nachn,
Vorna like p0002-Vorna,
GBPAS like p0002-GBPAS,
OrgS like  p0001-vdsk1,
PB like    p0001-WERKS,
Kostl like p0001-KOSTL,
Geschl like Geschlecht,
Dienst like Dienstj,
AZPR like p0007-SCHKZ,
end of data_struc.

data: itab type table of data_struc, kopf type data_struc.

data: alv_fieldcat type slis_t_fieldcat_alv,
* Tabelle ohne Kopfzeile
      alv_layout type slis_layout_alv,
      disvar type disvariant.

* BEGIN DER SELEKTION

SELECTION-SCREEN BEGIN OF BLOCK Zusatz with frame title text-t00.
Parameters: P_Dienst like Dienstj obligatory.
Select-options P_Abwes for p2001-subty obligatory.
SELECTION-SCREEN end of block Zusatz.

Initialization.
  PNPSTAT2-LOW =3D '3'.
  Append pnpstat2.


  pnpxpgpk-low =3D '*r1'.
  PNPXPGPK-option =3D 'NE'.
*  pnpxpgpk-high =3D '*r1'. sonst steht im Intervall von *r1 bis *r1,
*  was aber vorne ausgeschlossen wird
  append PNPXPGPK.


start-of-selection.

get pernr.
* Clear
  Abwesenheit =3D 'Y'.

  Provide * from p0041 between pn-begda and pn-endda.
    If p0041-DAR01 =3D '01'.
      Dienstj =3D sy-datum(4) - p0041-DAT01(4).
    Else.
      Dienstj =3D '0000'.
    endif.
  endprovide.


  Provide * from p0002 between pn-begda and pn-endda.
    If p0002-ANRED =3D 'Herr'.
      Geschlecht =3D 'M'.
    else.
      Geschlecht =3D 'W'.
    endif.

    Alter =3D sy-datum(4) - p0002-GBPAS(4).

    RP_READ_ALL_TIME_ity pn-begda pn-endda.

    datum(4) =3D sy-datum(4) - 1.
    datum+4(4) =3D '0101'.
*  Provide * from p2001 between Datum and sy-Datum
*            where p2001-subty =3D '0220'.
*
*    if p2001_valid eq 'X'.
*      Abwesenheit =3D 'Y'.
*    endif.
*  endprovide.

*  rp-provide-from-last p2001 0220 datum sy-datum.
*  if pnp-sw-found =3D '0'.
*    Abwesenheit =3D 'Y'.
*  endif.

    loop at p2001 where subty =3D '0220'
* ohne gr=F6=DFer und kleiner Genau 1 Datensatz von bis +
* vor get pernr Initialisieren!!!!!
    and begda GE datum
    and endda LE sy-datum.
      Abwesenheit =3D 'N'.
      exit.
    endloop.

    If p0002 ge P_abwes-low and p0002 le P_abwes-high.
      If Dienstj ge P_dienst.
        If Alter between '030' and '060'.
          If p0007-wostd gt '20'.
            If p2001-subty ne '0210'.
              If p0001-PERSG =3D '1' or p0001-persg =3D '2' or
              p0001-persg =3D'3'.
                If Abwesenheit =3D 'Y'.
                  perform print.
                endif.

              endif.
            endif.
          endif.
        endif.
      endif.
    endif.

  endprovide.


end-of-selection.

* Aufruf des Programms fieldcat initialisieren

  Perform fieldcat_init using alv_fieldcat.

*LAYOUT ALV
  ALV_layout-colwidth_optimize =3D 'X'.
  ALV_layout-zebra =3D 'X'.

* Funktionsbaustein Reuse_ALV_GRID_Display mit Muster einf=FCgen!
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
*   I_INTERFACE_CHECK                 =3D ' '
*   I_BYPASSING_BUFFER                =3D ' '
*   I_BUFFER_ACTIVE                   =3D ' '
      I_CALLBACK_PROGRAM                =3D 'ZHEIKE'
*   I_CALLBACK_PF_STATUS_SET          =3D ' '
*   I_CALLBACK_USER_COMMAND           =3D ' '
*   I_CALLBACK_TOP_OF_PAGE            =3D ' '
*   I_CALLBACK_HTML_TOP_OF_PAGE       =3D ' '
*   I_CALLBACK_HTML_END_OF_LIST       =3D ' '
*   I_STRUCTURE_NAME                  =3D
*   I_BACKGROUND_ID                   =3D ' '
      I_GRID_TITLE                      =3D 'Vorschlagsliste Vorsorgekur'
*   I_GRID_SETTINGS                   =3D
      IS_LAYOUT                         =3D alv_layout
      IT_FIELDCAT                       =3D alv_fieldcat
*   IT_EXCLUDING                      =3D
*   IT_SPECIAL_GROUPS                 =3D
*   IT_SORT                           =3D
*   IT_FILTER                         =3D
*   IS_SEL_HIDE                       =3D
*   I_DEFAULT                         =3D 'X'
      I_SAVE                            =3D 'A'
      IS_VARIANT                        =3D disvar
*   IT_EVENTS                         =3D
*   IT_EVENT_EXIT                     =3D
*   IS_PRINT                          =3D
*   IS_REPREP_ID                      =3D
*   I_SCREEN_START_COLUMN             =3D 0
*   I_SCREEN_START_LINE               =3D 0
*   I_SCREEN_END_COLUMN               =3D 0
*   I_SCREEN_END_LINE                 =3D 0
*   IT_ALV_GRAPHICS                   =3D
*   IT_HYPERLINK                      =3D
*   IT_ADD_FIELDCAT                   =3D
*   IT_EXCEPT_QINFO                   =3D
*   I_HTML_HEIGHT_TOP                 =3D
*   I_HTML_HEIGHT_END                 =3D
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER           =3D
*   ES_EXIT_CAUSED_BY_USER            =3D
    TABLES
      T_OUTTAB                          =3D itab
   EXCEPTIONS
     PROGRAM_ERROR                     =3D 1
     OTHERS                            =3D 2   .

  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.




*&---------------------------------------------------------------------*
*&      Form  fieldcat_init
*&---------------------------------------------------------------------*
* Um den Feldkatalog zu erstellen, den der Funktionsbaustein
* Reuse_ALV_Grid_Display ben=F6tigt
*----------------------------------------------------------------------*
*      -->P_FIELDCAT text
*----------------------------------------------------------------------*
Form fieldcat_init using P_fieldcat type slis_t_fieldcat_alv.
* Tabelle wird =FCbergeben (mit t) und Kopfzeile wird zugewisen (ohne t)
  data: WA_fieldcat type slis_fieldcat_alv.

  clear wa_fieldcat.
* F=FCr jedes Feld das obern deklariert wurde m=FCssen fieldname,
* ref_tabname, ref_fieldname und key ausgef=FCllt werden
  wa_fieldcat-fieldname =3D 'Pernr'.
  wa_fieldcat-ref_tabname =3D 'Pernr'.
  wa_fieldcat-key =3D 'X'.
  append wa_fieldcat to P_fieldcat.

  clear wa_fieldcat.
  wa_fieldcat-fieldname =3D 'Nachn'.
  wa_fieldcat-ref_tabname =3D 'p0002'.
  append wa_fieldcat to P_fieldcat.

  clear wa_fieldcat.
  wa_fieldcat-fieldname =3D 'Vorna'.
  wa_fieldcat-ref_tabname =3D 'p0002'.
  append wa_fieldcat to P_fieldcat.

  clear wa_fieldcat.
  wa_fieldcat-fieldname =3D 'GBPAS'.
  wa_fieldcat-ref_tabname =3D 'p0002'.
  append wa_fieldcat to P_fieldcat.

  clear wa_fieldcat.
  wa_fieldcat-fieldname =3D 'VDSK1'.
  wa_fieldcat-ref_tabname =3D 'p0001'.
  append wa_fieldcat to P_fieldcat.

  clear wa_fieldcat.
  wa_fieldcat-fieldname =3D 'werks'.
  wa_fieldcat-ref_tabname =3D 'p0001'.
  append wa_fieldcat to P_fieldcat.

  clear wa_fieldcat.
  wa_fieldcat-fieldname =3D 'Kostl'.
  wa_fieldcat-ref_tabname =3D 'p0001'.
  append wa_fieldcat to P_fieldcat.

  clear wa_fieldcat.
  wa_fieldcat-fieldname =3D 'Geschl'.
  append wa_fieldcat to P_fieldcat.

  clear wa_fieldcat.
  wa_fieldcat-fieldname =3D 'Dienstj'.
  append wa_fieldcat to P_fieldcat.

  clear wa_fieldcat.
  wa_fieldcat-fieldname =3D 'AZPR'.
  wa_fieldcat-ref_fieldname =3D 'SchKZ'.
  wa_fieldcat-ref_tabname =3D 'p0007'.
  append wa_fieldcat to P_fieldcat.

  clear wa_fieldcat.
  wa_fieldcat-fieldname =3D 'Pernr'.
  wa_fieldcat-ref_tabname =3D 'Pernr'.
  append wa_fieldcat to P_fieldcat.
endform.                    "fieldcat_init


*&---------------------------------------------------------------------*
*&      Form  print
*&---------------------------------------------------------------------*
*       Ausgabe
*----------------------------------------------------------------------*
form print.
  write: / p0002-pernr no-zero,
               sy-vline,
               (15) p0002-nachn,
               sy-vline,
               (15) p0002-Vorna,
               sy-vline,
               p0002-GBPAS,
               sy-vline,
               p0001-vdsk1,
               sy-vline,
               p0001-WERKS,
               sy-vline,
               p0001-KOSTL,
               sy-vline,
               (3) Geschlecht,
               sy-vline,
               Dienstj no-zero,
               sy-vline,
               p0007-SCHKZ,
               Dienstj.
endform.                    "print


home help back first fref pref prev next nref lref last post