Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

function module to find total for delivey for delivery no.

Former Member
0 Kudos

is there any function module to find total price for delivery no.

3 REPLIES 3

FredericGirod
Active Contributor
0 Kudos

You don't need function

table LIKP

NETWR net price

0 Kudos

ACTUALLY TOTAL PRICE = GROSS VALUE -DISCOUNT_FREIGHT +VAT

0 Kudos

If you want to add tax, ... conditions, you could try to read conditions (good luck).

here it's a sample code for sales order (the table are different, but the function the same)

  DATA : is_vbak TYPE vbak ,
         is_vbap TYPE vbap .


* Check if the sales order exist.
  SELECT SINGLE *
         INTO is_vbak
         FROM vbak
         WHERE vbeln EQ vbeln.
  IF sy-subrc NE space.
    RAISE sales_order_unknown.
  ENDIF.

* Check if the sales order item exist.
  SELECT SINGLE *
         INTO is_vbap
         FROM vbap
         WHERE vbeln EQ vbeln
         AND   posnr EQ posnr.
  IF sy-subrc NE space.
    RAISE sales_order_item_unknown.
  ENDIF.


* Set data.
  MOVE : is_vbak-mandt    TO isg_komk-mandt ,
         is_vbak-kalsm    TO isg_komk-kalsm ,
         is_vbak-fkara    TO isg_komk-fkart ,
         'V'              TO isg_komk-kappl ,
         is_vbak-waerk    TO isg_komk-waerk ,
         is_vbak-knumv    TO isg_komk-knumv ,
         is_vbak-vbtyp    TO isg_komk-vbtyp ,
         is_vbak-bukrs_vf TO isg_komk-bukrs ,
         is_vbak-vbeln    TO isg_komk-belnr ,
         is_vbap-posnr    TO isg_komp-kposn .
  MOVE-CORRESPONDING : is_vbak TO isg_komk ,
                       is_vbap TO isg_komp.

* Get the KOMV table.
  CALL FUNCTION 'RV_PRICE_PRINT_ITEM'
    EXPORTING
      comm_head_i = isg_komk
      comm_item_i = isg_komp
    TABLES
      tkomv       = itg_komv
      tkomvd      = itg_komvd.

* Get the 'Marge'.
  CALL FUNCTION 'PRICING_BUILD_XKOMV'
    EXPORTING
      i_komk           = isg_komk
      i_komp           = isg_komp
      calculation_type = 'E'
    TABLES
      tkomv            = itg_komv
      e_xkomv          = itg_komv2
    EXCEPTIONS
      OTHERS           = 2.