<?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: display error messages for each material in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/display-error-messages-for-each-material/m-p/2456453#M550821</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did the same thing in the below code, go thru it and check it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;* calling the BAPI to update the Asset Master AS02
  loop at it_final into is_final.
 
* If updating of floor area only
    if p_farea = 'X'.
* passing new area value to the BAPI
      is_realestate-area     = is_final-grufl.
      is_realestatex-area    = 'X'.
 
      call function 'BAPI_FIXEDASSET_CHANGE'
           exporting
                companycode = is_final-bukrs
                asset       = is_final-anln1
                subnumber   = is_final-anln2
                realestate  = is_realestate
                realestatex = is_realestatex
           importing
                return      = it_return.
 
* If Asset Master is changed with out any errors
      read table it_return with key type = 'E'.
      if sy-subrc = 0.
        flag = ' '.
      else.
        flag = 'X'.
* Call the COMMIT BAPI
        call function 'BAPI_TRANSACTION_COMMIT'
             exporting
                  wait = 'X'.
        wait up to 2 seconds.
      endif.
* If the Asset Master is changed with out any errors
      if flag = 'X'.
        read table it_output into is_output with key
                                  bukrs = is_final-bukrs
                                  anln1 = is_final-anln1
                                  anln2 = is_final-anln2
                                  binary search.
        if sy-subrc = 0.
*          is_output-c_icon  = c_green.
          is_output-grufl_n = is_final-grufl.
          is_output-message = it_return-message.
* Modify the output internal table with the changed new values
          modify it_output from is_output
                           transporting grufl_n message
                           where bukrs = is_output-bukrs
                             and anln1 = is_output-anln1
                             and anln2 = is_output-anln2.
        endif.
      elseif flag = ' '.
        read table it_output into is_output with key
                                  bukrs = is_final-bukrs
                                  anln1 = is_final-anln1
                                  anln2 = is_final-anln2
                                  binary search.
        if sy-subrc = 0.
*          is_output-c_icon  = c_red.
          is_output-grufl_n = is_realestate-area.
          is_output-message = it_return-message.
* Modify the output internal table with the changed new values
          modify it_output from is_output
                           transporting grufl_n message
                           where bukrs = is_output-bukrs
                             and anln1 = is_output-anln1
                             and anln2 = is_output-anln2.
        endif.
      endif.
 
    endif.
 
* If updating of lease commencement date only
    if p_ldate = 'X'.
* Passing new lease start date value to the BAPI
      is_leasing-start_date  = is_final-leabg.
      is_leasingx-start_date = 'X'.
 
* Call the BAPI to change the Asset Master
      call function 'BAPI_FIXEDASSET_CHANGE'
           exporting
                companycode = is_final-bukrs
                asset       = is_final-anln1
                subnumber   = is_final-anln2
                leasing     = is_leasing
                leasingx    = is_leasingx
           importing
                return      = it_return.
* If Asset Master is changed with out any errors
      read table it_return with key type = 'E'.
      if sy-subrc = 0.
        flag = ' '.
      else.
        flag = 'X'.
* Call the COMMIT BAPI
        call function 'BAPI_TRANSACTION_COMMIT'
             exporting
                  wait = 'X'.
        wait up to 2 seconds.
      endif.
 
* If the Asset Master is changed with out any errors
      if flag = 'X'.
        read table it_output into is_output with key
                                  bukrs = is_final-bukrs
                                  anln1 = is_final-anln1
                                  anln2 = is_final-anln2
                                  binary search.
        if sy-subrc = 0.
*          is_output-c_icon  = c_green.
          is_output-leabg_n = is_final-leabg.
          is_output-message = it_return-message.
* Modify the output internal table with the changed new values
          modify it_output from is_output
                           transporting leabg_n message
                           where bukrs = is_output-bukrs
                             and anln1 = is_output-anln1
                             and anln2 = is_output-anln2.
        endif.
      elseif flag = ' '.
        read table it_output into is_output with key
                                  bukrs = is_final-bukrs
                                  anln1 = is_final-anln1
                                  anln2 = is_final-anln2
                                  binary search.
        if sy-subrc = 0.
