<?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 Bad update table? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bad-update-table/m-p/3060771#M724983</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;I have in FORM code:&lt;/P&gt;&lt;P&gt; UPDATE Z_TABLE SET COL1 = 'value' WHERE COL2 = var&lt;/P&gt;&lt;P&gt;And in this program is also many inserts and BDC codes. &lt;/P&gt;&lt;P&gt;After execute all PERFORM is command  COMMIT WORK AND WAIT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problem is only in update table Z_TABLE. Some rows in database don't have updated&lt;/P&gt;&lt;P&gt;values. &lt;/P&gt;&lt;P&gt;It is possible that this error exists because FORM is executed many times ?&lt;/P&gt;&lt;P&gt;If I change this code to the one command: UPDATE Z_TABLE from itab, this repaire&lt;/P&gt;&lt;P&gt;my all updates or maybe this is work the same like single record UPDATE?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Nov 2007 08:26:16 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-11-19T08:26:16Z</dc:date>
    <item>
      <title>Bad update table?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bad-update-table/m-p/3060771#M724983</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;I have in FORM code:&lt;/P&gt;&lt;P&gt; UPDATE Z_TABLE SET COL1 = 'value' WHERE COL2 = var&lt;/P&gt;&lt;P&gt;And in this program is also many inserts and BDC codes. &lt;/P&gt;&lt;P&gt;After execute all PERFORM is command  COMMIT WORK AND WAIT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problem is only in update table Z_TABLE. Some rows in database don't have updated&lt;/P&gt;&lt;P&gt;values. &lt;/P&gt;&lt;P&gt;It is possible that this error exists because FORM is executed many times ?&lt;/P&gt;&lt;P&gt;If I change this code to the one command: UPDATE Z_TABLE from itab, this repaire&lt;/P&gt;&lt;P&gt;my all updates or maybe this is work the same like single record UPDATE?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2007 08:26:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bad-update-table/m-p/3060771#M724983</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-19T08:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: Bad update table?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bad-update-table/m-p/3060772#M724984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;UPDATE dbtab - source &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax &lt;/P&gt;&lt;P&gt;... { {SET set_expression [WHERE sql_cond]} &lt;/P&gt;&lt;P&gt;    | {FROM wa|{TABLE itab}} }. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatives: &lt;/P&gt;&lt;P&gt;1. ... SET set_expression [WHERE sql_cond] &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. ... FROM wa &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. ... FROM TABLE itab &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;The specifications in source define which rows and columns are changed. Either individual columns are changed using the addition SET or entire rows are overwritten using the addition FROM. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After FROM, either a non-table-type data object wa or an internal table itab can be specified. The content of these objects determines - on the one hand - which row(s) is/are changed, and &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- on the other hand - which values are used to overwrite the row(s). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternative 1 &lt;/P&gt;&lt;P&gt;... SET set_expression [WHERE sql_cond] &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;After the addition SET, the changes are specified in a list of change expressions in set_expression. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The addition WHERE uses a logical expression sql_cond to define in which rows of the database table the changes are executed. For the logical expression sql_cond, the same applies as for the WHEREcondition of the statement SELECT, with the exception that no subqueries are to be evaluated in the database table to be changed. If no WHERE condition is specified, all the rows in the database table are changed. If a column of the type STRING or RAWSTRING is changed, the primary key must be fully specified in the WHERE condition. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The content of primary key fields can only be changed if the respective database table is not linked with a search help and if pool and cluster tables are not accessed. If a link was to be created through the changes and this row would cause double entries in the primary key or a unique secondary index of the database table, no row is changed and sy-subrc is set to 4. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notes &lt;/P&gt;&lt;P&gt;Before release 6.10, SET could only be specified for static specification of the database table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before release 6.10, no dynamic logical expressions could be used in the WHERE condition of the statement UPDATE. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dynamic conversion of the content of an arbitrary column in an arbitrary database table of a previous currency in Euro. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS: table    TYPE c LENGTH 30, &lt;/P&gt;&lt;P&gt;            column   TYPE c LENGTH 30, &lt;/P&gt;&lt;P&gt;            old_curr TYPE sycurr. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: set_expr  TYPE string, &lt;/P&gt;&lt;P&gt;      condition TYPE string. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONCATENATE column ` = 'EUR'` &lt;/P&gt;&lt;P&gt;            INTO set_expr. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONCATENATE column ` = old_curr` &lt;/P&gt;&lt;P&gt;            INTO condition. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRY. &lt;/P&gt;&lt;P&gt;    UPDATE (table) &lt;/P&gt;&lt;P&gt;    SET    (set_expr) &lt;/P&gt;&lt;P&gt;    WHERE  (condition). &lt;/P&gt;&lt;P&gt;  CATCH cx_sy_dynamic_osql_error. &lt;/P&gt;&lt;P&gt;    MESSAGE `Error in update!` TYPE 'I'. &lt;/P&gt;&lt;P&gt;ENDTRY. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternative 2 &lt;/P&gt;&lt;P&gt;... FROM wa &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;If you specify a non-table-type work area wa, the system will search for a row in the database table which, in its primary key, has the same content as the respective beginning part of the work area. The content of the work area is interpreted in its non-converted form and in accordance with the structure of the database table or the view. The content of the work area is assigned to this row. The assignment takes place without conversion from the left to the right in accordance with the structure of the database table or the view. The work area must fulfill the prerequisites for use in Open SQL statements. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If there is no row with the same content for the primary key in the database or if the change would lead to a double entry in a unique secondary index, the line is not changed and sy-subrc is set to 4. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notes &lt;/P&gt;&lt;P&gt;The work area wa should always be declared in relation to the database table or the view in the ABAP Dictionary. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have a static specification of the database table or the view, the specification of the work area using FROM wa can be omitted outside of classes - provided a table work area dbtab for the respective database table or the view is declared using the statement TABLES. The system expands the UPDATE statement implicitly to include the addition FROM dbtab. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternative 3 &lt;/P&gt;&lt;P&gt;... FROM TABLE itab &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;When an internal table itab is specified, the system processes all the rows of the internal table in accordance with the rules for the work area wa. The row type of the internal table must meet the requirements for use in Open-SQL statements. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If, in the database, there is no row with the same content of the primary key for a row in the internal table, or if the change would lead to a double entry in a unique secondary key, the respective row is not changed and sy-subrc is set to 4. If the internal table is empty, sy-subrc is set to 0. The system field sy-dbcnt is always set to the number of rows actually inserted. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reduction of the flight cost for all of today's flights of an airline carrier in the database table SFLIGHT by the percentage percent. The calculation of the new price is always done in an internal table sflight_tab and the database table is changed accordingly. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS: p_carrid TYPE sflight-carrid, &lt;/P&gt;&lt;P&gt;            percent  TYPE p LENGTH 1 DECIMALS 0. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA sflight_tab TYPE TABLE OF sflight. &lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS &amp;lt;sflight&amp;gt; TYPE sflight. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * &lt;/P&gt;&lt;P&gt;       FROM sflight &lt;/P&gt;&lt;P&gt;       INTO TABLE sflight_tab &lt;/P&gt;&lt;P&gt;       WHERE carrid = p_carrid AND &lt;/P&gt;&lt;P&gt;             fldate = sy-datum. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0. &lt;/P&gt;&lt;P&gt;  LOOP AT sflight_tab ASSIGNING &amp;lt;sflight&amp;gt;. &lt;/P&gt;&lt;P&gt;    &amp;lt;sflight&amp;gt;-price = &lt;/P&gt;&lt;P&gt;      &amp;lt;sflight&amp;gt;-price * ( 1 - percent / 100 ). &lt;/P&gt;&lt;P&gt;  ENDLOOP. &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UPDATE sflight FROM TABLE sflight_tab.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2007 08:29:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bad-update-table/m-p/3060772#M724984</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-19T08:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: Bad update table?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bad-update-table/m-p/3060773#M724985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My main problem is that not all record are sometimes updated by UPDATE Z_TABLE SET ...&lt;/P&gt;&lt;P&gt;It is possible or maybe in other side is the problem?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2007 12:23:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bad-update-table/m-p/3060773#M724985</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-19T12:23:41Z</dc:date>
    </item>
  </channel>
</rss>

