Skip to Content
0
Jun 13, 2009 at 04:50 AM

calculation of net price for orders

34 Views

hi

below is my output wt i want.....

my problem is for one info record there will be n number of Order numbers and for some info records only one oredr number will be there..

now i want to calculate the variance for the info records that are having more than one order number.

how to do this?

Info Rec.  
5300000154 

Net Price   Curr.   Order No.  Variance

25.00    INR   /    4501000100
25.00    INR   /     01000100         80.0-
100.00  INR   /     4501000103    1,900.0
30.00    INR   /     4501000111     70.0-
25.00    INR   /     4501000112     16.7-
50.00    INR   /     4500000067     100.0
29.00    INR   /     14501000241    42.0-
28.00    INR   /     4501000271      3.4-

LOOP AT xeipa INTO wa_xeipa.
  idx = sy-tabix.
  CLEAR: wa_xeina.

    READ TABLE xeina INTO wa_xeina WITH KEY infnr = wa_xeipa-infnr.
    IF sy-subrc is INITIAL.
    wa_final-infnr = wa_xeipa-infnr.
    wa_final-ebeln = wa_xeipa-ebeln.
    wa_final-bedat = wa_xeipa-bedat.
    wa_final-matnr = wa_xeina-matnr.
    wa_final-lifnr = wa_xeina-lifnr.
    wa_final-peinh = wa_xeipa-peinh.
    wa_final-preis = wa_xeipa-preis.        "net price
    wa_final-bprme = wa_xeipa-bprme.
    wa_final-bwaer = wa_xeipa-bwaer.

    IF idx NE 1.
      old_xeipa-ebeln = new_xeipa-ebeln.
      old_xeipa-preis = new_xeipa-preis.
    ENDIF.
      new_xeipa-ebeln = wa_xeipa-ebeln.
      new_xeipa-preis = wa_xeipa-preis.