<?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: updating table. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-table/m-p/3170769#M754528</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 need some clarifications,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what is this v_bktxt will it comes from the internal table t_bseg ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sreeram.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Dec 2007 14:31:21 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-12-19T14:31:21Z</dc:date>
    <item>
      <title>updating table.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-table/m-p/3170768#M754527</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;     my issue is updating ztable which i have created . this table gets updated with records after processing a batch session. batch session is for posting FI documents. ztable gets updated with the document number after processing the session. when there is only one transaction per session the ztable is getting updated with the respestive document no. but they r multiple transactions per session i.e multiple FI documents r created its updating the table with only document no. i.e first FI document no.. please help me in resolving this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : v_bktxt like bkpf-bktxt.&lt;/P&gt;&lt;P&gt;ata: v_cnt(5) type n value 0,&lt;/P&gt;&lt;P&gt;      v_cnt1(5) type n value 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; v_cnt = v_cnt + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  loop at t_bseg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   if v_bktxt(1) EQ '1'.&lt;/P&gt;&lt;P&gt;      move: v_cnt to zbatch_log-cnt,&lt;/P&gt;&lt;P&gt;            v_bktxt+1(10) to zbatch_log-batchid,&lt;/P&gt;&lt;P&gt;            t_bseg-belnr to zbatch_log-belnr1.&lt;/P&gt;&lt;P&gt;      insert zbatch_log.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the basic code. what i was suggested to do is &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if v_bktxt ( 1 )  EQ '1'&lt;/P&gt;&lt;P&gt;then check whether batchidno. exists in zbatch_log table&lt;/P&gt;&lt;P&gt;if NO &lt;/P&gt;&lt;P&gt;then move v_cnt, v_bktxt, t_bseg-belnr to zbatch_log table(my ztable).&lt;/P&gt;&lt;P&gt;if YES&lt;/P&gt;&lt;P&gt;then check the last value of v_cnt in zbatch_log table .&lt;/P&gt;&lt;P&gt;store it ina variable .&lt;/P&gt;&lt;P&gt;then move v_bktxt, t_bseg-belnr and increment the stored variable and increment the counter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am not getting how to chech the ztable table whether the entries r already there r not please help me with this code.&lt;/P&gt;&lt;P&gt;(in my ztable v_cnt and batchid are primary keys)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Dec 2007 13:40:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-table/m-p/3170768#M754527</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-19T13:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: updating table.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-table/m-p/3170769#M754528</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 need some clarifications,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what is this v_bktxt will it comes from the internal table t_bseg ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sreeram.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Dec 2007 14:31:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-table/m-p/3170769#M754528</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-19T14:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: updating table.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-table/m-p/3170770#M754529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;v_bktxt is not fram the table t_bseg.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Dec 2007 15:15:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-table/m-p/3170770#M754529</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-19T15:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: updating table.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-table/m-p/3170771#M754530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To find out, if there already is an entry in your ztable, do the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if v_bktxt(1) EQ '1'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lv_batchid = v_bktxt+1(10).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single max( cnt ) &lt;/P&gt;&lt;P&gt;       from zbatch_log&lt;/P&gt;&lt;P&gt;       into lv_max_count&lt;/P&gt;&lt;P&gt;       where batchid eq lv_batchid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;there already is an entry and lv_max_count will contain the highest number of the entries - just add one to that number and insert your entry&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;else.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;there is no entry yet in your table =&amp;gt; insert the first one&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Dec 2007 15:23:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-table/m-p/3170771#M754530</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-19T15:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: updating table.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/updating-table/m-p/3170772#M754531</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;most of the times code review point of view they will not allow select statement inside the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i think the primary key's of your Ztable are not inthe table t_bseg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do one thing before your loop at t_bseg, select all entries from your ZTABLE into some internal table ex: T_ZTAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE:- sort T_ZTAB by v_cnt batchid DESCENDING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at T_BSEG.&lt;/P&gt;&lt;P&gt;     read table T_ZTAB with key cnt = v_cnt&lt;/P&gt;&lt;P&gt;                                        batchid = v_bktxt+1(10).&lt;/P&gt;&lt;P&gt;     if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;        don't insert.&lt;/P&gt;&lt;P&gt;     else.&lt;/P&gt;&lt;P&gt;        insert that record into your ZTABLE.&lt;/P&gt;&lt;P&gt;     endif.&lt;/P&gt;&lt;P&gt;end loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sreeram.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Dec 2007 16:17:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/updating-table/m-p/3170772#M754531</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-19T16:17:28Z</dc:date>
    </item>
  </channel>
</rss>

