-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathCLAS_ZSAPLINK_MIME.slnk
689 lines (614 loc) · 34.4 KB
/
CLAS_ZSAPLINK_MIME.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
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
<?xml version="1.0" encoding="iso-8859-1"?>
<CLAS CLSNAME="ZSAPLINK_MIME" VERSION="1" LANGU="E" DESCRIPT="SapLink Class Installer" UUID="DF43BB0FF40580F1BC94000C291BF083" CATEGORY="00" EXPOSURE="2" STATE="1" RELEASE="0" AUTHOR="BCUSER" CREATEDON="20100409" CHANGEDON="20100409" CHGDANYON="00000000" CLSCCINCL="X" FIXPT="X" UNICODE="X" R3RELEASE="701" CLSBCCAT="00" DURATION_TYPE="0 " RISK_LEVEL="0 " REFCLSNAME="ZSAPLINK" CHANGEDBY="BCUSER">
<types CLSNAME="ZSAPLINK_MIME" CMPNAME="GT_MIME" VERSION="1" LANGU="E" EXPOSURE="0" STATE="1" EDITORDER="1 " AUTHOR="BCUSER" CREATEDON="20100413" CHANGEDBY="BCUSER" CHANGEDON="20100414" TYPTYPE="4" SRCROW1="6 " SRCCOLUMN1="4 " SRCROW2="15 " SRCCOLUMN2="22 " TYPESRC_LENG="292 " TYPESRC="BEGIN OF gt_mime,
path TYPE string,
id TYPE sdok_docid,
class TYPE sdok_class,
name TYPE string,
description TYPE string,
type TYPE w3conttype,
size TYPE i,
language TYPE spras,
END OF gt_mime
"/>
<publicSection>class ZSAPLINK_MIME definition
public
inheriting from ZSAPLINK
create public .
*"* public components of class ZSAPLINK_MIME
*"* do not include other source files here!!!
public section.
type-pools ABAP .
type-pools SEOP .
type-pools SEOR .
type-pools SEOS .
type-pools SEOT .
type-pools SEOX .
methods CHECKEXISTS
redefinition .
methods CREATEIXMLDOCFROMOBJECT
redefinition .
methods CREATEOBJECTFROMIXMLDOC
redefinition .</publicSection>
<protectedSection>*"* protected components of class ZSAPLINK_MIME
*"* do not include other source files here!!!
protected section.
methods GETOBJECTTYPE
redefinition .
methods DELETEOBJECT
redefinition .</protectedSection>
<privateSection>*"* private components of class ZSAPLINK_MIME
*"* do not include other source files here!!!
private section.
types:
BEGIN OF gt_mime,
path TYPE string,
id TYPE sdok_docid,
class TYPE sdok_class,
name TYPE string,
description TYPE string,
type TYPE w3conttype,
size TYPE i,
language TYPE spras,
END OF gt_mime .
constants GC_DOC_CLASS_IMAGE_LOG type SDOK_CLASS value 'M_IMAGE_L'. "#EC NOTEXT
constants GC_PROP_FOLDER_ID type STRING value 'KW_PARENT_FOLDER_ID'. "#EC NOTEXT
constants GC_PROP_FOLDER_CLASS type STRING value 'KW_PARENT_FOLDER_CLASS'. "#EC NOTEXT
constants GC_PROP_URL type STRING value 'KW_RELATIVE_URL'. "#EC NOTEXT
constants GC_OBJECT_TYPE type STRING value 'SMIM'. "#EC NOTEXT
data GV_MIME_PATH type STRING .
data GR_MIME_REPOSITORY type ref to IF_MR_API .
data GC_DOC_CLASS_FOLDER_LOG type STRING value 'M_FOLDER'. "#EC NOTEXT .
methods GET_MIME_PATH
importing
!IV_CLASS type SDOK_CLASS
!IV_OBJID type SDOK_DOCID
returning
value(RV_PATH) type STRING
raising
ZCX_SAPLINK .
methods GET_MIME_DESCRIPTION
importing
!IV_CLASS type SDOK_CLASS
!IV_OBJID type SDOK_DOCID
returning
value(RV_DESCRIPTION) type STRING .
methods MIME_TO_XML
returning
value(RR_MIME_NODE) type ref to IF_IXML_ELEMENT .
methods XML_TO_MIME
importing
!IV_XML type ref to IF_IXML_DOCUMENT
!IV_DEV_PACKAGE type DEVCLASS default '$TMP'
!IV_OVERWRITE type FLAG
raising
ZCX_SAPLINK .
methods GET_MIME_CLASS
importing
!IV_OBJID type SDOK_DOCID
returning
value(RV_CLASS) type SDOK_CLASS .</privateSection>
<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_MIME" TYPEGROUP="ABAP" VERSION="1" TPUTYPE="0" EXPLICIT="X"/>
<typeUsage CLSNAME="ZSAPLINK_MIME" TYPEGROUP="SEOP" VERSION="1" TPUTYPE="0" EXPLICIT="X"/>
<typeUsage CLSNAME="ZSAPLINK_MIME" TYPEGROUP="SEOR" VERSION="1" TPUTYPE="0" EXPLICIT="X"/>
<typeUsage CLSNAME="ZSAPLINK_MIME" TYPEGROUP="SEOS" VERSION="1" TPUTYPE="0" EXPLICIT="X"/>
<typeUsage CLSNAME="ZSAPLINK_MIME" TYPEGROUP="SEOT" VERSION="1" TPUTYPE="0" EXPLICIT="X"/>
<typeUsage CLSNAME="ZSAPLINK_MIME" 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_MIME" CMPNAME="GC_DOC_CLASS_FOLDER_LOG" VERSION="1" LANGU="E" DESCRIPT="Folder document class" EXPOSURE="0" STATE="1" EDITORDER="8 " AUTHOR="BCUSER" CREATEDON="20100415" CHANGEDBY="BCUSER" CHANGEDON="20100415" ATTDECLTYP="0" ATTVALUE="'M_FOLDER'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " R3RELEASE="701" TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZSAPLINK_MIME" CMPNAME="GC_DOC_CLASS_IMAGE_LOG" VERSION="1" LANGU="E" DESCRIPT="Document class" EXPOSURE="0" STATE="1" EDITORDER="1 " AUTHOR="BCUSER" CREATEDON="20100415" CHANGEDON="00000000" ATTDECLTYP="2" ATTVALUE="'M_IMAGE_L'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="SDOK_CLASS" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZSAPLINK_MIME" CMPNAME="GC_OBJECT_TYPE" VERSION="1" LANGU="E" DESCRIPT="MIME object type" EXPOSURE="0" STATE="1" EDITORDER="5 " AUTHOR="BCUSER" CREATEDON="20100414" CHANGEDBY="BCUSER" CHANGEDON="20100415" ATTDECLTYP="2" ATTVALUE="'SMIM'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZSAPLINK_MIME" CMPNAME="GC_PROP_FOLDER_CLASS" VERSION="1" LANGU="E" DESCRIPT="Property folder class" EXPOSURE="0" STATE="1" EDITORDER="3 " AUTHOR="BCUSER" CREATEDON="20100414" CHANGEDBY="BCUSER" CHANGEDON="20100415" ATTDECLTYP="2" ATTVALUE="'KW_PARENT_FOLDER_CLASS'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZSAPLINK_MIME" CMPNAME="GC_PROP_FOLDER_ID" VERSION="1" LANGU="E" DESCRIPT="Property folder id" EXPOSURE="0" STATE="1" EDITORDER="2 " AUTHOR="BCUSER" CREATEDON="20100414" CHANGEDBY="BCUSER" CHANGEDON="20100415" ATTDECLTYP="2" ATTVALUE="'KW_PARENT_FOLDER_ID'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZSAPLINK_MIME" CMPNAME="GC_PROP_URL" VERSION="1" LANGU="E" DESCRIPT="Property relative url" EXPOSURE="0" STATE="1" EDITORDER="4 " AUTHOR="BCUSER" CREATEDON="20100414" CHANGEDBY="BCUSER" CHANGEDON="20100415" ATTDECLTYP="2" ATTVALUE="'KW_RELATIVE_URL'" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZSAPLINK_MIME" CMPNAME="GR_MIME_REPOSITORY" VERSION="1" LANGU="E" DESCRIPT="API for MIME Repository" EXPOSURE="0" STATE="1" EDITORDER="7 " AUTHOR="BCUSER" CREATEDON="20100414" CHANGEDBY="BCUSER" CHANGEDON="20100415" ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="3" TYPE="IF_MR_API" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
<attribute CLSNAME="ZSAPLINK_MIME" CMPNAME="GV_MIME_PATH" VERSION="1" LANGU="E" DESCRIPT="MIME path" EXPOSURE="0" STATE="1" EDITORDER="6 " AUTHOR="BCUSER" CREATEDON="20100414" CHANGEDBY="BCUSER" CHANGEDON="20100415" ATTDECLTYP="0" ATTEXPVIRT="0" TYPTYPE="1" TYPE="STRING" SRCROW1="0 " SRCCOLUMN1="0 " SRCROW2="0 " SRCCOLUMN2="0 " TYPESRC_LENG="0 "/>
<inheritance CLSNAME="ZSAPLINK_MIME" REFCLSNAME="ZSAPLINK" VERSION="1" STATE="1" AUTHOR="BCUSER" CREATEDON="20100409" CHANGEDBY="BCUSER" CHANGEDON="20100409">
<redefinition CLSNAME="ZSAPLINK_MIME" REFCLSNAME="ZSAPLINK" VERSION="1" MTDNAME="CHECKEXISTS"/>
<redefinition CLSNAME="ZSAPLINK_MIME" REFCLSNAME="ZSAPLINK" VERSION="1" MTDNAME="CREATEIXMLDOCFROMOBJECT"/>
<redefinition CLSNAME="ZSAPLINK_MIME" REFCLSNAME="ZSAPLINK" VERSION="1" MTDNAME="CREATEOBJECTFROMIXMLDOC"/>
<redefinition CLSNAME="ZSAPLINK_MIME" REFCLSNAME="ZSAPLINK" VERSION="1" MTDNAME="DELETEOBJECT"/>
<redefinition CLSNAME="ZSAPLINK_MIME" REFCLSNAME="ZSAPLINK" VERSION="1" MTDNAME="GETOBJECTTYPE"/>
</inheritance>
<method CLSNAME="ZSAPLINK" CMPNAME="CHECKEXISTS" VERSION="0" EXPOSURE="0" STATE="0" EDITORDER="0 " DISPID="0 " CREATEDON="00000000" CHANGEDON="00000000" MTDTYPE="0" MTDDECLTYP="0" BCMTDCAT="00" BCMTDSYN="0">
<source>METHOD checkexists.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink 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. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
"
" References
DATA lr_mime_repository TYPE REF TO if_mr_api.
"
" Variables
DATA lv_path TYPE string.
CLEAR exists.
" Create MIME repository instance
lr_mime_repository = cl_mime_repository_api=>get_api( ).
lr_mime_repository->get( EXPORTING
i_url = objname
EXCEPTIONS
parameter_missing = 1
error_occured = 2
not_found = 3
permission_failure = 4 ).
IF sy-subrc = 0.
" MIME exists
exists = abap_true.
ELSE.
" MIME does not exist
exists = abap_false.
ENDIF.
ENDMETHOD.</source>
</method>
<method CLSNAME="ZSAPLINK" CMPNAME="CREATEIXMLDOCFROMOBJECT" VERSION="0" EXPOSURE="0" STATE="0" EDITORDER="0 " DISPID="0 " CREATEDON="00000000" CHANGEDON="00000000" MTDTYPE="0" MTDDECLTYP="0" BCMTDCAT="00" BCMTDSYN="0">
<source>METHOD createixmldocfromobject.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink 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. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
"
" References
DATA lr_mime_node TYPE REF TO if_ixml_element.
"
"
DATA lv_return_code TYPE sysubrc.
"
" MIME to XML
lr_mime_node = me->mime_to_xml( ).
" Append MIME node to xmldoc
lv_return_code = xmldoc->append_child( lr_mime_node ).
" Return xml
ixmldocument = xmldoc.
ENDMETHOD.</source>
</method>
<method CLSNAME="ZSAPLINK" CMPNAME="CREATEOBJECTFROMIXMLDOC" VERSION="0" EXPOSURE="0" STATE="0" EDITORDER="0 " DISPID="0 " CREATEDON="00000000" CHANGEDON="00000000" MTDTYPE="0" MTDDECLTYP="0" BCMTDCAT="00" BCMTDSYN="0">
<source>METHOD createobjectfromixmldoc.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink 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. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
xml_to_mime( iv_xml = ixmldocument
iv_overwrite = overwrite ).
name = objname.
ENDMETHOD.</source>
</method>
<method CLSNAME="ZSAPLINK" CMPNAME="DELETEOBJECT" VERSION="0" EXPOSURE="0" STATE="0" EDITORDER="0 " DISPID="0 " CREATEDON="00000000" CHANGEDON="00000000" MTDTYPE="0" MTDDECLTYP="0" BCMTDCAT="00" BCMTDSYN="0">
<source>METHOD deleteobject.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink 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. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
"
" References
DATA lr_mime_repository TYPE REF TO if_mr_api.
"
" Variables
DATA lv_textid TYPE sotr_conc.
" Create instance of MIME repository
lr_mime_repository = cl_mime_repository_api=>get_api( ).
" Delete MIME object
lr_mime_repository->delete( EXPORTING
i_url = objname
i_delete_children = 'X'
EXCEPTIONS
parameter_missing = 1
error_occured = 2
cancelled = 3
permission_failure = 4
not_found = 5 ).
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN 4.
lv_textid = zcx_saplink=>not_authorized.
WHEN 5.
lv_textid = zcx_saplink=>not_found.
ENDCASE.
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING textid = lv_textid.
ENDIF.
ENDMETHOD.</source>
</method>
<method CLSNAME="ZSAPLINK" CMPNAME="GETOBJECTTYPE" VERSION="0" EXPOSURE="0" STATE="0" EDITORDER="0 " DISPID="0 " CREATEDON="00000000" CHANGEDON="00000000" MTDTYPE="0" MTDDECLTYP="0" BCMTDCAT="00" BCMTDSYN="0">
<source>METHOD getobjecttype.
*/---------------------------------------------------------------------\
*| This file is part of SAPlink. |
*| |
*| SAPlink is free software; you can redistribute it and/or modify |
*| it under the terms of the GNU General Public License as published |
*| by the Free Software Foundation; either version 2 of the License, |
*| or (at your option) any later version. |
*| |
*| SAPlink 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. |
*| |
*| You should have received a copy of the GNU General Public License |
*| along with SAPlink; if not, write to the |
*| Free Software Foundation, Inc., |
*| 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
*\---------------------------------------------------------------------/
"
"Return MIME object type SMIM
objecttype = me->gc_object_type.
ENDMETHOD.</source>
</method>
<method CLSNAME="ZSAPLINK_MIME" CMPNAME="GET_MIME_CLASS" VERSION="1" LANGU="E" DESCRIPT="Get document class of LOIO (objname)" EXPOSURE="0" STATE="1" EDITORDER="5 " DISPID="0 " AUTHOR="BCUSER" CREATEDON="20100415" CHANGEDON="00000000" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="701" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZSAPLINK_MIME" CMPNAME="GET_MIME_CLASS" SCONAME="IV_OBJID" VERSION="1" LANGU="E" DESCRIPT="ID for documents and relations" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="BCUSER" CREATEDON="20100415" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="SDOK_DOCID"/>
<parameter CLSNAME="ZSAPLINK_MIME" CMPNAME="GET_MIME_CLASS" SCONAME="RV_CLASS" VERSION="1" LANGU="E" DESCRIPT="Document class" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " AUTHOR="BCUSER" CREATEDON="20100415" CHANGEDON="00000000" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="SDOK_CLASS"/>
<source>METHOD get_mime_class.
CLEAR rv_class.
"
" Get mime class
SELECT SINGLE lo_class
INTO rv_class
FROM smimloio
WHERE loio_id = iv_objid.
ENDMETHOD.</source>
</method>
<method CLSNAME="ZSAPLINK_MIME" CMPNAME="GET_MIME_DESCRIPTION" VERSION="1" LANGU="E" DESCRIPT="Get description of LOIO (objname)" EXPOSURE="0" STATE="1" EDITORDER="2 " DISPID="0 " AUTHOR="BCUSER" CREATEDON="20100414" CHANGEDBY="BCUSER" CHANGEDON="20100414" MTDTYPE="0" MTDDECLTYP="0" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZSAPLINK_MIME" CMPNAME="GET_MIME_DESCRIPTION" SCONAME="IV_CLASS" VERSION="1" LANGU="E" DESCRIPT="Document class" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="BCUSER" CREATEDON="20100414" CHANGEDBY="BCUSER" CHANGEDON="20100414" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="SDOK_CLASS"/>
<parameter CLSNAME="ZSAPLINK_MIME" CMPNAME="GET_MIME_DESCRIPTION" SCONAME="IV_OBJID" VERSION="1" LANGU="E" DESCRIPT="ID for documents and relations" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " AUTHOR="BCUSER" CREATEDON="20100414" CHANGEDBY="BCUSER" CHANGEDON="20100414" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="SDOK_DOCID"/>
<parameter CLSNAME="ZSAPLINK_MIME" CMPNAME="GET_MIME_DESCRIPTION" SCONAME="RV_DESCRIPTION" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="3 " DISPID="0 " AUTHOR="BCUSER" CREATEDON="20100414" CHANGEDBY="BCUSER" CHANGEDON="20100414" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="STRING"/>
<source>METHOD get_mime_description.
"
" Tables
DATA lt_object_list TYPE TABLE OF sdokobject.
DATA lt_descriptions TYPE TABLE OF sdokdesc.
"
" Structures
DATA ls_object_list TYPE sdokobject.
DATA ls_description TYPE sdokdesc.
"
" Variables
DATA lv_description TYPE string.
CLEAR rv_description.
ls_object_list-class = iv_class.
ls_object_list-objid = iv_objid.
CALL FUNCTION 'SDOK_LOIO_DESCRIPTIONS_GET'
EXPORTING
object_id = ls_object_list
TABLES
descriptions = lt_descriptions
exceptions
NOT_EXISTING Object Does Not Exist
NOT_AUTHORIZED No Authorization .
"
" Description
READ TABLE lt_descriptions INTO ls_description WITH KEY langu = sy-langu.
IF sy-subrc = 0.
lv_description = ls_description-descript.
ENDIF.
rv_description = lv_description.
ENDMETHOD.</source>
</method>
<method CLSNAME="ZSAPLINK_MIME" CMPNAME="GET_MIME_PATH" VERSION="1" LANGU="E" DESCRIPT="Get path from LOIO (objname)" EXPOSURE="0" STATE="1" EDITORDER="1 " DISPID="0 " AUTHOR="BCUSER" CREATEDON="20100414" CHANGEDBY="BCUSER" CHANGEDON="20100415" MTDTYPE="0" MTDDECLTYP="0" MTDNEWEXC="X" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZSAPLINK_MIME" CMPNAME="GET_MIME_PATH" SCONAME="IV_CLASS" VERSION="1" LANGU="E" DESCRIPT="Document class" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="BCUSER" CREATEDON="20100414" CHANGEDBY="BCUSER" CHANGEDON="20100414" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="SDOK_CLASS"/>
<parameter CLSNAME="ZSAPLINK_MIME" CMPNAME="GET_MIME_PATH" SCONAME="IV_OBJID" VERSION="1" LANGU="E" DESCRIPT="ID for documents and relations" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " AUTHOR="BCUSER" CREATEDON="20100414" CHANGEDBY="BCUSER" CHANGEDON="20100414" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="SDOK_DOCID"/>
<parameter CLSNAME="ZSAPLINK_MIME" CMPNAME="GET_MIME_PATH" SCONAME="RV_PATH" VERSION="1" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="3 " DISPID="0 " AUTHOR="BCUSER" CREATEDON="20100414" CHANGEDBY="BCUSER" CHANGEDON="20100414" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="1" TYPE="STRING"/>
<exception CLSNAME="ZSAPLINK_MIME" CMPNAME="GET_MIME_PATH" SCONAME="ZCX_SAPLINK" VERSION="1" LANGU="E" DESCRIPT="SAPlink exception class" MTDTYPE="0" EDITORDER="1 " AUTHOR="BCUSER" CREATEDON="20100415" CHANGEDON="00000000"/>
<source>METHOD GET_MIME_PATH.
"
" Tables
DATA lt_object_list TYPE TABLE OF sdokobject.
DATA lt_properties TYPE TABLE OF sdokproptl.
"
" Structures
DATA ls_object_list TYPE sdokobject.
DATA ls_properties TYPE sdokproptl.
"
" Variables
DATA lv_path TYPE string.
CLEAR rv_path.
ls_object_list-class = iv_class.
ls_object_list-objid = iv_objid.
APPEND ls_object_list TO lt_object_list.
WHILE lt_object_list IS NOT INITIAL.
CALL FUNCTION 'SDOK_LOIOS_PROPERTIES_GET'
TABLES
object_list = lt_object_list
properties = lt_properties.
CLEAR ls_object_list.
REFRESH lt_object_list.
"
" KW_RELATIVE_URL
READ TABLE lt_properties INTO ls_properties WITH KEY name = me->gc_prop_url.
IF sy-subrc = 0.
" Build path
CONCATENATE '/'
ls_properties-value
lv_path
INTO lv_path.
ENDIF.
"
"KW_PARENT_FOLDER_CLASS
READ TABLE lt_properties INTO ls_properties WITH KEY name = me->gc_prop_folder_class.
ls_object_list-class = ls_properties-value.
" KW_PARENT_FOLDER_ID
READ TABLE lt_properties INTO ls_properties WITH KEY name = me->gc_prop_folder_id.
ls_object_list-objid = ls_properties-value.
IF ls_object_list-class IS NOT INITIAL AND
ls_object_list-objid IS NOT INITIAL.
APPEND ls_object_list TO lt_object_list.
ENDIF.
ENDWHILE.
if lv_path is initial.
"Not found
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING textid = zcx_saplink=>not_found.
endif.
rv_path = lv_path.
ENDMETHOD.</source>
</method>
<method CLSNAME="ZSAPLINK_MIME" CMPNAME="MIME_TO_XML" VERSION="1" LANGU="E" DESCRIPT="Convert MIME to XML" EXPOSURE="0" STATE="1" EDITORDER="3 " DISPID="0 " AUTHOR="BCUSER" CREATEDON="20100414" CHANGEDBY="BCUSER" CHANGEDON="20100414" MTDTYPE="0" MTDDECLTYP="0" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZSAPLINK_MIME" CMPNAME="MIME_TO_XML" SCONAME="RR_MIME_NODE" VERSION="1" LANGU="E" DESCRIPT="IF_IXML_ELEMENT" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="BCUSER" CREATEDON="20100414" CHANGEDBY="BCUSER" CHANGEDON="20100414" PARDECLTYP="3" PARPASSTYP="0" TYPTYPE="3" TYPE="IF_IXML_ELEMENT"/>
<source>METHOD mime_to_xml.
"
" References
DATA lr_mime_node TYPE REF TO if_ixml_element.
DATA lr_mime_repository TYPE REF TO if_mr_api.
DATA lr_zip TYPE REF TO cl_abap_zip.
"
" Structures
DATA ls_mime TYPE gt_mime.
DATA ls_loio TYPE skwf_io.
"
" Variables
DATA lv_object_type TYPE string.
DATA lv_return_code TYPE sysubrc.
DATA lv_mime_xstring TYPE xstring.
DATA lv_zip_xstring TYPE xstring.
DATA lv_string TYPE string.
DATA lv_loio TYPE sdok_docid.
DATA lv_class TYPE sdok_class.
CLEAR rr_mime_node.
try.
" Object type = SMIM
lv_object_type = getobjecttype( ).
" Node SMIM
lr_mime_node = xmldoc->create_element( lv_object_type ).
" Get logical id of info object
lv_loio = objname.
" MIME class
lv_class = me->get_mime_class( iv_objid = lv_loio ).
" Build path
ls_mime-path = me->get_mime_path( iv_class = lv_class
iv_objid = lv_loio ).
" Get description
ls_mime-description = me->get_mime_description( iv_class = lv_class
iv_objid = lv_loio ).
" MIME repository reference
lr_mime_repository = cl_mime_repository_api=>get_api( ).
" Get properties from MIME
CALL METHOD lr_mime_repository->properties
EXPORTING
i_url = ls_mime-path
IMPORTING
e_name = ls_mime-name
e_size = ls_mime-size
e_loio = ls_loio
EXCEPTIONS
parameter_missing = 1
error_occured = 2
not_found = 3
permission_failure = 4.
ls_mime-id = ls_loio-objid.
ls_mime-class = ls_loio-class.
" Get file from MIME
CALL METHOD lr_mime_repository->get
EXPORTING
i_url = ls_mime-path
IMPORTING
e_content = lv_mime_xstring
e_mime_type = ls_mime-type
CHANGING
c_language = ls_mime-language
EXCEPTIONS
parameter_missing = 1
error_occured = 2
not_found = 3
permission_failure = 4.
" Create zip file from MIME file
CREATE OBJECT lr_zip.
" Add MIME to zip
lr_zip->add(
EXPORTING name = ls_mime-name
content = lv_mime_xstring ).
"
lr_zip->save( RECEIVING zip = lv_zip_xstring ).
" Encode xstring BASE64
CALL FUNCTION 'SCMS_BASE64_ENCODE_STR'
EXPORTING
input = lv_zip_xstring
IMPORTING
output = lv_string.
IF sy-subrc = 0.
" Set node attributes from structure
setattributesfromstructure( node = lr_mime_node
structure = ls_mime
).
" Add BASE64 string to xml value
lv_return_code = lr_mime_node->if_ixml_node~set_value( lv_string ).
" Return xml node
rr_mime_node = lr_mime_node.
ENDIF.
CATCH zcx_saplink.
CATCH cx_root.
ENDTRY.
ENDMETHOD.</source>
</method>
<method CLSNAME="ZSAPLINK_MIME" CMPNAME="XML_TO_MIME" VERSION="1" LANGU="E" DESCRIPT="Convert XML to MIME" EXPOSURE="0" STATE="1" EDITORDER="4 " DISPID="0 " AUTHOR="BCUSER" CREATEDON="20100414" CHANGEDBY="BCUSER" CHANGEDON="20100414" MTDTYPE="0" MTDDECLTYP="0" MTDNEWEXC="X" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZSAPLINK_MIME" CMPNAME="XML_TO_MIME" SCONAME="IV_XML" VERSION="1" LANGU="E" DESCRIPT="IF_IXML_DOCUMENT" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="BCUSER" CREATEDON="20100414" CHANGEDBY="BCUSER" CHANGEDON="20100414" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="3" TYPE="IF_IXML_DOCUMENT"/>
<parameter CLSNAME="ZSAPLINK_MIME" CMPNAME="XML_TO_MIME" SCONAME="IV_DEV_PACKAGE" VERSION="1" LANGU="E" DESCRIPT="Development class/package" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " AUTHOR="BCUSER" CREATEDON="20100414" CHANGEDBY="BCUSER" CHANGEDON="20100414" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="DEVCLASS" PARVALUE="'$TMP'" PAROPTIONL="X"/>
<parameter CLSNAME="ZSAPLINK_MIME" CMPNAME="XML_TO_MIME" SCONAME="IV_OVERWRITE" VERSION="1" LANGU="E" DESCRIPT="Overwrite original objects" CMPTYPE="1" MTDTYPE="0" EDITORDER="3 " DISPID="0 " AUTHOR="BCUSER" CREATEDON="20100414" CHANGEDBY="BCUSER" CHANGEDON="20100414" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="FLAG"/>
<exception CLSNAME="ZSAPLINK_MIME" CMPNAME="XML_TO_MIME" SCONAME="ZCX_SAPLINK" VERSION="1" LANGU="E" DESCRIPT="SAPlink exception class" MTDTYPE="0" EDITORDER="1 " AUTHOR="BCUSER" CREATEDON="20100414" CHANGEDON="00000000"/>
<source>METHOD xml_to_mime.
"
" References
DATA lr_rootnode TYPE REF TO if_ixml_element.
DATA lr_filter TYPE REF TO if_ixml_node_filter.
DATA lr_iterator TYPE REF TO if_ixml_node_iterator.
DATA lr_node TYPE REF TO if_ixml_element.
DATA lr_mime_repository TYPE REF TO if_mr_api.
DATA lr_zip TYPE REF TO cl_abap_zip.
"
" Structures
DATA ls_mime TYPE gt_mime.
"
" Variables
DATA lv_string TYPE string.
DATA lv_zip_xstring TYPE xstring.
DATA lv_mime_xstring TYPE xstring.
DATA lv_is_existing TYPE flag.
DATA lv_is_folder TYPE flag.
xmldoc = iv_xml.
lr_filter = xmldoc->create_filter_name( me->gc_object_type ).
lr_iterator = xmldoc->create_iterator_filtered( lr_filter ).
lr_node ?= lr_iterator->get_next( ).
WHILE lr_node IS NOT INITIAL.
getstructurefromattributes( EXPORTING
node = lr_node
CHANGING
structure = ls_mime ).
lv_is_existing = checkexists( ).
IF lv_is_existing IS NOT INITIAL.
IF iv_overwrite IS INITIAL.
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING textid = zcx_saplink=>existing.
ELSE.
" Delete object for new install
deleteobject( ).
ENDIF.
ENDIF.
TRY.
" MIME repository API instance
lr_mime_repository = cl_mime_repository_api=>get_api( ).
IF ls_mime-class = me->gc_doc_class_folder_log.
"
" Create folder
lr_mime_repository->create_folder(
i_url = ls_mime-path
i_description = ls_mime-description
i_language = ls_mime-language
i_dev_package = iv_dev_package
).
ELSE.
lv_string = lr_node->get_value( ).
CALL FUNCTION 'SCMS_BASE64_DECODE_STR'
EXPORTING
input = lv_string
IMPORTING
output = lv_zip_xstring.
"
" Unzip
CREATE OBJECT lr_zip.
"
lr_zip->load( zip = lv_zip_xstring ).
" Get MIME from Zip
lr_zip->get( EXPORTING
name = ls_mime-name
IMPORTING
content = lv_mime_xstring
).
"
" Create MIME
lr_mime_repository->put(
EXPORTING
i_url = ls_mime-path
i_content = lv_mime_xstring
i_description = ls_mime-description
i_language = ls_mime-language
i_dev_package = iv_dev_package
EXCEPTIONS
parameter_missing = 1
error_occured = 2
cancelled = 3
permission_failure = 4
data_inconsistency = 5
new_loio_already_exists = 6
is_folder = 7
OTHERS = 8
).
ENDIF.
CATCH zcx_saplink.
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING textid = zcx_saplink=>cx_root.
CATCH cx_root.
RAISE EXCEPTION TYPE zcx_saplink
EXPORTING textid = zcx_saplink=>cx_root.
ENDTRY.
lr_node ?= lr_iterator->get_next( ).
ENDWHILE.
ENDMETHOD.</source>
</method>
</CLAS>