‎2010 Apr 20 2:07 AM
Hello Experts,
I am currently working on something, and I need anyone's help. Here is what I am trying to do:
I am currently looking inside of table BCONT and retrieving all records that have CCLASS = 0015 and ACTIVITY = 0002.
My statement looks like this:
select partner cclass activity ernam
into table lit_bcont
from bcont
for all entries in tl_fkk_instpln_head
where cclass = '0015' and activity = '0002' and
bcont~partner = tl_fkk_instpln_head-gpart. So far so good, now the problem is, that inside of TL_FKK_INSTPLN_HEAD, there is a field called RPNUM. This field does not exists in BCONT, but I really need it inside of LIT_BCONT for future operations.
Can anyone give me a tip or anything, that I can do to resolve this issue. I'm trying not to do any table linkages, but if that's the only way, then so be it.
Thanks.
Edited by: Rob Burbank on Apr 20, 2010 9:21 AM
‎2010 Apr 20 6:05 AM
Hello,
You could just loop at tl_fkk_instpln_head and move the required field to the internal table lit_bcont based on the partener.
loop at lit_bcont .
read table tl_fkk_instpln_head with key gpart = lit_bcont-parnter.
if sy-subrc = 0.
lit_bcont-rpnum = tl_fkk_instpln_head -rpnum.
modify lit_bcont index sy-tabix.
endif.
endloop.
Vikranth
‎2010 Apr 20 3:07 AM
Hi jotorres1,
Firstly please use meaningful Subject in order to get response soon.
1. You never given from which tables you are fetching data into TL_FKK_INSTPLN_HEAD.
2. If You are selecting from one table use inner join for both tables and select one shot.
Please give the declartions of TL_FKK_INSTPLN_HEAD and select query.
Regards,
Suneel Kumar G
‎2010 Apr 20 6:05 AM
Hello,
You could just loop at tl_fkk_instpln_head and move the required field to the internal table lit_bcont based on the partener.
loop at lit_bcont .
read table tl_fkk_instpln_head with key gpart = lit_bcont-parnter.
if sy-subrc = 0.
lit_bcont-rpnum = tl_fkk_instpln_head -rpnum.
modify lit_bcont index sy-tabix.
endif.
endloop.
Vikranth
‎2010 Apr 20 11:39 AM
Hi....
You need to create two workareas :
wa_tl_fkk_instpln_head of type tl_fkk_instpln_head
and wa_lit_bcont of type lit_bcont.
Please make sure that rpnum is there in the structure of table lit_bcont.
clear : wa_tl_fkk_instpln_head , wa_lit_bcont.
loop at tl_fkk_instpln_head into wa_tl_fkk_instpln_head .
read table lit_bcont into wa_lit_bcont with key partner = wa_tl_fkk_instpln_head-gpart binary search.
if sy-subrc = 0.
wa_lit_bcont-rpnum = wa_tl_fkk_instpln_head -rpnum.
modify lit_bcont from wa_lit_bcont transporting rpnum where rpnum = wa_tl_fkk_instpln_head-rpnum.
endif.
clear : wa_tl_fkk_instpln_head , wa_lit_bcont.
endloop.
Hope this solves your problem....
Please revert back in case of any issues....
‎2010 Apr 20 12:22 PM
I assume you have declared lit_bcont like:
lit_bcont type tabel of bcont.Redifne that internal table with your own type where you include the required field.
(syntax not 100% correct, but you should get the idea)
TYPES: BEGIN OF ty_bcont,
your_field.
INCLUDE STRUCTURE BCONT.
END OF ty_bcont.And when you select the data into your lit_bcont:
... INTO CORRESPONDING FIELDS OF TABLE lit_bcontAfter that, loop at both tables using their relationshiop and move that field value to lit_bcont.
Edited by: Maen Anachronos on Apr 20, 2010 1:32 PM
‎2010 Apr 20 12:48 PM
Hi,
Create a Internal table with partner cclass activity ernam and RPNUM fields
Regards,
Naresh.
‎2010 Apr 20 2:24 PM
Hi,
select partner cclass activity ernam
into table lit_bcont
from bcont
for all entries in tl_fkk_instpln_head
where cclass = '0015' and activity = '0002' and partner = tl_fkk_instpln_head-gpart.
Can u check this .Its wotking for u ?
If this stmt taking time reply for this.
With Regards,
Sumodh.P
‎2010 Apr 20 3:17 PM
Hi,
Just my thoughts.
Why don't you use an inner join as below.
select b~partner b~cclass b~activity b~ernam t~RPNUM
into table lit_bcont
from tl_fkk_instpln_head as t
left inner join bcont as b
on bcont~partner = p~gpart
where b~cclass = '0015' and b~activity = '0002'.I am not sure but, i think that efficiency could increase in this case.
Others - Please help me out on the efiiciency part.
Cheers,
Mz
Edited by: mazin mahmood on Apr 20, 2010 7:48 PM