<?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 LSMW field mapping Rule-ABAP code in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/lsmw-field-mapping-rule-abap-code/m-p/8092871#M1615594</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Guru!&lt;/P&gt;&lt;P&gt;I'm new to ABAP, but I have to write a little in ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I create a LSMW project using BAPI for changing standart price of material.&lt;/P&gt;&lt;P&gt;Input data: material, price, posting date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The point is: system should found in table MBEW &lt;STRONG&gt;all&lt;/STRONG&gt; valuation areas and valuation types fo which the material record is exist and cang price for all these records.&lt;/P&gt;&lt;P&gt;I wrote a code for these fields in Field Mapping menu. But it puts in only &lt;STRONG&gt;one&lt;/STRONG&gt; record whereas I need it to execute BAPI for all records.&lt;/P&gt;&lt;P&gt;I wrote the folliwing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VALUATIONAREA                Valuation Area&lt;/P&gt;&lt;P&gt;                   Code:    tables MBEW.&lt;/P&gt;&lt;P&gt;                            select * from MBEW&lt;/P&gt;&lt;P&gt;                             where MATNR = ZHEADER-MATNR.&lt;/P&gt;&lt;P&gt;                            E1MATERIALVALUATION_PRICECH-VALUATIONAREA = MBEW-BWKEY.&lt;/P&gt;&lt;P&gt;                            endselect.&lt;/P&gt;&lt;P&gt;VALUATIONTYPE                Valuation Type&lt;/P&gt;&lt;P&gt;                   Code:    select * from MBEW&lt;/P&gt;&lt;P&gt;                             where MATNR = ZHEADER-MATNR.&lt;/P&gt;&lt;P&gt;                            E1MATERIALVALUATION_PRICECH-VALUATIONTYPE = MBEW-BWTAR.&lt;/P&gt;&lt;P&gt;                            endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May be it's simple, may be not. But I don't know how do do it.&lt;/P&gt;&lt;P&gt;Will be grateful for any hints.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: assoli on Aug 3, 2011 3:51 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Aug 2011 13:46:14 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-08-03T13:46:14Z</dc:date>
    <item>
      <title>LSMW field mapping Rule-ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lsmw-field-mapping-rule-abap-code/m-p/8092871#M1615594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Guru!&lt;/P&gt;&lt;P&gt;I'm new to ABAP, but I have to write a little in ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I create a LSMW project using BAPI for changing standart price of material.&lt;/P&gt;&lt;P&gt;Input data: material, price, posting date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The point is: system should found in table MBEW &lt;STRONG&gt;all&lt;/STRONG&gt; valuation areas and valuation types fo which the material record is exist and cang price for all these records.&lt;/P&gt;&lt;P&gt;I wrote a code for these fields in Field Mapping menu. But it puts in only &lt;STRONG&gt;one&lt;/STRONG&gt; record whereas I need it to execute BAPI for all records.&lt;/P&gt;&lt;P&gt;I wrote the folliwing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VALUATIONAREA                Valuation Area&lt;/P&gt;&lt;P&gt;                   Code:    tables MBEW.&lt;/P&gt;&lt;P&gt;                            select * from MBEW&lt;/P&gt;&lt;P&gt;                             where MATNR = ZHEADER-MATNR.&lt;/P&gt;&lt;P&gt;                            E1MATERIALVALUATION_PRICECH-VALUATIONAREA = MBEW-BWKEY.&lt;/P&gt;&lt;P&gt;                            endselect.&lt;/P&gt;&lt;P&gt;VALUATIONTYPE                Valuation Type&lt;/P&gt;&lt;P&gt;                   Code:    select * from MBEW&lt;/P&gt;&lt;P&gt;                             where MATNR = ZHEADER-MATNR.&lt;/P&gt;&lt;P&gt;                            E1MATERIALVALUATION_PRICECH-VALUATIONTYPE = MBEW-BWTAR.&lt;/P&gt;&lt;P&gt;                            endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;May be it's simple, may be not. But I don't know how do do it.&lt;/P&gt;&lt;P&gt;Will be grateful for any hints.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: assoli on Aug 3, 2011 3:51 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Aug 2011 13:46:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lsmw-field-mapping-rule-abap-code/m-p/8092871#M1615594</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-03T13:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: LSMW field mapping Rule-ABAP code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/lsmw-field-mapping-rule-abap-code/m-p/8092872#M1615595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;select endselect goes like a Loop, so if you don't store the value in some table (internal table), only the last row will be available to you as it will be overwritten everytime in the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is no need of using 2 selects, one select itself will give you all the data for that material in MBEW table. I don't understand what you are doing with &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;E1MATERIALVALUATION_PRICECH-VALUATIONAREA = MBEW-BWKEY&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is E1MATERIALVALUATION_PRICECH a structure ? You need somethng like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select * from MBEW
where MATNR = ZHEADER-MATNR.
E1MATERIALVALUATION_PRICECH-MATERIAL             = ZHEADER-MATNR
E1MATERIALVALUATION_PRICECH-VALUATIONAREA = MBEW-BWKEY.
E1MATERIALVALUATION_PRICECH-VALUATIONTYPE = MBEW-BWTAR.

Append E1MATERIALVALUATION_PRICECH to itab.             "(itab is internal table)
endselect.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then use that itab for your purpose.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Aug 2011 02:14:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/lsmw-field-mapping-rule-abap-code/m-p/8092872#M1615595</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-04T02:14:46Z</dc:date>
    </item>
  </channel>
</rss>

