on 03-24-2009 1:25 PM
Hi All,
I have a requirment in select statement as below.
SELECT anln1
anln2
typbz
FROM anla
INTO TABLE it_anla
FOR ALL ENTRIES IN it_asset
WHERE typbz = it_asset-purch. "Contains pattern
IF sy-subrc EQ 0.
SORT it_anla BY typbz anln1 anln2.
ENDIF.
i need to select the ANLA table entries which contains the pattern IT_ASSET-purch which is not constant. like it_asset-purch* .
but its giving error if i write like this.
can any one suggest me good way of doing this.
Thanks.
Hi - Best way is using a range table :
"Define Range table and Work area
data: i_rng TYPE RANGE OF typbz INITIAL SIZE 0, "table
data: wa_wng LIKE LINE OF i_rng " Work area
wa_rng-sign = 'E'.
wa_rng-option = 'CP'
wa_rmg-low = " Put concatenated value
" Now use this range table for you selection, as you use select-option, when selecting.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this way..
SELECT anln1
anln2
typbz
FROM anla
INTO wa. <--- 'wa' workarea for table 'it_anla'
LOOP AT it_asset WHERE purch = wa-typbz.
IF sy-subrc EQ 0.
SORT it_anla BY typbz anln1 anln2.
ENDIF.
ENDLOOP.
ENDSELECT.
Edited by: Sap Fan on Mar 24, 2009 2:39 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you might have to create a range table.. and populate it and use that range in the select...
loop at it_asset into wa_asset.
ra-sign = 'E'.
ra-option = 'CP'
concatenate '*' it_asset-purch '*' into ra-low.
append it_asset from wa_asset.
clear: wa_asset.
endloop.
select,,,,,
.. where t&*( in ra. "ra is the range table.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
move the values from it_asset-purch table to a range and then use CP in the options.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
102 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.