<?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: will this code work in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/will-this-code-work/m-p/1642090#M285944</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One more sugestion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now u r writing for seperate LOOPS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can put all those Four READ statemnts in one siingle LOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After all READ and MOVE statement give the MODIFY statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So that u can avoid that four times looping&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at lt_ordsent into ls_ordsent.&lt;/P&gt;&lt;P&gt;Read table lt_ship into ls_ship with key vbeln = ls_ordsent-ordnr.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;Move ls_ship-kunnr to ls_ordsent-kunnr.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read table lt_material into ls_material with key vbeln = ls_ordsent-ordnr.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0..&lt;/P&gt;&lt;P&gt;Move ls_material-matnr to ls_ordsent-matnr. &lt;/P&gt;&lt;P&gt;Move ls_material-kwmeng to ls_ordsent-kwmeng.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read table lt_ddate into ls_ddate with key vbeln = ls_ordsent-ordnr.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;Move ls_ddate-edatu to ls_ordsent-edatu.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read table lt_order into ls_order with key vbeln = ls_ordsent-ordnr.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;Move ls_order-vbeln to ls_ordsent-vbeln.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Modify lt_ordsent from ls_ordsent.&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds&lt;/P&gt;&lt;P&gt;Anver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 26 Nov 2006 09:20:01 GMT</pubDate>
    <dc:creator>anversha_s</dc:creator>
    <dc:date>2006-11-26T09:20:01Z</dc:date>
    <item>
      <title>will this code work</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/will-this-code-work/m-p/1642088#M285942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Types : begin of ts_ordsent,&lt;/P&gt;&lt;P&gt;		Ordnr type ztsd2marc,&lt;/P&gt;&lt;P&gt;		Kunnr type vbpa-kunnr,&lt;/P&gt;&lt;P&gt;		Matnr type vbap-matnr,&lt;/P&gt;&lt;P&gt;Kwmeng type vbap-kwmeng,&lt;/P&gt;&lt;P&gt;Edatu type vbep-edatu,&lt;/P&gt;&lt;P&gt;Vbeln type vbak-vbeln,&lt;/P&gt;&lt;P&gt;	End of ts_ordsent,&lt;/P&gt;&lt;P&gt;	Tt_ordsent type table of  ts_ordsent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Types :begin of ts_ship,&lt;/P&gt;&lt;P&gt;		Vbenl type vbak-vbeln,&lt;/P&gt;&lt;P&gt;		Kunnr type vbpa-kunnr,&lt;/P&gt;&lt;P&gt;	End of ts_ship,&lt;/P&gt;&lt;P&gt;Tt_ship type standard table of ts_ship.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Types :begin of ts_material,&lt;/P&gt;&lt;P&gt;		Vbenl type vbak-vbeln,&lt;/P&gt;&lt;P&gt;		matnr type vbap-matnr,&lt;/P&gt;&lt;P&gt;		kwmeng type vbap-kwmeng,&lt;/P&gt;&lt;P&gt;	End of ts_material,&lt;/P&gt;&lt;P&gt;Tt_material type standard table of ts_material.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Types :begin of ts_ddate,&lt;/P&gt;&lt;P&gt;		Vbenl type vbak-vbeln,&lt;/P&gt;&lt;P&gt;		edatu type vbep-edatu,&lt;/P&gt;&lt;P&gt;	End of ts_ddate,&lt;/P&gt;&lt;P&gt;Tt_ddate type standard table of ts_ddate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Types :begin of ts_order,&lt;/P&gt;&lt;P&gt;		Vbenl type vbak-vbeln,&lt;/P&gt;&lt;P&gt;		vkorg type vbak-vkorg,&lt;/P&gt;&lt;P&gt;	End of ts_order,&lt;/P&gt;&lt;P&gt;Tt_order type standard table of ts_order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data : ls_ordsent type ts_ordsent,&lt;/P&gt;&lt;P&gt;	Ls_ship type ts_ship,&lt;/P&gt;&lt;P&gt;	Ls_material type ts_material,&lt;/P&gt;&lt;P&gt;	Ls_ddate type ts_ddate,&lt;/P&gt;&lt;P&gt;	Ls_order type ls_order,&lt;/P&gt;&lt;P&gt;lt_ordsent type tt_ordsent,&lt;/P&gt;&lt;P&gt;	Lt_ship type tt_ship,&lt;/P&gt;&lt;P&gt;	Lt_material type tt_material,&lt;/P&gt;&lt;P&gt;	Lt_ddate type tt_ddate,&lt;/P&gt;&lt;P&gt;	Lt_order type lt_order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS:  pa_sotg type vbak-vkorg,&lt;/P&gt;&lt;P&gt;		     Pa_dpln type vbap-werks.&lt;/P&gt;&lt;P&gt;Select-options : so_shpt for vbpa-kunnr,&lt;/P&gt;&lt;P&gt;		  So_ddat for vbep-edatu.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK b2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select ordnr from ztsd2marc&lt;/P&gt;&lt;P&gt;Into corresponding fields of table lt_ordsent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select vbeln kunnr from vbpa&lt;/P&gt;&lt;P&gt;Into corresponding fields of table lt_ship&lt;/P&gt;&lt;P&gt;For all entries in lt_ordsent&lt;/P&gt;&lt;P&gt;Where kunnr in so_shpt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select vbeln matnr kwmeng from vbap&lt;/P&gt;&lt;P&gt;Into corresponding fields of table lt_material&lt;/P&gt;&lt;P&gt;For all entries in lt_ordsent&lt;/P&gt;&lt;P&gt;Where werks = pa_dpln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select vbeln edatu from vbep&lt;/P&gt;&lt;P&gt;Into corresponding fields of table lt_ddate&lt;/P&gt;&lt;P&gt;For all entries in lt_ordsent&lt;/P&gt;&lt;P&gt;Where edatu  in so_ddat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select vbeln vkorg from vbak&lt;/P&gt;&lt;P&gt;Into corresponding fields of table lt_order&lt;/P&gt;&lt;P&gt;For all entries in lt_ordsent&lt;/P&gt;&lt;P&gt;Where .vkorg = pa_sorg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at lt_ordsent into ls_ordsent.&lt;/P&gt;&lt;P&gt;	Read table lt_ship into ls_ship with key vbeln = ls_ordsent-ordnr.&lt;/P&gt;&lt;P&gt;	Check sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;		Move ls_ship-kunnr to ls_ordsent-kunnr.&lt;/P&gt;&lt;P&gt;	Modify lt_ordsent from ls_ordsent.&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;Loop at lt_ordsent into ls_ordsent.&lt;/P&gt;&lt;P&gt;	Read table lt_material into ls_material with key vbeln = ls_ordsent-ordnr.&lt;/P&gt;&lt;P&gt;	Check sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;		Move ls_material-matnr to ls_ordsent-matnr.		&lt;/P&gt;&lt;P&gt;		Move ls_material-kwmeng to ls_ordsent-kwmeng.&lt;/P&gt;&lt;P&gt;	Modify lt_ordsent from ls_ordsent.&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;&lt;/P&gt;&lt;P&gt;Loop at lt_ordsent into ls_ordsent.&lt;/P&gt;&lt;P&gt;	Read table lt_ddate into ls_ddate with key vbeln = ls_ordsent-ordnr.&lt;/P&gt;&lt;P&gt;	Check sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;		Move ls_ddate-edatu to ls_ordsent-edatu.&lt;/P&gt;&lt;P&gt;	Modify lt_ordsent from ls_ordsent.&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;Loop at lt_ordsent into ls_ordsent.&lt;/P&gt;&lt;P&gt;	Read table lt_order into ls_order with key vbeln = ls_ordsent-ordnr.&lt;/P&gt;&lt;P&gt;	Check sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;		Move ls_order-vbeln to  ls_ordsent-vbeln.&lt;/P&gt;&lt;P&gt;	Modify lt_ordsent from ls_ordsent.&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;then display it in avl format.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Nov 2006 09:08:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/will-this-code-work/m-p/1642088#M285942</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-26T09:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: will this code work</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/will-this-code-work/m-p/1642089#M285943</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 to avoid that INTO CORRESPONDING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create internal table with only fields you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then use INTO TABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;otherwise its seems ok.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds&lt;/P&gt;&lt;P&gt;Anver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Nov 2006 09:12:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/will-this-code-work/m-p/1642089#M285943</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2006-11-26T09:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: will this code work</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/will-this-code-work/m-p/1642090#M285944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One more sugestion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now u r writing for seperate LOOPS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can put all those Four READ statemnts in one siingle LOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After all READ and MOVE statement give the MODIFY statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So that u can avoid that four times looping&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at lt_ordsent into ls_ordsent.&lt;/P&gt;&lt;P&gt;Read table lt_ship into ls_ship with key vbeln = ls_ordsent-ordnr.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;Move ls_ship-kunnr to ls_ordsent-kunnr.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read table lt_material into ls_material with key vbeln = ls_ordsent-ordnr.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0..&lt;/P&gt;&lt;P&gt;Move ls_material-matnr to ls_ordsent-matnr. &lt;/P&gt;&lt;P&gt;Move ls_material-kwmeng to ls_ordsent-kwmeng.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read table lt_ddate into ls_ddate with key vbeln = ls_ordsent-ordnr.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;Move ls_ddate-edatu to ls_ordsent-edatu.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read table lt_order into ls_order with key vbeln = ls_ordsent-ordnr.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;Move ls_order-vbeln to ls_ordsent-vbeln.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Modify lt_ordsent from ls_ordsent.&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds&lt;/P&gt;&lt;P&gt;Anver&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Nov 2006 09:20:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/will-this-code-work/m-p/1642090#M285944</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2006-11-26T09:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: will this code work</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/will-this-code-work/m-p/1642091#M285945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI neha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I donno wat is given in ztsd2marc but few changes in this code are u have given select options but tables are not defined like vbpa  and vbep and structures have some naming errors and read data is done witout transporting any field u can over come this by typing 'transporting any '.finally u want thjis in alv , in that case define alv types like field naes,position ets, hope u know that&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Nov 2006 09:20:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/will-this-code-work/m-p/1642091#M285945</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-26T09:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: will this code work</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/will-this-code-work/m-p/1642092#M285946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If there is &amp;lt;b&amp;gt;1:1 relation between all table&amp;lt;/b&amp;gt; entries you have here,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then you &amp;lt;b&amp;gt;need not use 4 LOOPS for that&amp;lt;/b&amp;gt;. Just you one as below,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at lt_ordsent into ls_ordsent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read table lt_ship into ls_ship with key vbeln = ls_ordsent-ordnr.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;Move ls_ship-kunnr to ls_ordsent-kunnr.&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;Read table lt_material into ls_material with key vbeln = ls_ordsent-ordnr.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;Move ls_material-matnr to ls_ordsent-matnr.&lt;/P&gt;&lt;P&gt;Move ls_material-kwmeng to ls_ordsent-kwmeng.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read table lt_ddate into ls_ddate with key vbeln = ls_ordsent-ordnr.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;Move ls_ddate-edatu to ls_ordsent-edatu.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read table lt_order into ls_order with key vbeln = ls_ordsent-ordnr.&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;Move ls_order-vbeln to ls_ordsent-vbeln.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Modify lt_ordsent from ls_ordsent.&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;The &amp;lt;b&amp;gt;execution time will be very less&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Kathirvel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Nov 2006 09:26:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/will-this-code-work/m-p/1642092#M285946</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-26T09:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: will this code work</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/will-this-code-work/m-p/1642093#M285947</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;You should correct the lines of your codes where u use FOR ALL ENTRIES option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It doesn't make sense to use FOR ALL ENTRIES and not to use the table in WHERE condition. For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;      ERROR &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;*
