<?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: Get Errors in LSMW session in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-errors-in-lsmw-session/m-p/2683651#M620570</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;&lt;/P&gt;&lt;P&gt;1) Just go through this which one is understandable go for that&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;In the field mappings and conversion rules,&lt;/P&gt;&lt;P&gt;in the global section,define an internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : begin of it_errors occurs 0,&lt;/P&gt;&lt;P&gt;desc type string,&lt;/P&gt;&lt;P&gt;end of it_errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and where ever you have wrong or empty values for the fields,populate error there to the internal table.&lt;/P&gt;&lt;P&gt;for example, if Material no is blank,i have to give err msg&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT MATMAS_MRPVIEW-MATNR IS INITIAL.&lt;/P&gt;&lt;P&gt;BMM00-MATNR = MATMAS_MRPVIEW-MATNR.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;IT_ERROR-DESC = 'Material no is empty'.&lt;/P&gt;&lt;P&gt;append it_error.&lt;/P&gt;&lt;P&gt;SKIP_RECORD. "to skip further processing of this error record.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;like this you populate all the error records to that IT_ERRORS internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and finally download it using GUI_DOWNLOAD in the event&lt;/P&gt;&lt;P&gt;'__END_OF_PROCESSING__'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)&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;Reward if it worthful/ useful to u &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&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>Thu, 09 Aug 2007 14:19:21 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-08-09T14:19:21Z</dc:date>
    <item>
      <title>Get Errors in LSMW session</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-errors-in-lsmw-session/m-p/2683650#M620569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a serious problem and I hope you will help me. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to update business partners that are listed in flat file. (It contains their numbers) I created LSMW project on the base of Batch input recording. It works suitable for me, but now I need to record the results of project execution. I want to get file like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Busness partners - Sucess/Error &lt;/P&gt;&lt;P&gt;1000000 - Sucess&lt;/P&gt;&lt;P&gt;1000001 - Error&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I don't now how to do such a check for each record in the file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thak in advance,&lt;/P&gt;&lt;P&gt;Ekaterina&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2007 13:51:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-errors-in-lsmw-session/m-p/2683650#M620569</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-09T13:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: Get Errors in LSMW session</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-errors-in-lsmw-session/m-p/2683651#M620570</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;&lt;/P&gt;&lt;P&gt;1) Just go through this which one is understandable go for that&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;In the field mappings and conversion rules,&lt;/P&gt;&lt;P&gt;in the global section,define an internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : begin of it_errors occurs 0,&lt;/P&gt;&lt;P&gt;desc type string,&lt;/P&gt;&lt;P&gt;end of it_errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and where ever you have wrong or empty values for the fields,populate error there to the internal table.&lt;/P&gt;&lt;P&gt;for example, if Material no is blank,i have to give err msg&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT MATMAS_MRPVIEW-MATNR IS INITIAL.&lt;/P&gt;&lt;P&gt;BMM00-MATNR = MATMAS_MRPVIEW-MATNR.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;IT_ERROR-DESC = 'Material no is empty'.&lt;/P&gt;&lt;P&gt;append it_error.&lt;/P&gt;&lt;P&gt;SKIP_RECORD. "to skip further processing of this error record.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;like this you populate all the error records to that IT_ERRORS internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and finally download it using GUI_DOWNLOAD in the event&lt;/P&gt;&lt;P&gt;'__END_OF_PROCESSING__'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)&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;Reward if it worthful/ useful to u &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&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>Thu, 09 Aug 2007 14:19:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-errors-in-lsmw-session/m-p/2683651#M620570</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-09T14:19:21Z</dc:date>
    </item>
  </channel>
</rss>

