10-11-2008 8:21 AM
Dear friends,
I am having one question for you. if we write a select statement after the END-OF-SELECTION event. it will triggers? please give me complete reference for this.
Regards,
Kailash Murthy
10-11-2008 8:25 AM
yes, it will trigger.
we use this event so as to specify the area where we are done with our selection of data, and want to display output.It helps in framing our program well.
this event has its importance when we use LDBs, without END-OF-SELECTION event along with START-OF-SELECTION, LDBs cannot work.
10-11-2008 8:27 AM
Hi ,
You can write SELECT statment in END-OF-SELECTION also. But you need to write the selected data only after your select statment.
It is generally not advised to write selects in END-OF-SELECTIONS.
or please refer to link given below for futher clearification.
http://help.sap.com/saphelp_erp2005/helpdata/en/9f/db9aca35c111d1829f0000e829fbfe/frameset.htm
Regards
Prashant
10-11-2008 8:31 AM
yes it will trigger
sample code
NODES: spfli, sflight, sbook.
DATA: weight TYPE p LENGTH 8 DECIMALS 4,
total_weight TYPE p LENGTH 8 DECIMALS 4.
INITIALIZATION.
carrid-sign = 'I'.
carrid-option = 'EQ'.
carrid-low = 'AA'.
carrid-high = 'LH'.
APPEND carrid TO carrid.
START-OF-SELECTION.
WRITE 'Luggage weight of flights'.
GET spfli FIELDS carrid connid cityfrom cityto.
SKIP.
ULINE.
WRITE: / 'Carrid:', spfli-carrid,
'Connid:', spfli-connid,
/ 'From: ', spfli-cityfrom,
'To: ', spfli-cityto.
ULINE.
GET sflight FIELDS fldate.
SKIP.
WRITE: / 'Date:', sflight-fldate.
GET sbook FIELDS luggweight.
weight = weight + sbook-luggweight.
GET sflight LATE FIELDS carrid .
WRITE: / 'Luggage weight =', weight.
total_weight = total_weight + weight.
weight = 0.
END-OF-SELECTION.
ULINE.
WRITE: / 'Sum of luggage weights =', total_weight.
10-11-2008 8:34 AM
Hi,
Yes you can write like this below. But generally all the data retrieval code is written in Start-of-selection. And End-of-selection we use to write the out put statements. But End-of-selection has its own importance when we use Logical Database.
Check this code once.
tables:
mara.
data:
t_mara like standard table of mara with header line.
data:
w_num type i.
*start-of-selection.*
write: w_num.
*end-of-selection.*
select *
from mara
into table t_mara.
loop at t_mara.
write : t_mara-matnr,t_mara-ernam.
endloop.
Regards,
Rajitha.
10-11-2008 8:44 AM
Hi Rajitha...
"YOUR CODE
tables:
mara.
data:
t_mara like standard table of mara with header line.
data:
w_num type i.
start-of-selection.
write: w_num.
end-of-selection.
select *
from mara
into table t_mara.
loop at t_mara.
write : t_mara-matnr,t_mara-ernam.
endloop.
" I DONT THINK IT IS THE CORRECT GUIDENCE FOR END OF SELECTION.
Hi Murthy,
We can assume END_OF_SELECTION is the closing event for START_OF_SELECTION.
Like LOOP & ENDLOOP <---- loops table
IF & ENDIF. <----- check one perticuler condition
CASE & ENDCASE. <------- excute for different cases.
START_OF_SELECTION -
END_OF_SELECTION <---- block, which carries database selection.
So I can say END_OF_SELECTION is the event where we can close data base selection in our report.
So we can write every WRITE or any statement which is not links with logical databse of SAP under END_OF_SELECTION event.
( I compared END_OF_SELECTION with ENDIF etc.., only for understanding purpose)
Thanks,
Naveen.I
10-11-2008 9:02 AM
Yes you can .bcz END-OF-SELECT indicates the completion of SELECTION block.
10-27-2008 6:35 AM