SAP Database

List of Infotypes configured in the SAP system - Simple ALV report

Print This Post Email This Post Written by A Swarna S on Feb 26th, 2008 | Filed under: ABAP, ABAP Programs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
*&-----------------------------------------------------------------------------------------------------------------------*
*& Report ZINFOTYPE *
*& Author : Swarna.S *
*&-----------------------------------------------------------------------------------------------------------------------*
*& *
*& AS: This program lists all the infotypes maintained in SAP system *
*&-----------------------------------------------------------------------------------------------------------------------*
 
REPORT zinfotype .
TYPE-POOLS : slis.
 
*Structure declaration for Infotypes for customer
TYPES : BEGIN OF ty_table,
infty TYPE infty,
pnnnn TYPE pnnnn_d,
END OF ty_table.
 
*Structure for infotype text
TYPES : BEGIN OF ty_itext,
infty TYPE infty,
itext TYPE intxt,
sprsl TYPE sprsl,
END OF ty_itext.
<pre>
<span id="more-815"></span>
<pre lang="abap" line="24">
*Structure for output display
TYPES : BEGIN OF ty_output,
infty TYPE infty,
itext TYPE intxt,
pnnnn TYPE pnnnn_d,
END OF ty_output.
 
*internal table and work area declarations
DATA : it_table TYPE STANDARD TABLE OF ty_table INITIAL SIZE 0,
it_output TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,
it_ittext TYPE STANDARD TABLE OF ty_itext INITIAL SIZE 0,
wa_table TYPE ty_table,
wa_output TYPE ty_output,
wa_ittext TYPE ty_itext.
 
*Data declarations for ALV
 
DATA: c_ccont TYPE REF TO cl_gui_custom_container, "Custom container object
c_alvgd TYPE REF TO cl_gui_alv_grid, "ALV grid object
it_fcat TYPE lvc_t_fcat, "Field catalogue
it_layout TYPE lvc_s_layo. "Layout
 
INITIALIZATION.
 
START-OF-SELECTION.
 
*select the infotypes maintained
SELECT infty
pnnnn
FROM t582a
INTO TABLE it_table.
 
*Select the infotype texts
IF it_table[] IS NOT INITIAL.
 
SELECT itext
infty
sprsl
FROM t582s
INTO CORRESPONDING FIELDS OF TABLE it_ittext
FOR ALL ENTRIES IN it_table
WHERE infty = it_table-infty
AND sprsl = 'E'.
 
ENDIF.
 
*Apppending the data to the internal table of ALV output
 
LOOP AT it_table INTO wa_table.
 
wa_output-infty = wa_table-infty.
wa_output-pnnnn = wa_table-pnnnn.
 
* For texts
READ TABLE it_ittext INTO wa_ittext WITH KEY infty = wa_table-infty.
wa_output-itext = wa_ittext-itext.
 
APPEND wa_output TO it_output.
CLEAR wa_output.
 
ENDLOOP.
 
* Calling the ALV screen wiht custom container
 
CALL SCREEN 0600.
 
*On this statement double click it takes you to the screen painter SE51.Enter the attributes
*Create a Custom container and name it CC_CONT and OK code as OK_CODE.
*Save check and Activate the scren painter.
*NOw a normal screen witn number 600 is created which holds the ALV grid.
 
* PBO of the actual screen , Here we can give a title and customized menuss
*&---------------------------------------------------------------------*
*& Module STATUS_0600 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module STATUS_0600 output.
* SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
 
endmodule. " STATUS_0600 OUTPUT
 
* calling the PBO module ALV_GRID.
*&---------------------------------------------------------------------*
*& Module ALV_GRID OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE alv_grid OUTPUT.
CREATE OBJECT c_ccont
EXPORTING
container_name = 'CC_CONT'.
 
CREATE OBJECT c_alvgd
EXPORTING
i_parent = c_ccont.
 
* Set field for ALV
PERFORM alv_build_fieldcat.
* Set ALV attributes FOR LAYOUT
PERFORM alv_report_layout.
 
CHECK NOT c_alvgd IS INITIAL.
 
* Call ALV GRID
CALL METHOD c_alvgd->set_table_for_first_display
EXPORTING
is_layout = it_layout
CHANGING
it_outtab = it_output
it_fieldcatalog = it_fcat
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
 
ENDMODULE. " ALV_GRID OUTPUT
*&---------------------------------------------------------------------*
*& Form alv_build_fieldcat
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_IT_FCAT text
*----------------------------------------------------------------------*
FORM alv_build_fieldcat.
 
DATA lv_fldcat TYPE lvc_s_fcat.
 
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '1'.
lv_fldcat-fieldname = 'INFTY'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 8.
lv_fldcat-scrtext_m = 'Infotype'.
lv_fldcat-icon = 'X'.
APPEND lv_fldcat TO it_fcat.
 
CLEAR lv_fldcat.
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '2'.
lv_fldcat-fieldname = 'PNNNN'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 15.
lv_fldcat-scrtext_m = 'Structure'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
 
CLEAR lv_fldcat.
 
lv_fldcat-row_pos = '1'.
lv_fldcat-col_pos = '3'.
lv_fldcat-fieldname = 'ITEXT'.
lv_fldcat-tabname = 'IT_OUTPUT'.
lv_fldcat-outputlen = 60.
lv_fldcat-scrtext_m = 'Description'.
lv_fldcat-icon = ''.
APPEND lv_fldcat TO it_fcat.
 
CLEAR lv_fldcat.
ENDFORM. " alv_build_fieldcat
*&---------------------------------------------------------------------*
*& Form alv_report_layout
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_IT_LAYOUT text
*----------------------------------------------------------------------*
FORM alv_report_layout.
it_layout-cwidth_opt = 'X'.
it_layout-zebra = 'X'.
ENDFORM. " alv_report_layout
* PAI module of the screen created. In case we use an interactive ALV or
*for additional functionalities we can create OK codes and based on the user command
*we can do the coding.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0600 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module USER_COMMAND_0600 input.
 
endmodule. " USER_COMMAND_0600 INPUT

If you like this post, you may as well like these too:

  1. Simple ALV Report - Details of Y or Z Objects *&---------------------------------------------------------------------* *& Report Z_OBJECT_TRACKER * *& Author :Swarna.S. *&---------------------------------------------------------------------* *& *& AS: *& Simple ALV report -- Details of Y or Z objects *& showing lists of all the...
  2. List of local objects in the SAP system This Program provides you with a list of all the objects in SAP System. *---------------------------------------------------------------------- * Report ZLOCAL * Author: Swarna.S. (Tata Consultancy Services) *---------------------------------------------------------------------- * AS: List of...
  3. Simple ALV report with its output transposed (rows as columns and columns as rows) Simple ALV Report with its output transposed. The Complete file with the source code and screen shots can be Downloaded Here(ALV Transposed). ...
  4. ALV Popup for Infotypes ALV pop up giving the list of all the infotypes in the system. The user can select the infotypes . After selection the details of the selected infotypes are...
  5. Source Code: Designing a report REPORT ZSOURCE0104. * Declaration of a work area for a Dictionary tableTABLES CUSTOMERS. * Internal table used as snapshot of the database tableDATA ALL_CUSTOMERS LIKE CUSTOMERS OCCURS 100 WITH...



Leave a Reply

  • Help Support CRY