<?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 Re: Insert without commit (implicit and explicit) stores data. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-without-commit-implicit-and-explicit-stores-data/m-p/3883050#M933080</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Today I spent some time to close this thread. &lt;/P&gt;&lt;P&gt;I made this test: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  ZTEST.

DATA: wa_zsic_abonos_chk TYPE zsic_abonos_chk. "Is a transparent table

START-OF-SELECTION.

   wa_zsic_abonos_chk-bukrs = 'MU01'.
   wa_zsic_abonos_chk-belnr = '999949'.
   wa_zsic_abonos_chk-gjahr = '2008'.

  INSERT into zsic_abonos_chk values wa_zsic_abonos_chk.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    WRITE:/ 'register NOT inserted'.
  ELSE.
    WRITE:/ 'register inserted'.
  ENDIF.

  SELECT SINGLE *
    INTO   wa_zsic_abonos_chk
  FROM zsic_abonos_chk
  WHERE bukrs = wa_zsic_abonos_chk-bukrs
    AND belnr = wa_zsic_abonos_chk-belnr
    AND gjahr = wa_zsic_abonos_chk-gjahr.

  IF sy-subrc = 0.
    WRITE:/ 'register found!.'.
  ELSE.
    WRITE:/ 'register NOT found.'.
  ENDIF.

  ROLLBACK WORK.

  SELECT SINGLE *
    INTO   wa_zsic_abonos_chk
  FROM zsic_abonos_chk
  WHERE bukrs = wa_zsic_abonos_chk-bukrs
    AND belnr = wa_zsic_abonos_chk-belnr
    AND gjahr = wa_zsic_abonos_chk-gjahr.

  IF sy-subrc = 0.
    WRITE:/ 'register found!.'.
  ELSE.
    WRITE:/ 'register NOT found.'.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result is: &lt;/P&gt;&lt;P&gt;register inserted  &lt;/P&gt;&lt;P&gt;register found!.   &lt;/P&gt;&lt;P&gt;register NOT found.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This clarifies the matter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Jul 2008 08:09:34 GMT</pubDate>
    <dc:creator>jordi_escodaruiz</dc:creator>
    <dc:date>2008-07-30T08:09:34Z</dc:date>
    <item>
      <title>Insert without commit (implicit and explicit) stores data.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-without-commit-implicit-and-explicit-stores-data/m-p/3883046#M933076</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have this piece of code: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  ztest.

DATA: wa_zsic_abonos_chk TYPE zsic_abonos_chk. "Is a transparent table

