2007 Jul 20 12:14 AM
I am developing a cost center. where i am extracting cost center and object number from
CSKS table.
Using the Object I am extracting Cost element...
loop at itab.
l_tabix = sy-tabix.
select single kstar ebeln from covp
into (covp-kstar , covp-ebeln)
where kokrs = p_kokrs
and objnr = gt_cc-objnr
and gjahr = p_fyear
and perio in s_period.
if sy-subrc = 0.
itab-kstar = covp-kstar.
itab-ebeln = covp-ebeln.
modify itab index sy-tabix.
endif.
endloop.
The problem is a object number can have any number of cost elements associated with it....
this part however is retreiving only 1 cost element...
Please let me know how to fix this problem...
2007 Jul 20 12:23 AM
you have a select single... that will return only one entry..
i am sorry if i have understood incorrectly... but thats how i have interpreted ur issue.
2007 Jul 20 12:28 AM
my internal table already has the cost center and object number
I cannot use select for all entries due to performance issue
so i used a select single..
Let me know how to fix this one
2007 Jul 20 12:44 AM
No other way,you need to use for all entries option,since select single will get one record at time.
Thanks
Seshu
2007 Jul 20 2:20 AM
2007 Jul 20 3:47 AM
Hi,
as you have multiple entries .. here is the code..
take one two more tables one jtab like itab and another table say ktab with two fields kstar and ebeln..
loop at itab.
l_tabix = sy-tabix.
select kstar ebeln from covp
into table ktab
where kokrs = p_kokrs
and objnr = gt_cc-objnr
and gjahr = p_fyear
and perio in s_period.
if sy-subrc = 0.
loop at ktab.
jtab = itab.
jtab-kstar = ktab-kstar.
jtab-ebeln = ktab-ebeln.
append jtab.
endloop.
endif.
endloop.
Thanks,
Mahesh