-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathZRFII07.abap
3493 lines (3062 loc) · 103 KB
/
ZRFII07.abap
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
998
999
1000
*&--------------------------------------------------------------------
*& Author : HS.Jeong (Tuned by IG.MOON)
*& Creation Date : 06/10/2003
*& Specification By : Andy Choi
*& Pattern : Report 1-2
*& Development Request No : UD1K904466
*& Addl documentation :
*& Description : [FI-IM] IM Progress Report
*&
*& Modification Log
*& Date Developer Request ID Description
*& 10.18.2006 Michelle J Andy Choi Add %Progress
*&--------------------------------------------------------------------
* Bug:
* - downpayment;
* - original budget; standard ledger, z-table.
REPORT zrfii07 MESSAGE-ID zmfi.
TYPE-POOLS: vrm.
INCLUDE zacoui00.
INCLUDE <icon>.
INCLUDE <symbol>.
CONSTANTS c_f2code LIKE sy-ucomm VALUE '&ETA'.
*class cl_gui_resources definition load.
*data: gt_fieldcat type slis_t_fieldcat_alv,
* gs_layout type slis_layout_alv,
* gt_sp_group type slis_t_sp_group_alv,
* gt_events type slis_t_event,
* gt_sorts type slis_t_sortinfo_alv with header line,
* gs_prnt type slis_print_alv.
*
*data: wa_repid like sy-repid,
* wa_var_save(1) type c value 'A',
* wa_default(1) type c,
* wa_exit(1) type c,
* wa_variant like disvariant,
* wa_var like disvariant,
* wa_alv_function_name(30) type c value 'REUSE_ALV_GRID_LIST',
* wa_alv_get_info_name(40) type c.
*--- ALV
*data: w_fieldcat type slis_t_fieldcat_alv with header line,
* w_eventcat type slis_t_event with header line,
* w_selfield type slis_selfield,
* w_sortcat type slis_t_sortinfo_alv with header line,
* w_col_pos type i,
* w_program like sy-repid,
* w_top_of_page type slis_t_listheader,
* w_line1 type slis_listheader.
*----------------------------------------------------------------------
* define tables and internal structure
*----------------------------------------------------------------------
TABLES: aufk, impr, fmfctr, ripasw, codia, bkpf, ztfi_imfm, imak, ania,
imavz, imav.
TYPES: BEGIN OF ty_itab,
aufnr TYPE aufnr,
posnr TYPE im_posnr,
posid TYPE im_posid,
prnam TYPE im_prnam,
objnr TYPE im_objnr,
kostl TYPE kostl,
END OF ty_itab.
TYPES: BEGIN OF ty_imak,
posid TYPE ima_posid,
END OF ty_imak.
TYPES: BEGIN OF ty_status,
objnr TYPE j_objnr,
stat TYPE j_status,
END OF ty_status.
DATA: BEGIN OF it_impr OCCURS 0,
posid LIKE impr-posid,
objnr LIKE impr-objnr,
gjahr LIKE impr-gjahr,
kostl TYPE kostl,
arno LIKE imak-posid,
prnam LIKE impr-prnam,
impr_objnr LIKE impr-objnr,
ergso LIKE impr-ergso,
usr03 LIKE imak-usr03,
usr09 LIKE imak-usr09,
bukrs LIKE impr-bukrs,
kokrs LIKE impr-kokrs,
posnr LIKE imak-posnr,
END OF it_impr.
DATA: BEGIN OF it_bpge OCCURS 0,
objnr LIKE impr-objnr,
vorga TYPE bp_vorgang,
wlges TYPE bp_wgl,
END OF it_bpge.
DATA: gt_status TYPE TABLE OF ty_status WITH HEADER LINE.
*--summary by activity
DATA : BEGIN OF it_sum OCCURS 0,
posid LIKE impr-posid,
gjahr LIKE impr-gjahr,
prnam LIKE ztfi_imfm-prnam,
objnr LIKE impr-objnr,
kostl TYPE kostl,
gubun LIKE ztfi_imfm-gubun,
tot LIKE ztfi_imfm-tot,
usr03 LIKE imak-usr03,
usr09 LIKE imak-usr09,
bukrs LIKE impr-bukrs,
kokrs LIKE impr-kokrs,
posnr LIKE imak-posnr,
impr_objnr TYPE j_objnr,
stat, " Status: 1 Created 2 Rel 3 Locked
END OF it_sum.
DATA: it_out TYPE TABLE OF impr WITH HEADER LINE,
it_imfm TYPE TABLE OF ztfi_imfm WITH HEADER LINE,
it_aufk TYPE TABLE OF aufk WITH HEADER LINE,
it_io_budget TYPE TABLE OF zfi_io_budget WITH HEADER LINE,
it_io_actual TYPE TABLE OF zfi_io_actual WITH HEADER LINE,
it_budget TYPE TABLE OF zfi_pi_budget WITH HEADER LINE,
it_actual TYPE TABLE OF zfi_pi_actual_act WITH HEADER LINE,
it_imak TYPE TABLE OF ty_imak WITH HEADER LINE,
itab TYPE TABLE OF ty_itab WITH HEADER LINE.
* by ig.moon {
* Type for ALV
TYPES: BEGIN OF ty_out.
INCLUDE STRUCTURE zsfi_imfm.
TYPES : anlkl TYPE anlkl,
aktiv TYPE am_aktivp,
usr03 TYPE ima_usr03,
usr09 TYPE ima_usr09,
bukrs TYPE bukrs,
kokrs TYPE kokrs,
posnr TYPE ima_posnr,
$objnr TYPE j_objnr,
impr_objnr TYPE j_objnr.
TYPES celltab TYPE lvc_t_styl.
TYPES tabcolor TYPE slis_t_specialcol_alv.
TYPES: END OF ty_out.
DATA gt_out TYPE TABLE OF ty_out WITH HEADER LINE.
DATA $gt_out TYPE TABLE OF ty_out WITH HEADER LINE.
*----for combox
DATA: it_val TYPE vrm_values,
w_line LIKE LINE OF it_val.
*---WORK AREA
DATA : wa_t_cnt TYPE i,
* WA_T_CNT1 TYPE I,
wa_prnam LIKE ztfi_imfm-prnam,
wa_before LIKE imzo-gjahr,
wa_last LIKE imzo-gjahr,
wa_year LIKE imzo-gjahr,
wa_year1 LIKE imzo-gjahr,
wa_year2 LIKE imzo-gjahr,
wa_year3 LIKE imzo-gjahr,
wa_year4 LIKE imzo-gjahr,
wa_year5 LIKE imzo-gjahr,
wa_year6 LIKE imzo-gjahr,
wa_after LIKE imzo-gjahr,
wa_before_txt(10),
wa_after_txt(10),
wa_org_amt LIKE ztfi_imfm-tot,
wa_sup_amt LIKE ztfi_imfm-tot,
wa_ret_amt LIKE ztfi_imfm-tot,
wa_cur_amt LIKE ztfi_imfm-tot,
wa_before_amt LIKE cosp-wtg001,
wa_after_amt LIKE cosp-wtg001,
*---Currenty
wa_n_tot LIKE cosp-wtg001,
wa_n_before LIKE cosp-wtg001,
wa_n_last LIKE cosp-wtg001,
wa_n_year LIKE cosp-wtg001,
wa_n_year1 LIKE cosp-wtg001,
wa_n_year2 LIKE cosp-wtg001,
wa_n_year3 LIKE cosp-wtg001,
wa_n_year4 LIKE cosp-wtg001,
wa_n_year5 LIKE cosp-wtg001,
wa_n_after LIKE cosp-wtg001.
*---Actual
DATA : wa_a_tot LIKE cosp-wtg001,
wa_a_before LIKE cosp-wtg001,
wa_a_last LIKE cosp-wtg001,
wa_a_year LIKE cosp-wtg001,
wa_a_year1 LIKE cosp-wtg001,
wa_a_year2 LIKE cosp-wtg001,
wa_a_year3 LIKE cosp-wtg001,
wa_a_year4 LIKE cosp-wtg001,
wa_a_year5 LIKE cosp-wtg001,
wa_a_after LIKE cosp-wtg001.
*---Commitment
DATA : wa_c_tot LIKE cosp-wtg001,
wa_c_before LIKE cosp-wtg001,
wa_c_last LIKE cosp-wtg001,
wa_c_year LIKE cosp-wtg001,
wa_c_year1 LIKE cosp-wtg001,
wa_c_year2 LIKE cosp-wtg001,
wa_c_year3 LIKE cosp-wtg001,
wa_c_year4 LIKE cosp-wtg001,
wa_c_year5 LIKE cosp-wtg001,
wa_c_after LIKE cosp-wtg001.
*---Downpayment
DATA : wa_d_tot LIKE cosp-wtg001,
wa_d_before LIKE cosp-wtg001,
wa_d_last LIKE cosp-wtg001,
wa_d_year LIKE cosp-wtg001,
wa_d_year1 LIKE cosp-wtg001,
wa_d_year2 LIKE cosp-wtg001,
wa_d_year3 LIKE cosp-wtg001,
wa_d_year4 LIKE cosp-wtg001,
wa_d_year5 LIKE cosp-wtg001,
wa_d_after LIKE cosp-wtg001.
* ALV
*----------------------------------------------------------------------*
* Define local class
*----------------------------------------------------------------------*
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
TYPES: BEGIN OF zsfi_imfm_k,
posid TYPE im_posid,
kostl TYPE kostl,
END OF zsfi_imfm_k.
TYPES: zsfi_imfm_key TYPE STANDARD TABLE OF zsfi_imfm_k,
zsfi_imfm_table TYPE STANDARD TABLE OF zsfi_imfm.
METHODS:
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed,
get_deleted_rows
EXPORTING
deleted_rows TYPE zsfi_imfm_table,
refresh_delta_tables,
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row
e_column
es_row_no.
PRIVATE SECTION.
DATA deleted_rows TYPE STANDARD TABLE OF zsfi_imfm.
* This flag is set if any error occured in one of the
* following methods:
DATA: error_in_data TYPE c.
METHODS:
update_delta_tables
IMPORTING
pr_data_changed TYPE REF TO cl_alv_changed_data_protocol.
ENDCLASS. " LCL_EVENT_RECEIVER Definition
*----------------------------------------------------------------------*
* Implementation local class
*----------------------------------------------------------------------*
CLASS lcl_event_receiver IMPLEMENTATION.
* Setting for Change data
METHOD handle_data_changed.
* remember deleted lines for saving
CALL METHOD update_delta_tables( er_data_changed ).
PERFORM data_changed USING er_data_changed.
ENDMETHOD. " handle_data_changed
METHOD get_deleted_rows.
deleted_rows = me->deleted_rows.
ENDMETHOD.
METHOD refresh_delta_tables.
CLEAR me->deleted_rows[].
ENDMETHOD.
METHOD update_delta_tables.
DATA: l_del_row TYPE lvc_s_moce,
ls_zsfi_imfm TYPE zsfi_imfm,
ls_outtab LIKE LINE OF gt_out.
LOOP AT pr_data_changed->mt_deleted_rows INTO l_del_row.
READ TABLE gt_out INTO ls_outtab INDEX l_del_row-row_id.
IF sy-subrc NE 0.
MESSAGE i000(0k) WITH text-e01. "Internal error
ELSE.
MOVE-CORRESPONDING ls_outtab TO ls_zsfi_imfm.
APPEND ls_zsfi_imfm TO deleted_rows.
ENDIF.
ENDLOOP.
ENDMETHOD.
* Double Click
METHOD handle_double_click.
PERFORM double_click USING e_row
e_column
es_row_no.
ENDMETHOD. " handle_double_click
ENDCLASS. " LCL_EVENT_RECEIVER Implementation
DATA g_event_receiver TYPE REF TO lcl_event_receiver.
DATA: g_error(1),
g_repid LIKE sy-repid,
gv_index LIKE sy-tabix.
************************************************************************
DATA : flag_data_changed,
info(80).
DATA: BEGIN OF ftab OCCURS 10,
fcode(6),
END OF ftab.
CONSTANTS: false VALUE ' ',
true VALUE 'X'.
*----------------------------------------------------------------------*
* Macro
*----------------------------------------------------------------------*
DEFINE __focus.
call method cl_gui_control=>set_focus
exporting
control = &1 .
END-OF-DEFINITION.
DEFINE __cls. " clear & refresh
clear &1.refresh &1.
END-OF-DEFINITION.
DEFINE __process.
perform show_progress using &1 &2.
END-OF-DEFINITION.
DEFINE __message.
call function 'POPUP_TO_INFORM'
exporting
titel = &1
txt1 = &2
txt2 = sy-subrc.
END-OF-DEFINITION.
DATA:
lt_ania LIKE rania OCCURS 0 WITH HEADER LINE,
lt_anib LIKE STANDARD TABLE OF ranib
INITIAL SIZE 10 WITH HEADER LINE,
lt_anib1 LIKE STANDARD TABLE OF ranib
INITIAL SIZE 10 WITH HEADER LINE.
DATA: i_imakpa LIKE imakpa OCCURS 0 WITH HEADER LINE.
DATA: i_imak LIKE imak OCCURS 0 WITH HEADER LINE.
*----------------------------------------------------------------------
* SELECTION-SCREEN
*----------------------------------------------------------------------
* General selections
SELECTION-SCREEN BEGIN OF BLOCK b0 WITH FRAME TITLE text-010.
* ...Position ID
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (15) c_pi.
PARAMETER r_1 RADIOBUTTON GROUP r1.
SELECTION-SCREEN POSITION 30.
SELECT-OPTIONS s_posid FOR imak-posid. "impr-posid.
SELECTION-SCREEN END OF LINE.
* ...Internal Order
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (15) c_or.
PARAMETER r_2 RADIOBUTTON GROUP r1.
SELECTION-SCREEN POSITION 30.
SELECT-OPTIONS s_aufnr FOR aufk-aufnr.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b0.
* Run Parameter
SELECTION-SCREEN BEGIN OF BLOCK s1 WITH FRAME TITLE c010.
PARAMETER p_ayear LIKE impr-gjahr MEMORY ID gjr OBLIGATORY
DEFAULT sy-datum+0(4).
PARAMETER p_arver LIKE imavz-versi DEFAULT 'IM'.
SELECT-OPTIONS s_gjahr FOR impr-gjahr .
SELECTION-SCREEN END OF BLOCK s1.
* Select option
SELECTION-SCREEN BEGIN OF BLOCK s3 WITH FRAME TITLE c030.
SELECT-OPTIONS s_prnam FOR impr-prnam MEMORY ID imt."bligatory.
PARAMETERS: p_mon(2) TYPE n NO-DISPLAY,
p_auth(1) TYPE c DEFAULT 'X' NO-DISPLAY.
SELECT-OPTIONS: s_kostl FOR impr-kostl,
s_ergso FOR impr-ergso.
* AR Selection
SELECT-OPTIONS: s_vkokrs FOR imak-vkokrs,
s_usr03 FOR imak-usr03,
s_agjahr FOR imak-gjahr,
s_ivart FOR imak-ivart.
SELECTION-SCREEN END OF BLOCK s3.
* Depreciation Selection
SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-003.
PARAMETERS : p_io RADIOBUTTON GROUP selm,
p_pi RADIOBUTTON GROUP selm,
p_ar RADIOBUTTON GROUP selm DEFAULT 'X'.
PARAMETERS: p_darver LIKE imavz-versi DEFAULT 'ID'.
PARAMETERS: p_yearp LIKE impr-gjahr . " Plan Year
* p_s as checkbox. " Simulation
SELECTION-SCREEN END OF BLOCK b4.
* Status
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-002.
PARAMETERS: p_crtd NO-DISPLAY,
p_rel NO-DISPLAY,
p_lkd NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK b3.
* Select layout
SELECTION-SCREEN BEGIN OF BLOCK b5 WITH FRAME TITLE text-004.
PARAMETER p_vari TYPE slis_vari.
SELECTION-SCREEN END OF BLOCK b5.
PARAMETER p_disp DEFAULT 'E'.
*----------------------------------------------------------------------*
* at selection screen *
*----------------------------------------------------------------------*
AT SELECTION-SCREEN OUTPUT.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'P_ACT'
values = it_val.
*----------------------------------------------------------------------*
* AT SELECTION-SCREEN
*----------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
PERFORM alv_variant_f4 CHANGING p_vari.
*----------------------------------------------------------------------
* INITIALIZATION
*----------------------------------------------------------------------
INITIALIZATION.
** ==> Change Variant saving type
* wa_var_save = 'A'.
** ==> Change first mode GRID or LIST
* wa_alv_function_name = 'REUSE_ALV_GRID_DISPLAY'.
** wa_alv_function_name = 'REUSE_ALV_LIST_DISPLAY'.
* refresh : gt_fieldcat.
* clear : gs_layout.
*--title set
c010 = 'Source Year / Plan Budget '.
* c020 = 'Select option'.
c030 = 'Select option'.
* wa_repid = sy-repid.
c_pi = 'Position ID'.
c_or = 'Internal Order'.
* for combo box
*---------------------------------------------------------------------
* M A I N
*---------------------------------------------------------------------
START-OF-SELECTION.
PERFORM select_data.
IF gt_out[] IS INITIAL.
MESSAGE s000(zmfi) WITH 'No found data '.
EXIT.
ENDIF.
PERFORM make_out.
CALL SCREEN 100.
END-OF-SELECTION.
*&---------------------------------------------------------------------
*& Form select_data
*&---------------------------------------------------------------------
FORM select_data.
* refresh : it_imfm, it_sum, gt_out.
* clear : it_imfm, it_sum, gt_out.
__cls : it_bpge, it_sum, gt_out.
* Position ID
IF r_1 = 'X'.
PERFORM cbo_pi_process.
* Order
ELSE.
PERFORM order_rpocess.
ENDIF.
PERFORM get_opt USING p_disp.
ENDFORM. " select_data
**---------------------------------------------------------------------*
** FORM alv_event_pf_status_set
**---------------------------------------------------------------------*
*form alv_event_pf_status_set using rt_extab type slis_t_extab.
* if wa_alv_function_name = 'REUSE_ALV_GRID_DISPLAY'.
* set pf-status 'STANDARD_GRID'.
* else.
* set pf-status 'STANDARD' excluding rt_extab.
* endif.
* set titlebar 'STANDARD'.
*
*endform. "alv_event_pf_status_set
**---------------------------------------------------------------------*
** FORM alv_event_user_command
**---------------------------------------------------------------------*
*form alv_event_user_command using r_ucomm like sy-ucomm
* rs_selfield type slis_selfield.
*
* case r_ucomm.
** ---------------------------------- processing on double click.
* when '&IC1'.
* read table gt_out index rs_selfield-tabindex.
* case rs_selfield-fieldname.
* when 'POSID'.
* set parameter id 'IMT' field s_prnam-low.
* set parameter id 'IMP' field gt_out-posid.
* set parameter id 'GJR' field p_ayear.
* call transaction 'ZIMR' and skip first screen.
* endcase.
** ---------------------------------- switching view type grid or list
* when 'LIST' or 'GRID'.
* perform switch_list_or_grid using r_ucomm.
*
* when 'PRE' or 'NEXT'.
* perform change_status using r_ucomm. " Change status
* rs_selfield-refresh = 'X'.
*
* when 'DPCR'.
* perform create_dpcr. " Create depreciation data
* rs_selfield-refresh = 'X'.
*
* when 'CAL1' or 'CAL2' or 'CAL3'.
* perform cal_dpcr_amt using r_ucomm.
* rs_selfield-refresh = 'X'.
*
* endcase.
*
* check r_ucomm eq 'LIST' or
* r_ucomm eq 'GRID'.
*
* rs_selfield-exit = 'X'.
*
*endform. "alv_event_user_command
**&---------------------------------------------------------------------
**& Form set_variant
**&---------------------------------------------------------------------
*form set_variant changing cs_vari type disvariant.
* check p_layout ne space.
*
* cs_vari-report = sy-repid.
* cs_vari-handle = space.
* cs_vari-log_group = space.
* cs_vari-username = space.
* cs_vari-variant = p_layout.
* cs_vari-text = space.
* cs_vari-dependvars = space.
*
*endform. " set_variant
**&---------------------------------------------------------------------
**& Form set_events
**&---------------------------------------------------------------------
*form set_events changing ct_events type slis_t_event.
*
* field-symbols: <ls_event> type slis_alv_event.
*
* data: l_event type lvc_fname.
*
* call function 'REUSE_ALV_EVENTS_GET'
* exporting
* i_list_type = 0
* importing
* et_events = ct_events
* exceptions
* list_type_wrong = 1
* others = 2.
*
* if sy-subrc <> 0.
* message id sy-msgid type sy-msgty number sy-msgno
* with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* else.
* delete ct_events where name ne 'END_OF_PAGE'
* and name ne 'TOP_OF_PAGE'
* and name ne 'TOP_OF_LIST'
* and name ne 'END_OF_LIST'.
* loop at ct_events assigning <ls_event>.
* concatenate 'ALV_EVENT_'
* <ls_event>-name
* into <ls_event>-form.
* endloop.
* endif.
*
*endform. " f01_set_evts
**&---------------------------------------------------------------------
**& Form set_layout
**&---------------------------------------------------------------------
*form set_layout changing cs_layo type slis_layout_alv.
* cs_layo-numc_sum = 'X'.
* cs_layo-group_buttons = 'X'.
* cs_layo-group_change_edit = 'X'.
* cs_layo-detail_popup = 'X'.
* cs_layo-coltab_fieldname = 'TABCOLOR'.
* cs_layo-list_append = space.
* cs_layo-colwidth_optimize = 'X'.
* cs_layo-box_fieldname = 'CHK'.
*
*endform. " set_layout
**&---------------------------------------------------------------------
**
**& Form dispaly_heager
**----------------------------------------------------------------------
**
*form display_header.
* call function 'REUSE_ALV_COMMENTARY_WRITE'
* exporting
* it_list_commentary = w_top_of_page.
*endform. " top_of_page
**&---------------------------------------------------------------------
**& Form switch_list_or_grid
**&---------------------------------------------------------------------
*form switch_list_or_grid using r_ucomm.
* data: ls_vari type disvariant,
* ls_slis_layo type slis_layout_alv,
* lt_slis_fcat type slis_t_fieldcat_alv,
* lt_slis_sort type slis_t_sortinfo_alv,
* lt_slis_filt type slis_t_filter_alv,
* ls_slis_prnt type slis_print_alv.
*
* if r_ucomm = 'LIST' and
* wa_alv_function_name = 'REUSE_ALV_LIST_DISPLY'.
* exit.
* endif.
*
* if r_ucomm = 'GRID' and
* wa_alv_function_name = 'REUSE_ALV_GRID_DISPLAY'.
* exit.
* endif.
*
* case wa_alv_function_name.
* when 'REUSE_ALV_LIST_DISPLAY'.
* wa_alv_get_info_name = 'REUSE_ALV_LIST_LAYOUT_INFO_GET'.
* when 'REUSE_ALV_GRID_DISPLAY'.
* wa_alv_get_info_name = 'REUSE_ALV_GRID_LAYOUT_INFO_GET'.
* endcase.
*
* call function wa_alv_get_info_name
* importing
* es_layout = ls_slis_layo
* et_fieldcat = lt_slis_fcat
* et_sort = lt_slis_sort
* et_filter = lt_slis_filt
* es_variant = ls_vari
* exceptions
* no_infos = 1
* program_error = 2
* others = 3.
* if sy-subrc <> 0.
* message id sy-msgid type sy-msgty number sy-msgno
* with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* endif.
*
* if r_ucomm = 'LIST'.
* wa_alv_function_name = 'REUSE_ALV_LIST_DISPLAY'.
* call function wa_alv_function_name
* exporting
* i_callback_program = wa_repid
* i_callback_pf_status_set = 'ALV_EVENT_PF_STATUS_SET'
* i_callback_user_command = 'ALV_EVENT_USER_COMMAND'
* is_layout = ls_slis_layo
* it_fieldcat = lt_slis_fcat
* it_sort = lt_slis_sort
* it_filter = lt_slis_filt
* i_default = ' ' "gs_test-vari_default
* i_save = wa_var_save
* is_variant = ls_vari
* is_print = ls_slis_prnt
* it_events = gt_events[]
* tables
* t_outtab = gt_out
* exceptions
* program_error = 1
* others = 2.
* endif.
*
* if r_ucomm = 'GRID'.
* wa_alv_function_name = 'REUSE_ALV_GRID_DISPLAY'.
* call function wa_alv_function_name
* exporting
* i_callback_program = wa_repid
* i_callback_pf_status_set = 'ALV_EVENT_PF_STATUS_SET'
* i_callback_user_command = 'ALV_EVENT_USER_COMMAND'
* is_layout = ls_slis_layo
* it_fieldcat = lt_slis_fcat
* it_sort = lt_slis_sort
* it_filter = lt_slis_filt
* i_default = ' ' "gs_test-vari_default
* i_save = wa_var_save
* is_variant = ls_vari
* is_print = ls_slis_prnt
* tables
* t_outtab = gt_out
* exceptions
* program_error = 1
* others = 2.
* endif.
*
* if sy-subrc <> 0.
* message id sy-msgid type sy-msgty number sy-msgno
* with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* endif.
*
*endform. " switch_list_or_grid
**&--------------------------------------------------------------------
**& Form make_field_category
**&--------------------------------------------------------------------
*form build_field_category using p_fieldname " field name
* p_title " field title
* p_outputlen " length
* p_key
* p_just.
*
* data ls_fieldcat type slis_fieldcat_alv.
*
* clear ls_fieldcat.
* ls_fieldcat-fieldname = p_fieldname.
* ls_fieldcat-seltext_l = p_title.
* ls_fieldcat-outputlen = p_outputlen.
* ls_fieldcat-key = p_key.
* ls_fieldcat-just = p_just.
*
* if p_fieldname = 'ICON'.
* ls_fieldcat-icon = 'X'.
* endif.
*
* append ls_fieldcat to gt_fieldcat.
*
*endform. " fill_field_category
**&---------------------------------------------------------------------
**
**& Form f4_variant
**&---------------------------------------------------------------------
**
*form f4_variant changing c_variant type disvariant-variant.
* data: ls_variant type disvariant,
* l_exit type char1.
*
* ls_variant-report = sy-repid.
*
* call function 'REUSE_ALV_VARIANT_F4'
* exporting
* is_variant = ls_variant
* i_save = 'A'
* importing
* e_exit = l_exit
* es_variant = ls_variant
* exceptions
* not_found = 2.
*
* if sy-subrc = 2.
* message id sy-msgid type 'S' number sy-msgno
* with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* else.
* if l_exit eq space.
* c_variant = ls_variant-variant.
* endif.
* endif.
*
*endform. " f4_variant
**&---------------------------------------------------------------------
**
**& Form build_sort_table
**&---------------------------------------------------------------------
**
*form build_sort_table using p_spos
* p_fieldname
* p_up
* p_subtot
* p_group.
* data ls_sort type slis_sortinfo_alv.
*
* ls_sort-spos = p_spos.
* ls_sort-fieldname = p_fieldname.
* ls_sort-up = p_up.
* ls_sort-subtot = p_subtot.
* ls_sort-group = p_group.
* append ls_sort to gt_sorts.
*
*endform. " build_sort_table
**&---------------------------------------------------------------------
**
**& Form set_line_color
**&---------------------------------------------------------------------
**
*form set_line_color using p_color.
* data: ls_fieldcat type slis_fieldcat_alv,
* lt_color type slis_t_specialcol_alv,
* ls_color type slis_specialcol_alv.
*
* refresh lt_color.
* clear lt_color.
*
* loop at gt_fieldcat into ls_fieldcat.
* ls_color-fieldname = ls_fieldcat-fieldname.
* ls_color-color-col = p_color.
* ls_color-color-int = cl_gui_resources=>list_intensified.
* ls_color-color-inv = 0.
* ls_color-nokeycol = 'X'.
* append ls_color to lt_color.
* gt_out-tabcolor = lt_color.
* endloop.
*
*endform. " set_line_color
**&---------------------------------------------------------------------
**
**& Form build_field_category1
**&---------------------------------------------------------------------
**
*form build_field_category1 using
* p_fieldname " field name
* p_title " field title
* p_outputlen " length
* p_key "
* p_just "
* p_noout "
* p_edit "
* p_cfield " currency field
*nam
* p_qfield " quantity field
*nam
* .
*
* data ls_fieldcat type slis_fieldcat_alv.
* clear ls_fieldcat.
*
* ls_fieldcat-fieldname = p_fieldname.
* ls_fieldcat-seltext_l = p_title.
* ls_fieldcat-outputlen = p_outputlen.
* ls_fieldcat-key = p_key.
* ls_fieldcat-just = p_just.
* ls_fieldcat-edit = p_edit.
* ls_fieldcat-no_out = p_noout.
* ls_fieldcat-cfieldname = p_cfield.
* ls_fieldcat-qfieldname = p_qfield.
* append ls_fieldcat to gt_fieldcat.
*endform. " build_field_category1
**&---------------------------------------------------------------------
**
**& Form comment_build
**&---------------------------------------------------------------------
**
*form comment_build using lt_top_of_page type slis_t_listheader.
* data: ls_line type slis_listheader,
* l_manager(50),
* l_date(50),
* l_list(50),
* l_dsnam like t024d-dsnam,
* l_h_dsnam like t024d-dsnam,
* l_ldate(10),
* l_hdate(10).
**-------------- HEADER
* clear ls_line.
* ls_line-typ = 'H'.
* ls_line-info = text-h01. "HEADER TITLE (H001)
* append ls_line to lt_top_of_page.
*
* ls_line-typ = 'S'.
* ls_line-key = 'Investment program : '.
* ls_line-info = s_prnam-low.
* append ls_line to lt_top_of_page.
**--
* ls_line-typ = 'S'.
* ls_line-key = 'Approval Year : '.
* ls_line-info = p_ayear.
* append ls_line to lt_top_of_page.
* ls_line-typ = 'S'.
* ls_line-key = 'Fiscal Year : '.
** ls_line-info = S_GJAHR-LOW.
* concatenate s_gjahr-low ' ~' s_gjahr-high into l_list.
* ls_line-info = l_list.
* append ls_line to lt_top_of_page.
**--
* ls_line-typ = 'S'.
* ls_line-key = 'Position ID : '.
* concatenate s_posid-low ' ~' s_posid-high into l_list.
* ls_line-info = l_list.
* append ls_line to lt_top_of_page.
**
*endform. " comment_build
**&---------------------------------------------------------------------
**
**& Form set_build_event
**&---------------------------------------------------------------------
**
*form set_build_event.
* w_eventcat-name = 'TOP_OF_PAGE'.
* w_eventcat-form = 'DISPLAY_HEADER'.
* append w_eventcat.
*
*endform. " set_build_event
*&---------------------------------------------------------------------*
*& Form get_pi_plan
*&---------------------------------------------------------------------*
FORM get_pi_plan USING u_posid
u_ayear
u_prnam.
REFRESH it_budget.
CLEAR it_budget.
CALL FUNCTION 'Z_FFI_GET_PI_BUDGET'
EXPORTING
posid = u_posid
prnam = u_prnam
gjahr = u_ayear
TABLES
out = it_budget.
*Issue Number : FI-20041118-007, Requested by Robin Simmons
*Changed on 2004/12/10, by WSKIM
*---Start
IF s_gjahr-low = space.
READ TABLE it_budget WITH KEY posid = u_posid
gjahr = '1111'.
IF sy-subrc = 0.
MOVE it_budget-plan TO gt_out-zplan.
ENDIF.
ELSE.
READ TABLE it_budget WITH KEY posid = u_posid
gjahr = s_gjahr-low.
IF sy-subrc = 0.
MOVE it_budget-plan TO gt_out-zplan.
ENDIF.
ENDIF.
*---End
ENDFORM. " get_pi_plan
*&---------------------------------------------------------------------*
*& Form get_pi_ACTUAL
*&---------------------------------------------------------------------*
FORM get_pi_actual USING u_posid
u_ayear
u_prnam.
DATA: l_name(20),
l_tot TYPE wtgxxx,
n(2) TYPE n.
FIELD-SYMBOLS <fs> TYPE ANY.
REFRESH it_actual.
CLEAR it_actual.
CALL FUNCTION 'Z_FFI_GET_PI_ACTUAL_ACT'
EXPORTING
posid = u_posid
gjahr = u_ayear
prnam = u_prnam
TABLES
out = it_actual.
IF p_mon IS INITIAL.
*---2004/03/23
*Issue Number : FI-20041118-007, Requested by Robin Simmons
*Changed on 2004/12/01, by WSKIM
*---Start
* LOOP AT it_actual WHERE gjahr IN s_gjahr
* AND ippos = ' '.
LOOP AT it_actual WHERE ippos <> 0.
IF s_gjahr-low <> ' '.
CHECK it_actual-gjahr = s_gjahr-low.
ENDIF.
*---End
CASE it_actual-wrttp.
WHEN '21'. "PR
ADD it_actual-tot TO gt_out-pr_amt.
WHEN '22'. "PO
ADD it_actual-tot TO gt_out-po_amt.
WHEN '04' OR '11'. " ACTUAL
ADD it_actual-tot TO gt_out-act_amt.
*Issue Number : FI-20041118-007, Requested by Robin Simmons
*Changed on 2004/12/10, by WSKIM
*---Start
WHEN '12'. "downpayment