<?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 'BAPI_MATERIAL_SAVEDATA' - how to handle errors? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-material-savedata-how-to-handle-errors/m-p/997356#M75564</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Howdy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to use the following BAPI:&lt;/P&gt;&lt;P&gt;'BAPI_MATERIAL_SAVEDATA'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately it has no 'Exceptions' so how would I handle errors?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Currently it is coded like this:
    call function 'BAPI_MATERIAL_SAVEDATA'
         exporting
              headdata            = st_head
              clientdata          = st_mara
              clientdatax         = st_marax
              plantdata           = st_plant
              plantdatax          = st_plantx
         importing
              return              = git_rtrn
         tables
              materialdescription = git_makt.

    if sy-subrc &amp;lt;&amp;gt; 0.
      perform change_zsrcmtrx_status using 'E'.
    else.
      perform change_zsrcmtrx_status using 'P'.
    endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would it be okay to add something like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    call function 'BAPI_MATERIAL_SAVEDATA'
         exporting
              headdata            = st_head
              clientdata          = st_mara
              clientdatax         = st_marax
              plantdata           = st_plant
              plantdatax          = st_plantx
         importing
              return              = git_rtrn
         tables
              materialdescription = git_makt
         exceptions
              error_message       = 3
              others              = 4.

    if sy-subrc &amp;lt;&amp;gt; 0.
      perform change_zsrcmtrx_status using 'E'.
    else.
      perform change_zsrcmtrx_status using 'P'.
    endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any input!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Jul 2005 09:46:13 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-07-01T09:46:13Z</dc:date>
    <item>
      <title>'BAPI_MATERIAL_SAVEDATA' - how to handle errors?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-material-savedata-how-to-handle-errors/m-p/997356#M75564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Howdy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to use the following BAPI:&lt;/P&gt;&lt;P&gt;'BAPI_MATERIAL_SAVEDATA'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately it has no 'Exceptions' so how would I handle errors?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Currently it is coded like this:
    call function 'BAPI_MATERIAL_SAVEDATA'
         exporting
              headdata            = st_head
              clientdata          = st_mara
              clientdatax         = st_marax
              plantdata           = st_plant
              plantdatax          = st_plantx
         importing
              return              = git_rtrn
         tables
              materialdescription = git_makt.

    if sy-subrc &amp;lt;&amp;gt; 0.
      perform change_zsrcmtrx_status using 'E'.
    else.
      perform change_zsrcmtrx_status using 'P'.
    endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would it be okay to add something like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    call function 'BAPI_MATERIAL_SAVEDATA'
         exporting
              headdata            = st_head
              clientdata          = st_mara
              clientdatax         = st_marax
              plantdata           = st_plant
              plantdatax          = st_plantx
         importing
              return              = git_rtrn
         tables
              materialdescription = git_makt
         exceptions
              error_message       = 3
              others              = 4.

    if sy-subrc &amp;lt;&amp;gt; 0.
      perform change_zsrcmtrx_status using 'E'.
    else.
      perform change_zsrcmtrx_status using 'P'.
    endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any input!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jul 2005 09:46:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-material-savedata-how-to-handle-errors/m-p/997356#M75564</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-01T09:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: 'BAPI_MATERIAL_SAVEDATA' - how to handle errors?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-material-savedata-how-to-handle-errors/m-p/997357#M75565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;no Steve,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you must analyze (like a message from T100)&lt;/P&gt;&lt;P&gt;bapi-return &amp;lt;b&amp;gt;git_rtrn&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;regards Andreas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jul 2005 09:49:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-material-savedata-how-to-handle-errors/m-p/997357#M75565</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2005-07-01T09:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: 'BAPI_MATERIAL_SAVEDATA' - how to handle errors?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-material-savedata-how-to-handle-errors/m-p/997358#M75566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Steve,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This Bapi doesn't need the "Commit", so datas aren't save if errors occured.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As for the errors, check for the 'returnmessages' table.&lt;/P&gt;&lt;P&gt;Take a look at the following code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;call function 'BAPI_MATERIAL_SAVEDATA'
    exporting
      headdata             = headdata
      clientdata           = clientdata
      clientdatax          = clientdatax
      plantdata            = plantdata
      plantdatax           = plantdatax
      forecastparameters   = forecastparameters
      forecastparametersx  = forecastparametersx
      planningdata         = planningdata
      planningdatax        = planningdatax
      storagelocationdata  = storagelocationdata
      storagelocationdatax = storagelocationdatax
      valuationdata        = valuationdata
      valuationdatax       = valuationdatax
      warehousenumberdata  = warehousenumberdata
      warehousenumberdatax = warehousenumberdatax
      salesdata            = salesdata
      salesdatax           = salesdatax
      storagetypedata      = storagetypedata
      storagetypedatax     = storagetypedatax
      flag_online          = ' '
      flag_cad_call        = ' '
    importing
      return               = return
   tables
*    materialdescription        =
*    unitsofmeasure             =
*    unitsofmeasurex            =
*    internationalartnos        =
*    materiallongtext           =
*    taxclassifications         =
     returnmessages             = t_return_msg .
*    prtdata                    =
*    prtdatax                   =
*    extensionin                =
*    extensioninx               =


  loop at t_return_msg.
    move-corresponding t_return_msg to t_return_msg_all.
    append t_return_msg_all.
  endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;erwan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jul 2005 09:50:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-material-savedata-how-to-handle-errors/m-p/997358#M75566</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-01T09:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: 'BAPI_MATERIAL_SAVEDATA' - how to handle errors?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-material-savedata-how-to-handle-errors/m-p/997359#M75567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Guys - that was really useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would you know what would have happened if I had used sy-subrc, as I had originally stated? Would it always have been set to '0'?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jul 2005 10:33:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-material-savedata-how-to-handle-errors/m-p/997359#M75567</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-01T10:33:31Z</dc:date>
    </item>
  </channel>
</rss>

