2012 Oct 30 11:58 PM
Hi Experts,
We are receiving following error when SAP Bw process chain executes.
SAPSQL_STMT_TOO_LARGE , Error occurs in following SQL statement and need your expert opinion on how to optmize the code.
CRM related objects are being used in the code.
Code:
SELECT crm_ohguid crm_itmgui kschl SUM( /bic/pr_kbetr )
FROM /bic/alq00_o0600 INTO TABLE lt_price
WHERE crm_ohguid IN lr_record
AND ( kschl = 'ZD01'
OR kschl = 'ZD10'
OR kschl = 'ZRME'
OR kschl = 'ZT03' )
AND /bic/pr_kinak = space
GROUP BY crm_ohguid crm_itmgui kschl
ORDER BY crm_ohguid crm_itmgui kschl.
Error Generated from the below code.
>>>>> SELECT crm_ohguid crm_itmgui kschl SUM( /bic/pr_kbetr )
FROM /bic/alq00_o0600 INTO TABLE lt_price
WHERE crm_ohguid IN lr_record <====
Here is the size information for variable lr_record:
LR_RECORD
Table IT_1201[167714x134]
Thank you.
Regards,
Las
2012 Oct 31 7:54 AM
The range is much to big, the OPEN SQL create a much too large SQL statement that the database is not able to interpret. Try to reduce the number of values, break the statement in batch of some hundred of records, or convert to a FOR ALL ENTRIES option. If the range table comes from another SELECT, you could also try to convert both SELECT into a single SELECT using JOIN or subquery.
You could also read some notes like Note 673575 - InfoSet: Long running program - SAPSQL_STMNT_TOO_LARGE to understan this kind of error.
Regards,
Raymond
2012 Oct 31 7:54 AM
The range is much to big, the OPEN SQL create a much too large SQL statement that the database is not able to interpret. Try to reduce the number of values, break the statement in batch of some hundred of records, or convert to a FOR ALL ENTRIES option. If the range table comes from another SELECT, you could also try to convert both SELECT into a single SELECT using JOIN or subquery.
You could also read some notes like Note 673575 - InfoSet: Long running program - SAPSQL_STMNT_TOO_LARGE to understan this kind of error.
Regards,
Raymond