<?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: code formation in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-formation/m-p/1621625#M278135</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To do the delete correctly, you will need to use an index. Your read will go more quickly if you use a binary search:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&amp;lt;b&amp;gt;data tab_index like sy-tabix.&amp;lt;/b&amp;gt;
select * from z4b2 into table t_z4b2.

&amp;lt;b&amp;gt;SORT t_z4b2 BY tmpkey.&amp;lt;/b&amp;gt;

describe table msegtbl lines wrecord.
if wrecord &amp;gt; 0.
  loop at msegtbl.
&amp;lt;b&amp;gt;    tab_index = sy-tabix.&amp;lt;/b&amp;gt;
    clear tmpkey.
    move sy-mandt to tmpkey-mandt.
    move msegtbl-wmblnr to tmpkey-wmblnr.
    move msegtbl-wmjahr to tmpkey-wmjahr.
    move msegtbl-wzeile to tmpkey-wzeile.

    read table t_z4b2
      with key tmpkey
&amp;lt;b&amp;gt;      BINARY SEARCH.&amp;lt;/b&amp;gt;
    if sy-subrc = 0.
      delete msegtbl 
&amp;lt;b&amp;gt;        index tab_index.&amp;lt;/b&amp;gt;
    endif.
  endloop.
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Test thoroughly - I haven't done a syntax check on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also - this should probably have been posted on the performance tuning forum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OK - I see that you &amp;lt;b&amp;gt;did&amp;lt;/b&amp;gt; post this in the performance tuning forum as well as this one. In the future, please pick one forum. I'd rather not spend time thinking about a problem only to find that it's already been solved. &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Rob Burbank&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 15 Oct 2006 18:24:07 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-10-15T18:24:07Z</dc:date>
    <item>
      <title>code formation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-formation/m-p/1621622#M278132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Eswar,&lt;/P&gt;&lt;P&gt;could anyone check my code below and suggest the changes for it interms of performance wise and also the pattern of writting the code. i want to cross check my code before i go for testing&lt;/P&gt;&lt;P&gt;thanks in adance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form checkdata.&lt;/P&gt;&lt;P&gt;data: wrecord type i.&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt;begin of tmpkey,&lt;/P&gt;&lt;P&gt;mandt like sy-mandt,&lt;/P&gt;&lt;P&gt;wmblnr like mseg-mblnr, "Material Document Number&lt;/P&gt;&lt;P&gt;wmjahr like mseg-mjahr, "Material Document Year&lt;/P&gt;&lt;P&gt;wzeile like mseg-zeile, "Item in Material Document&lt;/P&gt;&lt;P&gt;end of tmpkey.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from z4b2 into table t_z4b2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;describe table msegtbl lines wrecord.&lt;/P&gt;&lt;P&gt;if wrecord &amp;gt; 0.&lt;/P&gt;&lt;P&gt;loop at msegtbl.&lt;/P&gt;&lt;P&gt;clear tmpkey.&lt;/P&gt;&lt;P&gt;move sy-mandt to tmpkey-mandt.&lt;/P&gt;&lt;P&gt;move msegtbl-wmblnr to tmpkey-wmblnr.&lt;/P&gt;&lt;P&gt;move msegtbl-wmjahr to tmpkey-wmjahr.&lt;/P&gt;&lt;P&gt;move msegtbl-wzeile to tmpkey-wzeile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table t_z4b2 with key tmpkey.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;delete msegtbl.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. "CheckDat&lt;/P&gt;&lt;P&gt;********************&lt;/P&gt;&lt;P&gt;form getibminfo.&lt;/P&gt;&lt;P&gt;data: wrecord type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;describe table msegtbl lines wrecord.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if wrecord &amp;gt; 0.&lt;/P&gt;&lt;P&gt;loop at msegtbl.&lt;/P&gt;&lt;P&gt;refresh: t_val_tab.&lt;/P&gt;&lt;P&gt;call function 'QC01_BATCH_VALUES_READ'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;i_val_matnr = msegtbl-wmatnr&lt;/P&gt;&lt;P&gt;i_val_werks = msegtbl-wwerks&lt;/P&gt;&lt;P&gt;i_val_charge = msegtbl-wcharg&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;t_val_tab = t_val_tab&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;no_class&lt;/P&gt;&lt;P&gt;internal_error&lt;/P&gt;&lt;P&gt;no_values&lt;/P&gt;&lt;P&gt;no_chars.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;read table t_val_tab with key atnam = 'SUBLOTTYPE'.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;if t_val_tab-atwrt eq sublottype.&lt;/P&gt;&lt;P&gt;move msegtbl to 4b2tbl.&lt;/P&gt;&lt;P&gt;append 4b2tbl.&lt;/P&gt;&lt;P&gt;clear 4b2tbl.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;refresh mkpftbl.&lt;/P&gt;&lt;P&gt;refresh msegtbl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. "GetIBMInfo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------" /&gt;&lt;P&gt;*&amp;amp; Form GetSeqNo&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form getseqno.&lt;/P&gt;&lt;P&gt;data: wcount(6) type n.&lt;/P&gt;&lt;P&gt;data: wrecord(6) type n.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;describe table t_z4b2 lines wrecord.&lt;/P&gt;&lt;P&gt;read table t_z4b2 index wrecord.&lt;/P&gt;&lt;P&gt;write t_z4b2-wseqno+5(6) to wrecord.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;wrecord = wrecord + 1.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;describe table 4b2tbl lines wcount.&lt;/P&gt;&lt;P&gt;if wcount &amp;gt; 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at 4b2tbl.&lt;/P&gt;&lt;P&gt;at new wmblnr. wrecord = wrecord + 1. endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate preatsg wrecord into 4b2tbl-wseqno.&lt;/P&gt;&lt;P&gt;modify 4b2tbl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move 4b2tbl to z4b2.&lt;/P&gt;&lt;P&gt;insert z4b2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear 4b2tbl.&lt;/P&gt;&lt;P&gt;clear z4b2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. "GetSeqNo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form PutInfo&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form putinfo.&lt;/P&gt;&lt;P&gt;data: wrecord type i.&lt;/P&gt;&lt;P&gt;data: dtmp1(10) type c.&lt;/P&gt;&lt;P&gt;data: dtmp2(8) type c.&lt;/P&gt;&lt;P&gt;data: ttmp1(8) type c.&lt;/P&gt;&lt;P&gt;data: ttmp2(6) type c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;describe table 4b2tbl lines wrecord.&lt;/P&gt;&lt;P&gt;if wrecord &amp;gt; 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at 4b2tbl.&lt;/P&gt;&lt;P&gt;write 4b2tbl-wbldat to dtmp1.&lt;/P&gt;&lt;P&gt;concatenate dtmp1&lt;EM&gt;6(4) dtmp1(2) dtmp1&lt;/EM&gt;3(2) into dtmp2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write 4b2tbl-wbldat to ttmp1.&lt;/P&gt;&lt;P&gt;concatenate ttmp1&lt;EM&gt;0(2) ttmp1&lt;/EM&gt;3(2) ttmp1+6(2) into ttmp2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate dtmp2 'T' ttmp2 '.000Z' into datetime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at new wmblnr.&lt;/P&gt;&lt;P&gt;refresh wlines.&lt;/P&gt;&lt;P&gt;perform writeline1.&lt;/P&gt;&lt;P&gt;perform writeline2_1.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform writeline2_2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_seqno = 4b2tbl-wseqno.&lt;/P&gt;&lt;P&gt;at end of wmblnr.&lt;/P&gt;&lt;P&gt;perform writeline2_3.&lt;/P&gt;&lt;P&gt;perform writeline3.&lt;/P&gt;&lt;P&gt;perform writefile.&lt;/P&gt;&lt;P&gt;endat.&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;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. "PutInfo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Oct 2006 09:35:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-formation/m-p/1621622#M278132</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-15T09:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: code formation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-formation/m-p/1621623#M278133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data : t_z4b2 type sorted table z4b2 with non-unique key wmblnr wmjahr wzeile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select wmblnr wmjahr wzeile into corresponding fields of table t_z4b2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not msegtbl is initial.&lt;/P&gt;&lt;P&gt;loop at msegtbl assigning &amp;lt;l_msegtbl&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table t_z4b2 assigning &amp;lt;l_z4b2&amp;gt;&lt;/P&gt;&lt;P&gt;             with table key wmblnr = &amp;lt;l_z4b2&amp;gt;-wmblnr&lt;/P&gt;&lt;P&gt;                            wmjahr =  &amp;lt;l_z4b2&amp;gt;-wmjahr&lt;/P&gt;&lt;P&gt;                            wzeile = &amp;lt;l_z4b2&amp;gt;-wzeile.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;delete msegtbl.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. "CheckDat&lt;/P&gt;&lt;P&gt;********************&lt;/P&gt;&lt;P&gt;form getibminfo.&lt;/P&gt;&lt;P&gt;data: wrecord type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dat : tl_val_tab_temp sort by wmatnr wwerks wcharg.&lt;/P&gt;&lt;P&gt;      tl_val_tab  sort by atnam.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;if not msegtbl is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at msegtbl assigning &amp;lt;l_msegtbl&amp;gt;.&lt;/P&gt;&lt;P&gt;read table tl_val_tab_temp assigning &amp;lt;l_val_tab&amp;gt; with table key&lt;/P&gt;&lt;P&gt;wmatnr = &amp;lt;l_msegtbl&amp;gt;-wmatnr&lt;/P&gt;&lt;P&gt;wwerks = &amp;lt;l_msegtbl&amp;gt;-wwerks&lt;/P&gt;&lt;P&gt;wcharg = &amp;lt;l_msegtbl&amp;gt;-wcharg.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;refresh: t_val_tab.&lt;/P&gt;&lt;P&gt;call function 'QC01_BATCH_VALUES_READ'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;i_val_matnr = &amp;lt;l_msegtbl&amp;gt;-wmatnr&lt;/P&gt;&lt;P&gt;i_val_werks = &amp;lt;l_msegtbl&amp;gt;-wwerks&lt;/P&gt;&lt;P&gt;i_val_charge = &amp;lt;l_msegtbl&amp;gt;-wcharg&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;t_val_tab = t_val_tab&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;no_class&lt;/P&gt;&lt;P&gt;internal_error&lt;/P&gt;&lt;P&gt;no_values&lt;/P&gt;&lt;P&gt;no_chars.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;insert lines of t_val_tab into table tl_val_tab.&lt;/P&gt;&lt;P&gt;insert lines of t_val_tab into table tl_val_tab_temp.&lt;/P&gt;&lt;P&gt;read table tl_val_tab assigning &amp;lt;l_val_tab&amp;gt; with table key atnam = 'SUBLOTTYPE'.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;if &amp;lt;l_val_tab&amp;gt;-atwrt eq sublottype.&lt;/P&gt;&lt;P&gt;move msegtbl to wa_4b2tbl.&lt;/P&gt;&lt;P&gt;append wa_4b2tbl to 4b2tbl.&lt;/P&gt;&lt;P&gt;clear wa_4b2tbl.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;refresh mkpftbl.&lt;/P&gt;&lt;P&gt;refresh msegtbl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;free : tl_val_tab,tl_val_tab_temp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. "GetIBMInfo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------" /&gt;&lt;P&gt;*&amp;amp; Form GetSeqNo&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form getseqno.&lt;/P&gt;&lt;P&gt;data: wcount(6) type n.&lt;/P&gt;&lt;P&gt;data: wrecord(6) type n.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;describe table t_z4b2 lines wrecord.&lt;/P&gt;&lt;P&gt;read table t_z4b2 index wrecord.&lt;/P&gt;&lt;P&gt;write t_z4b2-wseqno+5(6) to wrecord.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;wrecord = wrecord + 1.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not 4b2tbl is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at 4b2tbl assigning &amp;lt;l_4b2tbl&amp;gt;.&lt;/P&gt;&lt;P&gt;at new wmblnr. wrecord = wrecord + 1. endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate preatsg wrecord into &amp;lt;l_4b2tbl&amp;gt;-wseqno.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move 4b2tbl to z4b2.&lt;/P&gt;&lt;P&gt;insert z4b2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear 4b2tbl.&lt;/P&gt;&lt;P&gt;clear z4b2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. "GetSeqNo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Form PutInfo&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form putinfo.&lt;/P&gt;&lt;P&gt;data: wrecord type i.&lt;/P&gt;&lt;P&gt;data: dtmp1(10) type c.&lt;/P&gt;&lt;P&gt;data: dtmp2(8) type c.&lt;/P&gt;&lt;P&gt;data: ttmp1(8) type c.&lt;/P&gt;&lt;P&gt;data: ttmp2(6) type c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not 4b2tbl is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at 4b2tbl.&lt;/P&gt;&lt;P&gt;write 4b2tbl-wbldat to dtmp1.&lt;/P&gt;&lt;P&gt;concatenate dtmp1&lt;EM&gt;6(4) dtmp1(2) dtmp1&lt;/EM&gt;3(2) into dtmp2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write 4b2tbl-wbldat to ttmp1.&lt;/P&gt;&lt;P&gt;concatenate ttmp1&lt;EM&gt;0(2) ttmp1&lt;/EM&gt;3(2) ttmp1+6(2) into ttmp2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate dtmp2 'T' ttmp2 '.000Z' into datetime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at new wmblnr.&lt;/P&gt;&lt;P&gt;refresh wlines.&lt;/P&gt;&lt;P&gt;perform writeline1.&lt;/P&gt;&lt;P&gt;perform writeline2_1.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;perform writeline2_2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_seqno = 4b2tbl-wseqno.&lt;/P&gt;&lt;P&gt;at end of wmblnr.&lt;/P&gt;&lt;P&gt;perform writeline2_3.&lt;/P&gt;&lt;P&gt;perform writeline3.&lt;/P&gt;&lt;P&gt;perform writefile.&lt;/P&gt;&lt;P&gt;endat.&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;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. "PutInfo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Oct 2006 09:43:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-formation/m-p/1621623#M278133</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-15T09:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: code formation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-formation/m-p/1621624#M278134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nihi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Please see if you can avoid looping the same internal multiple times. This can cause problem when data is huge.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An example of converting your first two subroutines in one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;form check_get_ibminfo.
  
  select * from z4b2 into table t_z4b2.
  sort t_z4b2 by wmblnr wmjahr wzeile.
  
  if not msegtbl[] is initial.
   loop at msegtbl.
     read table t_z4b2 with key wmblnr = msegtbl-wmblnr
                                wmjahr = msegtbl-wmjahr
                                wzeile = msegtbl-wzeile
                                binary search.
     if sy-subrc eq 0.
        delete msegtbl.
        continue.
     endif.
     
     refresh; t_val_tab.
     call function 'QC01_BATCH_VALUES_READ'
     EXPORTING
       i_val_matnr = msegtbl-wmatnr
       i_val_werks = msegtbl-wwerks
       i_val_charge = msegtbl-wcharg
     TABLES
       t_val_tab = t_val_tab
     EXCEPTIONS
       no_class
       internal_error
       no_values
       no_chars.
     
     if sy-subrc = 0.
        read table t_val_tab with key atnam = 'SUBLOTTYPE'.
        if sy-subrc = 0 and t_val_tab-atwrt eq sublottype.
           move msegtbl to 4b2tbl.
           append 4b2tbl.
           clear 4b2tbl.
        endif.
     endif.
   endloop.
  endif.
  
