‎2006 Jan 30 4:27 AM
Hi ,
Ple give the example for report event initialization .
Regards,
Narayana.
‎2006 Jan 30 4:33 AM
REPORT Z538DD NO STANDARD PAGE HEADING.
TABLES: vbak.
DATA: BEGIN OF i_vbak OCCURS 0,
vbeln LIKE vbak-vbeln,
erdat LIKE vbak-erdat,
vkorg LIKE vbak-vkorg,
vtweg LIKE vbak-vtweg,
spart LIKE vbak-spart,
END OF i_vbak.
DATA: BEGIN OF i_vbap OCCURS 0,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
matnr LIKE vbap-matnr,
zmeng LIKE vbap-zmeng,
END OF i_vbap.
DATA: BEGIN OF i_vbep OCCURS 0,
vbeln LIKE vbep-vbeln,
posnr LIKE vbep-posnr,
etenr LIKE vbep-etenr,
wmeng LIKE vbep-wmeng,
bddat LIKE vbep-bddat,
banfn LIKE vbep-banfn,
END OF i_vbep.
DATA i_x TYPE I.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln OBLIGATORY.
INITIALIZATION.
i_x = 1.
START-OF-SELECTION.
SELECT vbeln erdat vkorg vtweg spart
INTO TABLE i_vbak
FROM vbak
WHERE vbeln IN s_vbeln.
IF sy-subrc <> 0.
MESSAGE e000(Z538MSG).
ENDIF.
END-OF-SELECTION.
FORMAT COLOR 2.
LOOP AT i_vbak.
WRITE: /1 sy-vline, 2 i_vbak-vbeln,
14 sy-vline, 15 i_vbak-erdat,
26 sy-vline, 27 i_vbak-vkorg,
34 sy-vline, 35 i_vbak-vtweg,
40 sy-vline, 41 i_vbak-spart,
50 sy-vline.
HIDE i_vbak-vbeln.
ENDLOOP.
WRITE: /1 sy-vline,
14 sy-vline,
26 sy-vline,
34 sy-vline,
40 sy-vline,
50 sy-vline.
ULINE AT 1(50).
FORMAT RESET.
SET PF-STATUS 'Z538BUT'.
AT LINE-SELECTION.
IF sy-lsind = '1'.
REFRESH i_vbap.
CLEAR i_vbap.
SELECT vbeln posnr matnr zmeng
INTO TABLE i_vbap
FROM vbap
WHERE vbeln = i_vbak-vbeln.
IF sy-subrc <> 0.
MESSAGE i000(Z538MSG).
ENDIF.
FORMAT COLOR 2.
LOOP AT i_vbap.
WRITE: /1 sy-vline, 2 i_vbap-vbeln,
14 sy-vline, 15 i_vbap-posnr,
23 sy-vline, 25 i_vbap-matnr,
45 sy-vline, 47 i_vbap-zmeng,
64 sy-vline.
HIDE i_vbap.
AT LAST.
SUM.
WRITE: /1 sy-vline,
14 sy-vline,
23 sy-vline,
45 sy-vline,
64 sy-vline.
ULINE AT 1(64).
FORMAT COLOR 3.
WRITE: /1 sy-vline, 38 'SUM',
45 sy-vline, 47 i_vbap-zmeng,
64 sy-vline.
WRITE: /1 sy-vline,
14 sy-vline,
23 sy-vline,
45 sy-vline,
64 sy-vline.
ULINE AT 1(64).
FORMAT RESET.
ENDAT.
ENDLOOP.
ELSEIF sy-lsind = '2'.
REFRESH i_vbep.
CLEAR i_vbep.
SELECT vbeln posnr etenr wmeng bddat banfn
INTO TABLE i_vbep
FROM vbep
WHERE vbeln = i_vbap-vbeln AND
posnr = i_vbap-posnr.
IF sy-subrc <> 0.
MESSAGE I000(Z538MSG).
ENDIF.
FORMAT COLOR 2.
LOOP AT i_vbep.
WRITE: /1 sy-vline, 2 i_vbep-vbeln,
13 sy-vline, 15 i_vbep-posnr,
24 sy-vline, 26 i_vbep-etenr,
32 sy-vline, 34 i_vbep-wmeng,
50 sy-vline, 52 i_vbep-bddat,
60 sy-vline, 62 i_vbep-banfn,
75 sy-vline.
AT LAST.
SUM.
ULINE AT 1(75).
FORMAT COLOR 3.
WRITE: /1 sy-vline,
13 sy-vline,
24 sy-vline, 26 'SUM',
32 sy-vline, 34 i_vbep-wmeng,
50 sy-vline,
60 sy-vline,
75 sy-vline.
WRITE: /1 sy-vline,
13 sy-vline,
24 sy-vline,
32 sy-vline,
50 sy-vline,
60 sy-vline,
75 sy-vline.
ULINE AT 1(75).
FORMAT RESET.
ENDAT.
ENDLOOP.
ELSEIF sy-lsind = '3'.
WINDOW STARTING AT 45 10 ENDING AT 60 12.
WRITE 'HI'.
ENDIF.
TOP-OF-PAGE.
FORMAT COLOR 1 INTENSIFIED ON.
ULINE AT 1(50).
WRITE: /1 sy-vline, 2 'Sales',
14 sy-vline, 15 'Date',
26 sy-vline, 27 'Org',
34 sy-vline, 35 'Chl',
40 sy-vline, 41 'Division',
50 sy-vline.
WRITE: /1 sy-vline,
14 sy-vline,
26 sy-vline,
34 sy-vline,
40 sy-vline,
50 sy-vline.
ULINE AT 1(50).
FORMAT RESET.
TOP-OF-PAGE DURING LINE-SELECTION.
IF sy-lsind = '1'.
FORMAT COLOR 1 INTENSIFIED ON.
ULINE AT 1(64).
WRITE: /1 sy-vline, 2 'Sales',
14 sy-vline, 15 'Document',
23 sy-vline, 25 'Material',
45 sy-vline, 47 'Quantity',
64 sy-vline.
WRITE: /1 sy-vline,
14 sy-vline,
23 sy-vline,
45 sy-vline,
64 sy-vline.
ULINE AT 1(64).
FORMAT RESET.
ELSE.
FORMAT COLOR 1 INTENSIFIED ON.
ULINE AT 1(75).
WRITE: /1 sy-vline, 2 'Sales',
13 sy-vline, 15 'Document',
24 sy-vline, 26 'Sch',
32 sy-vline, 34 'Quantity',
50 sy-vline, 52 'ReqDate',
60 sy-vline, 62 'Purchase',
75 sy-vline.
WRITE: /1 sy-vline,
13 sy-vline,
24 sy-vline,
32 sy-vline,
50 sy-vline,
60 sy-vline,
75 sy-vline.
ULINE AT 1(75).
FORMAT RESET.
ENDIF.
‎2006 Jan 30 4:37 AM
Simple example to initialize select-options:
selection-screen begin of block g1 with frame title text-000.
select-options: s_docdat for vbak-erdat, "Document date
selection-screen end of block g1.
<b>initialization. </b>
move 'I' to s_docdat-sign.
move 'BT' to s_docdat-option.
move sy-datum to s_docdat-high.
subtract 7 from sy-datum.
move sy-datum to s_docdat-low.
append s_docdat.
‎2006 Jan 30 4:34 AM
Hi,
Initialization even fires before the selection screen of your report.
This is used to Initialize values for the selection screen fields.
Lets say you have a parameter for Invoice in the selection screen and you want to Intialize with some values for this field before the selection screen pops up. Then you assign those values in the initialization even.
Hope helps.
Good luck.
Please close the issue with appropriate points if helpful.
Venu
‎2006 Jan 30 5:30 AM
Hi Ravi,
Have a look at demo program DEMO_PROGRAM_INITIALIZATION
Thanks
Lakshman
‎2006 Jan 30 5:51 AM
hi,
Would like to add a little more information.
As an alternative u can use load of program event to achieve the same.
Initialization works only for reports.
regards,
Sumeet Mishra