*          is_output-c_icon  = c_red.
          is_output-leabg_n = is_leasing-start_date.
          is_output-message = it_return-message.
* Modify the output internal table with the changed new values
          modify it_output from is_output
                           transporting leabg_n message
                           where bukrs = is_output-bukrs
                             and anln1 = is_output-anln1
                             and anln2 = is_output-anln2.
        endif.
      endif.
    endif.
 
    clear : is_final, is_realestate, is_leasing,
            it_return, flag , is_output.
  endloop.
* Display the report out with old and new values
  PERFORM output_report.
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  output_report
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
*FORM output_report.
*
*  DATA : it_fieldcat TYPE slis_t_fieldcat_alv,
*         is_layout TYPE slis_layout_alv.
** Sub routine for filling the field catalog
*  IF it_fieldcat[] IS INITIAL.
*    PERFORM field_fill USING it_fieldcat.
*  ENDIF.
*
** Sub routine to set the layout
*  PERFORM set_layout USING is_layout.
*
** Function module to display the data in ALV format
*  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
*       EXPORTING
*            i_callback_program = l_repid
*            it_fieldcat        = it_fieldcat
*            is_layout          = is_layout
*       TABLES
*            t_outtab           = it_output
*       EXCEPTIONS
*            program_error      = 1
*            OTHERS             = 2.
*  IF sy-subrc &amp;lt;&amp;gt; 0.
*    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
*            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
*  ENDIF.
*ENDFORM.                    " output_report
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  field_fill
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&amp;gt;P_IT_FIELDCAT  text
*----------------------------------------------------------------------*
*FORM field_fill USING pt_fieldcat TYPE slis_t_fieldcat_alv.
*  DATA : ls_fieldcat TYPE slis_fieldcat_alv,
*         pos TYPE i VALUE 1.
*
*  ls_fieldcat-col_pos       = pos.
*  ls_fieldcat-fieldname     = 'C_ICON'.
*  ls_fieldcat-seltext_m     = 'Change Status'.
*  ls_fieldcat-tabname       = 'IT_OUTPUT'.
*  APPEND ls_fieldcat TO pt_fieldcat.
*  CLEAR ls_fieldcat.
*  pos = pos + 1.
*
*  ls_fieldcat-col_pos       = pos.
*  ls_fieldcat-fieldname     = 'BUKRS'.
*  ls_fieldcat-ref_fieldname = 'BUKRS'.
*  ls_fieldcat-ref_tabname   = 'ANLA'.
*  APPEND ls_fieldcat TO pt_fieldcat.
*  CLEAR ls_fieldcat.
*  pos = pos + 1.
*
*  ls_fieldcat-col_pos       = pos.
*  ls_fieldcat-fieldname     = 'ANLN1'.
*  ls_fieldcat-ref_fieldname = 'ANLN1'.
*  ls_fieldcat-ref_tabname   = 'ANLA'.
*  APPEND ls_fieldcat TO pt_fieldcat.
*  CLEAR ls_fieldcat.
*  pos = pos + 1.
*
*  ls_fieldcat-col_pos       = pos.
*  ls_fieldcat-fieldname     = 'ANLN2'.
*  ls_fieldcat-ref_fieldname = 'ANLN2'.
*  ls_fieldcat-ref_tabname   = 'ANLA'.
*  APPEND ls_fieldcat TO pt_fieldcat.
*  CLEAR ls_fieldcat.
*  pos = pos + 1.
*
*  IF p_farea = 'X'.
*    ls_fieldcat-col_pos       = pos.
*    ls_fieldcat-fieldname     = 'GRUFL'.
*    ls_fieldcat-ref_fieldname = 'GRUFL'.
*    ls_fieldcat-ref_tabname   = 'ANLA'.
*    APPEND ls_fieldcat TO pt_fieldcat.
*    CLEAR ls_fieldcat.
*    pos = pos + 1.
*
*    ls_fieldcat-col_pos       = pos.
*    ls_fieldcat-fieldname     = 'GRUFL_N'.
*    ls_fieldcat-seltext_l     = 'New Floor Area'.
*    ls_fieldcat-tabname       = 'IT_OUTPUT'.
*    APPEND ls_fieldcat TO pt_fieldcat.
*    CLEAR ls_fieldcat.
*    pos = pos + 1.
*  ENDIF.
*
*  IF p_ldate = 'X'.
*    ls_fieldcat-col_pos       = pos.
*    ls_fieldcat-fieldname     = 'LEABG'.
*    ls_fieldcat-ref_fieldname = 'LEABG'.
*    ls_fieldcat-ref_tabname   = 'ANLA'.
*    APPEND ls_fieldcat TO pt_fieldcat.
*    CLEAR ls_fieldcat.
*    pos = pos + 1.
*
*    ls_fieldcat-col_pos       = pos.
*    ls_fieldcat-fieldname     = 'LEABG_N'.
*    ls_fieldcat-seltext_l     = 'New Lease St.Date'.
*    ls_fieldcat-tabname       = 'IT_OUTPUT'.
*    APPEND ls_fieldcat TO pt_fieldcat.
*    CLEAR ls_fieldcat.
*    pos = pos + 1.
*  ENDIF.
*
*  ls_fieldcat-col_pos       = pos.
*  ls_fieldcat-fieldname     = 'MESSAGE'.
*  ls_fieldcat-seltext_l     = 'Status Message'.
*  ls_fieldcat-tabname       = 'IT_OUTPUT'.
*  APPEND ls_fieldcat TO pt_fieldcat.
*  CLEAR ls_fieldcat.
*  pos = pos + 1.
*
*ENDFORM.                    " field_fill&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Gopi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Jul 2007 05:55:49 GMT</pubDate>
    <dc:creator>gopi_narendra</dc:creator>
    <dc:date>2007-07-03T05:55:49Z</dc:date>
    <item>
      <title>display error messages for each material</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/display-error-messages-for-each-material/m-p/2456450#M550818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using a BAPI which gives errors in return table.I am executing this BAPI for several materials in a LOOP.I need to display the error messages for each of these materials as shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Material 1:&lt;/P&gt;&lt;P&gt;error1&lt;/P&gt;&lt;P&gt;error2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Material 2:&lt;/P&gt;&lt;P&gt;error 1 &lt;/P&gt;&lt;P&gt;error 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the best way to display this?Also plz let me know how to use REUSE_ALV_HIERSEQ_LIST_DISPLAY?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Rakesh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2007 05:28:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/display-error-messages-for-each-material/m-p/2456450#M550818</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-03T05:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: display error messages for each material</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/display-error-messages-for-each-material/m-p/2456451#M550819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hI,&lt;/P&gt;&lt;P&gt;                 bY  CALL FUNCTION 'MESSAGE_TEXT_BUILD'  you can disply the error msgs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this example for using the FM..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPE-POOLS: slis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF itab OCCURS 0,&lt;/P&gt;&lt;P&gt;vbeln TYPE vbeln,&lt;/P&gt;&lt;P&gt;expand,&lt;/P&gt;&lt;P&gt;END OF itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF itab1 OCCURS 0,&lt;/P&gt;&lt;P&gt;vbeln TYPE vbeln,&lt;/P&gt;&lt;P&gt;posnr TYPE posnr,&lt;/P&gt;&lt;P&gt;matnr TYPE matnr,&lt;/P&gt;&lt;P&gt;netpr TYPE netpr,&lt;/P&gt;&lt;P&gt;END OF itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.&lt;/P&gt;&lt;P&gt;DATA: s_fieldcatalog TYPE slis_fieldcat_alv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;s_fieldcatalog-col_pos = '1'.&lt;/P&gt;&lt;P&gt;s_fieldcatalog-fieldname = 'VBELN'.&lt;/P&gt;&lt;P&gt;s_fieldcatalog-tabname = 'ITAB'.&lt;/P&gt;&lt;P&gt;s_fieldcatalog-rollname = 'VBELN'.&lt;/P&gt;&lt;P&gt;s_fieldcatalog-outputlen = '12'.&lt;/P&gt;&lt;P&gt;APPEND s_fieldcatalog TO t_fieldcatalog.&lt;/P&gt;&lt;P&gt;CLEAR: s_fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;s_fieldcatalog-col_pos = '1'.&lt;/P&gt;&lt;P&gt;s_fieldcatalog-fieldname = 'VBELN'.&lt;/P&gt;&lt;P&gt;s_fieldcatalog-tabname = 'ITAB1'.&lt;/P&gt;&lt;P&gt;s_fieldcatalog-rollname = 'VBELN'.&lt;/P&gt;&lt;P&gt;s_fieldcatalog-outputlen = '12'.&lt;/P&gt;&lt;P&gt;APPEND s_fieldcatalog TO t_fieldcatalog.&lt;/P&gt;&lt;P&gt;CLEAR: s_fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;s_fieldcatalog-col_pos = '2'.&lt;/P&gt;&lt;P&gt;s_fieldcatalog-fieldname = 'POSNR'.&lt;/P&gt;&lt;P&gt;s_fieldcatalog-tabname = 'ITAB1'.&lt;/P&gt;&lt;P&gt;s_fieldcatalog-rollname = 'POSNR'.&lt;/P&gt;&lt;P&gt;APPEND s_fieldcatalog TO t_fieldcatalog.&lt;/P&gt;&lt;P&gt;CLEAR: s_fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;s_fieldcatalog-col_pos = '3'.&lt;/P&gt;&lt;P&gt;s_fieldcatalog-fieldname = 'MATNR'.&lt;/P&gt;&lt;P&gt;s_fieldcatalog-tabname = 'ITAB1'.&lt;/P&gt;&lt;P&gt;s_fieldcatalog-rollname = 'MATNR'.&lt;/P&gt;&lt;P&gt;APPEND s_fieldcatalog TO t_fieldcatalog.&lt;/P&gt;&lt;P&gt;CLEAR: s_fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;s_fieldcatalog-col_pos = '4'.&lt;/P&gt;&lt;P&gt;s_fieldcatalog-fieldname = 'NETPR'.&lt;/P&gt;&lt;P&gt;s_fieldcatalog-tabname = 'ITAB1'.&lt;/P&gt;&lt;P&gt;s_fieldcatalog-rollname = 'NETPR'.&lt;/P&gt;&lt;P&gt;s_fieldcatalog-do_sum = 'X'.&lt;/P&gt;&lt;P&gt;APPEND s_fieldcatalog TO t_fieldcatalog.&lt;/P&gt;&lt;P&gt;CLEAR: s_fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: s_layout TYPE slis_layout_alv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;s_layout-subtotals_text = 'SUBTOTAL TEXT'.&lt;/P&gt;&lt;P&gt;s_layout-key_hotspot = 'X'.&lt;/P&gt;&lt;P&gt;s_layout-expand_fieldname = 'EXPAND'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT vbeln UP TO 100 ROWS&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;vbak&lt;/P&gt;&lt;P&gt;INTO TABLE itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT itab[] IS INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT vbeln posnr matnr netpr&lt;/P&gt;&lt;P&gt;FROM vbap&lt;/P&gt;&lt;P&gt;INTO TABLE itab1&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN itab&lt;/P&gt;&lt;P&gt;WHERE vbeln = itab-vbeln.&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;&lt;/P&gt;&lt;P&gt;DATA: v_repid TYPE syrepid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;v_repid = sy-repid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: s_keyinfo TYPE slis_keyinfo_alv.&lt;/P&gt;&lt;P&gt;s_keyinfo-header01 = 'VBELN'.&lt;/P&gt;&lt;P&gt;s_keyinfo-item01 = 'VBELN'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;i_callback_program = v_repid&lt;/P&gt;&lt;P&gt;is_layout = s_layout&lt;/P&gt;&lt;P&gt;it_fieldcat = t_fieldcatalog&lt;/P&gt;&lt;P&gt;i_tabname_header = 'ITAB'&lt;/P&gt;&lt;P&gt;i_tabname_item = 'ITAB1'&lt;/P&gt;&lt;P&gt;is_keyinfo = s_keyinfo&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;t_outtab_header = itab&lt;/P&gt;&lt;P&gt;t_outtab_item = itab1&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;program_error = 1&lt;/P&gt;&lt;P&gt;OTHERS = 2.&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;&amp;lt;b&amp;gt;Reward points&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2007 05:34:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/display-error-messages-for-each-material/m-p/2456451#M550819</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-03T05:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: display error messages for each material</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/display-error-messages-for-each-material/m-p/2456452#M550820</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 can just create a screen(Model dialog) and then use WRITE statement to display the error. Alos use Supress dialog to supres the screen and goto the LIST directly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just loop through your list of messages and write them on to a screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2007 05:38:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/display-error-messages-for-each-material/m-p/2456452#M550820</guid>
      <dc:creator>seshatalpasai_madala</dc:creator>
      <dc:date>2007-07-03T05:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: display error messages for each material</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/display-error-messages-for-each-material/m-p/2456453#M550821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did the same thing in the below code, go thru it and check it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;* calling the BAPI to update the Asset Master AS02
  loop at it_final into is_final.
 
