2007 Aug 03 7:51 AM
hi there?
what is the meaning of last row in the where clause.
SELECT ALIFNR ANAME1 AREGIO AKTOKK
FROM LFA1 AS A
INNER JOIN LFB1 AS B
ON ALIFNR = BLIFNR
INTO TABLE I_VENDOR
WHERE A~LIFNR IN S_LIFNR
AND B~BUKRS EQ P_BUKRS
AND B~ZWELS EQ P_ZWELS
%_HINTS DB2 '&SUBSTITUTE VALUES&'.
hi there?
what is the meaning of last row in the where clause.
SELECT ALIFNR ANAME1 AREGIO AKTOKK
FROM LFA1 AS A
INNER JOIN LFB1 AS B
ON ALIFNR = BLIFNR
INTO TABLE I_VENDOR
WHERE A~LIFNR IN S_LIFNR
AND B~BUKRS EQ P_BUKRS
AND B~ZWELS EQ P_ZWELS
%_HINTS DB2 '&SUBSTITUTE VALUES&'.
2007 Aug 03 7:59 AM
Hi,
Can you paste the whole code of the program.
Not sure but may be some macro may be there. i am just trying to guess
Regards,
Atish
2007 Aug 03 8:11 AM
It is a database hint which is a way of passing information directly to the DBMS. I know these can be used to tell the DBMS which index should be used, but they can possibly also be used for other purposes. Have never used them myself, but I remember it being mentioned as one of the new features some years ago.
Advantage: optimization and performance improvements becomes possible
Disadvantage: DBMS-specific code, but from your code it seems you can give hints for different DBMS's which would be a Good Thing for SAP and ISVs.
2007 Aug 03 8:13 AM
<<<< %_HINTS DB2 '&SUBSTITUTE VALUES&'. >>>>>
This means that its using an index named 'SUBSTITUTE VALUES' explicitly while trying to select data which is defined in the SAP database layer (DB2 in this case).
Cheers,
Sougata.
2007 Aug 03 8:16 AM
That's a "hint" to database SQL server, look at OSS <a href="https://service.sap.com/sap/support/notes/129385">Note 129385 - Database hints in Open SQL</a>
<b> &SUBSTITUTE LITERALS&</b>
<i> Explicit request to the database interface, to insert all literal values directly into the statement text. Literals are direct literals in the ABAP program text as well as global ABAP constants but not constant (FORM-)parameters. This is to supply information to the optimizer which makes it possible to utilize statistics via the value distributions.
As of Release 4. 5, the database interface for some databases with more complex statements will attempt to insert literals directly into the statement text. You should therefore verify in the SQL trace (Transaction ST05) if this require this hint.
Depending on the database, it is possible that all ABAP literals are not passed on to the database as a literal. As an example, such restrictions can apply to certain data types.
</i>
<b>&SUBSTITUTE VALUES&</b>
<i>are similar to &SUBSTITUTE LITERALS& and the explicit request to insert values directly in the statement text, to allow the optimizer to better use statistics for value distributions for optimization.
In contrast to &SUBSTITUTE LITERALS&, however, all values are inserted and not only literals. As a result, every call of the Open SQL statement in question generates a new statement and as a result a statement cache can no longer be used.
In the case of &SUBSTITUTE LITERALS& for instance, there may be database-dependent restrictions whose values are actually passed on to the database as a literal.</i>
Regards