‎2010 Oct 08 10:34 AM
Hi,
I have an existing code that says
select bukrs belnr gjahr buzei augdt shkzg dmbtr kokrs kostl aufnr
hkont werks prctr projk fkber
from bseg
into table t_bseg
for all entries in t_jrnl_chg_ptr
where bukrs = t_jrnl_chg_ptr-bukrs
and belnr = t_jrnl_chg_ptr-belnr
and gjahr = t_jrnl_chg_ptr-gjahr
and buzei = t_jrnl_chg_ptr-buzei
and vorgn <> c_recur_doc.
In this, sometimes FKBER might be empty, in that case the functional consultant asked me to take fkber_long whenver fkber is empty.
Since it is BSEG table, I need some tips on performance based how to further check and achieve fkber_long instead of FKBER.
‎2010 Oct 08 10:37 AM
You extract both fields then run a condition check on the blank field.
‎2010 Oct 08 10:37 AM
You extract both fields then run a condition check on the blank field.
‎2010 Oct 08 10:38 AM
Hi,
Select the other field also into the internal table. In the further process, if the other field FKBER is initial, you can use this field FKBER_LONG. This will not affect performance.
Sujay
‎2010 Oct 08 10:44 AM
add the other fiels also in the query. After that use the fkber_long if the fkber is empty in the read statement of t_bseg.
ex:
select bukrs belnr gjahr buzei augdt shkzg dmbtr kokrs kostl aufnr
hkont werks prctr projk fkber, fkber_long
from bseg
into table t_bseg
for all entries in t_jrnl_chg_ptr
where bukrs = t_jrnl_chg_ptr-bukrs
and belnr = t_jrnl_chg_ptr-belnr
and gjahr = t_jrnl_chg_ptr-gjahr
and buzei = t_jrnl_chg_ptr-buzei
and vorgn c_recur_doc.
read t_bseg with key......
If sy-subrc =0.
If t_bseg-fkber is initital.
process....ft_bseg=fkber_long
endif
indif.
‎2010 Oct 08 10:46 AM
Hi,
Fetch FKBER in the same query as below,
select bukrs belnr gjahr buzei augdt shkzg dmbtr kokrs kostl aufnr
hkont werks prctr projk fkber fkber_long
from bseg
into table t_bseg
for all entries in t_jrnl_chg_ptr
where bukrs = t_jrnl_chg_ptr-bukrs
and belnr = t_jrnl_chg_ptr-belnr
and gjahr = t_jrnl_chg_ptr-gjahr
and buzei = t_jrnl_chg_ptr-buzei
and vorgn c_recur_doc.
Any ways this selection will have same performance as your previous query.After your selection you can delete entries by loop at t_bseg into wa_bseg.
if wa_bseg-fkber is not initial or wa_bseg-fkber_long is not initial.
write your logic here
endif.
endloop.
or if you are only concern with t_bseg having either fkber and fkber_long value then you can make use of DELETE statement.
Delete t_bseg where (fkber is initial or fkber_long is intial').
Try above two logics,this may solve your problem.
Thanks and Regards,
Manjunathm
‎2010 Oct 08 11:17 AM
Hi,
select the fkber_long also with your select statement as below
select bukrs belnr gjahr buzei augdt shkzg dmbtr kokrs kostl aufnr
hkont werks prctr projk fkber fkber_long
from bseg
into table t_bseg
for all entries in t_jrnl_chg_ptr
where bukrs = t_jrnl_chg_ptr-bukrs
and belnr = t_jrnl_chg_ptr-belnr
and gjahr = t_jrnl_chg_ptr-gjahr
and buzei = t_jrnl_chg_ptr-buzei
and vorgn c_recur_doc.
declare one more internal table with the same structure ( only one field among fkber and fkber_long ).
then move your t_bseg data to the second internal table say t_bseg1.
here you check if fkber is initial then move fkber_long to t_bseg1 else move fkber only.
hope this will solve your issue.
thanks,
sudheer
‎2010 Oct 08 12:17 PM
Hi Kris,
U have an existing code that says
select bukrs belnr gjahr buzei augdt shkzg dmbtr kokrs kostl aufnr
hkont werks prctr projk fkber
from bseg
into table t_bseg
for all entries in t_jrnl_chg_ptr
where bukrs = t_jrnl_chg_ptr-bukrs
and belnr = t_jrnl_chg_ptr-belnr
and gjahr = t_jrnl_chg_ptr-gjahr
and buzei = t_jrnl_chg_ptr-buzei
and vorgn c_recur_doc.
in the internal table decleration declare FKBER as type FKBER_LONG as it is of 16 charecters.
now write the following select queries:
select bukrs belnr gjahr buzei augdt shkzg dmbtr kokrs kostl aufnr
hkont werks prctr projk fkber
from bseg
into table t_bseg
for all entries in t_jrnl_chg_ptr
where bukrs = t_jrnl_chg_ptr-bukrs
and belnr = t_jrnl_chg_ptr-belnr
and gjahr = t_jrnl_chg_ptr-gjahr
and buzei = t_jrnl_chg_ptr-buzei
and vorgn c_recur_doc
and fkber ne space.
select bukrs belnr gjahr buzei augdt shkzg dmbtr kokrs kostl aufnr
hkont werks prctr projk fkber
from bseg
appending table t_bseg
for all entries in t_jrnl_chg_ptr
where bukrs = t_jrnl_chg_ptr-bukrs
and belnr = t_jrnl_chg_ptr-belnr
and gjahr = t_jrnl_chg_ptr-gjahr
and buzei = t_jrnl_chg_ptr-buzei
and vorgn c_recur_doc
and fkber eq space
and fkber_long ne space.
The above coding might solve u'r problem.
Regards,
Thabitha.
‎2010 Oct 08 2:27 PM
Hi Krish,
I dont think tht you will have any problem if you add FKBER_LONG in your current query if you are worring about performance. Further while processing your internal table use condition to check the fields. Dont create 1 more internal table unnessessarily.
Thanks,
Anmol.