-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathCLAS_ZSAPLINK_BSP_EXTENSIONS.slnk
997 lines (892 loc) · 45.7 KB
/
CLAS_ZSAPLINK_BSP_EXTENSIONS.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
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
<?xml version="1.0" encoding="iso-8859-1"?>
<CLAS CLSNAME="ZSAPLINK_WTAG" VERSION="0" LANGU="E" DESCRIPT="SAPlink - BSP plugin" UUID="450F6CFD574D01B602000000A7E42BB6" CATEGORY="00" EXPOSURE="2" STATE="1" RELEASE="0" AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" CHGDANYON="00000000" CLSCCINCL="X" FIXPT="X" UNICODE="X" R3RELEASE="620" CLSBCCAT="00" REFCLSNAME="ZSAPLINK">
<publicSection>class ZSAPLINK_WTAG definition
public
inheriting from ZSAPLINK
create public .
*"* public components of class ZSAPLINK_WTAG
*"* do not include other source files here!!!
public section.
methods CHECKEXISTS
redefinition .
methods CREATEIXMLDOCFROMOBJECT
redefinition .
methods CREATEOBJECTFROMIXMLDOC
redefinition .</publicSection>
<protectedSection>*"* protected components of class ZSAPLINK_WTAG
*"* do not include other source files here!!!
protected section.
methods WTAG_SETATTRIBUTESFROMSTR
importing
!NODE type ref to IF_IXML_ELEMENT
!STRUCTURE type DATA .
methods WTAG_GETSTRUCTUREFROMATTR
importing
!NODE type ref to IF_IXML_ELEMENT
changing
!STRUCTURE type DATA .
methods DELETEOBJECT
redefinition .
methods GETOBJECTTYPE
redefinition .</protectedSection>
<privateSection>*"* private components of class ZSAPLINK_WTAG
*"* do not include other source files here!!!
private section.
methods CORR_INSERT
importing
!P_AUTHOR type SYUNAME
!P_DEVCLASS type DEVCLASS
raising
ZCX_SAPLINK .
class-methods ACCESS_PERMISSION
importing
!P_OBJECT_KEY type C
!P_MODE type STRING default 'INSERT'
!P_NO_DIALOG type CHAR1 default 'X'
!P_OBJECTTYPE type TROBJTYPE
exporting
!P_DEVCLASS type DEVCLASS
!P_TRANSPORT_KEY type TRKEY
!P_CORR_NUM type TRKORR
!P_MASTER_LANG type SYLANGU
!P_MODIFY_LANG type SY-LANGU
raising
ZCX_SAPLINK .
class-methods DELETE_FROM_WORKING_AREA
importing
!P_TLIBID type O2TLIBID
!P_GLOBAL type XFELD
!P_OBJECTTYPE type TROBJTYPE .
class-methods UPDATE_OBJECT_LISTS
importing
!P_TLIBID type O2TLIBID
!P_OPERATION type C .</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>
<method CLSNAME="ZSAPLINK_WTAG" CMPNAME="ACCESS_PERMISSION" VERSION="0" LANGU="E" DESCRIPT="Call RS_ACCESS_PERMISSION" EXPOSURE="0" STATE="1" EDITORDER="2 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" MTDTYPE="0" MTDDECLTYP="1" MTDNEWEXC="X" R3RELEASE="620" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZSAPLINK_WTAG" CMPNAME="ACCESS_PERMISSION" SCONAME="P_OBJECT_KEY" VERSION="0" LANGU="E" DESCRIPT="Object Key" CMPTYPE="1" MTDTYPE="0" EDITORDER="3 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="C"/>
<parameter CLSNAME="ZSAPLINK_WTAG" CMPNAME="ACCESS_PERMISSION" SCONAME="P_MODE" VERSION="0" LANGU="E" DESCRIPT="Operation 'FREE' | 'INSERT'" CMPTYPE="1" MTDTYPE="0" EDITORDER="4 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="STRING" PARVALUE="'INSERT'" PAROPTIONL="X"/>
<parameter CLSNAME="ZSAPLINK_WTAG" CMPNAME="ACCESS_PERMISSION" SCONAME="P_NO_DIALOG" VERSION="0" LANGU="E" DESCRIPT="Single-Character Flag" CMPTYPE="1" MTDTYPE="0" EDITORDER="5 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="CHAR1" PARVALUE="'X'" PAROPTIONL="X"/>
<parameter CLSNAME="ZSAPLINK_WTAG" CMPNAME="ACCESS_PERMISSION" SCONAME="P_OBJECTTYPE" VERSION="0" LANGU="E" DESCRIPT="Object Type" CMPTYPE="1" MTDTYPE="0" EDITORDER="6 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="TROBJTYPE"/>
<parameter CLSNAME="ZSAPLINK_WTAG" CMPNAME="ACCESS_PERMISSION" SCONAME="P_DEVCLASS" VERSION="0" LANGU="E" DESCRIPT="Package" CMPTYPE="1" MTDTYPE="0" EDITORDER="7 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" PARDECLTYP="1" PARPASSTYP="1" TYPTYPE="1" TYPE="DEVCLASS"/>
<parameter CLSNAME="ZSAPLINK_WTAG" CMPNAME="ACCESS_PERMISSION" SCONAME="P_TRANSPORT_KEY" VERSION="0" LANGU="E" DESCRIPT="Complete Key of a Transport Object" CMPTYPE="1" MTDTYPE="0" EDITORDER="8 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" PARDECLTYP="1" PARPASSTYP="1" TYPTYPE="1" TYPE="TRKEY"/>
<parameter CLSNAME="ZSAPLINK_WTAG" CMPNAME="ACCESS_PERMISSION" SCONAME="P_CORR_NUM" VERSION="0" LANGU="E" DESCRIPT="Request/Task" CMPTYPE="1" MTDTYPE="0" EDITORDER="9 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" PARDECLTYP="1" PARPASSTYP="1" TYPTYPE="1" TYPE="TRKORR"/>
<parameter CLSNAME="ZSAPLINK_WTAG" CMPNAME="ACCESS_PERMISSION" SCONAME="P_MASTER_LANG" VERSION="0" LANGU="E" DESCRIPT="SAP R/3 System, Current Language" CMPTYPE="1" MTDTYPE="0" EDITORDER="10 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" PARDECLTYP="1" PARPASSTYP="1" TYPTYPE="1" TYPE="SYLANGU"/>
<parameter CLSNAME="ZSAPLINK_WTAG" CMPNAME="ACCESS_PERMISSION" SCONAME="P_MODIFY_LANG" VERSION="0" LANGU="E" DESCRIPT="SAP R/3 System, Current Language" CMPTYPE="1" MTDTYPE="0" EDITORDER="11 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" PARDECLTYP="1" PARPASSTYP="1" TYPTYPE="1" TYPE="SY-LANGU"/>
<exception CLSNAME="ZSAPLINK_WTAG" CMPNAME="ACCESS_PERMISSION" SCONAME="ZCX_SAPLINK" VERSION="0" LANGU="E" DESCRIPT="SAPlink exception class" MTDTYPE="0" EDITORDER="1 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000"/>
<source>METHOD ACCESS_PERMISSION .
* DATA:
* l_uname TYPE syuname,
* l_uname2 TYPE syuname,
* l_tlibid TYPE o2tlibid.
* check object name
CALL FUNCTION 'RS_ACCESS_PERMISSION'
EXPORTING
authority_check = 'X'
global_lock = 'X'
mode = p_mode
object = p_object_key
object_class = p_objecttype
suppress_language_check = p_no_dialog
suppress_language_dialog = p_no_dialog
IMPORTING
devclass = p_devclass
new_master_language = p_master_lang
korrnum = p_corr_num
transport_key = p_transport_key
modification_language = p_modify_lang
EXCEPTIONS
canceled_in_corr = 1
enqueued_by_user = 2
enqueue_system_failure = 3
illegal_parameter_values = 4
locked_by_author = 5
no_modify_permission = 6
no_show_permission = 7
permission_failure = 8
request_language_denied = 9
OTHERS = 10.
case sy-subrc.
when 0.
when 2 or 5.
raise exception type zcx_saplink
exporting textid = zcx_saplink=>locked.
when 6 or 7 or 8 or 9.
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.
ENDMETHOD. "access_permission</source>
</method>
<method CLSNAME="ZSAPLINK" CMPNAME="CHECKEXISTS" VERSION="0" LANGU="E" DESCRIPT="Check if object exists" EXPOSURE="2" STATE="1" EDITORDER="9 " DISPID="0 " AUTHOR="USEWH90" CREATEDON="20060831" CHANGEDBY="USEWH90" CHANGEDON="20060831" MTDTYPE="0" MTDDECLTYP="0" MTDABSTRCT="X" R3RELEASE="620" BCMTDCAT="00" BCMTDSYN="0">
<parameter VERSION="0" CMPTYPE="0" MTDTYPE="0" EDITORDER="0 " DISPID="0 " CREATEDON="00000000" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="0" TYPTYPE="0"/>
<source>*/---------------------------------------------------------------------\
*| 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 |
*\---------------------------------------------------------------------/
* Plugin created by:
* Phil Young
method CHECKEXISTS .
data P_TLIBID TYPE O2TLIBID.
P_TLIBID = objName.
exists = cl_o2_taglib_manager=>exists_on_db( p_tlibid ).
endmethod.</source>
</method>
<method CLSNAME="ZSAPLINK_WTAG" CMPNAME="CORR_INSERT" VERSION="0" LANGU="E" DESCRIPT="Insert Correction" EXPOSURE="0" STATE="1" EDITORDER="1 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" MTDTYPE="0" MTDDECLTYP="0" MTDNEWEXC="X" R3RELEASE="620" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZSAPLINK_WTAG" CMPNAME="CORR_INSERT" SCONAME="P_AUTHOR" VERSION="0" LANGU="E" DESCRIPT="SAP System, User Logon Name" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="SYUNAME"/>
<parameter CLSNAME="ZSAPLINK_WTAG" CMPNAME="CORR_INSERT" SCONAME="P_DEVCLASS" VERSION="0" LANGU="E" DESCRIPT="Package" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="DEVCLASS"/>
<exception CLSNAME="ZSAPLINK_WTAG" CMPNAME="CORR_INSERT" SCONAME="ZCX_SAPLINK" VERSION="0" LANGU="E" DESCRIPT="SAPlink exception class" MTDTYPE="0" EDITORDER="1 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000"/>
<source>*/---------------------------------------------------------------------\
*| 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 |
*\---------------------------------------------------------------------/
method CORR_INSERT .
data myTROBJTYPE type TROBJTYPE.
myTROBJTYPE = getobjecttype( ).
CALL FUNCTION 'RS_CORR_INSERT'
EXPORTING
AUTHOR = p_author
GLOBAL_LOCK = 'X'
OBJECT = objName
OBJECT_CLASS = myTROBJTYPE
DEVCLASS = p_devClass
* KORRNUM = CORRNUMBER_LOCAL
MASTER_LANGUAGE = sy-langu
* PROGRAM = PROGRAM_LOCAL
MODE = 'INSERT'
* IMPORTING
* AUTHOR = UNAME
* KORRNUM = CORRNUMBER_LOCAL
* DEVCLASS = DEVCLASS_LOCAL
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.
endmethod.</source>
</method>
<method CLSNAME="ZSAPLINK" CMPNAME="CREATEIXMLDOCFROMOBJECT" VERSION="0" LANGU="E" DESCRIPT="Creates an IF_IXML_DOCUMENT from the OBJNAME Attribute" EXPOSURE="2" STATE="1" EDITORDER="5 " DISPID="0 " AUTHOR="USDWM01" CREATEDON="20060720" CHANGEDBY="USEWH90" CHANGEDON="20060830" MTDTYPE="0" MTDDECLTYP="0" MTDABSTRCT="X" MTDNEWEXC="X" R3RELEASE="620" BCMTDCAT="00" BCMTDSYN="0">
<parameter VERSION="0" CMPTYPE="0" MTDTYPE="0" EDITORDER="0 " DISPID="0 " CREATEDON="00000000" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="0" TYPTYPE="0"/>
<exception CLSNAME="ZSAPLINK" CMPNAME="CREATEIXMLDOCFROMOBJECT" SCONAME="ZCX_SAPLINK" VERSION="0" LANGU="E" DESCRIPT="SAPlink exception class" MTDTYPE="0" EDITORDER="1 " AUTHOR="USEWH90" CREATEDON="20060830" CHANGEDON="00000000"/>
<source>*/---------------------------------------------------------------------\
*| 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 |
*\---------------------------------------------------------------------/
* Plugin created by:
* Phil Young
method CREATEIXMLDOCFROMOBJECT .
data rc type sysubrc.
data: my_wtag type ref to CL_O2_TAG_LIBRARY,
l_tlibid TYPE o2tlibid.
data P_TLIB_EDIT TYPE O2TLIBEDIT.
*xml nodes
data rootNode type ref to if_ixml_element.
l_tlibid = objName.
CALL METHOD CL_O2_TAG_LIBRARY=>GET_INSTANCE
EXPORTING
P_TLIBID = l_tlibid
P_STATE = 'A'
RECEIVING
P_TLIB_REF = my_wtag
.
CALL METHOD MY_WTAG->GET_TAGLIB
RECEIVING
P_TLIB_EDIT = P_TLIB_EDIT
.
* Create parent node
data _objType type string.
_objType = getObjectType( ).
rootNode = xmlDoc->create_element( _objType ).
WTAG_SETATTRIBUTESFROMSTR( node = rootNode structure = P_TLIB_EDIT
).
*\--------------------------------------------------------------------/
rc = xmldoc->append_child( rootNode ).
ixmlDocument = xmlDoc.
endmethod.</source>
</method>
<method CLSNAME="ZSAPLINK" CMPNAME="CREATEOBJECTFROMIXMLDOC" VERSION="0" LANGU="E" DESCRIPT="Creates Object on System from IXMLDocument passed in" EXPOSURE="2" STATE="1" EDITORDER="4 " DISPID="0 " AUTHOR="USDWM01" CREATEDON="20060720" CHANGEDBY="USEWH90" CHANGEDON="20060830" MTDTYPE="0" MTDDECLTYP="0" MTDABSTRCT="X" MTDNEWEXC="X" R3RELEASE="620" BCMTDCAT="00" BCMTDSYN="0">
<parameter VERSION="0" CMPTYPE="0" MTDTYPE="0" EDITORDER="0 " DISPID="0 " CREATEDON="00000000" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="0" TYPTYPE="0"/>
<parameter VERSION="0" CMPTYPE="0" MTDTYPE="0" EDITORDER="0 " DISPID="0 " CREATEDON="00000000" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="0" TYPTYPE="0"/>
<parameter VERSION="0" CMPTYPE="0" MTDTYPE="0" EDITORDER="0 " DISPID="0 " CREATEDON="00000000" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="0" TYPTYPE="0"/>
<parameter VERSION="0" CMPTYPE="0" MTDTYPE="0" EDITORDER="0 " DISPID="0 " CREATEDON="00000000" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="0" TYPTYPE="0"/>
<exception CLSNAME="ZSAPLINK" CMPNAME="CREATEOBJECTFROMIXMLDOC" SCONAME="ZCX_SAPLINK" VERSION="0" LANGU="E" DESCRIPT="SAPlink exception class" MTDTYPE="0" EDITORDER="1 " AUTHOR="USEWH90" CREATEDON="20060830" CHANGEDON="00000000"/>
<source>*/---------------------------------------------------------------------\
*| 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 |
*\---------------------------------------------------------------------/
* Plugin created by:
* Phil Young
method CREATEOBJECTFROMIXMLDOC .
types:
TT_TLINE type standard table of TLINE .
types:
t_t_tag TYPE HASHED TABLE OF o2tag
WITH UNIQUE KEY tlibid tagid .
types:
t_t_tagt TYPE HASHED TABLE OF tagt
WITH UNIQUE KEY tlibid tagid .
types:
t_t_tagatt TYPE HASHED TABLE OF o2tagatt
WITH UNIQUE KEY tlibid tagid attid .
types:
t_t_tagattt TYPE HASHED TABLE OF tagattt
WITH UNIQUE KEY tlibid tagid attid .
types:
t_t_tline TYPE STANDARD TABLE OF tline
WITH DEFAULT KEY .
data rootNode type ref to if_ixml_element.
data _devclass type devclass.
data _objType type string.
data P_TLIB_EDIT TYPE O2TLIBEDIT.
data checkExists type flag.
data l_cx_ref TYPE REF TO zcx_saplink.
_devclass = devclass.
_objType = getObjectType( ).
xmlDoc = ixmlDocument.
rootNode = xmlDoc->find_from_name( _objType ).
* call method GETSTRUCTUREFROMATTRIBUTES
call method WTAG_GETSTRUCTUREFROMATTR
exporting
node = rootNode
changing
structure = P_TLIB_EDIT.
objName = P_TLIB_EDIT-TLIBID.
checkExists = checkexists( ).
if checkExists is not initial.
if overwrite is initial.
raise exception type zcx_saplink
exporting textid = zcx_saplink=>existing.
else.
* delete object for new install
TRY.
deleteobject( ).
CATCH ZCX_SAPLINK into l_cx_ref.
raise exception l_cx_ref.
ENDTRY.
endif.
endif.
*TYPES:
*
* t_t_tag TYPE HASHED TABLE OF o2tag
* WITH UNIQUE KEY tlibid tagid,
*
* t_t_tagt TYPE HASHED TABLE OF tagt
* WITH UNIQUE KEY tlibid tagid,
*
* t_t_tagatt TYPE HASHED TABLE OF o2tagatt
* WITH UNIQUE KEY tlibid tagid attid,
*
* t_t_tagattt TYPE HASHED TABLE OF tagattt
* WITH UNIQUE KEY tlibid tagid attid,
*
* t_t_tline TYPE STANDARD TABLE OF tline
* WITH DEFAULT KEY.
*
*TYPES: BEGIN OF t_s_docu,
* tlibid TYPE o2tlibid,
* tagid TYPE o2tagid,
* dokhl TYPE dokhl,
* dokil TYPE dokil,
* docu TYPE t_t_tline,
* END OF t_s_docu,
*
* t_t_docu TYPE HASHED TABLE OF t_s_docu
* WITH UNIQUE KEY tlibid tagid.
data wa_o2taglib type o2taglib.
data wa_taglibt type taglibt.
data it_tag type t_t_tag.
data wa_tag like line of it_tag.
data it_tagt type t_t_tagt.
data wa_tagt like line of it_tagt.
data it_tagatt type t_t_tagatt.
data wa_tagatt like line of it_tagatt.
data it_tagattt type t_t_tagattt.
data wa_tagattt like line of it_tagattt.
data wa_tags type O2TAGEDIT.
data wa_attributes type O2ATTEDIT.
data state type r3state value 'I'.
* build tables / structures
*extension
move-corresponding P_TLIB_EDIT to wa_o2taglib.
wa_o2taglib-state = state.
wa_o2taglib-author = sy-uname.
wa_o2taglib-createdon = sy-datum.
wa_o2taglib-changedby = sy-uname.
wa_o2taglib-changedon = sy-datum.
wa_o2taglib-stamp = sy-uzeit.
move-corresponding P_TLIB_EDIT to wa_taglibt.
wa_taglibt-state = state.
wa_taglibt-langu = sy-langu.
* elements
loop at P_TLIB_EDIT-TAGS into wa_tags.
wa_tag-tlibid = P_TLIB_EDIT-TLIBID.
move-corresponding wa_tags to wa_tag.
wa_tag-state = state.
wa_tag-author = sy-uname.
wa_tag-createdon = sy-datum.
wa_tag-changedby = sy-uname.
wa_tag-changedon = sy-datum.
insert wa_tag into table it_tag.
move-corresponding wa_tag to wa_tagt.
wa_tagt-langu = sy-langu.
wa_tagt-descript = wa_tags-descript.
insert wa_tagt into table it_tagt.
* attributes
loop at wa_tags-attributes into wa_attributes.
move-corresponding wa_attributes to wa_tagatt.
wa_tagatt-tlibid = P_TLIB_EDIT-TLIBID.
wa_tagatt-state = state.
wa_tagatt-tagid = wa_tags-tagid.
insert wa_tagatt into table it_tagatt.
move-corresponding wa_tagatt to wa_tagattt.
wa_tagattt-descript = wa_attributes-descript.
wa_tagattt-langu = sy-langu.
insert wa_tagattt into table it_tagattt.
clear wa_tagattt.
clear wa_tagatt.
endloop.
clear wa_tag.
clear wa_tagt.
endloop.
* put bsp extension in worklist
data TROBJTYPE type TROBJTYPE.
data trobjName type trobj_name.
TROBJTYPE = GETOBJECTTYPE( ).
trobjName = objName.
TRY.
CALL METHOD CORR_INSERT
EXPORTING
P_AUTHOR = sy-uname
P_DEVCLASS = devclass
.
CATCH ZCX_SAPLINK into l_cx_ref.
raise exception l_cx_ref.
ENDTRY.
TRY.
CALL METHOD ZSAPLINK_WTAG=>ACCESS_PERMISSION
EXPORTING
P_OBJECT_KEY = trobjName
P_MODE = 'INSERT'
P_NO_DIALOG = 'X'
P_OBJECTTYPE = TROBJTYPE
* IMPORTING
* P_DEVCLASS =
* P_TRANSPORT_KEY =
* P_CORR_NUM =
* P_MASTER_LANG =
* P_MODIFY_LANG =
.
CATCH ZCX_SAPLINK into l_cx_ref.
raise exception l_cx_ref.
ENDTRY.
call function 'RS_INSERT_INTO_WORKING_AREA'
EXPORTING
object = TROBJTYPE
obj_name = trobjName
EXCEPTIONS
wrong_object_name = 1.
if sy-subrc <> 0.
raise exception type zcx_saplink
exporting textid = zcx_saplink=>system_error.
endif.
* update database tables
* extension
INSERT INTO o2taglib VALUES wa_o2taglib.
IF wa_taglibt IS NOT INITIAL.
INSERT INTO taglibt VALUES wa_taglibt.
ENDIF.
IF sy-subrc <> 0.
raise exception type zcx_saplink
exporting textid = zcx_saplink=>system_error.
ENDIF.
* elements
INSERT o2tag FROM TABLE it_tag.
IF it_tagt[] IS NOT INITIAL.
INSERT tagt FROM TABLE it_tagt.
ENDIF.
IF sy-subrc <> 0.
raise exception type zcx_saplink
exporting textid = zcx_saplink=>system_error.
ENDIF.
* element attributes
IF it_tagatt[] IS NOT INITIAL.
INSERT o2tagatt FROM TABLE it_tagatt.
ENDIF.
IF it_tagattt[] IS NOT INITIAL.
INSERT tagattt FROM TABLE it_tagattt.
ENDIF.
IF sy-subrc <> 0.
raise exception type zcx_saplink
exporting textid = zcx_saplink=>system_error.
ENDIF.
CALL METHOD ZSAPLINK_WTAG=>UPDATE_OBJECT_LISTS
EXPORTING
P_TLIBID = P_TLIB_EDIT-TLIBID
P_OPERATION = 'INSERT'
.
TRY.
CALL METHOD ZSAPLINK_WTAG=>ACCESS_PERMISSION
EXPORTING
P_OBJECT_KEY = trobjName
P_MODE = 'FREE'
P_NO_DIALOG = 'X'
P_OBJECTTYPE = TROBJTYPE
* IMPORTING
* P_DEVCLASS =
* P_TRANSPORT_KEY =
* P_CORR_NUM =
* P_MASTER_LANG =
* P_MODIFY_LANG =
.
CATCH ZCX_SAPLINK into l_cx_ref.
raise exception l_cx_ref.
ENDTRY.
name = objName.
*CL_O2_TAGLIB_MANAGER-IMPORT_EXTENSION
endmethod.</source>
</method>
<method CLSNAME="ZSAPLINK" CMPNAME="DELETEOBJECT" VERSION="0" LANGU="E" DESCRIPT="Delete object" EXPOSURE="1" STATE="1" EDITORDER="1 " DISPID="0 " AUTHOR="USEWH90" CREATEDON="20060831" CHANGEDBY="USEWH90" CHANGEDON="20060831" MTDTYPE="0" MTDDECLTYP="0" MTDABSTRCT="X" MTDNEWEXC="X" R3RELEASE="620" BCMTDCAT="00" BCMTDSYN="0">
<exception CLSNAME="ZSAPLINK" CMPNAME="DELETEOBJECT" SCONAME="ZCX_SAPLINK" VERSION="0" LANGU="E" DESCRIPT="SAPlink exception class" MTDTYPE="0" EDITORDER="1 " AUTHOR="USEWH90" CREATEDON="20060831" CHANGEDON="00000000"/>
<source>*/---------------------------------------------------------------------\
*| 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 |
*\---------------------------------------------------------------------/
* Plugin created by:
* Phil Young
method DELETEOBJECT .
data myTLIBID type O2TLIBID.
data l_cx_ref TYPE REF TO zcx_saplink.
data TROBJTYPE type TROBJTYPE.
data trobjName type trobj_name.
TROBJTYPE = GETOBJECTTYPE( ).
trobjName = objName.
myTLIBID = objName.
TRY.
CALL METHOD ZSAPLINK_WTAG=>ACCESS_PERMISSION
EXPORTING
P_OBJECT_KEY = trobjName
P_MODE = 'MODIFY'
P_NO_DIALOG = 'X'
P_OBJECTTYPE = TROBJTYPE
* IMPORTING
* P_DEVCLASS =
* P_TRANSPORT_KEY =
* P_CORR_NUM =
* P_MASTER_LANG =
* P_MODIFY_LANG =
.
CATCH ZCX_SAPLINK into l_cx_ref.
raise exception l_cx_ref.
ENDTRY.
* update database tables
* extension
delete from o2taglib where TLIBID = myTLIBID.
delete from taglibt where TLIBID = myTLIBID.
* elements
delete from o2tag where TLIBID = myTLIBID.
delete from tagt where TLIBID = myTLIBID.
* element attributes
delete from o2tagatt where TLIBID = myTLIBID.
delete from tagattt where TLIBID = myTLIBID.
TRY.
CALL METHOD ZSAPLINK_WTAG=>ACCESS_PERMISSION
EXPORTING
P_OBJECT_KEY = trobjName
P_MODE = 'FREE'
P_NO_DIALOG = 'X'
P_OBJECTTYPE = TROBJTYPE
* IMPORTING
* P_DEVCLASS =
* P_TRANSPORT_KEY =
* P_CORR_NUM =
* P_MASTER_LANG =
* P_MODIFY_LANG =
.
CATCH ZCX_SAPLINK into l_cx_ref.
raise exception l_cx_ref.
ENDTRY.
* remove entry from working area
delete_from_working_area( p_tlibid = myTLIBID
p_global = 'X'
p_objecttype = TROBJTYPE ).
* this call also deletes $TMP TADIR entries
update_object_lists( p_tlibid = myTLIBID
p_operation = 'DELETE' ).
endmethod.</source>
</method>
<method CLSNAME="ZSAPLINK_WTAG" CMPNAME="DELETE_FROM_WORKING_AREA" VERSION="0" LANGU="E" DESCRIPT="Delete BSP Extension from Worklist" EXPOSURE="0" STATE="1" EDITORDER="3 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" MTDTYPE="0" MTDDECLTYP="1" R3RELEASE="620" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZSAPLINK_WTAG" CMPNAME="DELETE_FROM_WORKING_AREA" SCONAME="P_TLIBID" VERSION="0" LANGU="E" DESCRIPT="Tag Library: ID" CMPTYPE="1" MTDTYPE="0" EDITORDER="12 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="O2TLIBID"/>
<parameter CLSNAME="ZSAPLINK_WTAG" CMPNAME="DELETE_FROM_WORKING_AREA" SCONAME="P_GLOBAL" VERSION="0" LANGU="E" DESCRIPT="'X': ACTUALIZE_WORKING_AREA='X'" CMPTYPE="1" MTDTYPE="0" EDITORDER="13 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="XFELD"/>
<parameter CLSNAME="ZSAPLINK_WTAG" CMPNAME="DELETE_FROM_WORKING_AREA" SCONAME="P_OBJECTTYPE" VERSION="0" LANGU="E" DESCRIPT="Object Type" CMPTYPE="1" MTDTYPE="0" EDITORDER="14 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="TROBJTYPE"/>
<source>METHOD DELETE_FROM_WORKING_AREA .
DATA:
l_obj_name TYPE trobj_name.
CALL FUNCTION 'RS_WORKING_AREA_INIT'.
l_obj_name = p_tlibid.
CALL FUNCTION 'RS_DELETE_FROM_WORKING_AREA'
EXPORTING
object = p_objecttype
obj_name = l_obj_name
immediate = 'X'
actualize_working_area = p_global.
ENDMETHOD. "delete_from_working_area</source>
</method>
<method CLSNAME="ZSAPLINK" CMPNAME="GETOBJECTTYPE" VERSION="0" LANGU="E" DESCRIPT="Get object type of plugin" EXPOSURE="1" STATE="1" EDITORDER="8 " DISPID="0 " AUTHOR="USEWH90" CREATEDON="20060829" CHANGEDBY="USEWH90" CHANGEDON="20060831" MTDTYPE="0" MTDDECLTYP="0" MTDABSTRCT="X" BCMTDCAT="00" BCMTDSYN="0">
<parameter VERSION="0" CMPTYPE="0" MTDTYPE="0" EDITORDER="0 " DISPID="0 " CREATEDON="00000000" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="0" TYPTYPE="0"/>
<source>*/---------------------------------------------------------------------\
*| 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 |
*\---------------------------------------------------------------------/
method GETOBJECTTYPE .
objecttype = 'WTAG'. "BSP Extension
endmethod.</source>
</method>
<method CLSNAME="ZSAPLINK_WTAG" CMPNAME="UPDATE_OBJECT_LISTS" VERSION="0" LANGU="E" DESCRIPT="Updating Object Lists" EXPOSURE="0" STATE="1" EDITORDER="4 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" MTDTYPE="0" MTDDECLTYP="1" R3RELEASE="620" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZSAPLINK_WTAG" CMPNAME="UPDATE_OBJECT_LISTS" SCONAME="P_TLIBID" VERSION="0" LANGU="E" DESCRIPT="BSP Extension: ID" CMPTYPE="1" MTDTYPE="0" EDITORDER="15 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="O2TLIBID"/>
<parameter CLSNAME="ZSAPLINK_WTAG" CMPNAME="UPDATE_OBJECT_LISTS" SCONAME="P_OPERATION" VERSION="0" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="16 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="C"/>
<source>METHOD UPDATE_OBJECT_LISTS .
DATA:
l_tree_log TYPE REF TO cl_wb_tree_log,
l_treelog_entry TYPE treelog,
l_treelog_tab TYPE treelog_tab.
CALL FUNCTION 'RS_TREE_OBJECT_PLACEMENT'
EXPORTING
object = p_tlibid
type = swbm_c_type_o2_taglibrary
operation = p_operation.
CREATE OBJECT l_tree_log.
CONCATENATE 'TL_' p_tlibid INTO l_treelog_entry-tname.
l_treelog_entry-type = swbm_c_type_o2_taglibrary.
l_treelog_entry-name = p_tlibid.
APPEND l_treelog_entry TO l_treelog_tab.
CALL METHOD l_tree_log->raise_entry_changed
EXPORTING
p_treelog = l_treelog_tab.
ENDMETHOD. "update_object_lists</source>
</method>
<method CLSNAME="ZSAPLINK_WTAG" CMPNAME="WTAG_GETSTRUCTUREFROMATTR" VERSION="0" LANGU="E" DESCRIPT="Updates a structure with node attributes" EXPOSURE="1" STATE="1" EDITORDER="2 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="620" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZSAPLINK_WTAG" CMPNAME="WTAG_GETSTRUCTUREFROMATTR" SCONAME="NODE" VERSION="0" LANGU="E" DESCRIPT="IF_IXML_ELEMENT" CMPTYPE="1" MTDTYPE="0" EDITORDER="3 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="3" TYPE="IF_IXML_ELEMENT"/>
<parameter CLSNAME="ZSAPLINK_WTAG" CMPNAME="WTAG_GETSTRUCTUREFROMATTR" SCONAME="STRUCTURE" VERSION="0" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="4 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" PARDECLTYP="2" PARPASSTYP="1" TYPTYPE="1" TYPE="DATA"/>
<source>*/---------------------------------------------------------------------\
*| 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 |
*\---------------------------------------------------------------------/
method WTAG_GETSTRUCTUREFROMATTR .
data attributeList type ref to IF_IXML_NAMED_NODE_MAP.
data nodeIterator type ref to IF_IXML_NODE_ITERATOR.
data attributeNode type ref to if_ixml_node.
data value type string.
data name type string.
field-symbols <value> type any.
************************************************************************
data tableDescr type ref to cl_abap_tabledescr.
data structDescr type ref to cl_abap_structdescr.
data typeDescr type ref to cl_abap_typedescr.
data childNode type ref to if_ixml_element.
data filter type ref to if_ixml_node_filter.
data iterator type ref to if_ixml_node_iterator.
data childName type string.
data it_foo type ref to data.
data wa_foo type ref to data.
field-symbols: <tab> type any table.
field-symbols: <row> type any.
************************************************************************
clear structure.
attributeList = node->GET_ATTRIBUTES( ).
nodeIterator = attributeList->create_iterator( ).
attributeNode = nodeIterator->get_next( ).
while attributeNode is not initial.
name = attributeNode->get_name( ).
if name = 'VERSION'.
value = '0'.
else.
value = attributeNode->get_value( ).
endif.
assign component name of structure structure to <value>.
if sy-subrc = 0.
************************************************************************
typeDescr = cl_abap_typedescr=>DESCRIBE_BY_DATA(
p_data = <value> ).
try.
tableDescr ?= typeDescr.
catch CX_SY_MOVE_CAST_ERROR.
endtry.
try.
structDescr ?= typeDescr.
catch CX_SY_MOVE_CAST_ERROR.
endtry.
if tableDescr is initial and structDescr is initial.
<value> = value.
elseif tableDescr is initial.
childNode ?= Node->get_first_child( ).
while childNode is not initial.
childName = childNode->GET_NAME( ).
if childName = name.
call method WTAG_GETSTRUCTUREFROMATTR
exporting
node = childNode
changing
structure = <value>.
exit.
endif.
childNode ?= childNode->get_next( ).
endwhile.
else.
create data it_foo type handle tableDescr.
assign it_foo->* to <tab>.
create data wa_foo like line of <tab>.
assign wa_foo->* to <row>.
free childNode.
childNode ?= Node->get_first_child( ).
while childNode is not initial.
childName = childNode->GET_NAME( ).
if childName = name.
clear <row>.
call method WTAG_GETSTRUCTUREFROMATTR
exporting
node = childNode
changing
structure = <row>.
insert <row> into table <tab>.
endif.
childNode ?= childNode->get_next( ).
endwhile.
<value> = <tab>.
endif.
clear tableDescr.
clear structDescr.
clear typedescr.
clear it_foo.
clear wa_foo.
************************************************************************
endif.
attributeNode = nodeIterator->get_next( ).
endwhile.
endmethod.</source>
</method>
<method CLSNAME="ZSAPLINK_WTAG" CMPNAME="WTAG_SETATTRIBUTESFROMSTR" VERSION="0" LANGU="E" DESCRIPT="Creates an XML Attribute list from any structure" EXPOSURE="1" STATE="1" EDITORDER="1 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" MTDTYPE="0" MTDDECLTYP="0" R3RELEASE="620" BCMTDCAT="00" BCMTDSYN="0">
<parameter CLSNAME="ZSAPLINK_WTAG" CMPNAME="WTAG_SETATTRIBUTESFROMSTR" SCONAME="NODE" VERSION="0" LANGU="E" DESCRIPT="xml Element" CMPTYPE="1" MTDTYPE="0" EDITORDER="1 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="3" TYPE="IF_IXML_ELEMENT"/>
<parameter CLSNAME="ZSAPLINK_WTAG" CMPNAME="WTAG_SETATTRIBUTESFROMSTR" SCONAME="STRUCTURE" VERSION="0" LANGU="E" CMPTYPE="1" MTDTYPE="0" EDITORDER="2 " DISPID="0 " AUTHOR="USPTY90" CREATEDON="20060919" CHANGEDON="00000000" PARDECLTYP="0" PARPASSTYP="1" TYPTYPE="1" TYPE="DATA"/>
<source>*/---------------------------------------------------------------------\
*| 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 |
*\---------------------------------------------------------------------/
method WTAG_SETATTRIBUTESFROMSTR .
data int type i.
int = int.
data structDescr type ref to cl_abap_structDescr.
data aComponent type abap_compdescr.
field-symbols <fieldValue> type any.
data rc type sysubrc.
data sName type string.
data sValue type string.
****************************************************************
data tableDescr type ref to cl_abap_tabledescr.
data structDescr2 type ref to cl_abap_structdescr.
data typeDescr type ref to cl_abap_typedescr.
data childNode type ref to if_ixml_element.
data childName type string.
data it_foo type ref to data.
field-symbols: <tab> type any table.
field-symbols: <row> type any.
****************************************************************
structDescr ?= cl_abap_structDescr=>describe_by_data( structure ).
loop at structDescr->components into aComponent.
assign component aComponent-name of structure
structure to <fieldValue>.
if sy-subrc = 0.
sName = aComponent-name.
* sValue = <fieldValue>.
* for certain attributes, set to a standard for exporting
case sName.
when 'VERSION'. "version should always export as inactive
sValue = '0'.
when 'DEVCLASS'. "development class should always be $TMP
sValue = '$TMP'.
when others.
**********************************************************
typeDescr = cl_abap_typedescr=>DESCRIBE_BY_DATA(
p_data = <fieldValue> ).
try.
tableDescr ?= typeDescr.
catch CX_SY_MOVE_CAST_ERROR.
endtry.
try.
structDescr2 ?= typeDescr.
catch CX_SY_MOVE_CAST_ERROR.
endtry.
if tableDescr is initial and structDescr2 is initial.
sValue = <fieldValue>.
elseif tableDescr is initial.
sValue = '$$STRUCTURE$$'.
childName = aComponent-name.
childNode = xmlDoc->create_element( childName ).
WTAG_SETATTRIBUTESFROMSTR( node = childNode
structure = <fieldValue> ).
rc = Node->append_child( childNode ).
else.
sValue = '$$TABLE$$'.
create data it_foo type handle tableDescr.
* get reference of <fieldvalue> into it_foo.
assign it_foo->* to <tab>.
<tab> = <fieldValue>.
loop at <tab> assigning <row>.
childName = aComponent-name.
childNode = xmlDoc->create_element( childName ).
WTAG_SETATTRIBUTESFROMSTR( node = childNode
structure = <row> ).
rc = Node->append_child( childNode ).
endloop.
endif.
clear it_foo.
clear tableDescr.
clear structDescr2.
clear typedescr.
* sValue = <fieldValue>.
**********************************************************
endcase.
if sValue is not initial.
rc = Node->set_attribute( name = sName value = sValue ).
endif.
else.
* WHAT?>!??
endif.
endloop.
endmethod.</source>
</method>
</CLAS>