<?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: Error in BAPI_MATERIAL_SAVEDATA in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-bapi-material-savedata/m-p/1350908#M175929</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please try......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

* Plant data    
w_marc-plant         = it_data-werks.   
w_marc-variance_key  = it_data-awsls.  
&amp;lt;b&amp;gt;w_marcx-plant        = it_data-werks. &amp;lt;/b&amp;gt;   
w_marcx-variance_key = 'X'.   



&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reason is that the PLANT field in the "X" structure is not a flag field, but the 4 character plant field which needs a valid plant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 May 2006 19:09:20 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2006-05-18T19:09:20Z</dc:date>
    <item>
      <title>Error in BAPI_MATERIAL_SAVEDATA</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-bapi-material-savedata/m-p/1350907#M175928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all.&lt;/P&gt;&lt;P&gt;Im trying to update a material using BAPI_MATERIAL_SAVEDATA, I have to update the field PLANTDATA-VARIANCE_KEY among others.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the BAPI returns with the following error:&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;Key fields for user data PLANTDATA and checkbox structure PLANTDATAX are different&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my code&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  LOOP AT it_data WHERE result EQ 1.

    CLEAR: header, w_mbew, return, return_msg.
    REFRESH: return_msg.

*- Header data
    header-material      = it_data-matnr.
    header-cost_view     = 'X'.
    header-purchase_view = 'X'.
    header-matl_type     = it_data-mtart.

*- Valuation View
    w_mbew-val_area    = it_data-werks.
    w_mbew-qty_struct  = ' '.
    w_mbew-plndprice1  = it_data-zplp1.
    w_mbew-price_unit  = it_data-peinh.
    w_mbew-price_ctrl  = it_data-vprsv.
    w_mbew-std_price   = it_data-stprs.
    w_mbew-moving_pr   = it_data-verpr.
    w_mbew-plndprdate1 = p_zldp1.

    w_mbewx-val_area    = it_data-werks.
    w_mbewx-qty_struct  = 'X'.
    w_mbewx-plndprice1  = 'X'.
    w_mbewx-price_unit  = 'X'.
    w_mbewx-price_ctrl  = 'X'.
    w_mbewx-std_price   = 'X'.
    w_mbewx-moving_pr   = 'X'.
    w_mbewx-plndprdate1 = 'X'.

* Plant data
    w_marc-plant         = it_data-werks.
    w_marc-variance_key  = it_data-awsls.

    w_marcx-plant        = 'X'.
    w_marcx-variance_key = 'X'.

    CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
      EXPORTING
        headdata       = header
        plantdata      = w_marc
        plantdatax     = w_marcx
        valuationdata  = w_mbew
        valuationdatax = w_mbewx
      IMPORTING
        return         = return
      TABLES
        returnmessages = return_msg.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help will be rewarded...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 May 2006 19:04:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-bapi-material-savedata/m-p/1350907#M175928</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-18T19:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: Error in BAPI_MATERIAL_SAVEDATA</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-bapi-material-savedata/m-p/1350908#M175929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please try......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

* Plant data    
w_marc-plant         = it_data-werks.   
w_marc-variance_key  = it_data-awsls.  
&amp;lt;b&amp;gt;w_marcx-plant        = it_data-werks. &amp;lt;/b&amp;gt;   
w_marcx-variance_key = 'X'.   



&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reason is that the PLANT field in the "X" structure is not a flag field, but the 4 character plant field which needs a valid plant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 May 2006 19:09:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-bapi-material-savedata/m-p/1350908#M175929</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-05-18T19:09:20Z</dc:date>
    </item>
  </channel>
</rss>

