Round up price

Hi everyone,
I have to round up the price in condition.
I did the following setting.
(i)Maintain round up in condition type
(ii)Also maintain round up in pricing procedure
After above setting my price is rounding up for second digit,Like,
In place of 1.76,i am getting 1.8
But i want 2 in place of 1.8 (there should be no digit after decimal)
For above requirement,What setting I should do.
Regards
prabudh

Modify the routine with the help of Abaper & apply the same to the Condition type in pricing procedure.
Include RV64A601
rounding rule for closest interger value
FORM FRM_KONDI_WERT_601.
data: da_xkwerx(15).
unpack xkwert to da_xkwerx.
move '00' to da_xkwerx+13.
pack da_xkwerx to xkwert.
data : lgort1 like lips-lgort .
data :  d1(13) , d6(13) .
data :  d2 type p decimals 2 .
data :  d3 type p decimals 0 .
data :  d4 type p decimals 2 .
data    d5(2) .
data :  d8(3) .
unpack xkwert to d1 .
d2 = d1 .
d3 = d2 .
unpack d3 to d6.
d5 = d6+11(2) .
if d5 >=  50 .
d8 = 100 - d5 .
  d1 = d6 + d8 .
else .
d1 = d6 - d5 .
endif .
*pack d1 to xkwert   .
select single lgort into lgort1 from lips where
                                          vbeln = komp-vgbel and
                                          posnr = komp-vgpos .
IF SY-SUBRC = 0 .
   if lgort1 = 'JSTO'.
   d1 = 0 .
   pack d1 to xkwert.
   else .
   pack d1 to xkwert.
   endif .
ELSE .
pack d1 to xkwert.
ENDIF .
This will definately resolve the issue. It is tried & tested on many occasions.
Regards,
Rajesh Banka

