<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic A general Question? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/a-general-question/m-p/2881644#M676782</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am acessing data from two tables with inner join statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i access the same tables with open cursor seperately then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which statement is more affective?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If any know the solution? Please explain me clearly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Lisa&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Sep 2007 11:47:12 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-09-27T11:47:12Z</dc:date>
    <item>
      <title>A general Question?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/a-general-question/m-p/2881644#M676782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am acessing data from two tables with inner join statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i access the same tables with open cursor seperately then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which statement is more affective?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If any know the solution? Please explain me clearly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Lisa&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2007 11:47:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/a-general-question/m-p/2881644#M676782</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-27T11:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: A general Question?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/a-general-question/m-p/2881645#M676783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi lisa,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;good...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the normal SELECT statement, the data from the selection is always read directly into the target area specified in the INTO clause during the SELECT statement. When you use a cursor to read data, you decouple the process from the SELECT statement. To do this, you must open a cursor for a SELECT statement. Afterwards, you can place the lines from the selection into a flat target area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The disadvantage of using joins is that redundant data is read from the hierarchically-superior table if there is a 1:N relationship between the outer and inner tables. This can considerably increase the amount of data transferred from the database to the application server. Therefore, when you program a join, you should ensure that the SELECT clause contains a list of only the columns that you really need. Furthermore, joins bypass the table buffer and read directly from the database. For this reason, you should use an ABAP Dictionary view instead of a join if you only want to read the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The runtime of a join statement is heavily dependent on the database optimizer, especially when it contains more than two database tables. However, joins are nearly always quicker than using nested SELECT statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SO Open cursor is comparitively good compared to inner join...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Pls reward if helpful...&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Shori&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2007 11:51:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/a-general-question/m-p/2881645#M676783</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-27T11:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: A general Question?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/a-general-question/m-p/2881646#M676784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using a Cursor to Read Data &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the normal SELECT statement, the data from the selection is always read directly into the target area specified in the INTO clause during the SELECT statement. When you use a cursor to read data, you decouple the process from the SELECT statement. To do this, you must open a cursor for a SELECT statement. Afterwards, you can place the lines from the selection into a flat target area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Opening and Closing Cursors&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To open a cursor for a SELECT statement, use the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN CURSOR [WITH HOLD] &amp;lt;c&amp;gt; FOR SELECT      &amp;lt;result&amp;gt; &lt;/P&gt;&lt;P&gt;                                  FROM      &amp;lt;source&amp;gt; &lt;/P&gt;&lt;P&gt;                                  [WHERE    &amp;lt;condition&amp;gt;]&lt;/P&gt;&lt;P&gt;                                  [GROUP BY &amp;lt;fields&amp;gt;] &lt;/P&gt;&lt;P&gt;                                  [HAVING   &amp;lt;cond&amp;gt;]&lt;/P&gt;&lt;P&gt;                                  [ORDER BY &amp;lt;fields&amp;gt;].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You must first have declared the cursor &amp;lt;c&amp;gt; using the DATA statement and the special data type CURSOR. You can use all clauses of the SELECT statement apart from the INTO clause. Furthermore, you can only formulate the SELECT clause so that the selection consists of more than one line. This means that you may not use the SINGLE addition, and that the column selection may not contain only aggregate expressions. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An open cursor points to an internal handler, similarly to a reference variable pointing to an object. You can reassign cursors so that more than one points to the same handler. In a MOVE statement, the target cursor adopts all of the attributes of the source cursor, namely its position, and all of the clauses in the OPEN CURSOR statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also open more than one cursor in parallel for a single database table. If a cursor is already open, you cannot reopen it. To close a cursor explicitly, use the following statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLOSE CURSOR &amp;lt;c&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should use this statement to close all cursors that you no longer require, since only a limited number of cursors may be open simultaneously. With one exception, a database LUW is concluded when you close a cursor either explicitly or implicitly. The WITH HOLD addition in the OPEN CURSOR statement allows you to prevent a cursor from being closed when a database commit occurs in Native SQL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reading Data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An open cursor is linked to a multiple-line selection in the database table. To read the data into a target area in the ABAP program, use the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FETCH NEXT CURSOR &amp;lt;c&amp;gt; INTO &amp;lt;target&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This writes one line of the selection into the target area &amp;lt;target&amp;gt;, and the cursor moves one line further in the selection set. The fetch statement decouples the INTO clause from the other clauses in the SELECT statement. All the INTO clauses of the SELECT statement can be used. The statement reads the lines that are needed to fill the target area of the INTO clause and moves the cursor to the next line to be read. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SY-SUBRC is set to 0 until all the lines of the selection have been read; otherwise it is 4. After a FETCH statement, system field SY-DBCNT contains the number of all the lines read so far for the corresponding cursor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT demo_select_cursor_1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: c1 TYPE cursor,&lt;/P&gt;&lt;P&gt;      c2 TYPE cursor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: wa1 TYPE spfli,&lt;/P&gt;&lt;P&gt;      wa2 TYPE spfli.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: flag1(1) TYPE c,&lt;/P&gt;&lt;P&gt;      flag2(1) TYPE c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN CURSOR: c1 FOR SELECT  carrid connid&lt;/P&gt;&lt;P&gt;                      FROM  spfli&lt;/P&gt;&lt;P&gt;                      WHERE carrid = 'LH',&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;             c2 FOR SELECT  carrid connid cityfrom cityto&lt;/P&gt;&lt;P&gt;                      FROM  spfli&lt;/P&gt;&lt;P&gt;                      WHERE carrid = 'AZ'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DO.&lt;/P&gt;&lt;P&gt;  IF flag1 NE 'X'.&lt;/P&gt;&lt;P&gt;    FETCH NEXT CURSOR c1 INTO CORRESPONDING FIELDS OF wa1.&lt;/P&gt;&lt;P&gt;    IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;      CLOSE CURSOR c1.&lt;/P&gt;&lt;P&gt;      flag1 = 'X'.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;      WRITE: / wa1-carrid, wa1-connid.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;  IF flag2 NE 'X'.&lt;/P&gt;&lt;P&gt;    FETCH NEXT CURSOR c2 INTO CORRESPONDING FIELDS OF wa2.&lt;/P&gt;&lt;P&gt;    IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;      CLOSE CURSOR c2.&lt;/P&gt;&lt;P&gt;      flag2 = 'X'.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;      WRITE: / wa2-carrid, wa2-connid,&lt;/P&gt;&lt;P&gt;               wa2-cityfrom, wa2-cityto.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;  IF flag1 = 'X' AND flag2 = 'X'.&lt;/P&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output looks something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The database table SPFLI is read using two cursors, each with different conditions.. The selected lines are read alternately in a DO loop. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT demo_select_cursor_2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA c TYPE cursor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA wa TYPE sbook.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN CURSOR c FOR SELECT     carrid connid fldate bookid smoker&lt;/P&gt;&lt;P&gt;                    FROM     sbook&lt;/P&gt;&lt;P&gt;                    ORDER BY carrid connid fldate smoker bookid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FETCH NEXT CURSOR c INTO CORRESPONDING FIELDS OF wa.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHILE sy-subrc = 0.&lt;/P&gt;&lt;P&gt;  IF wa-smoker = ' '.&lt;/P&gt;&lt;P&gt;    PERFORM nonsmoker USING c.&lt;/P&gt;&lt;P&gt;  ELSEIF wa-smoker = 'X'.&lt;/P&gt;&lt;P&gt;    PERFORM smoker USING c.&lt;/P&gt;&lt;P&gt;    SKIP.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDWHILE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM nonsmoker USING n_cur TYPE cursor.&lt;/P&gt;&lt;P&gt;  WHILE wa-smoker = ' ' AND sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    FORMAT COLOR = 5.&lt;/P&gt;&lt;P&gt;    WRITE: / wa-carrid, wa-connid, wa-fldate, wa-bookid.&lt;/P&gt;&lt;P&gt;    FETCH NEXT CURSOR n_cur INTO CORRESPONDING FIELDS OF wa.&lt;/P&gt;&lt;P&gt;ENDWHILE.&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM smoker USING s_cur TYPE cursor.&lt;/P&gt;&lt;P&gt;  WHILE wa-smoker = 'X' AND sy-subrc = 0.&lt;/P&gt;&lt;P&gt;    FORMAT COLOR = 6.&lt;/P&gt;&lt;P&gt;    WRITE: / wa-carrid, wa-connid, wa-fldate, wa-bookid.&lt;/P&gt;&lt;P&gt;    FETCH NEXT CURSOR s_cur INTO CORRESPONDING FIELDS OF wa.&lt;/P&gt;&lt;P&gt;ENDWHILE.&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following is an extract from the list display:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The program opens a cursor for the database table SBOOK. After the first FETCH statement, a subroutine is called, which is dependent on the contents of the SMOKER column. The cursor is passed to an interface parameter in the subroutine. The subroutines read further lines until the contents of the SMOKER column change. The subroutines perform different tasks using the lines read by the cursor. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT demo_select_cursor_3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: wa_spfli   TYPE spfli,&lt;/P&gt;&lt;P&gt;      wa_sflight TYPE sflight,&lt;/P&gt;&lt;P&gt;      wa_sflight_back TYPE sflight.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: c1 TYPE cursor,&lt;/P&gt;&lt;P&gt;      c2 TYPE cursor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN CURSOR c1 FOR     SELECT *&lt;/P&gt;&lt;P&gt;                 FROM  spfli&lt;/P&gt;&lt;P&gt;                 ORDER BY PRIMARY KEY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN CURSOR c2 FOR     SELECT *&lt;/P&gt;&lt;P&gt;                 FROM  sflight&lt;/P&gt;&lt;P&gt;                 ORDER BY PRIMARY KEY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DO.&lt;/P&gt;&lt;P&gt;  FETCH NEXT CURSOR c1 INTO wa_spfli.&lt;/P&gt;&lt;P&gt;  IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;    EXIT.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;  WRITE: / wa_spfli-carrid, wa_spfli-connid.&lt;/P&gt;&lt;P&gt;  DO.&lt;/P&gt;&lt;P&gt;    IF NOT wa_sflight_back IS INITIAL.&lt;/P&gt;&lt;P&gt;      wa_sflight = wa_sflight_back.&lt;/P&gt;&lt;P&gt;      CLEAR wa_sflight_back.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;      FETCH NEXT CURSOR c2 INTO wa_sflight.&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    EXIT.&lt;/P&gt;&lt;P&gt;      ELSEIF wa_sflight-carrid &amp;lt;&amp;gt; wa_spfli-carrid&lt;/P&gt;&lt;P&gt;          OR wa_sflight-connid &amp;lt;&amp;gt; wa_spfli-connid.&lt;/P&gt;&lt;P&gt;        wa_sflight_back = wa_sflight.&lt;/P&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;    WRITE: / wa_sflight-carrid, wa_sflight-connid,&lt;/P&gt;&lt;P&gt;             wa_sflight-fldate.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The program opens a cursor for each of the table SPFLI and SFLIGHT. Since both tables are linked by a foreign key relationship, it is possible to program a nested loop by sorting the selection by its primary key, so that the data read in the inner loop depends on the data in the outer loop. This programming method is quicker than using nested SELECT statements, since the cursor for the inner loop does not continually have to be reopened. If the group level in the inner loop is changed, the data that is read is stored temporarily until the next loop pass since it is not possible to reset the cursor.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2007 11:51:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/a-general-question/m-p/2881646#M676784</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-27T11:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: A general Question?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/a-general-question/m-p/2881647#M676785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;innerjoin is better than open cursor&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; why because the cursor works on the buffer(data set) and it will take from the buffer itself..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but innerjoin will create just alias names and then joins by dynamically&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it will fetch the data from two table with our own mentioned fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so better to use inner join&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2007 11:51:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/a-general-question/m-p/2881647#M676785</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-27T11:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: A general Question?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/a-general-question/m-p/2881648#M676786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;OPEN CURSOR [WITH HOLD] c FOR SELECT ... .&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;Opens a database cursor c in a database table or view for a SELECT statement. The variable c must be of the type CURSOR. You can use any SELECT statement that returns a table, but not a single record, as a result. When the cursor has been opened, the dataset specified with SELECT can be read with FETCH until the cursor is closed. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN CURSOR belongs to the Open SQL command set. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you attempt to open a cursor that has already been opened, you get a runtime error. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following events close a cursor: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The CLOSE CURSOR statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Open SQL statement COMMIT WORK &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A database commit in Native SQL. In this case, a cursor opened with WITH HOLD is not closed. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Open SQL statememnt ROLLBACK WORK &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A database rollback in Native SQL &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A screen change, in particular the statements CALL SCREEN, CALL DIALOG, CALL TRANSACTION, MESSAGE &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A Remote Function Call, in particular the statements CALL FUNCTION ... DESTINATION , CALL FUNCTION ... STARTING NEW TASK, or CALL FUNCTION ... IN BACKGROUND TASK. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example &lt;/P&gt;&lt;P&gt;Open the database cursor C1 in the database table SFLIGHT for the SELECT statement &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM SFLIGHT WHERE CARRID = 'LH '. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES SFLIGHT. &lt;/P&gt;&lt;P&gt;DATA   C1 TYPE CURSOR. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN CURSOR C1 FOR &lt;/P&gt;&lt;P&gt;     SELECT * FROM SFLIGHT WHERE CARRID = 'LH '. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Notes&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;In the above example, the OPEN statement contains no INTO clause. With cursor processing, you must always specify the target area for the selected data in the FETCH statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The OPEN CURSOR statement allows you to open several cursors at the same time in a table. Unlike with SELECT, you thus have several independent access paths to this table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you can open only a restricted number of cursors at the same time, you should close cursors that are no longer required with CLOSE CURSOR. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since the OPEN statement does not support authorization checks, you must program these yourself. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;LIJO&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2007 11:52:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/a-general-question/m-p/2881648#M676786</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-27T11:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: A general Question?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/a-general-question/m-p/2881649#M676787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;good&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;go through this which ll give the detail difference betwen the select and the open cursor statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.jt77.com/development1/programming-15805.html" target="test_blank"&gt;http://www.jt77.com/development1/programming-15805.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward point if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;mrutyun^&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2007 12:06:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/a-general-question/m-p/2881649#M676787</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-27T12:06:03Z</dc:date>
    </item>
  </channel>
</rss>

