‎2008 Mar 26 7:29 AM
hi abaper's
i am having the problem in this query
SELECT ZUONR BELNR BUZEI LIFNR KUNNR GSBER PRCTR KOSTL SGTXT SHKZG DMBTR BUKRS GJAHR HKONT
FROM BSEG INTO CORRESPONDING FIELDS OF TABLE IT_BSEG1
FOR ALL ENTRIES IN IT_BKPF1
WHERE GJAHR IN FYEAR AND
BELNR = IT_BKPF1-BELNR AND BUKRS = IT_BKPF1-BUKRS.
please give me best way to write this select query.
this query is giving me dump error.
thnks
pardeep
‎2008 Mar 26 9:43 AM
data: begin of it_bseg1 occurs 0,
ZUONR type ZUONR
BELNR type BELNR
BUZEI...
LIFNR ...
KUNNR ..
GSBER..
PRCTR ..
KOSTL
SGTXT
SHKZG
DMBTR
BUKRS
GJAHR
HKONT
end of it_bseg1.
data: itab_bkpf like standard table of it_bkpf1.
if it_bkpf1[] is not initial.
itab_bkpf[] = it_bkpf1[].
delete adjecent duplicates from itab_bkpf comparing belnr bukrs.
sort itab_bjkf by belnr bukrs.
SELECT ZUONR BELNR BUZEI LIFNR KUNNR GSBER PRCTR KOSTL SGTXT SHKZG DMBTR BUKRS GJAHR HKONT
FROM BSEG INTO TABLE IT_BSEG1
FOR ALL ENTRIES IN IT_BKPF1
WHERE GJAHR IN FYEAR AND
BELNR = IT_BKPF1-BELNR AND BUKRS = IT_BKPF1-BUKRS.
endif.
please define your internal table in same sequence as their field in query.
reward if helpful...
and please be specify what error you r getting..in dump..
‎2008 Mar 26 7:36 AM
Hi
Remove INTO Corresponding Fields and also sequence of the fields shoudl be same in ITAB with table position
IF IT_BSEG1 is having duplicate entries then move the same into IT_BSEG2
IT_BSEG2 delete duplicate entreis from it
USE index for the same
Regards
Shiva
‎2008 Mar 26 9:43 AM
data: begin of it_bseg1 occurs 0,
ZUONR type ZUONR
BELNR type BELNR
BUZEI...
LIFNR ...
KUNNR ..
GSBER..
PRCTR ..
KOSTL
SGTXT
SHKZG
DMBTR
BUKRS
GJAHR
HKONT
end of it_bseg1.
data: itab_bkpf like standard table of it_bkpf1.
if it_bkpf1[] is not initial.
itab_bkpf[] = it_bkpf1[].
delete adjecent duplicates from itab_bkpf comparing belnr bukrs.
sort itab_bjkf by belnr bukrs.
SELECT ZUONR BELNR BUZEI LIFNR KUNNR GSBER PRCTR KOSTL SGTXT SHKZG DMBTR BUKRS GJAHR HKONT
FROM BSEG INTO TABLE IT_BSEG1
FOR ALL ENTRIES IN IT_BKPF1
WHERE GJAHR IN FYEAR AND
BELNR = IT_BKPF1-BELNR AND BUKRS = IT_BKPF1-BUKRS.
endif.
please define your internal table in same sequence as their field in query.
reward if helpful...
and please be specify what error you r getting..in dump..
‎2008 Mar 26 1:27 PM
Hi,
Sort the it_bseg1 table before using for all entries.
Check it_bseg1 table is not initial.
avoid into corresponding.
check the sequence of fields.
Thanks,
Srikanth.A
‎2008 Mar 26 2:16 PM
Hi,
What type of dump you are getting ? Is it memory dump or time out dump ??
First thing is BKPF-BSEG tables should be be heat unless there is absolute necessity of doing that. Discuss with your functional consultant and try to use other tables like BSIS, BSID etc etc
If not try the suggestions given by others like sort the driver table before select etc etc
If you are getting memory dump, you might have to mention the fetch size and restrict the size of the internal table processed - this might take some more time but won't give memory dump.
‎2008 Mar 27 10:42 AM