Similar Messages

  • How to round unit price in XSL-FO Standard Purchase Order

    I have been trying to round the unit price of the Standard Purchase Order stylesheet that is written in XSL-FO. Please could someone suggest I how I could achieve this? As my attempt have been unsuccessful. In the stylesheet the following line of code returns the unit price.
    <xsl:value-of select="UNIT_PRICE"/>
    Thank you,
    Mark

    I assume you are talking about number formatting:
    You can use the XPATH function format-number:
    <xsl:value-of select="format-number(UNIT_PRICE,"####.#")"/>
    This will ONLY work if UNIT_PRICE is a correct XSL number (meaning no thousand seperator). Otherwise you can probabley remove the , out of say 1,234,567 using the
    translate function translate(UNIT_PRICE,",","") - Please check any XSL reference for additional information.
    Hope that helps,
    Klaus

  • Price per unit is getting round off to two decimal places.

    Hi Gurus,
    In the Billing output, the Price per unit is getting round off to two decimal places.
    How can we avoid this or allow 4 decimal places for such cases.
    In the same pricing procedure, we have two pricing condition types PR02 and ZR01.
    When PR02 is being used,it doesnt rounds off Price per unit.e.g .578888 = .578888
    But when ZR01 is being used the system rounds off price per unit.e.g.578888 = .58
    Please suggest where is the setting for it.
    Thanks
    Montee

    Hi,
    Which currency you are using? If its INR, then it will do only for 2 decimal places.
    The solution for ur problem can be ractified by changing the scales :
    Also check OSS 80183
    Thanks,
    Raja

  • Sales Orders :: OpenSum differs from OpenQty*Price

    Hello all,
    Creating a backlog report for a customer, I've found that, for partially delivered Sales Orders rows the OpenSum = LineTotal when, in my opinion, it should be OpenSum = OpenQty x Price.
    Can anyone confirm what should be the correct value of the OpenSum field?
    I've found no other post or SAP Note mentioning this issue.
    You can use the following query to search for "problematic" records.
    SELECT     T0.DocNum, T1.VisOrder, T1.OpenQty, T1.Price, T1.PriceBefDi,
              T1.PriceAfVAT, T1.OpenSum, ROUND(T1.Price*T1.OpenQty,2) AS 'Price*OpenQty',
              ROUND(Price*T1.Quantity,2) AS 'Price*Qty', T1.Linetotal
    FROM     ORDR T0 INNER JOIN
              RDR1 T1 ON T0.DocEntry = T1.DocEntry
    WHERE          T1.OpenSum <> ROUND(T1.Price*T1.OpenQty,2)
              AND T1.LineStatus = 'O'
    Kind Regards,
    Vítor Vieira

    Hi,
    It seems that the issue is only appearing for the partially copied document. When the document is fully copied, then the value is updated to the correct values.
    Same results from following query as well :
              select opensum, openqty,quantity, * from RDR1 where Quantity <> OpenQty
              and openqty <> 0
    Kind Regards,
    Jitin
    SAP Business One Forum Team

  • Istore Prices not shown correctly during checkout

    hi all;
    when i have selected the items from shopping cart say for 1578.46 euros:
    as i check out it is showing 1578.47 euros:
    after confirmation of the order it is showing 1578.49 euros. in OM
    How is this working?
    Regards;
    Prasad

    hi chandu,
    thank you very much for the update,
    oracle says this is the current functionality, could you pl suggest any workarounds?
    i tried using pricing formulae to round the price, not working
    even when i refresh the place order page increases the price by 0.01
    any suggestions please;
    prasad

  • Round up syntax for Formatted Search

    Hi all,
    I need help on writing the formatted search syntax for below scenario.
    Discount % = 2 decimal place only
    Unit Price = 99,376.00
    Discount = 30.97%
    Price After Discount = 68,599.25
    I want the Price After Discount to be rounded up to 68,600. Any idea how to achieve this? Will do this round up in another UDF so that my layout will show the rounded up price to customer.
    Even if the Price after discount is 600.02, i wanted the result to be always rounded up to nearest $1 as long as the original price has some amount at the decimal. For this case, should round up to 601.00.
    Anyone can help? Thanks in advance.

    Hi Too Mui Hwee
    Will the UDF be varchar or numeric? Do you want the udf to show the currency as well?
    I have done both for you. The problem with SQL 2008 & 2012 is that they don't have a roundup function. This is however in version 2014 which is not yet supported by SAP Business One.
    Without currency:
    SELECT CASE WHEN ROUND($[$38.17.NUMBER],0) < $[$38.17.NUMBER] THEN ROUND($[$38.17.NUMBER],0) + 1 ELSE ROUND($[$38.17.NUMBER],0) END
    With currency:
    SELECT CASE WHEN ROUND($[$38.17.NUMBER],0) < $[$38.17.NUMBER] THEN $[$38.17.CURRENCY] + ' ' + CAST(ROUND($[$38.17.NUMBER],0) + 1 AS VARCHAR(20)) ELSE $[$38.17.CURRENCY] + ' ' + CAST(ROUND($[$38.17.NUMBER],0) AS VARCHAR(20)) END
    Kind regards
    Peter Juby

  • Prices changes drastically in istore during checkout

    hi all;
    when i have selected the items from shopping cart say for 1578.46 euros:
    as i check out it is showing 1578.47 euros:
    after confirmation of the order it is showing 1578.49 euros. in OM
    How is this working?
    Regards;
    Prasad

    hi chandu,
    thank you very much for the update,
    oracle says this is the current functionality, could you pl suggest any workarounds?
    i tried using pricing formulae to round the price, not working
    even when i refresh the place order page increases the price by 0.01
    any suggestions please;
    prasad

  • How to selling price is derive in Sale order

    Hi ,
    I have an selling price rounding issue.  Price list of an item is 5.25 and the discout is 2.125 generaly selling price should be 3.075. But it showing 3.07... is there any setup in oracle to round the selling price in oracle?

    I have gone through some documents and I found some information about rounding of price.
    QP: Selling Price Rounding Options :- is the profile having different values. and for each value different different property
    Values
      NO: = unrounded listprice + unrounded adjustments: No rounding is done. 
    Individual: = round (listprice) + round (adj): The adjustments are calculated using rounded list price.
    Additive: = round (listprice + adj); unrounded Freight: The adjustments are calculated using unrounded list price.
    In my application this profile is set to :"Additive". So for the example which I posted above, the selling price should come 3.8,round(5.25 + (-2.175),2). But it came as 3.07.
    Can anyone tell why this is truncating the value instead of rounding? or is there any other standard functionality behind it?

  • Price List by BP by item

    I would like to make a report that shows the price list by BP by item, that looks at the price list the BP is pointed to in BP master, and take into account if any special prices by BP exists for that item, and any Period or Volume discounts.
    I also need the report to show if there is any additional expense for freight that item may have also based on the A/E type setup in BP Master.
    Does such a query exist?

    Art:
    Here's a starter, see if you can get it going from here...
    SELECT
         T0.ItemCode,
         T0.ItemName,
         'Default Price List' = TPL.ListName,
         'Special Price per BP' = ROUND(T1P.Price * (- T1.Discount / 100 + 1), 2)
         'Default Price' = T0P.Price,
    FROM
         OCRD TBP
         FULL OUTER JOIN OITM T0 ON 1=1
         LEFT JOIN OSPP T1 ON T0.ItemCode = T1.ItemCode AND T1.CardCode = TBP.CardCode
         LEFT JOIN ITM1 T1P ON T0.ItemCode = T1P.ItemCode AND T1.ListNum = T1P.PriceList
         LEFT JOIN ITM1 T0P ON T0.ItemCode = T0P.ItemCode AND T0P.PriceList = TBP.ListNum
         LEFT JOIN OPLN TPL ON TBP.ListNum = TPL.ListNum
    WHERE
         TBP.CardCode = '[%0]'
         AND T0.SellItem = 'Y'
    ORDER BY
         T0.ItemCode
    Joerg.

  • Zen Micro - New Models and Australian Pric

    I am looking at purchasing a Zen Micro however before I do I have a few queries:
    ** According to the US Creative website, a 4GB and 6GB Micro will be launched very soon.
    ) Does anyone know when these variations will be available in Australia?
    2) And will they have any different features to the 5GB model (apart from differing memory)?
    ** The US pricing is around 20% cheaper than Aussie prices. Currently the 5GB model retails for ~A$370 in Australia vs ~US$229 (A$290) in the US.
    3) What is the reason for the difference in price?
    4) What are the anticipated prices for the 4GB and 6GB models (when released)?
    5) Should I hold off my purchase until the next round of price drops hit Australia?

    SSR wrote:
    5. There's always some price drop around the corner
    Well I was going to buy a Zen Micro 5GB today, but now I am going to hang out and see if I can pick up a 6GB for around the same price. Hopefully these hit Australia shores, at a reasonable price soon. <B>Does anyone have an inkling on how long products take to hit Australia? (Weeks/months)?[/b]
    This has been the most dynamic few months in the MP3 market for sometime. *Fingers crossed* Creative can keep competiti've against Apple - Apple's recent price drop almost saw me rush out and buy a new mini (even with all it's limitations).

  • RMA 생성시 CREDIT PRICE가 EXTENDED PRECISION이 적용되지 않는 문제

    제품 : MFG_OE
    작성날짜 : 2003-05-16
    RMA 생성시 CREDIT PRICE가 EXTENDED PRECISION이 적용되지 않는 문제
    =======================================================
    PURPOSE
    Original Order를 참조하여 RMA 생성시 Credit Price가 extended precision이 적용되지 않는다. 일반 user들은 이 상황을 문제로 제기하지만 이는 현재 standard function이며 11,11i 동일하게 design 되어 있다.
    Explanation
    Currency standard precision = 2, Extended precision = 5 로 정의되어 있
    고, Prifle option-unit price precision type이 'Extended', OM(OE)에서
    사용하는 price list rounding factor = -2 인 경우.
    Order 생성시 selling price = 1.63200으로 입력,
    이 order를 참조하여 RMA를 생성하면 Credir price = 1.63000으로 조회된다.
    이 경우 대부분의 고객은 RMA credit price가 orginal order의 selling price
    인 1.63200 으로 조회되는것이 맞는 function이라 생각하나, 현재 design은
    extended precision 과 무관하게 사용한 price list rounding factor 값을
    기준으로 credit price를 입력하고 있다.
    다음은 bug 1316874에 developer가 update한 내용이며 이는 11i에서도 동일
    하게 적용된다.
    If Customer wants to see the price of the item up to 3 decimal place,
    they should NOT make the rounding factor of the Price List -2.
    Instead they should set the rounding factor as -3.
    If the OE:Unit price Precision Type is EXTENDED and Extended Precision is 5, then it would be logical to set the rounding factor of Price List as -5 only, in order to avoid any rounding off.
    While displaying the unit price, OE takes care of both Precision
    and Price List Rounding Factor.
    I checked both Sales Order form and RMA forms and the behavior is same.
    Even the original price at discount screen (RMA form) also displayed
    the price rounded to the price list rounding factor.
    All of the fields show price in EXTENDED precision (as desired) and
    round off the price to the PRICE LIST ROUNDING FACTOR (as desired).
    결론적으로 OM(OE)의 보여지는 price 자리수는 extended precision을 따르지만,price의 round off는 price list rounding factor에 따라 결정된다.
    Example
    Reference Documents
    bug 1316874

  • PO roundings (ME21N - MIRO)

    Hi Guru,
    Iu2019ve a problema with PO roundings.
    Our situation is as follows:
    we manage MM in the public sector integrated with FI - FM - CO - SP - SD.
    Even with ECC 4.6 we had problems on the rounding of prices for individual positions in the Purchase Orders (ME21N) and invoices (MIRO), the problem is now with ECC 6.0.
    PROBLEM
    When creating the purchase order and goods receipt, the system calculates the total value of VAT purchases in a manner different from that determined during invoice entry. In the first case, purchase order, the VAT amount is calculated and rounded at each item; in the second case, invoice entry, the amount is calculated and rounded at header level. This mechanism can cause problems of mismatch between tax amounts calculated in purchase order and amounts calculated in miro.
    EXAMPLE:
    u2022 In purchase order (and goods receipt):
    Example:
    Item 1: 83.78 * 20% = 16.756 -> rounds to 16.76 
    Item 2: 83.78 * 20% = 16.756 -> rounds to 16.76 
    Total VAT: 16.76 + 16.76 = 33.52
    total financial commitment (earmarked fund) to consume = total PO = 201.08
    u2022 During invoice entry:
    Example:
    Item 1: 83.78
    Item 2: 83.78
    Total VAT 167.56 * 20% = 33.512 -> rounds to 33.51
    total financial commitment (earmarked fund) to consume = total PO = 201.07
    From the fact that the VAT amount is calculated correctly in MIRO, we want to align the two methods of calculation, so: total amount of VAT PO = 33.51 and  not 33.52 (for us it is essential that the system correctly calculate the VAT already in the PO for the integration with the earmarked fund).
    Hoping that it was not too wordy or so exhaustive,
    Thank you in advance,

    Hi,
    It's a problem related with rounding in header conditions. In tcode M/06, in group conditions you can manage this issue. It use to happens when you have a lot of items in a document and with large amounts.
    For a futher information, you can see these notes:
    Note 315792 - Group conditions of the same amount on item
    Note 80183 - Rounding
    Note 517829 - Source code f new dstrbtn rule 'roundng diffrnce comparison'
    and related notes
    I hope this helps you
    Regards
    Eduardo

  • How to load data with carriage return through DRM action script ?

    Hello,
    We are using DRM to manage Essbase metadata. These metadata contain a field for member formula.
    Currently it's a string data type property in DRM so we can't use carriage return and our formula are really hard to read.
    But DRM support other data type property : memo or formatted memo where we can use carriage return.
    Then in the export file, we have change the record delimiter to an other character than CRLF
    Our issue : we are regularly using action script to load new metadata => How to load data properties with carriage return using action script ? There is no option to change the record delimiter.
    Thanks!

    Hello Sandeep
    here what I want to do through action script : loading a formula that use more on than one line:
    Here, I write my formula using 4 lines but action script cannot load since one line = 1 record.
    ChangeProp|Version_name|Hier_name|Node_name|Formula|@round(
    qty*price
    *m05*fy13

  • SQL Query with Distinct and Count is wrong.

    Hello,
    i have another problem with a query.
    Here the Data:
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    CREATE      TABLE      TABLE_1
    (       "ORDER_NR"        VARCHAR2 (12)
    ,        "PRIORITY"        VARCHAR2 (2)
    ,        "WO_STATUS"        VARCHAR2 (1)
    ,        "STATUS_DATE"        DATE
    ,       "ART_NR"                      VARCHAR2 (9)
    ,       "DESCRIPTION"      VARCHAR2 (255)
    ,                 "PRICE"                     VARCHAR2 (10)
    CREATE      TABLE      TABLE_2
    (     "ART_NR"            VARCHAR(9)
    ,     "MODELL"              VARCHAR2(10)
    ,     "MANUFACT"         VARCHAR2(20)
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE)
                  VALUES           ('1KKA1Z300612',     '12',     'U',        TO_DATE('05-FEB-13 10:22:39','DD-MON-RR HH24:MI:SS'),     '005231987',     '1ST ANNUAL SERVICE',   '5000.2546');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE)
                  VALUES           ('1KKA1Z300638',     '05',     'U',        TO_DATE('05-FEB-13 11:38:39','DD-MON-RR HH24:MI:SS'),     '005667821',     '3RD ANNUAL SERVICE',   '5269.7856');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE)
                  VALUES           ('1KKA1Z300638',     '12',     'U',        TO_DATE('06-FEB-13 12:38:39','DD-MON-RR HH24:MI:SS'),     '005667821',     '1ST BIENNIAL SERVICE', '1234.4468');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE)
                  VALUES           ('1KKA1Z300638',     '12',     'U',        TO_DATE('07-FEB-13 13:38:39','DD-MON-RR HH24:MI:SS'),     '005667821',     '3RD ANNUAL SERVICE',   '4366.7856');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE)
                  VALUES           ('1KKA1Z300762',     '12',     'U',        TO_DATE('22-FEB-13 14:55:48','DD-MON-RR HH24:MI:SS'),     '018743356',     '3RD ANNUAL SERVICE',   '4462.8632');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE)
                  VALUES           ('1KKA1Z300766',     '12',     'U',        TO_DATE('22-FEB-13 08:32:13','DD-MON-RR HH24:MI:SS'),     '018743356',     '2ND ANNUAL SERVICE',   '8762.6643');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE)
                  VALUES           ('1KKA1Z300766',     '05',     'U',        TO_DATE('23-FEB-13 12:32:13','DD-MON-RR HH24:MI:SS'),     '018743356',     '1ST BIENNIAL SERVICE', '3425.6643');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE)
                  VALUES           ('1KKA1Z300766',     '12',     'U',        TO_DATE('24-FEB-13 14:32:13','DD-MON-RR HH24:MI:SS'),     '018743356',     '2ND BIENNIAL SERVICE', '6678.6643');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE)
                  VALUES           ('1KKA1Z300612',     '12',     'U',        TO_DATE('06-FEB-13 10:22:39','DD-MON-RR HH24:MI:SS'),     '005231987',     '1ST ANNUAL SERVICE',   '5000.2546');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE)
                  VALUES           ('1KKA1Z300638',     '05',     'U',        TO_DATE('05-FEB-13 11:38:39','DD-MON-RR HH24:MI:SS'),     '005667821',     '3RD ANNUAL SERVICE',   '5269.7856');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE)
                  VALUES           ('1KKA1Z300638',     '12',     'U',        TO_DATE('06-FEB-13 12:38:39','DD-MON-RR HH24:MI:SS'),     '005667821',     '1ST BIENNIAL SERVICE', '1234.4468');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE)
                  VALUES           ('1KKA1Z300638',     '12',     'U',        TO_DATE('07-FEB-13 13:38:39','DD-MON-RR HH24:MI:SS'),     '005667821',     '3RD ANNUAL SERVICE',   '4366.7856');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE)
                  VALUES           ('1KKA1Z300762',     '12',     'U',        TO_DATE('22-FEB-13 14:55:48','DD-MON-RR HH24:MI:SS'),     '018743356',     '3RD ANNUAL SERVICE',   '4462.8632');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE)
                  VALUES           ('1KKA1Z300766',     '12',     'U',        TO_DATE('22-FEB-13 08:32:13','DD-MON-RR HH24:MI:SS'),     '018743356',     '2ND ANNUAL SERVICE',   '8762.6643');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE)
                  VALUES           ('1KKA1Z300766',     '05',     'U',        TO_DATE('23-FEB-13 12:32:13','DD-MON-RR HH24:MI:SS'),     '018743356',     '1ST BIENNIAL SERVICE', '3425.6643');
    INSERT      INTO      TABLE_1      (ORDER_NR,              PRIORITY, WO_STATUS,  STATUS_DATE,                                             ART_NR,           DESCRIPTION,            PRICE)
                  VALUES           ('1KKA1Z300766',     '12',     'U',        TO_DATE('24-FEB-13 14:32:13','DD-MON-RR HH24:MI:SS'),     '018743356',     '2ND BIENNIAL SERVICE', '6678.6643');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT1');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT2');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT3');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT4');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT5');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT6');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005667821',     'LASER',          'MANUFACT1');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005667821',     'LASER',          'MANUFACT2');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005667821',     'LASER',          'MANUFACT3');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005667821',     'LASER',          'MANUFACT4');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT1');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT2');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT3');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT4');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT5');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT6');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT1');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT2');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT3');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT4');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT5');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005231987',     'X-RAY1',          'MANUFACT6');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005667821',     'LASER',          'MANUFACT1');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005667821',     'LASER',          'MANUFACT2');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005667821',     'LASER',          'MANUFACT3');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('005667821',     'LASER',          'MANUFACT4');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT1');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT2');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT3');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT4');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT5');
    INSERT     INTO      TABLE_2      (ART_NR,            MODELL,         MANUFACT)
                  VALUES           ('018743356',     'VACCUM',          'MANUFACT6');
    COMMIT;And my query:
    SELECT T1.ART_NR
    , T2.MODELL
    , SUM(ROUND(T1.PRICE, 2)) AS TOTAL_PRICE
    , COUNT(*) AS QTY
    , TO_CHAR(T1.STATUS_DATE, 'MON-RR') AS MONTH
    FROM TABLE_1 T1, TABLE_2 T2
    WHERE T1.WO_STATUS = 'U'
    AND T1.ART_NR = T2.ART_NR
    AND TO_CHAR(T1.STATUS_DATE, 'MON-RR') = 'FEB-13'
    GROUP BY T2.MODELL
    , T1.ART_NR
    , TO_CHAR(T1.STATUS_DATE, 'MON-RR')And the result:
    ART_NR      MODELL     TOTAL_PRICE        QTY     MONTH
    018743356 VACCUM     559916.16            96        FEB-13
    005667821 LASER        173936.48            48        FEB-13
    005231987 X-RAY1          120006             24        FEB-13My problem now is, the OTY field ist wrong it should count how often the equipment was in service in FEB-13 and group it by "MODELL" the MANUFACT field is not interesting for me, but this ist my problem, one Modell can have multible Manufacter and so i got a wrong count for my QTY.
    The next step i need is to group the result also by Service type (annual or biennial), like this:
    ART_NR      MODELL     TOTAL_PRICE        QTY     MONTH   SERVICE_TYPE
    018743356 VACCUM      1234.56               4         FEB-13     ANNUAL
    018743356 VACCUM      4423.48               10       FEB-13     BIENNIAL
    005667821 LASER         4783.11               2         FEB-13     ANNUAL
    005667821 LASER         1123.77               22       FEB-13      BIENNIAL
    005231987 X-RAY1        8966.12               6        FEB-13      ANNUAL
    005231987 X-RAY1        7826.44              12        FEB-13      BIENNIALThis values are only out of my head, not the table, only to show what i need.
    Thanks for your help.
    Greets Reinhard

    Hi,
    Here's one way:
    WITH    got_groups  AS
         SELECT  art_nr
         ,     TRUNC (status_date, 'MONTH')     AS month
         ,     CASE
                  WHEN  UPPER (description) LIKE '%ANNUAL%'
                                         THEN  'ANNUAL'
                  WHEN  UPPER (description) LIKE '%BIENNIAL%'
                                         THEN  'BIENNIAL'
              END                    AS service_type
         ,     TO_NUMBER (price)          AS price
         FROM     table_1
         WHERE     status_date     >= DATE '2013-02-01'
         AND     status_date     <  DATE '2013-03-01'
    ,       table_2_summary  AS
         SELECT DISTINCT       art_nr, modell
         FROM               table_2
    SELECT       g.art_nr
    ,       s.modell
    ,       ROUND ( SUM (g.price)
              , 2
              )          AS total_price
    ,       COUNT (*)          AS qty
    ,       g.month
    ,       service_type
    FROM       got_groups       g
    JOIN       table_2_summary  s     ON  s.art_nr  = g.art_nr 
    GROUP BY  g.art_nr
    ,            s.modell
    ,            g.month
    ,       g.service_type
    ;The reason why your aggregates were originally too high is that you have a many-to-many relationship between the tables. The tables are related only by art_nr, but art_nr is not unique in either table. Look at art_nr '005231987', example. There ate 2 rows in table_1 with that art_nr, and 6 rows in table_2 with the same art_nr. If we join on art_nr, then both of the rows in table_1 will match each of the 6 rows in table_2, so the COUNT will be 2 * 6 = 12, and in the SUM, each of the numbers from table_1 will get added 6 times.
    Why is table_2 designed the way it is? Cn there be multiple modells for the same art_nr? If so, what would you want for output? If there can only be 1 modell for each art_nr, then a better design would be to have a table that just had one row per art_nr, and included the modell column, and another table to show which manufacturers produce each art_nr. In this problem, you wouldn't need the manufacturers table, and the other table already has unique art_nrs, so you wouldn't need anything like the sub-query table_2_summary.
    Don't store price in a VARCHAR2 column. Storing NUMBERs in a VARCHAR2 column is just asking for problems. Why not use a NUMBER column instead.
    You'll notice that I used ROUND (SUM ... where you use SUM ( ROUND. The results might be a little different because of rounding errors. ROUND ( SUM only has to call ROUND once per group (5 times in this example) instead of once per row (16 times in this example). The less rounding you do, the less rounding error creeps in. Also, since there are fewer function calls, it's more convenient. (Of course, you'll never notice the difference between calling ROUND 5 times or 16 times, but in a real-life exampe, the difference could be between calling it 50 times or calling it 16000 times.) If you really need to use SUM (ROUND, you can.

  • Reg: Material Ledger Account posting

    Hello Everyone,
    We have Material Ledger active for a plant with transaction based price determination (Price Control V). I have posted a GR & its creating 2 Accounting docs. One with Transaction keys BSX, WRX & PRD.
    WRX is calculating correctly based on the PO price. But, I am not sure how BSX is calculated as its not picking the Periodic Price unit in the current period.
    Could you please guide how account posing (GR & IR) will happen for a material with Price control V & Material Ledger active.
    Thanks in Advance,
    Uswin

    Hi Uswin,
    if you look at the second FI document generated upon the GR, I'm pretty sure you will find that in this document, the price difference from the first document ist "reversed" and the amount added to inventory value, correct? So the end result is the same as it would be without material ledger (GR valued at PO price), it just happens in two steps. Therefore, what Frederick said is not 100% correct, as only the end result is the same with and without ML for V/2 materials, but not each single document.
    Secondly, as to why the PRD arises on GR.
    In my system I found the same case. A GR with a PRD posting for a material with price control V and price determination 2.
    In my case I found the PRD to be in fact a rounding difference, which arose in the following way:
    Price in PO was 57,78 u20AC/10 pieces. The price unit in material master, however, is 1 unit.
    Now what the system seems to have done is:
    (1) round the price in PO to the price unit from material master: result: 5,78 u20AC/piece
    (2) Post 5,78 u20AC * pieces received to stock value, the difference (5,778 - 5,78)*pieces received to PRD account
    (3) POst a second document reversing the PRD and addig it to stock value
    Perhaps, the reason for a "price difference" arising is similar in your case
    Regards
    Nikolas

Maybe you are looking for