2007 Sep 06 7:55 AM
Hi experts ,
Having Doubt in select & endselect Statement
SELECT matnr
kwmeng
werks
lgort
UP TO l_index ROWS
FROM vbap
INTO tp_vbap
WHERE vbeln = com_kbv1-vbeln.
ENDSELECT.
In the above select Query l_index contains 2 Line items.
When i try to execute this Select Query?
It is reading only the First Line item Only..
Its not going to second Line item.
Regs,
Murthy
hi narayana
your select statement should be like this
SELECT matnr
kwmeng
werks
lgort
UP TO l_index ROWS
FROM vbap
INTO table tp_vbap
WHERE vbeln = com_kbv1-vbeln.
ENDSELECT.
tp_vbap should be a table then only it can accomodate all the entries . and into table clause has to be putten on the select statement
Reward if helpfull
Thanks
rohit
2007 Sep 06 7:59 AM
Hi,
dont use the select and endselect as it a loop on the data base
SELECT matnr
kwmeng
werks
lgort
UP TO l_index ROWS
FROM vbap
INTO <b>table</b> tp_vbap
WHERE vbeln = com_kbv1-vbeln.
and your answer.
SELECT matnr
kwmeng
werks
lgort
UP TO l_index ROWS
FROM vbap
INTO tp_vbap
WHERE vbeln = com_kbv1-vbeln.
<b>l_index = l_index + 1.
if l_index > 2.
exit.
endif.</b>
ENDSELECT.
thanks & regards,
Venkatesh
2007 Sep 06 7:59 AM
hi narayana
your select statement should be like this
SELECT matnr
kwmeng
werks
lgort
UP TO l_index ROWS
FROM vbap
INTO table tp_vbap
WHERE vbeln = com_kbv1-vbeln.
ENDSELECT.
tp_vbap should be a table then only it can accomodate all the entries . and into table clause has to be putten on the select statement
Reward if helpfull
Thanks
rohit
2007 Sep 06 8:01 AM
sory correction in my previous reply plz remove the endselect statement
2007 Sep 06 8:01 AM
I hope tp_vbap is an internal table,
SELECT matnr
kwmeng
werks
lgort
UP TO l_index ROWS
FROM vbap
INTO tp_vbap
WHERE vbeln = com_kbv1-vbeln.
<b></b> APPEND tp_vbap.<b></b>
<b></b> CLEAR tp_vbap.<b></b>
ENDSELECT.
regards,
Prabhu
reward if it is helpful
2007 Sep 06 8:03 AM
Hi..
here what is the Value of l_index (If it is 1 then it will read only one row)
So check the value of l_index...
Then try like this to see the No of rows using SY-DBCNT.
SELECT matnr
kwmeng
werks
lgort
UP TO l_index ROWS
FROM vbap
INTO tp_vbap
WHERE vbeln = com_kbv1-vbeln.
write:/ SY-DBCNT, TP_VBAP-MATNR.
ENDSELECT.
REWARD IF HELPFUL.
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |