<?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 Entering value in database in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/entering-value-in-database/m-p/2514545#M568828</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have single screen having following six fields..&lt;/P&gt;&lt;P&gt;table1-field1&lt;/P&gt;&lt;P&gt;table1-field2&lt;/P&gt;&lt;P&gt;table1-field3,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;table2-field1,&lt;/P&gt;&lt;P&gt;table2-field1,&lt;/P&gt;&lt;P&gt;table1-field3,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And have save button, When i user click on save. Data shud entered in table1 and table2 respectively.&lt;/P&gt;&lt;P&gt;Can anybody give me sample coding for above situation&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pages: 1 	&lt;/P&gt;&lt;P&gt;Back to Thread List&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Jul 2007 19:55:34 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-17T19:55:34Z</dc:date>
    <item>
      <title>Entering value in database</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/entering-value-in-database/m-p/2514545#M568828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have single screen having following six fields..&lt;/P&gt;&lt;P&gt;table1-field1&lt;/P&gt;&lt;P&gt;table1-field2&lt;/P&gt;&lt;P&gt;table1-field3,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;table2-field1,&lt;/P&gt;&lt;P&gt;table2-field1,&lt;/P&gt;&lt;P&gt;table1-field3,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And have save button, When i user click on save. Data shud entered in table1 and table2 respectively.&lt;/P&gt;&lt;P&gt;Can anybody give me sample coding for above situation&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pages: 1 	&lt;/P&gt;&lt;P&gt;Back to Thread List&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jul 2007 19:55:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/entering-value-in-database/m-p/2514545#M568828</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-17T19:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: Entering value in database</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/entering-value-in-database/m-p/2514546#M568829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data: i_table1 like table1 occurs 0 with header line,&lt;/P&gt;&lt;P&gt;        i_table2 like table2 occurs 0 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your PAI USER_COMMAND routine&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHEN 'SAVE'.&lt;/P&gt;&lt;P&gt;move: table1-field1 to i_table1-field1,&lt;/P&gt;&lt;P&gt;table1-field2 to i_table1-field2,&lt;/P&gt;&lt;P&gt;table1-field3 to i_table1-field3.&lt;/P&gt;&lt;P&gt;append i_table1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;similarly do it for table2 and then you can save it to the database as follows&lt;/P&gt;&lt;P&gt;modify table1 from table i_table1.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jul 2007 21:30:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/entering-value-in-database/m-p/2514546#M568829</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-17T21:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: Entering value in database</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/entering-value-in-database/m-p/2514547#M568830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd structure it something along the following lines:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assuming in top include you have something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;tables:
  zmy_table1,
  zmy_table2,

data:
  begin of gs_table1,
    field1              like zmy_table1-field1,
    field2              like zmy_table1-field2,
    field3              like zmy_table1-field3,
  end of gs_table1,
  begin of gs_table2
    field1              like zmy_table2-field1,
    field2              like zmy_table2-field2,
    field3              like zmy_table2-field3,
  end of gs_table2.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and you have a "perform d9999_user_command" in your PAI:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  d9999_user_command
*&amp;amp;---------------------------------------------------------------------*
form d9999_user_command.
* Process use actions
  case sy-ucomm.
    when 'ZSAVE'.
      perform d9999_validate_screen.  "make sure data is clean
      perform d9999_save_data.        "insert in database

    when 'ZCHECK'
      perform d9999_validate_screen.  "make sure data is clean
* etc etc
  endcase.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  d9999_save_data
*&amp;amp;---------------------------------------------------------------------*
form d9999_save_data.
* Add to database
  data:
    ls_table1           like zmy_table1,
    ls_table2           like zmy_table2.

* ZMY_TABLE1:
* Move screen to local structure that matches DB table
  move-corresponding gs_table1 to ls_table1.
* fill in any gaps in table e.g. Created By &amp;amp; Date
  ls_table1-cr_user = sy-uname.
  ls_table1-cr_date = sy-datum.

  insert ls_table1 into zmy_table1.  "attempt DB insert

  if not sy-subrc is initial.  "handle exceptions
    rollback work.
    message s398(00) with 'Data insert error!' space space space.
    exit.
  endif.
*
* ZMY_TABLE2:
* Move screen to local structure that matches DB table
  move-corresponding gs_table2 to ls_table2.
* fill in any gaps in table e.g. Created By &amp;amp; Date
  ls_table2-cr_user = sy-uname.
  ls_table2-cr_date = sy-datum.

  insert ls_table2 into zmy_table2.  "attempt DB insert

  if not sy-subrc is initial.  "handle exceptions
    rollback work.
    message s398(00) with 'Data insert error!' space space space.
    exit.
  endif.

  commit work and wait.
  message s398(00) with 'Data saved!' space space space.

endform.                    "d9999_user_command&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2007 00:43:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/entering-value-in-database/m-p/2514547#M568830</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-18T00:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: Entering value in database</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/entering-value-in-database/m-p/2514548#M568831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2007 22:54:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/entering-value-in-database/m-p/2514548#M568831</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-18T22:54:48Z</dc:date>
    </item>
  </channel>
</rss>