* If updating of floor area only
    if p_farea = 'X'.
* passing new area value to the BAPI
      is_realestate-area     = is_final-grufl.
      is_realestatex-area    = 'X'.
 
      call function 'BAPI_FIXEDASSET_CHANGE'
           exporting
                companycode = is_final-bukrs
                asset       = is_final-anln1
                subnumber   = is_final-anln2
                realestate  = is_realestate
                realestatex = is_realestatex
           importing
                return      = it_return.
 
* If Asset Master is changed with out any errors
      read table it_return with key type = 'E'.
      if sy-subrc = 0.
        flag = ' '.
      else.
        flag = 'X'.
* Call the COMMIT BAPI
        call function 'BAPI_TRANSACTION_COMMIT'
             exporting
                  wait = 'X'.
        wait up to 2 seconds.
      endif.
* If the Asset Master is changed with out any errors
      if flag = 'X'.
        read table it_output into is_output with key
                                  bukrs = is_final-bukrs
                                  anln1 = is_final-anln1
                                  anln2 = is_final-anln2
                                  binary search.
        if sy-subrc = 0.
*          is_output-c_icon  = c_green.
          is_output-grufl_n = is_final-grufl.
          is_output-message = it_return-message.
* Modify the output internal table with the changed new values
          modify it_output from is_output
                           transporting grufl_n message
                           where bukrs = is_output-bukrs
                             and anln1 = is_output-anln1
                             and anln2 = is_output-anln2.
        endif.
      elseif flag = ' '.
        read table it_output into is_output with key
                                  bukrs = is_final-bukrs
                                  anln1 = is_final-anln1
                                  anln2 = is_final-anln2
                                  binary search.
        if sy-subrc = 0.
