<?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: Update a database table dynamically in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-a-database-table-dynamically/m-p/12283111#M1988896</link>
    <description>&lt;P&gt;Hi Sandra,&lt;/P&gt;&lt;P&gt;"It means that there's no line in the database table for the key fields in &amp;lt;ls_hyper_update_log&amp;gt;"&lt;/P&gt;&lt;P&gt;Thank you very much for this. I just realized I should have used insert since it's a new entry and will not update any lines in the database table.I am now able to insert the new entry.&lt;/P&gt;&lt;P&gt;Again, thanks for the assistance.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kath&lt;/P&gt;</description>
    <pubDate>Tue, 01 Sep 2020 05:09:31 GMT</pubDate>
    <dc:creator>former_member602116</dc:creator>
    <dc:date>2020-09-01T05:09:31Z</dc:date>
    <item>
      <title>Update a database table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-a-database-table-dynamically/m-p/12283107#M1988892</link>
      <description>&lt;P&gt;Hi ABAP Experts,&lt;/P&gt;
  &lt;P&gt;Good day! &lt;/P&gt;
  &lt;P&gt;I have a test code to update a database table dynamically. (Currently, values are in strings since this is only a test code and my actual code is in a class. Unfortunately, I am unable to test it as I am still missing some logic.). My problem here is I actually see the correct values in &amp;lt;ls_hyper_update_log&amp;gt; that will be used to update the database table. However, the update statement returns a sy-subrc of 4, which means table was not updated. May you please check on what's wrong with the below code? Thank you very much.&lt;/P&gt;
  &lt;P&gt;Regards,&lt;/P&gt;
  &lt;P&gt;Katherine Darunday&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;FIELD-SYMBOLS:
    &amp;lt;ls_hyper_update_log&amp;gt; TYPE any,
    &amp;lt;ls_update&amp;gt;           TYPE any.
  DATA:
    lv_field1 TYPE /txn/de_hyper_gen_fld_name,
    lv_field2 TYPE /txn/de_hyper_gen_fld_name,
    lv_field3 TYPE /txn/de_hyper_gen_fld_name,
    lv_field4 TYPE /txn/de_hyper_gen_fld_name,
    lv_field5 TYPE /txn/de_hyper_gen_fld_name,
    im_field_1 type CHAR20,
    im_field_2 type CHAR20,
    im_field_3 type CHAR20,
    im_field_4 type CHAR20,
    im_field_5 type CHAR20,
  DATA: DYN_WA TYPE REF TO DATA.
  CREATE DATA DYN_WA TYPE /txn/t_hyper_log.
  ASSIGN DYN_WA-&amp;gt;* TO &amp;lt;ls_hyper_update_log&amp;gt;.
  lv_field1 = 'HYPER_TEAM'. "im_s_hyper_tsk-field_name1.
  lv_field2 = 'HYPER_TASK'. "im_s_hyper_tsk-field_name2.
  lv_field3 = 'TASK_CLASS'. "im_s_hyper_tsk-field_name3.
  lv_field4 = 'MONI_DATE'.  ".m_s_hyper_tsk-field_name4.
  lv_field5 = 'MONI_TIME'.  "im_s_hyper_tsk-field_name5.

  im_field_1 = 'LOGISTICS'.
  im_field_2 = 'DYNAMIC'.
  im_field_3 = 'TEST'.
  im_field_4 = SY-DATUM.
  im_field_5 = SY-UZEIT.
  ASSIGN COMPONENT lv_field1 OF STRUCTURE &amp;lt;ls_hyper_update_log&amp;gt; TO &amp;lt;ls_update&amp;gt;.
  IF sy-subrc EQ 0.
    &amp;lt;ls_update&amp;gt; = im_field_1.
  ENDIF.
  ASSIGN COMPONENT lv_field2 OF STRUCTURE &amp;lt;ls_hyper_update_log&amp;gt; TO &amp;lt;ls_update&amp;gt;.
  IF sy-subrc EQ 0.
    &amp;lt;ls_update&amp;gt; = im_field_2.
  ENDIF.
  ASSIGN COMPONENT lv_field3 OF STRUCTURE &amp;lt;ls_hyper_update_log&amp;gt; TO &amp;lt;ls_update&amp;gt;.
  IF sy-subrc EQ 0.
    &amp;lt;ls_update&amp;gt; = im_field_3.
  ENDIF.
  ASSIGN COMPONENT lv_field4 OF STRUCTURE &amp;lt;ls_hyper_update_log&amp;gt; TO &amp;lt;ls_update&amp;gt;.
  IF sy-subrc EQ 0.
    &amp;lt;ls_update&amp;gt; = im_field_4.
  ENDIF.
  ASSIGN COMPONENT lv_field5 OF STRUCTURE &amp;lt;ls_hyper_update_log&amp;gt; TO &amp;lt;ls_update&amp;gt;.
  IF sy-subrc EQ 0.
    &amp;lt;ls_update&amp;gt; = im_field_5.
  ENDIF.
  UPDATE /txn/t_hyper_log FROM &amp;lt;ls_hyper_update_log&amp;gt;.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Aug 2020 16:53:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-a-database-table-dynamically/m-p/12283107#M1988892</guid>
      <dc:creator>former_member602116</dc:creator>
      <dc:date>2020-08-31T16:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: Update a database table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-a-database-table-dynamically/m-p/12283108#M1988893</link>
      <description>&lt;P&gt;It means that there's no line in the database table for the key fields in &amp;lt;ls_hyper_update_log&amp;gt;, or the update is impossible because the table has one or more unique indexes and the values would make a duplicate key for these indexes.&lt;/P&gt;&lt;P&gt;See ABAP doc: &lt;A href="https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abapupdate.htm"&gt;UPDATE&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2020 17:05:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-a-database-table-dynamically/m-p/12283108#M1988893</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-08-31T17:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: Update a database table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-a-database-table-dynamically/m-p/12283109#M1988894</link>
      <description>&lt;P&gt;Can u check if any entry exists with the specified key field in the database? sy-subrc 4 will  usually come if no entry is available in the data base with the specified primary key&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2020 17:10:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-a-database-table-dynamically/m-p/12283109#M1988894</guid>
      <dc:creator>maheshpalavalli</dc:creator>
      <dc:date>2020-08-31T17:10:58Z</dc:date>
    </item>
    <item>
      <title>Re: Update a database table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-a-database-table-dynamically/m-p/12283110#M1988895</link>
      <description>&lt;P&gt;Hi Sandra,&lt;/P&gt;&lt;P&gt;Yes, I know meaning of sy-subrc 4 in Update statement. The table I am trying to update is actually new and only has one entry. The values I am trying to insert have different primary keys with that of the existing entry. Which is why I was wondering why sy-subrc  is being encountered.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kath&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2020 04:55:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-a-database-table-dynamically/m-p/12283110#M1988895</guid>
      <dc:creator>former_member602116</dc:creator>
      <dc:date>2020-09-01T04:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: Update a database table dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/update-a-database-table-dynamically/m-p/12283111#M1988896</link>
      <description>&lt;P&gt;Hi Sandra,&lt;/P&gt;&lt;P&gt;"It means that there's no line in the database table for the key fields in &amp;lt;ls_hyper_update_log&amp;gt;"&lt;/P&gt;&lt;P&gt;Thank you very much for this. I just realized I should have used insert since it's a new entry and will not update any lines in the database table.I am now able to insert the new entry.&lt;/P&gt;&lt;P&gt;Again, thanks for the assistance.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kath&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2020 05:09:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/update-a-database-table-dynamically/m-p/12283111#M1988896</guid>
      <dc:creator>former_member602116</dc:creator>
      <dc:date>2020-09-01T05:09:31Z</dc:date>
    </item>
  </channel>
</rss>