START-OF-SELECTION.

   wa_zsic_abonos_chk-bukrs = 'MU01'.
   wa_zsic_abonos_chk-belnr = '99999'.
   wa_zsic_abonos_chk-gjahr = '2008'.

  INSERT into zsic_abonos_chk values wa_zsic_abonos_chk.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    WRITE:/ 'register NOT inserted'.
  ELSE
    WRITE:/ 'register inserted'.
  ENDIF.

  SELECT SINGLE *
    INTO   wa_zsic_abonos_chk
  FROM zsic_abonos_chk
  WHERE bukrs = 'MU01'
    AND belnr = '99999'
    AND gjahr = '2008'.

  IF sy-subrc = 0.
    WRITE:/ 'register found!.'.
  ELSE.
    WRITE:/ 'register NOT found.'.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I run this code I get this results: &lt;/P&gt;&lt;P&gt;register inserted&lt;/P&gt;&lt;P&gt;register found!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is surprising to me, because I did not write the COMMIT WORK after the Insert.&lt;/P&gt;&lt;P&gt;What I expected to have was: &lt;/P&gt;&lt;P&gt;register inserted&lt;/P&gt;&lt;P&gt;register NOT found&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;zsic_abonos_chk is a transparent table without buffering, and the register does not exists before the Insert.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Database system is running below SAP is DB2. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone explain this behavior?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jordi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2008 10:30:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-without-commit-implicit-and-explicit-stores-data/m-p/3883046#M933076</guid>
      <dc:creator>jordi_escodaruiz</dc:creator>
      <dc:date>2008-05-29T10:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: Insert without commit (implicit and explicit) stores data.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-without-commit-implicit-and-explicit-stores-data/m-p/3883047#M933077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you use BYPASSING BUFFER in your select, I expect that record will not be found.&lt;/P&gt;&lt;P&gt;When inserting the data, records will be 'stored' in the table already, ready to be commited. If anything goes wrong, you will need to do a ROLLBACK. If no errors occur and you do NO commit, data can be implicitely commited by the system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Micky Oestreich on May 29, 2008 12:34 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2008 10:34:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-without-commit-implicit-and-explicit-stores-data/m-p/3883047#M933077</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2008-05-29T10:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: Insert without commit (implicit and explicit) stores data.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-without-commit-implicit-and-explicit-stores-data/m-p/3883048#M933078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe it's because the insert and select statements are within the same internal mode i.e. database connection.&lt;/P&gt;&lt;P&gt;Another process looking for the same record would not find it before you commit or your program ends.&lt;/P&gt;&lt;P&gt;Greetings&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2008 10:42:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-without-commit-implicit-and-explicit-stores-data/m-p/3883048#M933078</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2008-05-29T10:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: Insert without commit (implicit and explicit) stores data.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-without-commit-implicit-and-explicit-stores-data/m-p/3883049#M933079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Micky: &lt;/P&gt;&lt;P&gt;Thanks for your answer.&lt;/P&gt;&lt;P&gt;The transparent table ZSIC_ABONOS_CHK does not have the Buffering attribute active, i.e.does not have buffering.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried adding BYPASSING BUFFER to the select statement, and I still get the register.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I made another check: Adding ROLLBACK WORK between the INSERT and the SELECT, and I still got the register (result register found!).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;INSERT into zsic_abonos_chk values wa_zsic_abonos_chk.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    WRITE:/ 'register not inserted'.
  ENDIF.

  ROLLBACK WORK.

  SELECT SINGLE * BYPASSING BUFFER
    INTO   wa_zsic_abonos_chk
  FROM zsic_abonos_chk
  WHERE bukrs = 'MU01'
    AND belnr = '99999'
    AND gjahr = '2008'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's really confusing. I think something is going wrong.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2008 10:58:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-without-commit-implicit-and-explicit-stores-data/m-p/3883049#M933079</guid>
      <dc:creator>jordi_escodaruiz</dc:creator>
      <dc:date>2008-05-29T10:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: Insert without commit (implicit and explicit) stores data.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-without-commit-implicit-and-explicit-stores-data/m-p/3883050#M933080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Today I spent some time to close this thread. &lt;/P&gt;&lt;P&gt;I made this test: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  ZTEST.

DATA: wa_zsic_abonos_chk TYPE zsic_abonos_chk. "Is a transparent table

START-OF-SELECTION.

   wa_zsic_abonos_chk-bukrs = 'MU01'.
   wa_zsic_abonos_chk-belnr = '999949'.
   wa_zsic_abonos_chk-gjahr = '2008'.

  INSERT into zsic_abonos_chk values wa_zsic_abonos_chk.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    WRITE:/ 'register NOT inserted'.
  ELSE.
    WRITE:/ 'register inserted'.
  ENDIF.

  SELECT SINGLE *
    INTO   wa_zsic_abonos_chk
  FROM zsic_abonos_chk
  WHERE bukrs = wa_zsic_abonos_chk-bukrs
    AND belnr = wa_zsic_abonos_chk-belnr
    AND gjahr = wa_zsic_abonos_chk-gjahr.

  IF sy-subrc = 0.
    WRITE:/ 'register found!.'.
  ELSE.
    WRITE:/ 'register NOT found.'.
  ENDIF.

  ROLLBACK WORK.

  SELECT SINGLE *
    INTO   wa_zsic_abonos_chk
  FROM zsic_abonos_chk
  WHERE bukrs = wa_zsic_abonos_chk-bukrs
    AND belnr = wa_zsic_abonos_chk-belnr
    AND gjahr = wa_zsic_abonos_chk-gjahr.

  IF sy-subrc = 0.
    WRITE:/ 'register found!.'.
  ELSE.
    WRITE:/ 'register NOT found.'.
  ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result is: &lt;/P&gt;&lt;P&gt;register inserted  &lt;/P&gt;&lt;P&gt;register found!.   &lt;/P&gt;&lt;P&gt;register NOT found.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This clarifies the matter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2008 08:09:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-without-commit-implicit-and-explicit-stores-data/m-p/3883050#M933080</guid>
      <dc:creator>jordi_escodaruiz</dc:creator>
      <dc:date>2008-07-30T08:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: Insert without commit (implicit and explicit) stores data.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/insert-without-commit-implicit-and-explicit-stores-data/m-p/3883051#M933081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I close the thread. I answered myself.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2008 08:10:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/insert-without-commit-implicit-and-explicit-stores-data/m-p/3883051#M933081</guid>
      <dc:creator>jordi_escodaruiz</dc:creator>
      <dc:date>2008-07-30T08:10:48Z</dc:date>
    </item>
  </channel>
</rss>