*          is_output-c_icon  = c_red.
          is_output-grufl_n = is_realestate-area.
          is_output-message = it_return-message.
* Modify the output internal table with the changed new values
          modify it_output from is_output
                           transporting grufl_n message
                           where bukrs = is_output-bukrs
                             and anln1 = is_output-anln1
                             and anln2 = is_output-anln2.
        endif.
      endif.
 
    endif.
 
* If updating of lease commencement date only
    if p_ldate = 'X'.
* Passing new lease start date value to the BAPI
      is_leasing-start_date  = is_final-leabg.
      is_leasingx-start_date = 'X'.
 
* Call the BAPI to change the Asset Master
      call function 'BAPI_FIXEDASSET_CHANGE'
           exporting
                companycode = is_final-bukrs
                asset       = is_final-anln1
                subnumber   = is_final-anln2
                leasing     = is_leasing
                leasingx    = is_leasingx
           importing
                return      = it_return.
* If Asset Master is changed with out any errors
      read table it_return with key type = 'E'.
      if sy-subrc = 0.
        flag = ' '.
      else.
        flag = 'X'.
* Call the COMMIT BAPI
        call function 'BAPI_TRANSACTION_COMMIT'
             exporting
                  wait = 'X'.
        wait up to 2 seconds.
      endif.
 
