‎2010 Mar 10 5:24 AM
Hi all
What is the maximum permitted length for open dynamic multitable sql for different database?
like we have open sql in this format
Select (op_list) from (join_tables) into itab where (where_crietria).
so
1-> what is the maximum length of total sql?
2-> what is the maximum length of op_list?
3-> what is the maximum length of jointables?
4-> what is the maximum length of where_criteria with diff operator like 'IN' ?
thanks,
Anuj
‎2010 Mar 10 5:39 AM
‎2010 Mar 10 5:40 AM
If you done something this way i don't think you have limitation
DATA: V_CONDITION(72) TYPE C,
ITAB LIKE TABLE OF V_CONDITION.
SELECTION-OPTIONS : S_MATNR FOR MARA-MATNR.
DATA WA TYPE MARA-MATNR.
LOOP AT S_MATNR.
IF SY-TABIX EQ 1.
CONCATENATE 'MATNR = ''' S_MATNR-LOW '''' INTO V_CONDITION.
APPEND V_CONDITION TO ITAB.
ELSE.
CONCATENATE 'OR MATNR = ''' S_MATNR-LOW '''' INTO V_CONDITION.
APPEND V_CONDITION TO ITAB.
ENDIF.
ENDLOOP.
SELECT MATNR
INTO WA
FROM MARA
WHERE (ITAB).
WRITE / WA.
ENDSELECT.
a®
‎2010 Mar 10 5:44 AM
Hello aRs,
The restriction is on the total length of the dynamic SQL statement which is generated at the DB level during runtime.
You should check the OSS Note: Note 635318 - Open SQL: Size restrictions for commands.
Cheers,
Suhas
Edited by: Suhas Saha on Mar 10, 2010 11:16 AM
‎2010 Mar 10 6:07 AM
suhas,
You are right.
When the SQL statement is generated at runtime, you should check the following restrictions and divide or reduce the statement if necessary.
The static length (in the ABAP editor) of any ABAP command must not exceed 28672 characters.In Open SQL commands with dynamic subclauses (WHERE, GROUP BY, ORDER BY, and so on), the subclauses cannot contain more than 28672 characters
Thanks for pointing out.
a®
‎2010 Mar 10 6:14 AM
Thanks suhas $ aRs,
"The static length (in the ABAP editor) of any ABAP command must not exceed 28672 characters.In Open SQL commands with dynamic subclauses (WHERE, GROUP BY, ORDER BY, and so on), the subclauses cannot contain more than 28672 characters"
But this is only realated to where_criteria ..... is there any limit for op_list ond join_tables and right now i
m able to run query more than 65k character....
regards,
Anuj
‎2010 Mar 10 6:29 AM
>
> But this is only realated to where_criteria ..... is there any limit for op_list ond join_tables and right now i
> m able to run query more than 65k character....
Can you elaborate on this statement please ?
I am not sure about the OP_LIST but for JOINs you have a limitation of 24 join expressions. (source: [http://help.sap.com/abapdocu_70/en/ABAPSELECT_JOIN.htm|http://help.sap.com/abapdocu_70/en/ABAPSELECT_JOIN.htm])
BR,
Suhas