endform.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  I guess this will still serve the purpose. Please check for the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Am not on SAP, so please bear incase of any syntax errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;Eswar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Oct 2006 10:13:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-formation/m-p/1621624#M278134</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-15T10:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: code formation</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/code-formation/m-p/1621625#M278135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To do the delete correctly, you will need to use an index. Your read will go more quickly if you use a binary search:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&amp;lt;b&amp;gt;data tab_index like sy-tabix.&amp;lt;/b&amp;gt;
select * from z4b2 into table t_z4b2.

&amp;lt;b&amp;gt;SORT t_z4b2 BY tmpkey.&amp;lt;/b&amp;gt;

describe table msegtbl lines wrecord.
if wrecord &amp;gt; 0.
  loop at msegtbl.
&amp;lt;b&amp;gt;    tab_index = sy-tabix.&amp;lt;/b&amp;gt;
    clear tmpkey.
    move sy-mandt to tmpkey-mandt.
    move msegtbl-wmblnr to tmpkey-wmblnr.
    move msegtbl-wmjahr to tmpkey-wmjahr.
    move msegtbl-wzeile to tmpkey-wzeile.

    read table t_z4b2
      with key tmpkey
&amp;lt;b&amp;gt;      BINARY SEARCH.&amp;lt;/b&amp;gt;
    if sy-subrc = 0.
      delete msegtbl 
&amp;lt;b&amp;gt;        index tab_index.&amp;lt;/b&amp;gt;
    endif.
  endloop.
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Test thoroughly - I haven't done a syntax check on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also - this should probably have been posted on the performance tuning forum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OK - I see that you &amp;lt;b&amp;gt;did&amp;lt;/b&amp;gt; post this in the performance tuning forum as well as this one. In the future, please pick one forum. I'd rather not spend time thinking about a problem only to find that it's already been solved. &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Rob Burbank&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Oct 2006 18:24:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/code-formation/m-p/1621625#M278135</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-15T18:24:07Z</dc:date>
    </item>
  </channel>
</rss>