SELECT VBELN KUNNR FROM VBPA
    INTO CORRESPONDING FIELDS OF TABLE LT_SHIP     
        FOR ALL ENTRIES IN LT_ORDSENT
* U have to indicate a condtion for the table used in
* FOR ALL ENTRIES:        
          WHERE VBELN IN LT_ORDSENT-ORDNR "???????????
            AND KUNNR IN SO_SHPT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following considerations are to improve the performance:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- If the internal table you're using in the select has the same fields you're finding out it's better to use only INTO TABLE statamente instead of INTO CORRISPONDING FIELDS OF TABLE:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT VBELN KUNNR FROM VBPA
    INTO TABLE LT_SHIP     
        FOR ALL ENTRIES IN LT_ORDSENT     
          WHERE VBELN IN LT_ORDSENT-ORDNR "???????????
            AND KUNNR IN SO_SHPT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- U can do only one big loop instead of several loop of the same table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Loop at lt_ordsent into ls_ordsent.
  Read table lt_ship into ls_ship 
                 with key vbeln = ls_ordsent-ordnr.
*Check sy-subrc eq 0.
  IF SY-SUBRC = 0.
    Move ls_ship-kunnr to ls_ordsent-kunnr.
*Modify lt_ordsent from ls_ordsent.
*Endloop.
   ENDIF.
