07-17-2007 8:24 AM
hi there,
suggest me here.
select * from j_1iexchdr into ij_1iexchdr
where trntyp = trntyp
and docyr = docyr
where exnum = exnum
and exnum in exnum
and werks = werks
and srgrp = srgrp.
select * from j_1iexcdtl where trntyp = ij_1iexchdr-trntyp
and docyr = ij_1iexchdr-docyr
and docno = ij_1iexchdr-docno
and exnum = ij_1iexchdr-exnum
and werks = ij_1iexchdr-werks.
if ij_1iexchdr-lifnr ne space.
SELECT SINGLE * FROM lfa1 WHERE lifnr = ij_1iexchdr-lifnr.
select single name1 stras ort01 ort02 pstlz into
(ij_1iexchdr-name1, ij_1iexchdr-stras, ij_1iexchdr-ort01,
ij_1iexchdr-ort02, ij_1iexchdr-pstlz)
from lfa1 where lifnr = ij_1iexchdr-lifnr.
SELECT SINGLE * FROM j_1imovend WHERE lifnr = ij_1iexchdr-lifnr.
select single j_1icstno j_1ilstno into (ij_1iexchdr-j_1icstno,
ij_1iexchdr-j_1ilstno )
from j_1imovend where lifnr = ij_1iexchdr-lifnr.
move: j_1iexcdtl-zeile to ij_1iexchdr-zeile,
j_1iexcdtl-matnr to ij_1iexchdr-matnr,
j_1iexcdtl-maktx to ij_1iexchdr-maktx,
j_1iexcdtl-chapid to ij_1iexchdr-chapid,
j_1iexcdtl-bedrate to ij_1iexchdr-bedrat,
j_1iexcdtl-exbed to ij_1iexchdr-exbedl,
j_1iexcdtl-exbas to ij_1iexchdr-exbas,
j_1iexcdtl-menge to ij_1iexchdr-menge,
J_1IEXCDTL-BEDRATE TO ij_1iexchdr-BEDRATE.
append ij_1iexchdr.
endif.
if ij_1iexchdr-kunag ne space.
SELECT SINGLE * FROM kna1 WHERE kunnr = ij_1iexchdr-kunag.
select single name1 stras ort01 ort02 pstlz into
(ij_1iexchdr-name1, ij_1iexchdr-stras, ij_1iexchdr-ort01,
ij_1iexchdr-ort02, ij_1iexchdr-pstlz)
from kna1 where kunnr = ij_1iexchdr-kunag.
SELECT SINGLE * FROM j_1imocust WHERE kunnr = ij_1iexchdr-kunag.
select single j_1icstno j_1ilstno into
(ij_1iexchdr-j_1icstno, ij_1iexchdr-j_1ilstno )
from j_1imocust where kunnr = ij_1iexchdr-kunag.
move: j_1iexcdtl-zeile to ij_1iexchdr-zeile,
j_1iexcdtl-matnr to ij_1iexchdr-matnr,
j_1iexcdtl-maktx to ij_1iexchdr-maktx,
j_1iexcdtl-chapid to ij_1iexchdr-chapid,
j_1iexcdtl-bedrate to ij_1iexchdr-bedrat,
j_1iexcdtl-exbed to ij_1iexchdr-exbedl,
j_1iexcdtl-exbas to ij_1iexchdr-exbas,
j_1iexcdtl-menge to ij_1iexchdr-menge.
append ij_1iexchdr.
endif.
endselect.
endselect.
07-17-2007 10:02 AM
Please try using Select * for all entries ...instead of using nested select statment...as this causes so much performance issues..
Please refer this
http://www.sap-img.com/abap/usage-of-for-all-entries-in-select-statement.htm
http://www.sapbrainsonline.com/ARTICLES/TECHNICAL/optimization/optimization.html#For%20all%20entries
Regards,
Reema
Message was edited by:
Reema Elsy Easow
Message was edited by:
Reema Elsy Easow
07-17-2007 10:45 AM
Dear Tuborg,
Performance wise this program will get low mark!
I am giving some suggessions.
1. Avoid select * if you are not using all fields
Just try the below mentioned code .I had rewrite your code.
SELECT * FROM j_1iexchdr INTO table it_j_1iexchdr
WHERE trntyp = trntyp
AND docyr = docyr
AND exnum IN exnum
AND werks = werks
AND srgrp = srgrp.
if it_j_1iexchdr is not initial.
SELECT * FROM j_1iexcdtl into table it_j_1iexcdtl
FOR ALL ENTRIES IN it_j_1iexchdr
WHERE trntyp = it_j_1iexchdr-trntyp
AND docyr = it_j_1iexchdr-docyr
AND docno = it_j_1iexchdr-docno
AND exnum = it_j_1iexchdr-exnum
AND werks = it_j_1iexchdr-werks.
SELECT name1 stras ort01 ort02 pstlz FROM lfa1 INTO TABLE it_lfa1
for all entries IN it_j_1iexchdr
WHERE lifnr = it_j_1iexchdr-lifnr.
SELECT j_1icstno j_1ilstno FROM j_1imovend into TABLE it_j_1imovend
for all entries IN it_j_1iexchdr
WHERE lifnr = ij_1iexchdr-lifnr.
SELECT name1 stras ort01 ort02 pstlz FROM lfa1 INTO TABLE it_kna1
for all entries IN it_j_1iexchdr
WHERE kunnr = it_j_1iexchdr-kunag .
SELECT j_1icstno j_1ilstno FROM j_1imocust into TABLE it_j_1imocust
for all entries IN it_j_1iexchdr
WHERE kunnr = it_j_1iexchdr-kunag .
endif.
now you have all the rquired data in your internal tables,
loop over internal tables as per your requirement,
read data from diffrent internal tables, then assign this valuse into some work area say final work area, then appen it to final internal table.
regards
Antony Thomas
REward if find usefull!
07-17-2007 11:40 AM
07-17-2007 1:40 PM
hi
i think i shud MODIFY the final intab....not APPEND right?
coz all my data is there already in final intab.
plz respond fast..it's urgent.