cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Gross price calculation in ME23n

ronaldo_aparecido
Contributor
0 Likes
578

Is there any function or calculation that returns the gross price by item displayed in ME23n?

ronaldo_aparecido_0-1744296589188.png

I need to display this in a report based on the 'PO' number.

I tried to go through konv, but I can't get the exact value of the gross price like ME23n

Thanks

 

Accepted Solutions (1)

Accepted Solutions (1)

RaymondGiuseppi
Active Contributor
0 Likes

The BAPI BAPI_PO_GETDETAIL1 should provide this information in some records of the returned table parameter POCOND.

  • Feel free to analyze the BAPI logic after some testing.
ronaldo_aparecido
Contributor
0 Likes

Thanks the CALCULATE_TAX_ITEM works :

METHOD get_val_bruto.

  SELECT SINGLE ebeln ebelp kostl aufnr wempf kokrs prctr ps_psp_pnr
         FROM ekkn
         INTO wg_ekkn
         WHERE ebeln EQ t_ekpo-ebeln
           AND ebelp EQ t_ekpo-ebelp.
  IF sy-subrc = 0.

    wg_taxcom_item-bukrs = t_ekko-bukrs.
    wg_taxcom_item-budat = t_ekko-bedat.
    wg_taxcom_item-waers = t_ekko-waers.
    wg_taxcom_item-kposn = t_ekpo-ebelp.
    wg_taxcom_item-mwskz = t_ekpo-mwskz.
    wg_taxcom_item-txjcd = t_ekpo-txjcd.
    wg_taxcom_item-ebeln = t_ekpo-ebeln.
    wg_taxcom_item-ebelp = t_ekpo-ebelp.
    wg_taxcom_item-shkzg = 'H'.
    wg_taxcom_item-xmwst = 'X'.
    wg_taxcom_item-wrbtr = t_ekpo-netwr.
    wg_taxcom_item-lifnr =  t_ekko-lifnr.
    wg_taxcom_item-land1 = t_ekko-lands.
    wg_taxcom_item-ekorg = t_ekko-ekorg.
    wg_taxcom_item-hwaer = t_ekko-waers.
    wg_taxcom_item-bldat = t_ekko-bedat.
    wg_taxcom_item-matnr = t_ekpo-matnr.
    wg_taxcom_item-werks = t_ekpo-werks.
    wg_taxcom_item-bwtar = t_ekpo-bwtar.
    wg_taxcom_item-matkl = t_ekpo-matkl.
    wg_taxcom_item-meins = t_ekpo-meins.

    IF t_ekko-bstyp EQ 'F'.
      wg_taxcom_item-mglme = t_ekpo-menge.
    ELSEIF t_ekpo-bstyp EQ 'K' AND t_ekpo-abmng GT 0.
      wg_taxcom_item-mglme = t_ekpo-abmng.
    ELSE.
      wg_taxcom_item-mglme = t_ekpo-ktmng.
    ENDIF.

    IF wg_taxcom_item-mglme EQ 0.
      wg_taxcom_item-mglme = 1000.
    ENDIF.

    wg_taxcom_item-mtart = t_ekpo-mtart.

    IF NOT t_ekko-llief IS INITIAL.
      wg_taxcom_item-llief = t_ekko-lifnr.
    ENDIF.

    IF NOT t_ekko-lifre IS INITIAL.
      wg_taxcom_item-lifnr = t_ekko-lifre.
    ENDIF.

    wg_taxcom_item-projk = wg_ekkn-ps_psp_pnr.
    wg_taxcom_item-prctr = wg_ekkn-prctr.
    wg_taxcom_item-aufnr = wg_ekkn-aufnr.
    wg_taxcom_item-kostl = wg_ekkn-kostl.
    wg_taxcom_item-kokrs = wg_ekkn-kokrs.

    FREE MEMORY ID 'KWERT'.
    CALL FUNCTION 'REFRESH_TAX_TABLES'.

    CALL FUNCTION 'PRICING_REFRESH'
      TABLES
        tkomk = tg_tkomk
        tkomv = tg_tkomv.

    TRY.
        CALL FUNCTION 'CALCULATE_TAX_ITEM'
          EXPORTING
            i_taxcom            = wg_taxcom_item
          TABLES
            t_xkomv             = tg_xkomv
          EXCEPTIONS
            mwskz_not_defined   = 1
            mwskz_not_found     = 2
            mwskz_not_valid     = 3
            steuerbetrag_falsch = 4
            country_not_found   = 5
            txjcd_not_valid     = 6
            OTHERS              = 7.
        IF sy-subrc = 0.

          "Cálculo de Impostos
          CALL FUNCTION 'REFRESH_TAX_TABLES'.

          CALL FUNCTION 'PRICING_REFRESH'
            TABLES
              tkomk = tg_tkomk
              tkomv = tg_tkomv.

          SORT tg_xkomv BY kschl.

          READ TABLE tg_xkomv INTO wg_xkomv WITH KEY kschl = 'ZVLT' BINARY SEARCH.
          IF  sy-subrc EQ 0.
            vg_bruto = wg_xkomv-kwert.
          ENDIF.

        ENDIF.
      CATCH cx_root.
    ENDTRY.
  ENDIF.

ENDMETHOD.

Answers (0)