*Loop at lt_ordsent into ls_ordsent.
  Read table lt_material into ls_material 
                 with key vbeln = ls_ordsent-ordnr.
*Check sy-subrc eq 0.
  IF SY-SUBRC = 0.
    Move ls_material-matnr to ls_ordsent-matnr. 
    Move ls_material-kwmeng to ls_ordsent-kwmeng.
*Modify lt_ordsent from ls_ordsent.
*Endloop.
   ENDIF.

*Loop at lt_ordsent into ls_ordsent.
   Read table lt_ddate into ls_ddate 
                 with key vbeln = ls_ordsent-ordnr.
*Check sy-subrc eq 0.
   IF SY-SUBRC = 0.    
     Move ls_ddate-edatu to ls_ordsent-edatu.
*Modify lt_ordsent from ls_ordsent.
*Endloop.
   ENDIF.

*Loop at lt_ordsent into ls_ordsent.
   Read table lt_order into ls_order 
                 with key vbeln = ls_ordsent-ordnr.
*Check sy-subrc eq 0.
   IF SY-SUBRC = 0.
     Move ls_order-vbeln to ls_ordsent-vbeln.
   ENDIF. 
   Modify lt_ordsent from ls_ordsent.
Endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The last thing u should consider is you get some data from header, but also item table, so you coudln't use the READ TABLE statament because it's like to do a select single, but you should use the loop statamtent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example u can have several material for the same order so if you want to get all data you should use a loop and append statament.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;U should use PSONR field to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;..................
  Types: begin of ts_ship,
           Vbenl type vbak-vbeln,
           POSNR TYPE VBAP-POSNR,
           Kunnr type vbpa-kunnr,
         End of ts_ship,
         Tt_ship type standard table of ts_ship.

  Types: begin of ts_material,
           Vbenl type vbak-vbeln,
           POSNR TYPE VBAP-POSNR,
           matnr type vbap-matnr,
           kwmeng type vbap-kwmeng,
         End of ts_material,
         Tt_material type standard table of ts_material.

  Types: begin of ts_ddate,
           Vbenl type vbak-vbeln,
           POSNR TYPE VBAP-POSNR,
           edatu type vbep-edatu,
         End of ts_ddate,
         Tt_ddate type standard table of ts_ddate.


  DATA: GT_ORDSENT TYPE TT_ORDSENT.

  SELECT ORDNR FROM ZTSD2MARC
      INTO CORRESPONDING FIELDS OF TABLE LT_ORDSENT.

  SELECT VBELN POSNR KUNNR FROM VBPA
      INTO CORRESPONDING FIELDS OF TABLE LT_SHIP
          FOR ALL ENTRIES IN LT_ORDSENT
            WHERE VBELN = LT_ORDSENT-ORDNR
              AND KUNNR IN SO_SHPT.


  SELECT VBELN POSNR MATNR KWMENG FROM VBAP
      INTO TABLE LT_MATERIAL
        FOR ALL ENTRIES IN LT_ORDSENT
          WHERE VBELN = LT_ORDSENT-ORDNR
            AND WERKS = PA_DPLN.

  SELECT VBELN POSNR EDATU FROM VBEP
      INTO TABLE LT_DDATE
          FOR ALL ENTRIES IN LT_ORDSENT
            WHERE VBELN = LT_ORDSENT-ORDNR
              AND EDATU IN SO_DDAT.

  SELECT VBELN VKORG FROM VBAK
      INTO TABLE LT_ORDER
          FOR ALL ENTRIES IN LT_ORDSENT
            WHERE VBELN = LT_ORDSENT-ORDNR
              AND VKORG = PA_SORG.

  LOOP AT LT_ORDSENT INTO LS_ORDSENT.
