2007 Feb 26 12:47 PM
2007 Feb 26 1:19 PM
In
TOP-OF-PAGE & START-OF-SELECTION.
U have to write what ever u want to dispaly.
Top-of-page will trigger first and write the statements.
SAmple report program for reference.
REPORT ztemplate
NO STANDARD PAGE HEADING
LINE-SIZE 130
LINE-COUNT 65
MESSAGE-ID zm.
**************************************
* The Data Declarations
TABLES: mara." General Material Data.
************************************************************************
* Type Declarations:
************************************************************************
TYPES : BEGIN OF ty_mara,
cb(1),
matnr LIKE mara-matnr,
mtart LIKE mara-mtart,
matkl LIKE mara-matkl,
END OF ty_mara.
************************************************************************
* Internal Tables:
************************************************************************
* The following structure type must be defined in the data dictionary
DATA : i_output TYPE ty_mara OCCURS 0 WITH HEADER LINE.
DATA: lines TYPE i, free TYPE i.
* The Selection Screen Definition
SELECTION-SCREEN BEGIN OF BLOCK b_main WITH FRAME TITLE text-b01.
*
*SELECTION-SCREEN skip.
*
SELECT-OPTIONS: s_matnr FOR mara-matnr. "Material No
*PARAMETERS: P_XXXXX like XXXX-XXXXX. "Description
*PARAMETERS: CB_XXXX as checkbox. "Description
*PARAMETERS: RB_XXXY radiobutton group XXX default 'X'. "Description
*PARAMETERS: RB_XXXZ radiobutton group XXX. "Description
*
*SELECTION-SCREEN COMMENT fmt name.
SELECTION-SCREEN END OF BLOCK b_main.
*SELECTION-SCREEN ULINE.
*eject
************************************************************************
* INITIALIZATION
************************************************************************
INITIALIZATION.
*
************************************************************************
* AT SELECTION-SCREEN
************************************************************************
AT SELECTION-SCREEN.
*Validate material no details
IF NOT s_matnr[] IS INITIAL.
LOOP AT s_matnr.
IF NOT s_matnr-low IS INITIAL.
SELECT SINGLE matnr INTO v_matnr
FROM mara
WHERE matnr = s_matnr-low.
IF sy-subrc NE 0.
MESSAGE i128.
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
IF NOT s_matnr-high IS INITIAL.
SELECT SINGLE matnr INTO v_matnr
FROM mara
WHERE matnr = s_matnr-high.
IF sy-subrc NE 0.
MESSAGE i128.
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
************************************************************************
* START-OF-SELECTION
************************************************************************
START-OF-SELECTION.
REFRESH: i_output.
CLEAR : i_output.
SELECT matnr
mtart
matkl
INTO TABLE i_output
FROM mara
WHERE mara~matnr IN s_matnr.
IF sy-subrc NE 0.
MESSAGE i000 WITH text-002.
" No records found for selected criteria
leave list-processing.
ENDIF.
IF NOT i_output[] IS INITIAL.
LOOP AT i_output INTO wa_output.
WRITE:/001 wa_output-cb AS checkbox,
003 wa_output-matnr,
015 wa_output-mtart,
024 wa_output-matkl.
CLEAR wa_output.
ENDLOOP.
ENDIF.
************************************************************************
* END-OF-SELECTION
************************************************************************
END-OF-SELECTION.
lines = sy-linno - 1.
SET PF-STATUS 'ZSTATUS'.
AT USER-COMMAND.
wa_output-cb = space.
SET PF-STATUS 'ZSTATUS' EXCLUDING 'SAVE'.
DO lines TIMES.
READ LINE sy-index FIELD VALUE wa_output-cb.
IF wa_output-cb = 'X'.
MODIFY i_output FROM wa_output INDEX sy-tabix TRANSPORTING cb.
ENDIF.
ENDDO.
CASE sy-ucomm.
WHEN 'SAVE'.
DELETE i_output WHERE cb = 'X'.
WHEN 'BACK'.
LEAVE SCREEN.
ENDCASE.
************************************************************************
* TOP-OF-PAGE.
************************************************************************
TOP-OF-PAGE.
ULINE.
FORMAT INTENSIFIED OFF.
FORMAT COLOR COL_HEADING.
WRITE:/001 'CB' ,
003 'Material No',
015 'Mat type',
024 'Mat group'.
FORMAT COLOR OFF.
FORMAT INTENSIFIED ON.
ULINE.
2007 Feb 26 12:48 PM
hi,
There is no any mandatory condition, its preferable to write the write stmnt in end-of-selection event
2007 Feb 26 12:48 PM
No conditions..
For example.
REPORT ZTEST.
WRITE: 'Hi'.
This report will write Hi in the output list.
Vasanth
2007 Feb 26 12:49 PM
Do not use write statements in initiliazation. at select screen events.
You can use the write statements in start-of-selection, end-of-selection, top-of-page etc.
Regards,
Ravi
2007 Feb 26 1:19 PM
In
TOP-OF-PAGE & START-OF-SELECTION.
U have to write what ever u want to dispaly.
Top-of-page will trigger first and write the statements.
SAmple report program for reference.
REPORT ztemplate
NO STANDARD PAGE HEADING
LINE-SIZE 130
LINE-COUNT 65
MESSAGE-ID zm.
**************************************
* The Data Declarations
TABLES: mara." General Material Data.
************************************************************************
* Type Declarations:
************************************************************************
TYPES : BEGIN OF ty_mara,
cb(1),
matnr LIKE mara-matnr,
mtart LIKE mara-mtart,
matkl LIKE mara-matkl,
END OF ty_mara.
************************************************************************
* Internal Tables:
************************************************************************
* The following structure type must be defined in the data dictionary
DATA : i_output TYPE ty_mara OCCURS 0 WITH HEADER LINE.
DATA: lines TYPE i, free TYPE i.
* The Selection Screen Definition
SELECTION-SCREEN BEGIN OF BLOCK b_main WITH FRAME TITLE text-b01.
*
*SELECTION-SCREEN skip.
*
SELECT-OPTIONS: s_matnr FOR mara-matnr. "Material No
*PARAMETERS: P_XXXXX like XXXX-XXXXX. "Description
*PARAMETERS: CB_XXXX as checkbox. "Description
*PARAMETERS: RB_XXXY radiobutton group XXX default 'X'. "Description
*PARAMETERS: RB_XXXZ radiobutton group XXX. "Description
*
*SELECTION-SCREEN COMMENT fmt name.
SELECTION-SCREEN END OF BLOCK b_main.
*SELECTION-SCREEN ULINE.
*eject
************************************************************************
* INITIALIZATION
************************************************************************
INITIALIZATION.
*
************************************************************************
* AT SELECTION-SCREEN
************************************************************************
AT SELECTION-SCREEN.
*Validate material no details
IF NOT s_matnr[] IS INITIAL.
LOOP AT s_matnr.
IF NOT s_matnr-low IS INITIAL.
SELECT SINGLE matnr INTO v_matnr
FROM mara
WHERE matnr = s_matnr-low.
IF sy-subrc NE 0.
MESSAGE i128.
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
IF NOT s_matnr-high IS INITIAL.
SELECT SINGLE matnr INTO v_matnr
FROM mara
WHERE matnr = s_matnr-high.
IF sy-subrc NE 0.
MESSAGE i128.
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
************************************************************************
* START-OF-SELECTION
************************************************************************
START-OF-SELECTION.
REFRESH: i_output.
CLEAR : i_output.
SELECT matnr
mtart
matkl
INTO TABLE i_output
FROM mara
WHERE mara~matnr IN s_matnr.
IF sy-subrc NE 0.
MESSAGE i000 WITH text-002.
" No records found for selected criteria
leave list-processing.
ENDIF.
IF NOT i_output[] IS INITIAL.
LOOP AT i_output INTO wa_output.
WRITE:/001 wa_output-cb AS checkbox,
003 wa_output-matnr,
015 wa_output-mtart,
024 wa_output-matkl.
CLEAR wa_output.
ENDLOOP.
ENDIF.
************************************************************************
* END-OF-SELECTION
************************************************************************
END-OF-SELECTION.
lines = sy-linno - 1.
SET PF-STATUS 'ZSTATUS'.
AT USER-COMMAND.
wa_output-cb = space.
SET PF-STATUS 'ZSTATUS' EXCLUDING 'SAVE'.
DO lines TIMES.
READ LINE sy-index FIELD VALUE wa_output-cb.
IF wa_output-cb = 'X'.
MODIFY i_output FROM wa_output INDEX sy-tabix TRANSPORTING cb.
ENDIF.
ENDDO.
CASE sy-ucomm.
WHEN 'SAVE'.
DELETE i_output WHERE cb = 'X'.
WHEN 'BACK'.
LEAVE SCREEN.
ENDCASE.
************************************************************************
* TOP-OF-PAGE.
************************************************************************
TOP-OF-PAGE.
ULINE.
FORMAT INTENSIFIED OFF.
FORMAT COLOR COL_HEADING.
WRITE:/001 'CB' ,
003 'Material No',
015 'Mat type',
024 'Mat group'.
FORMAT COLOR OFF.
FORMAT INTENSIFIED ON.
ULINE.
2007 Feb 26 1:39 PM
<b>The order of execution of events is
initialization
at selection-screen
start-of-selection
top-of-page
end-of-page
end-of-selection
But if u write write statement in initialization , top-of-page and start-of-selection then,
The order of triggering of events
1. Top-of-page
2. Initialization
3. start-of-selection
Report zex36.
INITIALIZATION.
WRITE : / 'sree'.
TOP-OF-PAGE.
WRITE : / 'kanth'.
START-OF-SELECTION.
WRITE : / 'Reddy'.
O/P will be
kanth
sree
Reddy </b>