2009 May 15 12:11 PM
Hi All,
Fetch on LIPS is taking long to run. The below is attached code.
SELECT VBELN " Delivery
INCO1 " Incoterms (part 1)
INCO2 " Incoterms (part 2)
KUNNR " Ship-To Party
KDGRP " Customer group
BTGEW " Total Weight
WADAT_IST " Actual goods movement date
GBSTK " Overall proc. stat of document
INTO TABLE T_LIKP
FROM LIKPUK
WHERE VBELN IN S_VBELN
AND INCO1 IN R_INCO1
AND KUNNR IN S_KUNNR
AND KDGRP IN S_KDGRP
AND WADAT_IST IN S_WADAT
AND WBSTK EQ C_WBSTK_C.
End of insertion DEVK913159
IF SY-SUBRC EQ 0.
Get the document reference numbers for delivery documents
SORT T_LIKP BY VBELN.
SELECT VBELN " Delivery
POSNR " Delivery Item
VGBEL " Document number of the
" reference document
FROM LIPS
INTO TABLE LT_LIPS
FOR ALL ENTRIES IN T_LIKP
WHERE VBELN EQ T_LIKP-VBELN.
Please let me know what is problem in below code.
Moderator message - Moved to the correct forum - by someone else!
Edited by: Rob Burbank on May 15, 2009 9:18 AM
Hi All,
Fetch on LIPS is taking long to run. The below is attached code.
SELECT VBELN " Delivery
INCO1 " Incoterms (part 1)
INCO2 " Incoterms (part 2)
KUNNR " Ship-To Party
KDGRP " Customer group
BTGEW " Total Weight
WADAT_IST " Actual goods movement date
GBSTK " Overall proc. stat of document
INTO TABLE T_LIKP
FROM LIKPUK
WHERE VBELN IN S_VBELN
AND INCO1 IN R_INCO1
AND KUNNR IN S_KUNNR
AND KDGRP IN S_KDGRP
AND WADAT_IST IN S_WADAT
AND WBSTK EQ C_WBSTK_C.
End of insertion DEVK913159
IF SY-SUBRC EQ 0.
Get the document reference numbers for delivery documents
SORT T_LIKP BY VBELN.
SELECT VBELN " Delivery
POSNR " Delivery Item
VGBEL " Document number of the
" reference document
FROM LIPS
INTO TABLE LT_LIPS
FOR ALL ENTRIES IN T_LIKP
WHERE VBELN EQ T_LIKP-VBELN.
Please let me know what is problem in below code.
Moderator message - Moved to the correct forum - by someone else!
Edited by: Rob Burbank on May 15, 2009 9:18 AM
2009 May 15 12:20 PM
hi there.
the code you have written is correct... but what about lt_lips.
have you declared the internal table with type lips..
if yes.please define a strucure with only this three fields you are fetching. and then declare internal table lt_lips with that strucure:
ex: types: begin of line,
3 fields.
end of line,
data: lt_lips type standard table of line.
or use ' corresponding fields of table ' in the select statment.
Since you dont have the delivery line items ,primary key fetching cannot be done succssfuly.
Try to Create index for the particular table and then fetch the data using index keys.
this will reduce the fetchin time of the program.
safel
Edited by: Safel007 on May 15, 2009 4:50 PM
2009 May 15 12:20 PM
Hi,
It should be fast as VBELN is primary key.
I suggest you to check with
SELECT on VBUK
NEXT SELECT on WB2_V_LIKP_LIPS / WB2_V_LIKP_LIPS2 (Views for LIKP and LIPS)
It may give better performance.
Check times with SQL Trace and decide.
Thanks,
Jyothi
2009 May 15 12:22 PM
Hi,
whenever we use FOR ALL ENTRIES we should verify that the table is not initial.
If the query is taking long to run then, probabloy you can try by specifying the PACKAGE SIZE option.
Regards,
Anil
2009 May 15 12:42 PM
The code you have written is absolutely right. Regarding performance problem it could be due to huge number of records in the internal table. try to add the necessary columns only in the internal table.
2009 May 15 12:56 PM
Hi,
Explaining further the point mentioned by Mr. Anil; the table T_LIKP shouldn't be initial. If it is initial then the query will try to pull out all the entries from table LIPS hence taking long time to execute the query.
Hope I am clear.
Regards,
Farheen
2009 May 15 1:01 PM
Hi
Write SORT Statement before IF Loop.
Also write Delete Adjacent Statement after SORT.
Regards.
2009 May 15 2:15 PM
Hi,
Since the first internal table you mentioned would contain large number of records..That will be the main problem when you go for all entries using that table..
You can reduce the load in database server as below..But anyhow the load on application server will increase by following the below steps:
Just loop all the records of the first internal table and populate a range which contains vbeln field..
Now use select from lips where vbeln in range table..
2009 May 15 2:18 PM
@everyone - the check on sy-subrc = 0 effectively checks that the internal table is not initial.
Rob