07-18-2006 11:09 AM
Hello,
I want to retrieve the line item # from bseg which has the following pattern,
account type = S
AND
gl account starting from 135***** , 136***** , 137*****
, 138***** , 139*****
hope i am comprehendable. How do i go on writing the query,
Thanks..
Shehryar
07-18-2006 11:13 AM
Hello,
Select * from bseg into itab
where koart = 'S'
and ( hkont like '000135%' or hkont like '000136%' )
Reagrds,
Naimesh
07-18-2006 11:13 AM
Hello,
Select * from bseg into itab
where koart = 'S'
and ( hkont like '000135%' or hkont like '000136%' )
Reagrds,
Naimesh
07-18-2006 11:13 AM
simplest of all would be use ranges statement
populate ina range as low eq 13500000 ( 0 for a * )
and high as 1399999(high is 9 for a *)
use ranges
r_range-low = 13500000
r_range-high = 1399999
r_range-sign = BT
r_range-option = I
Regards,
Harish
07-18-2006 11:16 AM
Hi ,
put like this
ranges : r_hkont for bseg-hkont.
r_hkont-sigh = 'I'.
r_hkont-option = 'BT'
r_hkont-low = '000000000135000'.
r_hkont-high = '000000000139999'.
append r_hkont.
clear r_hkont.
if r_hknot is not initial.
select * from bseg into corresponding fields of ibseg
where bukrs in s_bukrs
and gjahr in s_gjahr
and HKONT in R_hkont.
endif.
Regards
Prabhu
07-18-2006 11:28 AM
Hello and thanks..
Prabhu, ibseg will have the type of bseg ..rite ?
07-18-2006 11:52 AM
07-23-2006 5:47 AM
Hi Dahar ,
just check the internal length of the Hkont then pass.
otherwise post ur code
Regards
Prabhu
07-18-2006 11:16 AM
Hello,
Built a range table like the field u have mentioned.
Then fill the Table like.
s_glacc-sign = 'I'.
s_glacc-option = 'CP'
s_glacc-low = '135*'.
append g_glacc.
s_glacc-sign = 'I'.
s_glacc-option = 'CP'
s_glacc-low = '136*'.
append g_glacc.
so on...
In the query where glacc in s_glacc.
If useful reward points.
Vasanth
07-18-2006 11:26 AM
hi,
you'll get performance problems with your select
-> try to fill some key-fields too:
bukrs, gjahr and perhaps the nr. range to fill the field belnr
- you can preselect your accounts with table glt0: if here are no movements - you can exclude the account from select of bseg
Andreas
07-18-2006 11:38 AM
Hi Shehryar,
This will fetch records with GL A/C starting with <b>13</b> only , if you want 14 and others also write sepearate conditions using <b>LIKE</b> statements.
REPORT zztest.
DATA : itab TYPE STANDARD TABLE OF bseg WITH HEADER LINE.
SELECT * FROM bseg INTO TABLE itab WHERE <b>koart = 'S'
AND
hkont LIKE '13%'</b>.
This will take a lot of DB time for fetching the records, try to include Key Fields(BUKRS and GJAHR .. if possible others).
Regards,
Arun Sambargi.
Regards