* Get Header data:
    READ TABLE LT_ORDER INTO LS_ORDER WITH KEY VBELN = LS_ORDSENT-ORDNR.
    IF SY-SUBRC = 0.
      LS_ORDSENT-VKORG = LT_ORDER-VKORG.
    ENDIF.
    READ TABLE LT_SHIP INTO LS_SHIP WITH KEY VBELN = LS_ORDSENT-ORDNR
                                             POSNR = '000000'.
    IF SY-SUBRC EQ 0.
      MOVE LS_SHIP-KUNNR TO LS_ORDSENT-KUNNR.
    ENDIF.

* Get Item data:
    LOOP LT_MATERIAL INTO LS_MATERIAL WHERE VBELN = = LS_ORDSENT-ORDNR.
      READ TABLE LT_DDATE INTO LS_DDATE
                                     WITH KEY VBELN = LS_ORDSENT-ORDNR
                                              POSNR = LS_MATERIAL-POSNR.
      IF SY-SUBRC &amp;lt;&amp;gt; 0.
        CLEAR LS_DDATE.
      ENDIF.
      MOVE LS_MATERIAL-MATNR TO LS_ORDSENT-MATNR.
      MOVE LS_MATERIAL-KWMENG TO LS_ORDSENT-KWMENG.
      MOVE LS_DDATE-EDATU TO LS_ORDSENT-EDATU.
      APPEND LS_ORDSENT TO GT_ORDSENT.
    ENDLOOP.
  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Nov 2006 09:26:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/will-this-code-work/m-p/1642093#M285947</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-26T09:26:15Z</dc:date>
    </item>
  </channel>
</rss>

