Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAPSQL_STMT_TOO_LARGE

Former Member
0 Likes
4,730

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

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
3,536

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

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

1 REPLY 1
Read only

RaymondGiuseppi
Active Contributor
0 Likes
3,537

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