<?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 table modification problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-modification-problem/m-p/1738368#M321017</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 one problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose I have two delivery doc no &amp;amp; delivery item. Now i m getting the delivery quantity  from lips table based on delivery doc no &amp;amp; delivery item.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i have to modify my same table having field delivery qty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sample coding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of ty_str,&lt;/P&gt;&lt;P&gt;         del_doc like vbfa-vbeln,&lt;/P&gt;&lt;P&gt;         del_item like vbfa-posnn,&lt;/P&gt;&lt;P&gt;         lfimg like lips-lfimg,&lt;/P&gt;&lt;P&gt;         end of ty_str.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: gt_str like table of ty_str,&lt;/P&gt;&lt;P&gt;         gs_str like line of gt_str.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*consider my records r in gt_str.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at gt_str into gs_str.&lt;/P&gt;&lt;P&gt;select single lfimg from lips into lv_lfimg where vbeln = gs_str-del_doc&lt;/P&gt;&lt;P&gt;			                and    posnr = gs_str-del_item.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*now i wanted to modify the field lfimg in table gt_str  based on del_doc &amp;amp; del_item.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any body will pls suggest me the solution.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 31 Dec 2006 04:33:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-12-31T04:33:51Z</dc:date>
    <item>
      <title>table modification problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-modification-problem/m-p/1738368#M321017</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 one problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose I have two delivery doc no &amp;amp; delivery item. Now i m getting the delivery quantity  from lips table based on delivery doc no &amp;amp; delivery item.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i have to modify my same table having field delivery qty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sample coding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of ty_str,&lt;/P&gt;&lt;P&gt;         del_doc like vbfa-vbeln,&lt;/P&gt;&lt;P&gt;         del_item like vbfa-posnn,&lt;/P&gt;&lt;P&gt;         lfimg like lips-lfimg,&lt;/P&gt;&lt;P&gt;         end of ty_str.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: gt_str like table of ty_str,&lt;/P&gt;&lt;P&gt;         gs_str like line of gt_str.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*consider my records r in gt_str.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at gt_str into gs_str.&lt;/P&gt;&lt;P&gt;select single lfimg from lips into lv_lfimg where vbeln = gs_str-del_doc&lt;/P&gt;&lt;P&gt;			                and    posnr = gs_str-del_item.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*now i wanted to modify the field lfimg in table gt_str  based on del_doc &amp;amp; del_item.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any body will pls suggest me the solution.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 31 Dec 2006 04:33:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-modification-problem/m-p/1738368#M321017</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-31T04:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: table modification problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-modification-problem/m-p/1738369#M321018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Neha&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Simply modify your itab like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at gt_str into gs_str.
select single lfimg from lips into lv_lfimg 
  where vbeln = gs_str-del_doc
  and posnr   = gs_str-del_item.

*now i wanted to modify the field lfimg in table gt_str based on del_doc &amp;amp; del_item.
  IF ( syst-subrc = 0 ).
    gs_str-lfimg = lv_lfimg.
    MODIFY gt_str FROM gs_str.
  ENDIF.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would suggest the following simplification:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at gt_str into gs_str.
select single lfimg from lips into gs_str-lifmg     " lv_lfimg 
  where vbeln = gs_str-del_doc
  and posnr   = gs_str-del_item.

*now i wanted to modify the field lfimg in table gt_str based on del_doc &amp;amp; del_item.
  IF ( syst-subrc = 0 ).
    MODIFY gt_str FROM gs_str.
  ENDIF.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Furthermore, if you have many records in gt_str then you should replace the SELECT SINGLE with an array fetch:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:
  gt_tmp    TYPE TABLE of ty_str,
  gs_tmp   TYPE ty_str.

IF ( gt_str IS NOT INITIAL ).
  SELECT * FROM lips INTO CORRESPONDING FIELDS OF TABLE gt_tmp
    FOR ALL ENTRIES IN gt_str
    WHERE vbeln = gs_str-del_doc
    AND      posnr = gs_str-del_item.
ENDIF.

SORT gt_tmp BY vbeln posnr.  " for BINARY SEARCH

loop at gt_str into gs_str.
  READ gt_tmp INTO gs_tmp
    WITH KEY vbeln = gs_str-del_doc
                     posnr = gs_str-del_item
    BINARY SEARCH.

*now i wanted to modify the field lfimg in table gt_str based on del_doc &amp;amp; del_item.
  IF ( syst-subrc = 0 ).
    MODIFY gt_str FROM gs_tmp.    " gs_str.
  ENDIF.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 31 Dec 2006 05:21:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-modification-problem/m-p/1738369#M321018</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2006-12-31T05:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: table modification problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-modification-problem/m-p/1738370#M321019</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;    1)   select the fields outside the loop.&lt;/P&gt;&lt;P&gt;    2)   Then loop into the itab into work area and modify the itab using&lt;/P&gt;&lt;P&gt;    3)   MODIFY ITAB TRANSPORTING &amp;lt; key fields in table &amp;gt;.&lt;/P&gt;&lt;P&gt;         This modify statement would help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 31 Dec 2006 05:24:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-modification-problem/m-p/1738370#M321019</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-31T05:24:37Z</dc:date>
    </item>
  </channel>
</rss>

