‎2008 Jan 24 12:59 PM
In my table (not internal table), I have the records
VBELN SHIPNO ATPDOC SELLER
1100000197 0000000471 0000000476 IFX::LEVEL1
1100000197 0000000472 0000000476 IFX::LEVEL1
1100000197 0000000473 0000000476 IFX::LEVEL1
1100000197 0000000474 0000000476 IFX::LEVEL1
1100000197 0000000475 0000000476 OTHER_1000::LEVEL3
I want to fetch the SELLER Value OTHER_1000::LEVEL3 . Also I want to use the VBELN and SHIPNO as the fields in WHERE clause. Means, the last seller value from the set. How can I write the query?
‎2008 Jan 24 1:02 PM
Hi,
Fetch the record based on SHIPNO, because that is the only field value which is not varying.
Regards,
Satish
‎2008 Jan 24 1:05 PM
‎2008 Jan 24 1:02 PM
Hi Santo,
> Select seller
> from table
> where seller ne 'OTHER_1000::LEVEL3'.
Plzz reward if it is useful,
Mahi.
‎2008 Jan 24 1:07 PM
‎2008 Jan 24 1:05 PM
select vbeln shipno atpdoc seller from dbtab into table itab.
if sy-subrc = 0.
sort itab by vbeln shipno descending.
read table itab index 1.
if sy-subrc = 0.
*-- itab-seller = OTHER_1000::LEVEL3
endif.
endif.
first u have to know the criteria for considering a record as last record....!!!! then sort itab accordingly to fetch it.....!!!
‎2008 Jan 24 1:10 PM
I think u tried to understand what is my problem unlike others responded blindly w/o reading query. Thx
‎2008 Jan 24 1:16 PM
Hi Santo,
I think it is not possible to get the last record from the database table. So first pass the values into internal table.
and write like this
DESCRIBE TABLE IT_TAB LINES COUNT.
COUNT = COUNT - 1.
**Then u know the last record.then write read statement
READ TABLE IT_TAB INTO WA_TAB INDEX COUNT.
Hope it may helpful,
regards,
ravi shankar reddy
‎2008 Jan 24 1:07 PM
Hi Santo,
Use describe statment.
data: lv_line type i.
Describe table itab lines lv_line.
read table itab into wa_itab index lv_line.
cheers,
Hema.
‎2008 Jan 24 1:08 PM
‎2008 Jan 24 1:10 PM
select vbeln
max ( shipno )
<other fields>
where vbeln = <condition>.
‎2008 Jan 24 1:14 PM
‎2008 Jan 24 1:15 PM
Hi Santo,
It may be helpful to u...
SELECT SELLER FROM <TABLE NAME> WHERE
VBELN = '1100000197' AND SHIPNO = '0000000475'.
************************************************************reward points if it works****************************
THANKS,
SAYAK
‎2008 Jan 24 1:19 PM
‎2008 Jan 24 1:53 PM
‎2008 Jan 24 1:33 PM