* If the Asset Master is changed with out any errors
      if flag = 'X'.
        read table it_output into is_output with key
                                  bukrs = is_final-bukrs
                                  anln1 = is_final-anln1
                                  anln2 = is_final-anln2
                                  binary search.
        if sy-subrc = 0.
*          is_output-c_icon  = c_green.
          is_output-leabg_n = is_final-leabg.
          is_output-message = it_return-message.
* Modify the output internal table with the changed new values
          modify it_output from is_output
                           transporting leabg_n message
                           where bukrs = is_output-bukrs
                             and anln1 = is_output-anln1
                             and anln2 = is_output-anln2.
        endif.
      elseif flag = ' '.
        read table it_output into is_output with key
                                  bukrs = is_final-bukrs
                                  anln1 = is_final-anln1
                                  anln2 = is_final-anln2
                                  binary search.
        if sy-subrc = 0.
*          is_output-c_icon  = c_red.
          is_output-leabg_n = is_leasing-start_date.
          is_output-message = it_return-message.
* Modify the output internal table with the changed new values
          modify it_output from is_output
                           transporting leabg_n message
                           where bukrs = is_output-bukrs
                             and anln1 = is_output-anln1
                             and anln2 = is_output-anln2.
        endif.
      endif.
    endif.
 
    clear : is_final, is_realestate, is_leasing,
            it_return, flag , is_output.
  endloop.
