<?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: lsmw in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/lsmw/m-p/2417044#M539479</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;SAP generated messages can't be handled in LSMW. We can check/Analyze the logs by T.Code: SLG1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In case they are errors that you can/ want to capture before proceeding to the session. you can capture it in the end_of_record area for each record and move it to an internal table which can then be downloaded in the end_of_processing. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example : You have a loaded material master with the legacy material number in BISMT field in MARA. Let's say you now want to load your inventory. In the LSMW for the inventory load you can do a select and get teh SAP material number for the legacy material number provided to you. In this select if you do not find the SAP material number for one material(may be it errored out during material master load for instance) you can move this record to an internal table and in the processing block when all such errrors have been collected in the internal table then you can download it to your presentation server so you can report it to your business users to fix. This is my preferred method of loading data. Sure it will error out int eh batch session as a valid SAP material number is not provided but then you can never fix it automatically. you will have to process tem in the foreground or in errors mode and this invoves a lot of time and developers intervention. In my way developers intervention is limited. A report is generated and then business will fix the data and the delta loades will have to be loaded. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the sample code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Material Number &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BINS-MATNR () &lt;/P&gt;&lt;P&gt;RLBES-MATNR = BINS-MATNR. &lt;/P&gt;&lt;P&gt;clear RLBES-MATNR. &lt;/P&gt;&lt;P&gt;select single matnr into RLBES-MATNR from MARA &lt;/P&gt;&lt;P&gt;where BISMT = BINS-MATNR. &lt;/P&gt;&lt;P&gt;IF SY-SUBRC &amp;lt;&amp;gt; 0. &lt;/P&gt;&lt;P&gt;RLBES-matnr = BINS-MATNR. &lt;/P&gt;&lt;P&gt;MOVE-CORRESPONDING BINS TO err_file. &lt;/P&gt;&lt;P&gt;MOVE 'Material not created' TO err_file-error. &lt;/P&gt;&lt;P&gt;APPEND err_file. &lt;/P&gt;&lt;P&gt;WRITE : 'NO MATERIAL'. &lt;/P&gt;&lt;P&gt;skip_record. &lt;/P&gt;&lt;P&gt;endif. &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;__END_OF_PROCESSING__ &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;FUNCTION 'GUI_DOWNLOAD' &lt;/P&gt;&lt;P&gt;EXPORTING &lt;/P&gt;&lt;P&gt;FILENAME = error_file_name &lt;/P&gt;&lt;P&gt;TABLES &lt;/P&gt;&lt;P&gt;DATA_TAB = err_file. &lt;/P&gt;&lt;P&gt;IF SY-SUBRC &amp;lt;&amp;gt; 0. &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. &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;&lt;/P&gt;&lt;P&gt;This example used GUI_DOWNLOAD . Ofcourse this is now not recommended so you can use the latest FMs for download.&lt;/P&gt;&lt;P&gt;&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; Sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Jul 2007 12:08:44 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-11T12:08:44Z</dc:date>
    <item>
      <title>lsmw</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lsmw/m-p/2417042#M539477</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how to fix errors in lsmw&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jul 2007 08:05:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lsmw/m-p/2417042#M539477</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-05T08:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: lsmw</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lsmw/m-p/2417043#M539478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pavan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u can fix the errors in the mapping step u can fix errors for writing logic in each mapping or else if u want u can write whole logic , by clicking display variant in the top of the mapping screen after clicking that icon&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u find one pop up screen in that choose bottom three check boxes and enter , then u find some functions like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;__GLOBAL_DATA__                &lt;/P&gt;&lt;P&gt;__BEGIN_OF_PROCESSING__       &lt;/P&gt;&lt;P&gt;__BEGIN_OF_TRANSACTION__       &lt;/P&gt;&lt;P&gt; __END_OF_RECORD__   &lt;/P&gt;&lt;P&gt; __END_OF_TRANSACTION__&lt;/P&gt;&lt;P&gt; __END_OF_PROCESSING__  &lt;/P&gt;&lt;P&gt; __FORM_ROUTINES__ &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in this u can declare any thing and write logic as per ur requirement ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in this way we can fix the errors..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;plz let me know if u have any issues in LSMW&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Naveen  khan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2007 12:06:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lsmw/m-p/2417043#M539478</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-11T12:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: lsmw</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lsmw/m-p/2417044#M539479</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;SAP generated messages can't be handled in LSMW. We can check/Analyze the logs by T.Code: SLG1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In case they are errors that you can/ want to capture before proceeding to the session. you can capture it in the end_of_record area for each record and move it to an internal table which can then be downloaded in the end_of_processing. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example : You have a loaded material master with the legacy material number in BISMT field in MARA. Let's say you now want to load your inventory. In the LSMW for the inventory load you can do a select and get teh SAP material number for the legacy material number provided to you. In this select if you do not find the SAP material number for one material(may be it errored out during material master load for instance) you can move this record to an internal table and in the processing block when all such errrors have been collected in the internal table then you can download it to your presentation server so you can report it to your business users to fix. This is my preferred method of loading data. Sure it will error out int eh batch session as a valid SAP material number is not provided but then you can never fix it automatically. you will have to process tem in the foreground or in errors mode and this invoves a lot of time and developers intervention. In my way developers intervention is limited. A report is generated and then business will fix the data and the delta loades will have to be loaded. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the sample code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Material Number &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BINS-MATNR () &lt;/P&gt;&lt;P&gt;RLBES-MATNR = BINS-MATNR. &lt;/P&gt;&lt;P&gt;clear RLBES-MATNR. &lt;/P&gt;&lt;P&gt;select single matnr into RLBES-MATNR from MARA &lt;/P&gt;&lt;P&gt;where BISMT = BINS-MATNR. &lt;/P&gt;&lt;P&gt;IF SY-SUBRC &amp;lt;&amp;gt; 0. &lt;/P&gt;&lt;P&gt;RLBES-matnr = BINS-MATNR. &lt;/P&gt;&lt;P&gt;MOVE-CORRESPONDING BINS TO err_file. &lt;/P&gt;&lt;P&gt;MOVE 'Material not created' TO err_file-error. &lt;/P&gt;&lt;P&gt;APPEND err_file. &lt;/P&gt;&lt;P&gt;WRITE : 'NO MATERIAL'. &lt;/P&gt;&lt;P&gt;skip_record. &lt;/P&gt;&lt;P&gt;endif. &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;__END_OF_PROCESSING__ &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;FUNCTION 'GUI_DOWNLOAD' &lt;/P&gt;&lt;P&gt;EXPORTING &lt;/P&gt;&lt;P&gt;FILENAME = error_file_name &lt;/P&gt;&lt;P&gt;TABLES &lt;/P&gt;&lt;P&gt;DATA_TAB = err_file. &lt;/P&gt;&lt;P&gt;IF SY-SUBRC &amp;lt;&amp;gt; 0. &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. &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;&lt;/P&gt;&lt;P&gt;This example used GUI_DOWNLOAD . Ofcourse this is now not recommended so you can use the latest FMs for download.&lt;/P&gt;&lt;P&gt;&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; Sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2007 12:08:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lsmw/m-p/2417044#M539479</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-11T12:08:44Z</dc:date>
    </item>
  </channel>
</rss>

