<?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 for return orders in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/pricing-for-return-orders/m-p/1999604#M406916</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;Can anyone help me on an user exit for return orders pricing.i have to do the pricing based on some logic .but im unable to find the table in which material/customer exists (except KNMT table) such that i can find entry for shipment and go head and find the avg price.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can suggestion also is welcome&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Mar 2007 14:12:20 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-03-19T14:12:20Z</dc:date>
    <item>
      <title>Pricing for return orders</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pricing-for-return-orders/m-p/1999604#M406916</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;Can anyone help me on an user exit for return orders pricing.i have to do the pricing based on some logic .but im unable to find the table in which material/customer exists (except KNMT table) such that i can find entry for shipment and go head and find the avg price.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can suggestion also is welcome&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2007 14:12:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pricing-for-return-orders/m-p/1999604#M406916</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-19T14:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: Pricing for return orders</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/pricing-for-return-orders/m-p/1999605#M406917</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;following is the code that can be helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use the following code in the MV45AFZZ include program and trigger the following code in a include program USEREXIT_PRICING_PREPARE_TKOMP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CHECK vbak-auart EQ 'ZRE'.&lt;/P&gt;&lt;P&gt;*CHECK vbak-vkorg EQ '1300'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     T Y P E  D E C L A R A T I O N S                               *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES : BEGIN OF ty_s_retorders,&lt;/P&gt;&lt;P&gt;          kunag TYPE vbrk-kunag,    " Customer Number&lt;/P&gt;&lt;P&gt;          vbeln TYPE vbrp-vbeln,    " Billing Doucuement&lt;/P&gt;&lt;P&gt;          matnr TYPE vbrp-matnr,    " Material Number&lt;/P&gt;&lt;P&gt;          vgpos TYPE vbrp-vgpos,    " Item Number&lt;/P&gt;&lt;P&gt;          fkimg TYPE vbrp-fkimg,    " Item Quantity&lt;/P&gt;&lt;P&gt;          netwr TYPE vbrp-netwr,    " Net price of the Item&lt;/P&gt;&lt;P&gt;          erdat TYPE vbrk-erdat,    " Date of cretaion of the record&lt;/P&gt;&lt;P&gt;          value TYPE vbrp-netwr,    " Net value of the Item&lt;/P&gt;&lt;P&gt;        END OF ty_s_retorders,&lt;/P&gt;&lt;P&gt;       ty_t_retorders TYPE STANDARD TABLE OF ty_s_retorders.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;            V A R I A B L E S                                       *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : lv_quant TYPE vbrp-fkimg,    " Total quantity&lt;/P&gt;&lt;P&gt;       lv_value TYPE vbrp-netwr,    " Total value of the materials&lt;/P&gt;&lt;P&gt;       lv_avgpr TYPE vbrp-netwr,    " Averge Price of the material&lt;/P&gt;&lt;P&gt;       lv_dat   TYPE i,             " variable to hold the year value&lt;/P&gt;&lt;P&gt;       lv_date  TYPE vbrk-erdat.    " Creation date of the docuement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     I N T E R N A L  T A B L E S                                   *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : gt_retorders TYPE ty_t_retorders.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;G L O B A L    D A T A   D E C L A R A T I O N S                    *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA   : gs_output    TYPE ty_s_retorders.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONSTANTS : lc_zpr0(4) TYPE c VALUE 'ZPR0' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get date value which is 12 months ago.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;lv_dat     = sy-datum+0(4) - 1.&lt;/P&gt;&lt;P&gt;lv_date    = sy-datum.&lt;/P&gt;&lt;P&gt;lv_date(4) = lv_dat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Select data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;SELECT   vbrk~kunag          " Customer Number&lt;/P&gt;&lt;P&gt;         vbrp~vbeln          " Billing Doucuement&lt;/P&gt;&lt;P&gt;         vbrp~matnr          " Material Number&lt;/P&gt;&lt;P&gt;         vbrp~vgpos          " Item Number&lt;/P&gt;&lt;P&gt;         vbrp~fkimg          " Item Quantity&lt;/P&gt;&lt;P&gt;         vbrp~netwr          " Net price of the Item&lt;/P&gt;&lt;P&gt;         vbrk~erdat          " Date of cretaion of the record&lt;/P&gt;&lt;P&gt;         INTO   TABLE gt_retorders&lt;/P&gt;&lt;P&gt;         FROM  vbrp  JOIN   vbrk&lt;/P&gt;&lt;P&gt;         ON   vbrk&lt;SUB&gt;vbeln = vbrp&lt;/SUB&gt;vbeln&lt;/P&gt;&lt;P&gt;         WHERE   vbrk~erdat BETWEEN lv_date AND sy-datum&lt;/P&gt;&lt;P&gt;           AND   kunag EQ vbak-kunnr&lt;/P&gt;&lt;P&gt;           AND   matnr EQ vbap-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLEAR: lv_quant,&lt;/P&gt;&lt;P&gt;       lv_value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;loop the internal table and get the total of quantity and value&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;LOOP AT gt_retorders INTO gs_output.&lt;/P&gt;&lt;P&gt;  gs_output-value = gs_output-fkimg * gs_output-netwr.&lt;/P&gt;&lt;P&gt;  lv_quant        = lv_quant +  gs_output-fkimg.&lt;/P&gt;&lt;P&gt;  lv_value        = lv_value +  gs_output-value.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;calculate the average pricing value&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CLEAR lv_avgpr .&lt;/P&gt;&lt;P&gt;lv_avgpr = lv_value / lv_quant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLEAR xkomv.&lt;/P&gt;&lt;P&gt;READ TABLE xkomv INTO xkomv WITH KEY kposn = vbap-posnr&lt;/P&gt;&lt;P&gt;                                     kschl = lc_zpr0 .&lt;/P&gt;&lt;P&gt;IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;  xkomv-kbetr = lv_avgpr .&lt;/P&gt;&lt;P&gt;  MODIFY TABLE xkomv[] FROM xkomv TRANSPORTING kbetr .&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Mar 2007 17:50:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/pricing-for-return-orders/m-p/1999605#M406917</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-21T17:50:30Z</dc:date>
    </item>
  </channel>
</rss>