* Display the report out with old and new values
  PERFORM output_report.
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  output_report
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
*FORM output_report.
*
*  DATA : it_fieldcat TYPE slis_t_fieldcat_alv,
*         is_layout TYPE slis_layout_alv.
** Sub routine for filling the field catalog
*  IF it_fieldcat[] IS INITIAL.
*    PERFORM field_fill USING it_fieldcat.
*  ENDIF.
*
** Sub routine to set the layout
*  PERFORM set_layout USING is_layout.
*
** Function module to display the data in ALV format
*  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
*       EXPORTING
*            i_callback_program = l_repid
*            it_fieldcat        = it_fieldcat
*            is_layout          = is_layout
*       TABLES
*            t_outtab           = it_output
*       EXCEPTIONS
*            program_error      = 1
*            OTHERS             = 2.
*  IF sy-subrc &amp;lt;&amp;gt; 0.
*    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
*            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
*  ENDIF.
*ENDFORM.                    " output_report
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  field_fill
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&amp;gt;P_IT_FIELDCAT  text
*----------------------------------------------------------------------*
*FORM field_fill USING pt_fieldcat TYPE slis_t_fieldcat_alv.
*  DATA : ls_fieldcat TYPE slis_fieldcat_alv,
*         pos TYPE i VALUE 1.
*
*  ls_fieldcat-col_pos       = pos.
*  ls_fieldcat-fieldname     = 'C_ICON'.
*  ls_fieldcat-seltext_m     = 'Change Status'.
*  ls_fieldcat-tabname       = 'IT_OUTPUT'.
*  APPEND ls_fieldcat TO pt_fieldcat.
*  CLEAR ls_fieldcat.
*  pos = pos + 1.
*
*  ls_fieldcat-col_pos       = pos.
*  ls_fieldcat-fieldname     = 'BUKRS'.
*  ls_fieldcat-ref_fieldname = 'BUKRS'.
*  ls_fieldcat-ref_tabname   = 'ANLA'.
*  APPEND ls_fieldcat TO pt_fieldcat.
*  CLEAR ls_fieldcat.
*  pos = pos + 1.
*
*  ls_fieldcat-col_pos       = pos.
*  ls_fieldcat-fieldname     = 'ANLN1'.
*  ls_fieldcat-ref_fieldname = 'ANLN1'.
*  ls_fieldcat-ref_tabname   = 'ANLA'.
*  APPEND ls_fieldcat TO pt_fieldcat.
*  CLEAR ls_fieldcat.
*  pos = pos + 1.
*
*  ls_fieldcat-col_pos       = pos.
*  ls_fieldcat-fieldname     = 'ANLN2'.
*  ls_fieldcat-ref_fieldname = 'ANLN2'.
*  ls_fieldcat-ref_tabname   = 'ANLA'.
*  APPEND ls_fieldcat TO pt_fieldcat.
*  CLEAR ls_fieldcat.
*  pos = pos + 1.
*
*  IF p_farea = 'X'.
*    ls_fieldcat-col_pos       = pos.
*    ls_fieldcat-fieldname     = 'GRUFL'.
*    ls_fieldcat-ref_fieldname = 'GRUFL'.
*    ls_fieldcat-ref_tabname   = 'ANLA'.
*    APPEND ls_fieldcat TO pt_fieldcat.
*    CLEAR ls_fieldcat.
*    pos = pos + 1.
*
*    ls_fieldcat-col_pos       = pos.
*    ls_fieldcat-fieldname     = 'GRUFL_N'.
*    ls_fieldcat-seltext_l     = 'New Floor Area'.
*    ls_fieldcat-tabname       = 'IT_OUTPUT'.
*    APPEND ls_fieldcat TO pt_fieldcat.
*    CLEAR ls_fieldcat.
*    pos = pos + 1.
*  ENDIF.
*
*  IF p_ldate = 'X'.
*    ls_fieldcat-col_pos       = pos.
*    ls_fieldcat-fieldname     = 'LEABG'.
*    ls_fieldcat-ref_fieldname = 'LEABG'.
*    ls_fieldcat-ref_tabname   = 'ANLA'.
*    APPEND ls_fieldcat TO pt_fieldcat.
*    CLEAR ls_fieldcat.
*    pos = pos + 1.
*
*    ls_fieldcat-col_pos       = pos.
*    ls_fieldcat-fieldname     = 'LEABG_N'.
*    ls_fieldcat-seltext_l     = 'New Lease St.Date'.
*    ls_fieldcat-tabname       = 'IT_OUTPUT'.
*    APPEND ls_fieldcat TO pt_fieldcat.
*    CLEAR ls_fieldcat.
*    pos = pos + 1.
*  ENDIF.
*
*  ls_fieldcat-col_pos       = pos.
*  ls_fieldcat-fieldname     = 'MESSAGE'.
*  ls_fieldcat-seltext_l     = 'Status Message'.
*  ls_fieldcat-tabname       = 'IT_OUTPUT'.
*  APPEND ls_fieldcat TO pt_fieldcat.
*  CLEAR ls_fieldcat.
*  pos = pos + 1.
*
*ENDFORM.                    " field_fill&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Gopi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2007 05:55:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/display-error-messages-for-each-material/m-p/2456453#M550821</guid>
      <dc:creator>gopi_narendra</dc:creator>
      <dc:date>2007-07-03T05:55:49Z</dc:date>
    </item>
  </channel>
</rss>

