‎2008 Jul 15 8:38 AM
What's Dynamic SQL and Static SQL?
Difference between DYnami and Static SQL ?
Can anybody please share this information?
‎2008 Jul 15 8:42 AM
hi
Dynamic SQL
http://help.sap.com/saphelp_nw04/helpdata/en/9d/05b8d660f77f4387d6d054d7655ecb/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/f5/c49051f80f444391b45ddee1f1e37e/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/d2/b685c05725bc4db947d0856daae9b1/frameset.htm
Static SQL
http://help.sap.com/saphelp_nw04/helpdata/en/f5/c49051f80f444391b45ddee1f1e37e/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/b9/817f8d8e246e42b9d64be39c736daf/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/67/1c914e1e96f5498c633c8ec641bd2d/frameset.htm
Cheers
Snehi
Edited by: snehi chouhan on Jul 15, 2008 9:42 AM
‎2008 Jul 15 8:42 AM
hi
Dynamic SQL
http://help.sap.com/saphelp_nw04/helpdata/en/9d/05b8d660f77f4387d6d054d7655ecb/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/f5/c49051f80f444391b45ddee1f1e37e/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/d2/b685c05725bc4db947d0856daae9b1/frameset.htm
Static SQL
http://help.sap.com/saphelp_nw04/helpdata/en/f5/c49051f80f444391b45ddee1f1e37e/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/b9/817f8d8e246e42b9d64be39c736daf/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/67/1c914e1e96f5498c633c8ec641bd2d/frameset.htm
Cheers
Snehi
Edited by: snehi chouhan on Jul 15, 2008 9:42 AM
‎2008 Jul 15 8:49 AM
hi,
http://www.susanto.id.au/papers/DynOpenSQL.asp
ex:
SELECT *
FROM (w_table)
INTO CORRESPONDING FIELDS OF wa_consolidate
WHERE kappl EQ wa_kona-kappl
AND kschl EQ wa_t6b2f-kschl
AND vkorg EQ wa_kona-vkorg
AND vtweg EQ wa_kona-vtweg
AND datbi GE p_datbi
AND knuma EQ wa_kona-knuma.
here table is select ed dynamically.
regards,
sandeep
‎2008 Jul 15 8:53 AM
Hi
It means the table and where condition are managed dynamically in the program, so they aren't hardcoded.
DATA: tablename(30) TYPE c.
DATA: t_cond(1000) TYPE c OCCURS 0 WITH HEADER LINE.
DATA: wa TYPE REF TO data.
FIELD-SYMBOLS: <wa> TYPE ANY.
START-OF-SELECTION.
tablename = 'BKPF'.
* Create a workarea
CREATE DATA wa TYPE (tablename).
ASSIGN wa->* TO <wa>.
CONCATENATE 'BUKRS =' '''' '1000' '''' INTO t_cond.
APPEND t_cond.
CONCATENATE 'AND GJAHR = ' '''' '2008' '''' INTO t_cond.
APPEND t_cond.
SELECT * FROM (tablename) INTO <wa> WHERE (t_cond).
ENDSELECT.The query above it can write statically:
SELECT * FROM BKPF WHERE BUKRS = '1000'
AND GJAHR = '2008'.
ENDSELECT.The main difference is it can't use a SELECT-OPTIONS or RANGES in the dynamic sql, but the WHERE condition has to have constants value only.
The performance should be better for the static sql.
Max