Properties SourceCde
txt
1
*----------------------------------------------------------------------*
2
***INCLUDE LSVIMF5B .
3
*----------------------------------------------------------------------*
4
*&---------------------------------------------------------------------*
5
*&      Form  CHECK_LIST_BEFORE_ALV
6
*&---------------------------------------------------------------------*
7
*       text
8
*----------------------------------------------------------------------*
9
*  -->  p1        text
10
*  <--  p2        text
11
*----------------------------------------------------------------------*
12
FORM check_list_before_alv CHANGING rc LIKE sy-subrc.
13
 
14
  DATA:          counter TYPE i, index type i,
15
                 variant LIKE disvariant,
16
                 fcat_var TYPE slis_t_fieldcat_alv.
17
  FIELD-SYMBOLS: <fcat> TYPE slis_fieldcat_alv.
18
  CONSTANTS:     alv_maxcols TYPE i VALUE 99.
19
 
20
  CLEAR: counter, rc.
21
  LOOP AT vim_alv_fcat TRANSPORTING NO FIELDS WHERE no_out <> 'X'.
22
    ADD 1 TO counter.
23
  ENDLOOP.
24
  CHECK counter > alv_maxcols.
25
* suitable standard variant defined?
26
  CONCATENATE x_header-viewname sy-repid INTO variant-report.
27
  CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'
28
       EXPORTING
29
            i_dialog            = space
30
            i_user_specific     = 'X'
31
            i_default           = 'X'  "vim_var_default
32
*         I_TABNAME_HEADER    =
33
*         I_TABNAME_ITEM      =
34
            it_default_fieldcat = vim_alv_fcat
35
            i_layout            = vim_alv_layout
36
       IMPORTING
37
*         E_EXIT              =
38
            et_fieldcat         = fcat_var
39
*         ET_SORT             =
40
*         ET_FILTER           =
41
            es_layout           = vim_alv_layout
42
       CHANGING
43
            cs_variant          = variant
44
       EXCEPTIONS
45
            wrong_input         = 1
46
            fc_not_complete     = 2
47
            not_found           = 3
48
            program_error       = 4
49
            OTHERS              = 5.
50
  IF sy-subrc = 0 AND NOT variant-variant IS INITIAL.
51
    CLEAR: counter.
52
    LOOP AT fcat_var TRANSPORTING NO FIELDS WHERE no_out <> 'X'.
53
      ADD 1 TO counter.
54
    ENDLOOP.
55
    CHECK counter > alv_maxcols.
56
  ENDIF.
57
* no variant with less than 99 columns exists
58
*  WHILE counter > alv_maxcols.
59
*    MESSAGE i807(sv) WITH counter.
60
**    Bitte wählen Sie max. 99 Felder für die Liste aus.
61
*    CALL FUNCTION 'REUSE_ALV_VARIANT_MAINTAIN'
62
*         EXPORTING
63
**         I_TABNAME_HEADER  =
64
**         I_TABNAME_ITEM    =
65
*              i_save            = vim_var_save
66
**         I_POPUP           = 'X'
67
*              is_layout         = vim_alv_layout
68
**         IT_SPECIAL_GROUPS =
69
**         IT_SORT           =
70
**    IMPORTING
71
**         E_SAVE            =
72
*         CHANGING
73
*              ct_fieldcat       = vim_alv_fcat
74
*         EXCEPTIONS
75
*              no_change         = 1
76
**         PROGRAM_ERROR     = 2
77
*              OTHERS            = 3.
78
*    rc = sy-subrc.
79
*    IF rc <> 0. EXIT. ENDIF.
80
*    CLEAR counter.
81
*    LOOP AT vim_alv_fcat TRANSPORTING NO FIELDS WHERE no_out <> 'X'.
82
*      ADD 1 TO counter.
83
*    ENDLOOP.
84
**    check counter < alv_maxcols.
85
** field catalogue changed => rearrange value tab
86
*>>>>Complete field catalogue needs to be rearranged here: too lavish
87
*>>>>for this rare case. Let's try an easier attempt at first.
88
*  ENDWHILE.
89
  MESSAGE i808(sv) with COUNTER.
90
*   Es können nicht alle Spalten der Tabelle auf der Liste angezeigt wer
91
  index = alv_maxcols + 1.
92
  LOOP AT vim_alv_fcat ASSIGNING <fcat> FROM index.
93
    <fcat>-no_out = 'X'.
94
  ENDLOOP.
95
ENDFORM.                               " CHECK_LIST_BEFORE_ALV