2007 Apr 05 10:33 AM
Hi,
I am populating this internal table t_bkpf for all entries in gt_covp_ext
select bukrs belnr gjahr
bldat budat cpudt
xblnr waers awtyp awkey
from bkpf
into corresponding fields of table t_bkpf
for all entries in gt_covp_ext
where bukrs eq gt_covp_ext-bukrs and
awtyp eq 'MKPF'.
Here i have to add one more condition in where clause
AWKEY = ( Concatenated string of gt_covp_ext-REFBN + gt_covp_ext-REFGJ )
As i am not using loop at gt_covp_ext.How to implement this condition in Where clause.
Please help.If you did not understood the requirement reply this post.
Mukesh Kumar
Message was edited by:
mukesh kumar
2007 Apr 05 10:37 AM
Hi Mukesh,
YOu have to have anothe fild to hold the concatenation of the fields REFBN and REFGJ , say AWKEY
loop at gt_covp_ext.
concatenate gt_covp_ext-refbn gt_covp_ext-refgj into gt_covp_ext-awkey.
modify gt_covp_ext index sy-tabix.
endloop.
select bukrs belnr gjahr
bldat budat cpudt
xblnr waers awtyp awkey
from bkpf
into corresponding fields of table t_bkpf
for all entries in gt_covp_ext
where bukrs eq gt_covp_ext-bukrs and
awtyp eq 'MKPF' and
<b>awkey = gt_covp_ext-awkey.</b>
Regards,
Ravi
2007 Apr 05 10:37 AM
Hi Mukesh,
YOu have to have anothe fild to hold the concatenation of the fields REFBN and REFGJ , say AWKEY
loop at gt_covp_ext.
concatenate gt_covp_ext-refbn gt_covp_ext-refgj into gt_covp_ext-awkey.
modify gt_covp_ext index sy-tabix.
endloop.
select bukrs belnr gjahr
bldat budat cpudt
xblnr waers awtyp awkey
from bkpf
into corresponding fields of table t_bkpf
for all entries in gt_covp_ext
where bukrs eq gt_covp_ext-bukrs and
awtyp eq 'MKPF' and
<b>awkey = gt_covp_ext-awkey.</b>
Regards,
Ravi
2007 Apr 05 10:37 AM
maintain one more field in that internal table like AWKEY
get the data
then
loop at itab.
concatenate itab1 itab1 into itab-awkey.
modify itab.
endloop.
second select.
Regards
prabhu
2007 Apr 05 10:38 AM
Ad one more add one more field to table gt_covp_ext
data : begin of gt_covp_ext occurs 0,
....
AWKEY(25),
end of gt_covp_ext.
loop at gt_covp_ext into wa_gt_covp_ext.
concatenate gt_covp_ext-REFBN gt_covp_ext-REFGJ into wa_gt_covp_ext-AWKEY.
modify gt_covp_ext from wa_gt_covp_ext.
endloop.
if not gt_covp_ext[] is initial.
select bukrs belnr gjahr
bldat budat cpudt
xblnr waers awtyp awkey
from bkpf
into corresponding fields of table t_bkpf
for all entries in gt_covp_ext
where bukrs eq gt_covp_ext-bukrs and
<b> AWKEY = gt_covp_ext-AWKEY</b>
awtyp eq 'MKPF' .
endif.
2007 Apr 05 10:39 AM
Hi
U have to do that before doing the query on BKPF, so add the field AWKEY in gt_covp_ext.
LOOP AT gt_covp_ext.
CONCATENATE gt_covp_ext-REFBN gt_covp_ext-REFGJ INTO gt_covp_ext-AWKEY.
MODIFY gt_covp_ext.
ENDLOOP.
select bukrs belnr gjahr bldat budat cpudt xblnr waers awtyp awkey
from bkpf into corresponding fields of table t_bkpf
for all entries in gt_covp_ext
where awtyp eq 'MKPF'
AND AWKEY EQ gt_covp_ext-AWKEY.
<b>U don't need to use BUKRS in where condition, because there's an index using AWTYP and AWKEY only.</b>
Max
2007 Apr 05 10:41 AM
Hi,
Create a new internal table gt_covp_ext_new with the same structure as gt_covp_ext. Include an extra field in gt_covp_ext_new-concat, to store the concatenated value.
Copy all entries from gt_covp_ext to gt_covp_ext_new.
Loop at gt_covp_ext.
move-corresponding gt_covp_ext to gt_covp_ext_new.
gt_covp_ext_new-concat = gt_covp_ext-REFBN + gt_covp_ext-REFGJ .
append gt_covp_ext_new.
endloop.
Now use this new internal table in the query.
select bukrs belnr gjahr
bldat budat cpudt
xblnr waers awtyp awkey
from bkpf
into corresponding fields of table t_bkpf
for all entries in gt_covp_ext_new
where bukrs eq gt_covp_ext_new-bukrs and
awkey eq gt_covp_ext_new-concat and
awtyp eq 'MKPF'.
Hope this answers your qn.
Regards,
Divya
2007 Apr 05 10:41 AM
hi
good
as far as i got the knowledge from your post ,you want to add the next condition with your first select statement.
I dont think there is any statement in sap like "Concatenated string of " as you have mentione din your second statement,so try to use the CONCATENATE statement outside the select query and than try to use that particular value in your existing select statement.
thanks
mrutyun^