‎2007 Sep 12 11:20 AM
Hi Experts ,
IM Having doubt in Select & Endselect Query .abt this Code .
SELECT matnr kwmeng werks lgort
UP TO l_index ROWS """"l_index contains 2 rows
FROM vbap
INTO tp_vbap
WHERE vbeln = com_kbv1-vbeln.
ENDSELECT.
When i try 2 execute this Query , it has to read 2 times as L_index = 2.
But it is Reading for only one time.
Here we have 2 use only Select & Endselect Not Internal table.
after reading this 2 entries , it wil go for further Processing .
Please provide me a proper solutions for this ?
Thanq Very Much !!
Regs,
Murthy.
‎2007 Sep 12 11:23 AM
why the heck do you have to use select endselect?
cant you just make an array fetchj in an internal table and then loop over this one?
Besides i cant imagine that a select endselect statement cooperates with the up to 2 rows statement.
Message was edited by:
Florian Kemmer
‎2007 Sep 12 11:24 AM
‎2007 Sep 12 11:27 AM
Hi Narayana..
Just change the Code using Array fetch like this.. it will work..
Note: ENDSELECT not needed here
SELECT matnr kwmeng werks lgort
UP TO l_index ROWS
FROM vbap
<b>INTO TABLE tp_vbap</b>
WHERE vbeln = com_kbv1-vbeln.
<i>reward if Helpful.</i>
‎2007 Sep 12 11:33 AM
Hi NArayana,
u might be declared ur internal<b> table with header line</b>...
so remove that header line or use <b>INTO table tp_vbap</b>.
‎2007 Sep 12 11:39 AM
select matnr kwmeng werks lgort
from vbap
into tp_vbap
where vbeln = com_kbv1-vbeln.
if sy-tabix = 2.
exit.
endif.
append tp_vbap.
endselect.
Regards
Vasu
‎2007 Sep 12 12:52 PM
Hi narayana,
You can get 2rows or 3 rows according to ur requirement .
But u have to keep APPEND there in between select and endselect statement.
Plz make a look in foolowing code............
REPORT ZTESS.
tables: kna1.
select-options: s_kunnr for kna1-kunnr.
types: begin of Ty_kna1,
kunnr type kna1-kunnr,
name1 type kna1-kunnr,
ort01 type kna1-ort01,
end of ty_kna1,
tt_kna1 type standard table of ty_kna1.
Data: wa type ty_kna1,
IT_kna1 type tt_kna1.
select kunnr name1 ort01 up to 10 rows from kna1 into wa
where kunnr in s_kunnr.
append wa to it_kna1.
endselect.
loop at it_kna1 into wa.
write:/ wa-kunnr,wa-name1,wa-ort01.
endloop.
Reward points if it useful to u.....
‎2007 Sep 12 1:16 PM
Hi,
Better to use the following code instead of select-endselect....
SELECT matnr kwmeng werks lgort
UP TO l_index ROWS
FROM vbap
INTO TABLE tp_vbap
WHERE vbeln = com_kbv1-vbeln
and perform wise also is not good, if u check in debugg mode it will go short dump...
<b>if it is use answer reward me a points....</b>
praveen