‎2007 Apr 17 4:45 AM
‎2007 Apr 17 4:52 AM
Balu,
1 . It is not only the parameters default value
which are required/accessed/controlled
in initialization event.
2. In a program there are so many variables,
the values of these variables
can be set in intiailization event.
3. Such values sometimes cannot be hardcoded.
They may be requried to fetch from database
or do some calculations,
(which is not possible while declaration
data and parameters)
4. Sometimes, some variant can also be imported
for selection screen.
5.This event is invoked directly after LOAD-OF-PROGRAM and before the selection screen processing of any existing standard selection screen.
This gives you the one-time opportunity to initialize the input fields of the selection screen, including those defined in the logical database linked with the program.
When run in background, values initialized in initialization event are considered.
For eg: if you want to initialize like this:
carrid-sign = 'I'.
carrid-option = 'EQ'.
carrid-low = 'AA'.
carrid-high = 'LH'.
APPEND carrid TO carrid.
You cannot achieve this by giving 'default' or 'value' at selection-screen.
Don't forget ot reward if useful
‎2007 Apr 17 4:49 AM
You can
1) clear the global variables, internal tables etc
2) Manipulate the initial value of selection screen fields
Thanks
Sandeep
‎2007 Apr 17 4:52 AM
Balu,
1 . It is not only the parameters default value
which are required/accessed/controlled
in initialization event.
2. In a program there are so many variables,
the values of these variables
can be set in intiailization event.
3. Such values sometimes cannot be hardcoded.
They may be requried to fetch from database
or do some calculations,
(which is not possible while declaration
data and parameters)
4. Sometimes, some variant can also be imported
for selection screen.
5.This event is invoked directly after LOAD-OF-PROGRAM and before the selection screen processing of any existing standard selection screen.
This gives you the one-time opportunity to initialize the input fields of the selection screen, including those defined in the logical database linked with the program.
When run in background, values initialized in initialization event are considered.
For eg: if you want to initialize like this:
carrid-sign = 'I'.
carrid-option = 'EQ'.
carrid-low = 'AA'.
carrid-high = 'LH'.
APPEND carrid TO carrid.
You cannot achieve this by giving 'default' or 'value' at selection-screen.
Don't forget ot reward if useful
‎2007 Apr 17 4:52 AM
Hi Balu,
If u want give some input to selection fields.
Initialization event triggers before the selection screen is displayed.
PLz go through this program u can understand clearly.
REPORT YCLASSICREPORTING NO STANDARD PAGE HEADING LINE-COUNT 20(5)
LINE-SIZE 88 MESSAGE-ID ZMGSVMR .
TABLES : LFA1.
SELECT-OPTIONS : VENDOR FOR LFA1-LIFNR.
DATA: BEGIN OF ITAB OCCURS 0,
LIFNR LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
ORT01 LIKE LFA1-ORT01,
END OF ITAB.
DATA : FNAME(10) , FVAL(10) TYPE N.
INITIALIZATION .
VENDOR-LOW = 100.
VENDOR-HIGH = 1500.
VENDOR-OPTION = 'BT'.
VENDOR-SIGN = 'I'.
APPEND VENDOR.
AT SELECTION-SCREEN ON VENDOR.
IF VENDOR-LOW < 100 OR VENDOR-HIGH > 1500.
MESSAGE I000(ZMSGVMR) WITH 'enter oroper input'.
ENDIF.
START-OF-SELECTION.
SELECT LIFNR NAME1 ORT01 FROM LFA1 INTO TABLE ITAB WHERE LIFNR IN
VENDOR.
LOOP AT ITAB.
FORMAT COLOR 1.
WRITE : / ' accno' , 'name of vendor' , 'city of vendor' .
WRITE : / ITAB-LIFNR ,SY-VLINE , ITAB-NAME1,SY-VLINE , ITAB-ORT01,
SY-VLINE.
ULINE.
FORMAT COLOR OFF.
ENDLOOP.
SET PF-STATUS 'YVMR'.
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'VENDOR'.
GET CURSOR FIELD FNAME VALUE FVAL.
SET PARAMETER ID 'LIF' FIELD FVAL.
CALL TRANSACTION 'XK02' AND SKIP FIRST SCREEN.
ENDCASE.
TOP-OF-PAGE.
WRITE : / 'VENDOR DETAILS ' COLOR 3 .
END-OF-PAGE.
WRITE 😕 'PAGE NO:' , SY-PAGNO COLOR 6.
END OF SELECTION.
Rewards points.
Rgds,
P.Nag
‎2007 Apr 17 4:54 AM
IF U NEED TO PERFORM ANY OPERATION BEFORE GOING TO DISPLAY THE SELECTION SCREEN WE WRITE THAT CODE IN INITAILIZATION. IN GENERAL WE INITIALIZE THE VALUES... AND WE CAN PERFORM SOME OPERATIONS ALSO..
IF U WANT MORE CLEARLY JUST DEBUGG U REPORT IT FIRST GOES TO INITALIZTION PART N LATER IT PRINTS TH ESELECTION SCREEN.