-
Notifications
You must be signed in to change notification settings - Fork 53
/
CLAS_ZSAPLINK_DEVC.slnk
624 lines (561 loc) · 26.8 KB
/
CLAS_ZSAPLINK_DEVC.slnk
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
<?xml version="1.0" encoding="utf-8"?>
<CLAS CLSNAME="ZSAPLINK_DEVC" VERSION="1" LANGU="E" DESCRIPT="SapLink Class Installer" CATEGORY="00" EXPOSURE="2" STATE="1" RELEASE="0" CLSCCINCL="X" FIXPT="X" UNICODE="X" CLSBCCAT="00" DURATION_TYPE="0 " RISK_LEVEL="0 " REFCLSNAME="ZSAPLINK">
<types CLSNAME="ZSAPLINK_DEVC" CMPNAME="TS_FIELD_MAP" VERSION="1" LANGU="E" DESCRIPT="Field map" EXPOSURE="2" STATE="1" EDITORDER="1 " TYPTYPE="4" SRCROW1="17 " SRCCOLUMN1="4 " SRCROW2="20 " SRCCOLUMN2="24 " TYPESRC_LENG="151 " TYPESRC='BEGIN OF ts_field_map,
st_fn TYPE string, " Structure Field Name
obj_fn TYPE string, " Object Field NAME
END OF ts_field_map
'/>
<types CLSNAME="ZSAPLINK_DEVC" CMPNAME="TT_FIELD_MAP" VERSION="1" LANGU="E" DESCRIPT="Mapping" EXPOSURE="2" STATE="1" EDITORDER="2 " TYPTYPE="4" SRCROW1="22 " SRCCOLUMN1="4 " SRCROW2="22 " SRCCOLUMN2="71 " TYPESRC_LENG="70 " TYPESRC="tt_field_map TYPE SORTED TABLE OF ts_field_map WITH UNIQUE KEY st_fn
"/>
<localImplementation>*"* local class implementation for public class
*"* use this source file for the implementation part of
*"* local helper classes</localImplementation>
<localTypes>*"* use this source file for any type declarations (class
*"* definitions, interfaces or data types) you need for method
*"* implementation or private method's signature</localTypes>
<localMacros>*"* use this source file for any macro definitions you need
*"* in the implementation part of the class</localMacros>
<typeUsage CLSNAME="ZSAPLINK_DEVC" TYPEGROUP="ABAP" VERSION="1" TPUTYPE="0" EXPLICIT="X"/>
<typeUsage CLSNAME="ZSAPLINK_DEVC" TYPEGROUP="SEOP" VERSION="1" TPUTYPE="0" EXPLICIT="X"/>
<typeUsage CLSNAME="ZSAPLINK_DEVC" TYPEGROUP="SEOR" VERSION="1" TPUTYPE="0" EXPLICIT="X"/>
<typeUsage CLSNAME="ZSAPLINK_DEVC" TYPEGROUP="SEOS" VERSION="1" TPUTYPE="0" EXPLICIT="X"/>
<typeUsage CLSNAME="ZSAPLINK_DEVC" TYPEGROUP="SEOT" VERSION="1" TPUTYPE="0" EXPLICIT="X"/>
<typeUsage CLSNAME="ZSAPLINK_DEVC" TYPEGROUP="SEOX" VERSION="1" TPUTYPE="0" EXPLICIT="X"/>
<forwardDeclaration>ABAP</forwardDeclaration>
<forwardDeclaration>SEOP</forwardDeclaration>
<forwardDeclaration>SEOR</forwardDeclaration>
<forwardDeclaration>SEOS</forwardDeclaration>
<forwardDeclaration>SEOT</forwardDeclaration>
<forwardDeclaration>SEOX</forwardDeclaration>
<attribute CLSNAME="ZSAPLINK_DEVC" CMPNAME="OBJ" VERSION="1" LANGU="E" DESCRIPT="Interface for Packages" EXPOSURE="0" STATE="1" EDITORDER="1 " ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="3" TYPE="IF_PACKAGE" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZSAPLINK_DEVC" CMPNAME="SCOMPKDTLN_MAPPING" VERSION="1" LANGU="E" DESCRIPT="Mapping" EXPOSURE="0" STATE="1" EDITORDER="2 " ATTDECLTYP="1" ATTEXPVIRT="0" TYPTYPE="1" TYPE="TT_FIELD_MAP" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
<inheritance CLSNAME="ZSAPLINK_DEVC" REFCLSNAME="ZSAPLINK" VERSION="1" STATE="1">
<redefinition CLSNAME="ZSAPLINK_DEVC" REFCLSNAME="ZSAPLINK" VERSION="1" MTDNAME="CHECKEXISTS" EXPOSURE="2"/>
<redefinition CLSNAME="ZSAPLINK_DEVC" REFCLSNAME="ZSAPLINK" VERSION="1" MTDNAME="CREATEIXMLDOCFROMOBJECT" EXPOSURE="2"/>
<redefinition CLSNAME="ZSAPLINK_DEVC" REFCLSNAME="ZSAPLINK" VERSION="1" MTDNAME="CREATEOBJECTFROMIXMLDOC" EXPOSURE="2"/>
<redefinition CLSNAME="ZSAPLINK_DEVC" REFCLSNAME="ZSAPLINK" VERSION="1" MTDNAME="DELETEOBJECT" EXPOSURE="1"/>
<redefinition CLSNAME="ZSAPLINK_DEVC" REFCLSNAME="ZSAPLINK" VERSION="1" MTDNAME="GETOBJECTTYPE" EXPOSURE="1"/>
</inheritance>
<method CLSNAME="ZSAPLINK" CMPNAME="CHECKEXISTS" VERSION="0" EXPOSURE="0" STATE="0" EDITORDER="0 " DISPID="0 " MTDTYPE="0" MTDDECLTYP="0" BCMTDCAT="00" BCMTDSYN="0">
<source>method CHECKEXISTS.
*/---------------------------------------------------------------------\
*| This plugin have been don by : Taryck BENSIALI |
*| |
*| e-mail : taryck@bensiali.net |
*| |
*| this plugin is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*\---------------------------------------------------------------------/
data _key type DEVCLASS.
data _devc type ref to IF_PACKAGE. "for debug
_key = objname.
CALL METHOD cl_package=>if_package~load_package
EXPORTING
i_package_name = _key
i_force_reload = 'X'
IMPORTING
e_package = _devc
EXCEPTIONS
object_not_existing = 1
* unexpected_error = 2 => DUMP
* intern_err = 3 => DUMP
object_locked_and_modified = 0
* others = 5 => DUMP
.
IF sy-subrc = 0.
exists = 'X'.
ENDIF.
endmethod.</source>
</method>
<method CLSNAME="ZSAPLINK_DEVC" CMPNAME="CLASS_CONSTRUCTOR" VERSION="1" LANGU="E" DESCRIPT="CLASS_CONSTRUCTOR" EXPOSURE="2" STATE="1" EDITORDER="1 " DISPID="0 " MTDTYPE="2" MTDDECLTYP="1" BCMTDCAT="00" BCMTDSYN="0">
<source>method CLASS_CONSTRUCTOR.
*/---------------------------------------------------------------------\
*| This plugin have been don by : Taryck BENSIALI |
*| |
*| e-mail : taryck@bensiali.net |
*| |
*| this plugin is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*\---------------------------------------------------------------------/
data: _wa like LINE OF SCOMPKDTLN_MAPPING.
* FROM method M_LOAD_DATA of CL_PACKAGE
* Package
_wa-st_fn = 'DEVCLASS'.
_wa-obj_fn = 'PACKAGE_NAME'.
INSERT _wa into TABLE SCOMPKDTLN_MAPPING.
* Short Description of Repository Objects
_wa-st_fn = 'CTEXT'.
_wa-obj_fn = 'SHORT_TEXT'.
INSERT _wa into TABLE SCOMPKDTLN_MAPPING.
* Indicator for Object Deleted from Memory
_wa-st_fn = 'DEL_IN_MEM'.
_wa-obj_fn = 'DELETED_IN_MEMORY'.
INSERT _wa into TABLE SCOMPKDTLN_MAPPING.
* Language Key
_wa-st_fn = 'LANGUAGE'.
_wa-obj_fn = 'TEXT_LANGUAGE'.
INSERT _wa into TABLE SCOMPKDTLN_MAPPING.
* Original Language in Repository objects
_wa-st_fn = 'MASTERLANG'.
_wa-obj_fn = 'MASTER_LANGUAGE'.
INSERT _wa into TABLE SCOMPKDTLN_MAPPING.
* Changes Recorded
_wa-st_fn = 'KORRFLAG'.
_wa-obj_fn = 'WBO_KORR_FLAG'.
INSERT _wa into TABLE SCOMPKDTLN_MAPPING.
* User Responsible for Package
_wa-st_fn = 'AS4USER'.
_wa-obj_fn = 'AUTHOR'.
INSERT _wa into TABLE SCOMPKDTLN_MAPPING.
* Transport Layer in ABAP Workbench
_wa-st_fn = 'PDEVCLASS'.
_wa-obj_fn = 'TRANSPORT_LAYER'.
INSERT _wa into TABLE SCOMPKDTLN_MAPPING.
** Short Text for Transport Layer
* _wa-st_fn = 'LAYER_TEXT'.
* _wa-obj_fn = 'TRANSPORT_LAYER_TEXT'.
* INSERT _wa into TABLE SCOMPKDTLN_MAPPING.
* Software Component
_wa-st_fn = 'DLVUNIT'.
_wa-obj_fn = 'SOFTWARE_COMPONENT'.
INSERT _wa into TABLE SCOMPKDTLN_MAPPING.
* Application Component ID
_wa-st_fn = 'COMP_POSID'.
_wa-obj_fn = 'APPLICATION_COMPONENT_ABBREV'.
INSERT _wa into TABLE SCOMPKDTLN_MAPPING.
* Application Component
_wa-st_fn = 'COMPONENT'.
_wa-obj_fn = 'APPLICATION_COMPONENT'.
INSERT _wa into TABLE SCOMPKDTLN_MAPPING.
* Flag: Inherit Use Accesses from Surrounding Package
_wa-st_fn = 'PERMINHER'.
_wa-obj_fn = 'INHERITS_PERMISSIONS'.
INSERT _wa into TABLE SCOMPKDTLN_MAPPING.
* Surrounding Package
_wa-st_fn = 'PARENTCL'.
_wa-obj_fn = 'SUPER_PACKAGE_NAME'.
INSERT _wa into TABLE SCOMPKDTLN_MAPPING.
* Prefix for Package Interfaces (Suggested Value)
_wa-st_fn = 'INTFPREFX'.
_wa-obj_fn = 'INTERFACE_PREFIX'.
INSERT _wa into TABLE SCOMPKDTLN_MAPPING.
* Package Type (Permitted Object Types)
_wa-st_fn = 'PACKTYPE'.
_wa-obj_fn = 'PACKAGE_TYPE'.
INSERT _wa into TABLE SCOMPKDTLN_MAPPING.
* Constraint on Extending Package
_wa-st_fn = 'RESTRICTED'.
_wa-obj_fn = 'EXTENSION_RESTRICTED'.
INSERT _wa into TABLE SCOMPKDTLN_MAPPING.
* Main Package Indicator
_wa-st_fn = 'MAINPACK'.
_wa-obj_fn = 'MAIN_PACKAGE'.
INSERT _wa into TABLE SCOMPKDTLN_MAPPING.
* Flag for Package Check as Server
_wa-st_fn = 'SRV_CHECK'.
_wa-obj_fn = 'CHECKS_AS_SERVER_ENFORCED'.
INSERT _wa into TABLE SCOMPKDTLN_MAPPING.
* Flag: Package Check as Client
_wa-st_fn = 'CLI_CHECK'.
_wa-obj_fn = 'CHECKS_AS_CLIENT_ENFORCED'.
INSERT _wa into TABLE SCOMPKDTLN_MAPPING.
* Alias for R/3 Enterprise Extension in Transaction FIBF
_wa-st_fn = 'EXT_ALIAS'.
_wa-obj_fn = 'R3_EXTENSION_ALIAS'.
INSERT _wa into TABLE SCOMPKDTLN_MAPPING.
endmethod.</source>
</method>
<method CLSNAME="ZSAPLINK" CMPNAME="CREATEIXMLDOCFROMOBJECT" VERSION="0" EXPOSURE="0" STATE="0" EDITORDER="0 " DISPID="0 " MTDTYPE="0" MTDDECLTYP="0" BCMTDCAT="00" BCMTDSYN="0">
<source>METHOD createixmldocfromobject.
*/---------------------------------------------------------------------\
*| This plugin have been don by : Taryck BENSIALI |
*| |
*| e-mail : taryck@bensiali.net |
*| |
*| this plugin is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*\---------------------------------------------------------------------/
DATA _devc_data TYPE scompkdtln.
DATA rc TYPE sysubrc. " for debug
DATA _objtype TYPE string.
DATA tmp_str TYPE string.
DATA root_node TYPE REF TO if_ixml_element.
_objtype = getobjecttype( ).
root_node = xmldoc->create_element( _objtype ).
load_obj( ).
obj_2_struct( EXPORTING obj = obj
mapping = scompkdtln_mapping
CHANGING struct = _devc_data ).
setattributesfromstructure( node = root_node structure = _devc_data ).
* because of the following code in the previous method we have to set back DEVCLASS
* when 'DEVCLASS'. "development class should always be $TMP
* sValue = '$TMP'.
tmp_str = _devc_data-devclass.
rc = root_node->set_attribute( name = 'DEVCLASS' value = tmp_str ).
rc = xmldoc->append_child( root_node ).
ixmldocument = xmldoc.
ENDMETHOD.</source>
</method>
<method CLSNAME="ZSAPLINK" CMPNAME="CREATEOBJECTFROMIXMLDOC" VERSION="0" EXPOSURE="0" STATE="0" EDITORDER="0 " DISPID="0 " MTDTYPE="0" MTDDECLTYP="0" BCMTDCAT="00" BCMTDSYN="0">
<source>METHOD createobjectfromixmldoc.
*/---------------------------------------------------------------------\
*| This plugin have been don by : Taryck BENSIALI |
*| |
*| e-mail : taryck@bensiali.net |
*| |
*| this plugin is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*\---------------------------------------------------------------------/
DATA root_node TYPE REF TO if_ixml_element.
DATA rootnode TYPE REF TO if_ixml_element.
DATA objname TYPE e071-obj_name.
DATA _objtype TYPE string.
DATA _devc_data TYPE scompkdtln.
_objtype = getobjecttype( ).
xmldoc = ixmldocument.
root_node = xmldoc->find_from_name( _objtype ).
* Get Root
me->getstructurefromattributes(
EXPORTING node = root_node
CHANGING structure = _devc_data ).
objname = _devc_data-devclass.
* Done in method S_LOCK_DB de CL_PACKAGE
* CALL FUNCTION 'RS_ACCESS_PERMISSION'
* EXPORTING
* global_lock = 'X'
* mode = 'INSERT'
* object = objname
* object_class = _objtype
* EXCEPTIONS
* canceled_in_corr = 1
* enqueued_by_user = 3
* enqueue_system_failure = 4
* locked_by_author = 5
* illegal_parameter_values = 6
* no_modify_permission = 7
* no_show_permission = 8
* permission_failure = 9.
*
* IF sy-subrc <> 0.
* CASE sy-subrc.
* WHEN 7 OR 8 OR 9.
* RAISE EXCEPTION TYPE zcx_saplink
* EXPORTING
* textid = zcx_saplink=>not_authorized.
* WHEN 5.
* RAISE EXCEPTION TYPE zcx_saplink
* EXPORTING
* textid = zcx_saplink=>error_message
* msg = 'object locked'.
* WHEN OTHERS.
* RAISE EXCEPTION TYPE zcx_saplink
* EXPORTING
* textid = zcx_saplink=>system_error.
* ENDCASE.
* ENDIF.
* CALL FUNCTION 'RS_CORR_INSERT'
* EXPORTING
* object = objname
* object_class = _objtype
* mode = 'INSERT'
* global_lock = 'X'
** devclass = devclass
* author = sy-uname
* master_language = sy-langu
* EXCEPTIONS
* cancelled = 1
* permission_failure = 2
* unknown_objectclass = 3.
* IF sy-subrc <> 0.
* CASE sy-subrc.
* WHEN 2.
* RAISE EXCEPTION TYPE zcx_saplink
* EXPORTING
* textid = zcx_saplink=>not_authorized.
* WHEN OTHERS.
* RAISE EXCEPTION TYPE zcx_saplink
* EXPORTING
* textid = zcx_saplink=>system_error.
* ENDCASE.
* ENDIF.
CALL METHOD cl_package=>if_package~create_new_package
* EXPORTING
* i_reuse_deleted_object = 'X'
IMPORTING
e_package = obj
CHANGING
c_package_data = _devc_data
EXCEPTIONS
object_already_existing = 1
object_just_created = 2
not_authorized = 3
wrong_name_prefix = 4
undefined_name = 5
reserved_local_name = 6
invalid_package_name = 7
short_text_missing = 8
software_component_invalid = 9
layer_invalid = 10
author_not_existing = 11
component_not_existing = 12
component_missing = 13
prefix_in_use = 14
unexpected_error = 15
intern_err = 16
OTHERS = 17
.
IF sy-subrc = 11.
_devc_data-as4user = sy-uname.
CALL METHOD cl_package=>if_package~create_new_package
* EXPORTING
* i_reuse_deleted_object = 'X'
IMPORTING
e_package = obj
CHANGING
c_package_data = _devc_data
EXCEPTIONS
object_already_existing = 1
object_just_created = 2
not_authorized = 3
wrong_name_prefix = 4
undefined_name = 5
reserved_local_name = 6
invalid_package_name = 7
short_text_missing = 8
software_component_invalid = 9
layer_invalid = 10
author_not_existing = 11
component_not_existing = 12
component_missing = 13
prefix_in_use = 14
unexpected_error = 15
intern_err = 16
OTHERS = 17
.
ENDIF.
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN 1.
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING
textid = zcx_saplink=>error_message
msg = 'All ready exist'.
WHEN 2 OR 3.
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING
textid = zcx_saplink=>not_authorized.
WHEN 4 OR 5 OR 6 OR 7.
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING
textid = zcx_saplink=>error_message
msg = 'Problem with Dev Class name'.
WHEN 8.
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING
textid = zcx_saplink=>error_message
msg = 'Problem with Short Text'.
WHEN 9.
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING
textid = zcx_saplink=>error_message
msg = 'Problem with SoftwareComponent'.
WHEN 10.
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING
textid = zcx_saplink=>error_message
msg = 'Problem with Layer'.
WHEN 12 OR 13.
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING
textid = zcx_saplink=>error_message
msg = 'Problem with Component'.
WHEN OTHERS.
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING
textid = zcx_saplink=>system_error.
ENDCASE.
ENDIF.
CALL METHOD obj->save
* EXPORTING
* i_transport_request =
* IMPORTING
* e_transport_request =
EXCEPTIONS
object_invalid = 1
object_not_changeable = 2
cancelled_in_corr = 3
permission_failure = 4
unexpected_error = 5
intern_err = 6
OTHERS = 7
.
IF sy-subrc <> 0.
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING
textid = zcx_saplink=>error_message
msg = 'Dev Class creation failed !'.
ENDIF.
ENDMETHOD.</source>
</method>
<method CLSNAME="ZSAPLINK" CMPNAME="DELETEOBJECT" VERSION="0" EXPOSURE="0" STATE="0" EDITORDER="0 " DISPID="0 " MTDTYPE="0" MTDDECLTYP="0" BCMTDCAT="00" BCMTDSYN="0">
<source>METHOD deleteobject.
*/---------------------------------------------------------------------\
*| This plugin have been don by : Taryck BENSIALI |
*| |
*| e-mail : taryck@bensiali.net |
*| |
*| this plugin is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*\---------------------------------------------------------------------/
load_obj( ).
CALL METHOD obj->delete
EXCEPTIONS
object_not_empty = 1
object_not_changeable = 2
object_invalid = 3
intern_err = 4
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD obj->save
EXPORTING
i_transport_request = space
* IMPORTING
* e_transport_request =
EXCEPTIONS
object_invalid = 1
object_not_changeable = 2
cancelled_in_corr = 3
permission_failure = 4
unexpected_error = 5
intern_err = 6
OTHERS = 7
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMETHOD.</source>
</method>
<method CLSNAME="ZSAPLINK" CMPNAME="GETOBJECTTYPE" VERSION="0" EXPOSURE="0" STATE="0" EDITORDER="0 " DISPID="0 " MTDTYPE="0" MTDDECLTYP="0" BCMTDCAT="00" BCMTDSYN="0">
<source>method GETOBJECTTYPE.
*/---------------------------------------------------------------------\
*| This plugin have been don by : Taryck BENSIALI |
*| |
*| e-mail : taryck@bensiali.net |
*| |
*| this plugin is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*\---------------------------------------------------------------------/
objecttype = 'DEVC'. "Dev class
endmethod.</source>
</method>
<method CLSNAME="ZSAPLINK_DEVC" CMPNAME="LOAD_OBJ" VERSION="1" LANGU="E" DESCRIPT="Load IF_Package" EXPOSURE="0" STATE="1" EDITORDER="3 " DISPID="0 " MTDTYPE="0" MTDDECLTYP="0" BCMTDCAT="00" BCMTDSYN="0">
<source>method LOAD_OBJ.
*/---------------------------------------------------------------------\
*| This plugin have been don by : Taryck BENSIALI |
*| |
*| e-mail : taryck@bensiali.net |
*| |
*| this plugin is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*\---------------------------------------------------------------------/
data _key type DEVCLASS.
_key = objname.
CALL METHOD cl_package=>if_package~load_package
EXPORTING
i_package_name = _key
i_force_reload = 'X'
IMPORTING
e_package = obj
EXCEPTIONS
object_not_existing = 1
unexpected_error = 2
intern_err = 3
object_locked_and_modified = 4
others = 5
.
IF sy-subrc <> 0.
clear obj.
ENDIF.
endmethod.</source>
</method>
<method CLSNAME="ZSAPLINK_DEVC" CMPNAME="OBJ_2_STRUCT" VERSION="1" LANGU="E" DESCRIPT="Object fields to Structure fierlds" EXPOSURE="2" STATE="1" EDITORDER="2 " DISPID="0 " MTDTYPE="0" MTDDECLTYP="1" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZSAPLINK_DEVC" CMPNAME="OBJ_2_STRUCT" SCONAME="OBJ" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="3" TYPE="OBJECT"/>
<parameter CLSNAME="ZSAPLINK_DEVC" CMPNAME="OBJ_2_STRUCT" SCONAME="MAPPING" VERSION="1" LANGU="E" DESCRIPT="Mapping" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="TT_FIELD_MAP" PAROPTIONL="X"/>
<parameter CLSNAME="ZSAPLINK_DEVC" CMPNAME="OBJ_2_STRUCT" SCONAME="STRUCT" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="3 " DISPID="0 " PARDECLTYP="2" PARPASSTYP="1" TYPTYPE="1" TYPE="ANY"/>
<source>METHOD obj_2_struct.
*/---------------------------------------------------------------------\
*| This plugin have been don by : Taryck BENSIALI |
*| |
*| e-mail : taryck@bensiali.net |
*| |
*| this plugin is distributed in the hope that it will be useful, |
*| but WITHOUT ANY WARRANTY; without even the implied warranty of |
*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
*| GNU General Public License for more details. |
*| |
*\---------------------------------------------------------------------/
DATA:
of TYPE string,
desc TYPE REF TO cl_abap_typedescr,
fields TYPE REF TO cl_abap_structdescr.
FIELD-SYMBOLS:
<map> LIKE LINE OF mapping,
<field> LIKE LINE OF fields->components,
<sf> TYPE ANY,
<of> TYPE ANY.
CALL METHOD cl_abap_datadescr=>describe_by_data
EXPORTING
p_data = struct
RECEIVING
p_descr_ref = desc.
CHECK desc->kind = cl_abap_typedescr=>kind_struct.
CHECK desc->type_kind = cl_abap_typedescr=>typekind_struct1
OR desc->type_kind = cl_abap_typedescr=>typekind_struct2.
fields ?= desc.
CHECK fields->struct_kind = cl_abap_structdescr=>structkind_flat.
LOOP AT fields->components ASSIGNING <field>.
* Check for exception
READ TABLE mapping WITH TABLE KEY st_fn = <field>-name
ASSIGNING <map>.
IF sy-subrc <> 0.
CONCATENATE 'OBJ->' <field>-name INTO of.
ELSE.
CONCATENATE 'OBJ->' <map>-obj_fn INTO of.
ENDIF.
ASSIGN (of) TO <of>.
CHECK sy-subrc = 0.
ASSIGN COMPONENT <field>-name OF STRUCTURE struct TO <sf>.
CHECK sy-subrc = 0.
TRY.
<sf> = <of>.
CATCH cx_root.
ENDTRY.
ENDLOOP.
ENDMETHOD.</source>
</method>
</CLAS>