Skip to Content
0
Former Member
Dec 10, 2008 at 06:30 PM

select statement using BSEG table

883 Views

Hello SAPinas,

I am using the following lines of code in one of my program. Becuase of that code I am getting Performance issue.

Note : BSEG is Cluster Table.

Could you please help me how I will use in another way

loop at t_hdr.

select buzei buzid koart shkzg mwskz dmbtr hwbas sgtxt vbund kostl

aufnr anln1 anln2 hkont kunnr lifnr matnr werks ebeln ebelp

zekkn rewrt prctr txjcd projk

into (t_item-buzei, t_item-buzid, t_item-koart, t_item-shkzg,

t_item-mwskz, t_item-dmbtr, t_item-hwbas, t_item-sgtxt,

t_item-vbund, t_item-kostl, t_item-aufnr, t_item-anln1,

t_item-anln2, t_item-hkont, t_item-kunnr, t_item-lifnr,

t_item-matnr, t_item-werks, t_item-ebeln, t_item-ebelp,

t_item-zekkn, t_item-rewrt, t_item-prctr, t_item-txjcd,

t_item-projk)

from bseg

where bukrs = t_hdr-bukrs

and belnr = t_hdr-belnr

and gjahr = t_hdr-gjahr

and hkont in s_hkont

and mwskz in s_mwskz

and kostl in s_kostl

and prctr in s_prctr

and werks in s_werks.

  • Skip record if not in selection screen range for state

check t_item-txjcd(2) in s_state.

if t_item-shkzg = c_debit. "S

endif.

if t_item-shkzg = c_credit. "H

t_item-dmbtr = t_item-dmbtr * ( -1 ).

t_item-rewrt = t_item-rewrt * ( -1 ).

t_item-hwbas = t_item-hwbas * ( -1 ).

endif.

**&MWB 04/08/2005 ... add additional US Bayer Tax dept requested fields

clear: t_item-basetax, t_item-accrtax, t_item-vendtax,

t_item-taxrate, t_item-invbase, t_item-invtax.

**&MWB ... end insert 04/08/2005

clear t_item-hwbas.

*

move-corresponding t_hdr to t_item.

append t_item.

clear t_item.

endselect.

endloop.

Thank you very much Advance.............:-)