1 FUNCTION zfm_pp_0004.
2 *"----------------------------------------------------------------------
3 *"*"本地接口:
4 *" IMPORTING
5 *" VALUE(IV_TEST) TYPE CHAR1 OPTIONAL
6 *" EXPORTING
7 *" VALUE(EV_MESSAGE) TYPE CHAR255
8 *" VALUE(EV_TYPE) TYPE CHAR1
9 *" TABLES
10 *" TI_INPUT STRUCTURE ZSPP_0004 OPTIONAL
11 *"----------------------------------------------------------------------
12
13 DATA:ls_in_crhd_api01 TYPE crhd_api01,
14 ls_in_crhd_api02 TYPE crhd_api02,
15 ls_in_crhd_api03 TYPE crhd_api03,
16 ls_in_crhd_api05 TYPE crhd_api05,
17 lt_in_crco_api01 TYPE TABLE OF crco_api01,
18 ls_in_crco_api01 TYPE crco_api01,
19 lt_in_kapa_api01 TYPE TABLE OF kapa_api01,
20 ls_in_kapa_api01 TYPE kapa_api01,
21 lt_in_crhd_api04 TYPE TABLE OF crhd_api04,
22 ls_in_crhd_api04 TYPE crhd_api04,
23 lt_in_kapa_api02 TYPE TABLE OF kapa_api02,
24 ls_in_kapa_api02 TYPE kapa_api02,
25 lt_return TYPE bapiret2_tab,
26 ls_return TYPE bapiret2.
27
28 CLEAR ls_in_crhd_api01 .
29 CLEAR ls_in_crhd_api02 .
30 CLEAR ls_in_crhd_api03 .
31 CLEAR ls_in_crhd_api05 .
32 REFRESH lt_in_crco_api01 .
33 REFRESH lt_in_kapa_api01 .
34 REFRESH lt_in_crhd_api04 .
35 REFRESH lt_in_kapa_api02 .
36
37 LOOP AT ti_input ASSIGNING FIELD-SYMBOL(<fs_data>) .
38
39 ls_in_crhd_api01-arbpl = <fs_data>-arbpl .
40 ls_in_crhd_api01-werks = <fs_data>-werks .
41 ls_in_crhd_api01-verwe = <fs_data>-verwe .
42 ls_in_crhd_api01-ktext = <fs_data>-ktext .
43
44 ls_in_crhd_api02-vgwts = <fs_data>-vgwts .
45 ls_in_crhd_api02-veran = <fs_data>-veran .
46 ls_in_crhd_api02-planv = '009' ."用途
47
48 ls_in_crhd_api03-steus = <fs_data>-steus .
49
50 ls_in_crhd_api05-fort1 = <fs_data>-fort1 .
51 ls_in_crhd_api05-fort2 = <fs_data>-fort2 .
52 ls_in_crhd_api05-fort3 = <fs_data>-fort3 .
53 ls_in_crhd_api05-kapart = <fs_data>-kapar .
54
55 CLEAR ls_in_crco_api01 .
56 ls_in_crco_api01-begda = <fs_data>-begda .
57 ls_in_crco_api01-endda = '99991231'."结束日期
58 ls_in_crco_api01-kostl = <fs_data>-kostl .
59 ls_in_crco_api01-lstar1 = <fs_data>-lstar1 .
60 ls_in_crco_api01-leinh1 = <fs_data>-leinh1 .
61 ls_in_crco_api01-forml1 = <fs_data>-forml1 .
62 ls_in_crco_api01-lstar2 = <fs_data>-lstar2 .
63 ls_in_crco_api01-leinh2 = <fs_data>-leinh2 .
64 ls_in_crco_api01-forml2 = <fs_data>-forml2 .
65 ls_in_crco_api01-lstar3 = <fs_data>-lstar3 .
66 ls_in_crco_api01-leinh3 = <fs_data>-leinh3 .
67 ls_in_crco_api01-forml3 = <fs_data>-forml3 .
68 ls_in_crco_api01-lstar4 = <fs_data>-lstar4 .
69 ls_in_crco_api01-leinh4 = <fs_data>-leinh4 .
70 ls_in_crco_api01-forml4 = <fs_data>-forml4 .
71 ls_in_crco_api01-lstar5 = <fs_data>-lstar5 .
72 ls_in_crco_api01-leinh5 = <fs_data>-leinh5 .
73 ls_in_crco_api01-forml5 = <fs_data>-forml5 .
74 ls_in_crco_api01-lstar6 = <fs_data>-lstar6 .
75 ls_in_crco_api01-leinh6 = <fs_data>-leinh6 .
76 ls_in_crco_api01-forml6 = <fs_data>-forml6 .
77 APPEND ls_in_crco_api01 TO lt_in_crco_api01 .
78
79 CLEAR ls_in_kapa_api01 .
80 ls_in_kapa_api01-kapart = <fs_data>-kapar .
81 ls_in_kapa_api01-ktext = <fs_data>-ktext .
82 ls_in_kapa_api01-werks = <fs_data>-werks .
83 APPEND ls_in_kapa_api01 TO lt_in_kapa_api01 .
84
85 CLEAR ls_in_crhd_api04 .
86 ls_in_crhd_api04-fork1 = <fs_data>-fork1 .
87 ls_in_crhd_api04-fork2 = <fs_data>-fork2 .
88 ls_in_crhd_api04-fork3 = <fs_data>-fork3 .
89 APPEND ls_in_crhd_api04 TO lt_in_crhd_api04 .
90
91 CLEAR ls_in_kapa_api02 .
92 ls_in_kapa_api02-planr = <fs_data>-planr .
93 ls_in_kapa_api02-kalid = <fs_data>-kalid .
94 ls_in_kapa_api02-versa = <fs_data>-versa .
95 ls_in_kapa_api02-kapeh = <fs_data>-kapeh .
96 ls_in_kapa_api02-begzt = <fs_data>-begzt+0(2) && <fs_data>-begzt+3(2) && <fs_data>-begzt+6(2) .
97 ls_in_kapa_api02-endzt = <fs_data>-endzt+0(2) && <fs_data>-endzt+3(2) && <fs_data>-endzt+6(2) .
98 ls_in_kapa_api02-pause = <fs_data>-pause+0(2) && <fs_data>-pause+3(2) && <fs_data>-pause+6(2) .
99 ls_in_kapa_api02-ngrad = <fs_data>-ngrad .
100 ls_in_kapa_api02-aznor = <fs_data>-aznor .
101 ls_in_kapa_api02-meins = <fs_data>-meins .
102 ls_in_kapa_api02-kapter = <fs_data>-kapter .
103 ls_in_kapa_api02-kaplpl = <fs_data>-kaplpl .
104 APPEND ls_in_kapa_api02 TO lt_in_kapa_api02 .
105
106 ENDLOOP .
107
108 CLEAR lt_return.
109
110 DATA: gv_extnum TYPE balhdr-extnumber,
111 lv_guid_22 TYPE sysuuid_22,
112 lv_comment TYPE crtx-ktext.
113 CLEAR gv_extnum .
114 CLEAR lv_guid_22 .
115 CLEAR lv_comment .
116 lv_guid_22 = cl_system_uuid=>if_system_uuid_static~create_uuid_c22( ).
117 gv_extnum = lv_guid_22.
118 TRANSLATE gv_extnum TO UPPER CASE.
119 lv_comment = gv_extnum.
120
121 CALL FUNCTION 'CRAP_WKC_CLR_APPL_LOG_EXTRNLID'.
122 CALL FUNCTION 'CRAP_WORKCENTER_CREATE'
123 EXPORTING
124 in_crhd_api01 = ls_in_crhd_api01
125 in_crhd_api02 = ls_in_crhd_api02
126 * IN_CRHD_API03 =
127 in_crhd_api05 = ls_in_crhd_api05
128 comment = lv_comment
129 test = ''
130 * IN_CRHD_API07 =
131 * IN_CRHD_API08 =
132 * IV_NO_COMMIT =
133 * IV_LANGU =
134 TABLES
135 in_kapa_api01 = lt_in_kapa_api01
136 in_kapa_api02 = lt_in_kapa_api02
137 in_crhd_api04 = lt_in_crhd_api04
138 in_crco_api01 = lt_in_crco_api01
139 * IN_KAZY_API01 =
140 * IN_KAPA_API04 =
141 * IN_CRHD_API09 =
142 * IN_KAKT_API01 =
143 * IN_KAPA_API05 =
144 .
145
146 DATA:lt_message TYPE TABLE OF balm,
147 ls_message TYPE balm,
148 lv_message TYPE string.
149
150 REFRESH lt_message .
151
152 CALL FUNCTION 'APPL_LOG_READ_DB'
153 EXPORTING
154 object = 'CRAP'
155 subobject = '*'
156 external_number = gv_extnum
157 * DATE_FROM = '00000000'
158 * DATE_TO = SY-DATUM
159 * TIME_FROM = '000000'
160 * TIME_TO = SY-UZEIT
161 * LOG_CLASS = '4'
162 * PROGRAM_NAME = '*'
163 * TRANSACTION_CODE = '*'
164 * USER_ID = ' '
165 * MODE = '+'
166 * PUT_INTO_MEMORY = ' '
167 * IMPORTING
168 * NUMBER_OF_LOGS =
169 TABLES
170 * HEADER_DATA =
171 * HEADER_PARAMETERS =
172 messages = lt_message
173 * MESSAGE_PARAMETERS =
174 * CONTEXTS =
175 * T_EXCEPTIONS =
176 .
177
178 IF line_exists( lt_message[ msgty = 'E' ] ) .
179
180 LOOP AT lt_message INTO ls_message WHERE msgty = 'E' .
181
182 CALL FUNCTION 'MESSAGE_TEXT_BUILD'
183 EXPORTING
184 msgid = ls_message-msgid
185 msgnr = ls_message-msgno
186 msgv1 = ls_message-msgv1
187 msgv2 = ls_message-msgv2
188 msgv3 = ls_message-msgv3
189 msgv4 = ls_message-msgv4
190 IMPORTING
191 message_text_output = lv_message.
192
193 ev_message = lv_message && ';' && ev_message .
194
195 ENDLOOP .
196
197 ev_type = 'E' .
198
199 ELSE .
200
201 ev_type = 'S' .
202
203 ENDIF .
204
205 ENDFUNCTION.
ABAP-CR01工作中心批导
该代码段展示了在ABAP中定义的一个函数(FUNCTIONzfm_pp_0004),它涉及多个数据结构的初始化、赋值和循环处理。函数用于从输入表中获取数据,并将这些数据填充到不同的结构中,然后调用其他函数进行工作中心的创建和日志读取操作。如果在处理过程中遇到错误,会将错误信息整合到返回消息中。
摘要由CSDN通过智能技术生成