<?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: Set initial value in a table field in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/set-initial-value-in-a-table-field/m-p/6953214#M1488991</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;try this code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

if sy-subrc = 0 .
clear ls_pa0105-usrid.
else.
ls_pa0105-usrid = p_val.
endif.

Modify pa0105 from ls_pa0105.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 May 2010 11:56:08 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-05-27T11:56:08Z</dc:date>
    <item>
      <title>Set initial value in a table field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/set-initial-value-in-a-table-field/m-p/6953213#M1488990</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 to test some programs and want to clear values in tables to check the behavior of a program when dealing with initial values.&lt;/P&gt;&lt;P&gt;I using this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters: p_pernr type pa0105-pernr,&lt;/P&gt;&lt;P&gt;            p_val   type pa0105-usrid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: ls_pa0105 type pa0105.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single * from pa0105 into ls_pa0105&lt;/P&gt;&lt;P&gt;       where subty = '0001'&lt;/P&gt;&lt;P&gt;       and pernr = p_pernr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    if p_val is initial.&lt;/P&gt;&lt;P&gt;       clear ls_pa0105-usrid.&lt;/P&gt;&lt;P&gt;    else.&lt;/P&gt;&lt;P&gt;      ls_pa0105-usrid = p_val.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    modify pa0105 from ls_pa0105.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works if I put a value in p_val but it does nothing if I leave p_val initial.&lt;/P&gt;&lt;P&gt;Even if I clear the field, when I execute the modify, nothing has change in the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 May 2010 11:49:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/set-initial-value-in-a-table-field/m-p/6953213#M1488990</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-27T11:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: Set initial value in a table field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/set-initial-value-in-a-table-field/m-p/6953214#M1488991</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;try this code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

if sy-subrc = 0 .
clear ls_pa0105-usrid.
else.
ls_pa0105-usrid = p_val.
endif.

Modify pa0105 from ls_pa0105.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 May 2010 11:56:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/set-initial-value-in-a-table-field/m-p/6953214#M1488991</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-27T11:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: Set initial value in a table field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/set-initial-value-in-a-table-field/m-p/6953215#M1488992</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;It's the same code has I have tried, except for the p_val checking.&lt;/P&gt;&lt;P&gt;Checking p_val is not the problem, I debug the program and it goes through the clearing and modify part of the program.&lt;/P&gt;&lt;P&gt;In the debugger I can see that the usrid field is empty, but this does nothing in the table itself.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 May 2010 12:08:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/set-initial-value-in-a-table-field/m-p/6953215#M1488992</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-27T12:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Set initial value in a table field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/set-initial-value-in-a-table-field/m-p/6953216#M1488993</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;try the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single * from pa0105 into ls_pa0105&lt;/P&gt;&lt;P&gt;where subty = '0001'&lt;/P&gt;&lt;P&gt;and pernr = p_pernr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if p_val is initial.&lt;/P&gt;&lt;P&gt;clear ls_pa0105-usrid.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;ls_pa0105-usrid = p_val.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;modify pa0105 from ls_pa0105 TRANSPORTING USRID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Shruti&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 May 2010 12:21:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/set-initial-value-in-a-table-field/m-p/6953216#M1488993</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-27T12:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: Set initial value in a table field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/set-initial-value-in-a-table-field/m-p/6953217#M1488994</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;This works only for an internal table, I'm updating a database table.&lt;/P&gt;&lt;P&gt;If I put this I get a syntax error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 May 2010 12:29:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/set-initial-value-in-a-table-field/m-p/6953217#M1488994</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-27T12:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: Set initial value in a table field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/set-initial-value-in-a-table-field/m-p/6953218#M1488995</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 tried implementing this in my system with the code below, which seems to work fine. Here, the table tbl5 has 2 columns PARAMNAME and PARAMVALUE. The PARAMVALUE initially has the value 'X' which is cleared in the program and the database table is modified corretly. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check if you are missing out something by refering this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: wa_tbl5 type tbl5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single * from  tbl5 into wa_tbl5&lt;/P&gt;&lt;P&gt;where paramname = 'param1'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear wa_tbl5-PARAMVALUE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;modify tbl5 from tbl5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;write: 'success'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;write:/ 'fail'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sowmiya M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 May 2010 13:03:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/set-initial-value-in-a-table-field/m-p/6953218#M1488995</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-27T13:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: Set initial value in a table field</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/set-initial-value-in-a-table-field/m-p/6953219#M1488996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How silly of me,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had multiple rows in that table so I was actually writing to one row and the other program was reading the other row!&lt;/P&gt;&lt;P&gt;My code was working all this time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks all for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 May 2010 13:18:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/set-initial-value-in-a-table-field/m-p/6953219#M1488996</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-05-27T13:18:06Z</dc:date>
    </item>
  </channel>
</rss>

