<?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 PRICING FM in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/pricing-fm/m-p/8014203#M1608060</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Seeking help on using this function module.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically, I want to simulate the PRICING of a material by geting an existing Invoice Line Item and just changing the material.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am getting mixed results and can't seem to get a pattern or clue. Perhaps you guys can help as I'm quite new to this FM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried setting CALTY to 'B' and 'C'.  Let me know if you see something I don't. Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    
    SELECT SINGLE * INTO lwa_vbrk FROM vbrk WHERE vbeln EQ P_VBELN.
    SELECT SINGLE * INTO lwa_vbrp FROM vbrp WHERE vbeln EQ P_VBELN AND posnr EQ P_POSNR.

*   Get KOMK and KOMP, the rest are dummies.. unfortunately
    CALL FUNCTION 'RV_INVOICE_PRICING_PREPARE'
    EXPORTING
      VBRK_I         = lwa_vbrk
      VBRP_I         = lwa_vbrp
    IMPORTING
      KOMK_E         = lwa_komk
      KOMP_E         = lwa_komp
    TABLES
      XKOMFK         = li_komfk
      XVBFS          = li_vbfs
      XVBPA          = li_vbpa
      XVBRK          = li_vbrk
      XVBRP          = li_vbrp.

    lwa_komp-matnr = P_MATNR. " change material to material to be simulated

*   remove all references to be sure
    CLEAR: lwa_komk-belnr.
    CLEAR: lwa_komk-knumv.
    CLEAR: lwa_komk-Vbelv.

*   Simulate pricing
    CALL FUNCTION 'PRICING'
      EXPORTING
        CALCULATION_TYPE = P_CALTY "LC_NEW    "IMPORTANT: Carry out new pricing, default is A=&amp;gt;extract from existing
        COMM_HEAD_I      = lwa_komk
        COMM_ITEM_I      = lwa_komp
      TABLES
        TKOMV            = li_komv. " RESULT
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Aug 2011 14:38:16 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-08-08T14:38:16Z</dc:date>
    <item>
      <title>PRICING FM</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pricing-fm/m-p/8014203#M1608060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Seeking help on using this function module.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically, I want to simulate the PRICING of a material by geting an existing Invoice Line Item and just changing the material.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am getting mixed results and can't seem to get a pattern or clue. Perhaps you guys can help as I'm quite new to this FM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried setting CALTY to 'B' and 'C'.  Let me know if you see something I don't. Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    
    SELECT SINGLE * INTO lwa_vbrk FROM vbrk WHERE vbeln EQ P_VBELN.
    SELECT SINGLE * INTO lwa_vbrp FROM vbrp WHERE vbeln EQ P_VBELN AND posnr EQ P_POSNR.

*   Get KOMK and KOMP, the rest are dummies.. unfortunately
    CALL FUNCTION 'RV_INVOICE_PRICING_PREPARE'
    EXPORTING
      VBRK_I         = lwa_vbrk
      VBRP_I         = lwa_vbrp
    IMPORTING
      KOMK_E         = lwa_komk
      KOMP_E         = lwa_komp
    TABLES
      XKOMFK         = li_komfk
      XVBFS          = li_vbfs
      XVBPA          = li_vbpa
      XVBRK          = li_vbrk
      XVBRP          = li_vbrp.

    lwa_komp-matnr = P_MATNR. " change material to material to be simulated

*   remove all references to be sure
    CLEAR: lwa_komk-belnr.
    CLEAR: lwa_komk-knumv.
    CLEAR: lwa_komk-Vbelv.

*   Simulate pricing
    CALL FUNCTION 'PRICING'
      EXPORTING
        CALCULATION_TYPE = P_CALTY "LC_NEW    "IMPORTANT: Carry out new pricing, default is A=&amp;gt;extract from existing
        COMM_HEAD_I      = lwa_komk
        COMM_ITEM_I      = lwa_komp
      TABLES
        TKOMV            = li_komv. " RESULT
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Aug 2011 14:38:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pricing-fm/m-p/8014203#M1608060</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-08T14:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: PRICING FM</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pricing-fm/m-p/8014204#M1608061</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;found the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some of the documents that I am extracting from VBRK are cancelled or cancellation documents.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried clearing the following fields and I got results from KOMV:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fksto&lt;/P&gt;&lt;P&gt;sfakn&lt;/P&gt;&lt;P&gt;rfbsk&lt;/P&gt;&lt;P&gt;cpkur&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I didn't do more tests so, probably, you don't need to clear all of these.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Aug 2011 07:03:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pricing-fm/m-p/8014204#M1608061</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-08-09T07:03:53Z</dc:date>
    </item>
  </channel>
</rss>

