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: 

table behind tax details in P.O

Former Member
765

Hi,

im trying to find the tax condition types in a purchase order by going to item detail(invoice tab) ->taxes button and it displays the taxes .

i'm unable to find the table where the tax conditon type , amount and the conditon value are being stored, though it shows komv and refers to konv. i checked and the tax details are not stored in KONV.

Can some one help me out on how to retrieve the tax amounts?

Regards,

ravi.

1 ACCEPTED SOLUTION

venkata_ramisetti
Active Contributor
0 Kudos
237

Hi,

Use the function module WLF_READ_KOMV.

You need to pass values to I_KNUMV & I_KNUMVD .

Fields EKKO-KNUMV and EKKO-KALSM need to be passed to the above function module and it will return the tables that contain condition values.

Thanks

Ramakrishna

6 REPLIES 6

venkata_ramisetti
Active Contributor
0 Kudos
238

Hi,

Use the function module WLF_READ_KOMV.

You need to pass values to I_KNUMV & I_KNUMVD .

Fields EKKO-KNUMV and EKKO-KALSM need to be passed to the above function module and it will return the tables that contain condition values.

Thanks

Ramakrishna

Former Member
0 Kudos
237

Hi,

its returning the values from konv, its not giving the tax details.

can you please tell me how KOMV, KOMK, KOMP gets filled. is there any funtion module

Regards,

ravi.

0 Kudos
237

Hope this code gives you some idea:

PARAMETERS: P_EBELN LIKE EKKO-EBELN OBLIGATORY,
            P_BUKRS LIKE T001-BUKRS OBLIGATORY.

TYPES: BEGIN OF T_COND,
         KNUMV LIKE KONV-KNUMV,
         KPOSN LIKE KONV-KPOSN,
         KSCHL LIKE KONV-KSCHL,
         KRECH LIKE KONV-KRECH,
         KAWRT LIKE KONV-KAWRT,
         KBETR LIKE KONV-KBETR,
         WAERS LIKE KONV-WAERS,
         MWSK1 LIKE KONV-MWSK1,
       END OF T_COND.
DATA: IT_COND TYPE STANDARD TABLE OF T_COND,
      WA_COND TYPE T_COND.
DATA: L_KNUMV TYPE KNUMV,
      L_LAND1 LIKE T001-LAND1,
      L_KALSM LIKE T005-KALSM,
      L_KBETR LIKE BSET-KBETR,
      TAX_AMT LIKE BSET-KBETR.

SELECT SINGLE KNUMV INTO L_KNUMV FROM EKKO WHERE EBELN = P_EBELN.
SELECT KNUMV KPOSN KSCHL KRECH
       KAWRT KBETR WAERS MWSK1
       INTO TABLE IT_COND
       FROM KONV AS B
       WHERE KNUMV = L_KNUMV.
CLEAR: L_LAND1.
SELECT SINGLE LAND1 INTO L_LAND1 FROM T001 WHERE BUKRS EQ P_BUKRS.
SELECT SINGLE KALSM INTO L_KALSM FROM T005 WHERE LAND1 = L_LAND1.

LOOP AT IT_COND INTO WA_COND WHERE NOT MWSK1 IS INITIAL.
     CALL FUNCTION 'FI_TAX_GET_CONDITION'
      EXPORTING
        I_BUKRS                   = P_BUKRS
        I_LAND1                   = L_LAND1
        I_KALSM                   = L_KALSM
        I_MWSKZ                   = WA_COND-MWSK1
        I_TXJCD                   = ' '
        I_KSCHL                   = WA_COND-KSCHL
        I_KTOSL                   = ' '
        I_TDATE                   = SY-DATUM
      IMPORTING
*   E_KNUMH                   =
        E_KBETR                   = L_KBETR
*   E_KTOSL                   =
*   E_KSCHL                   =
      EXCEPTIONS
        INPUT_PARAM_INVALID       = 1
        BUKRS_INVALID             = 2
        COUNTRY_INVALID           = 3
        TXJCD_INVALID             = 4
        CONDITION_NOT_FOUND       = 5
        OTHERS                    = 6.

  TAX_AMT = WA_COND-KAWRT * ( L_KBETR / 10 ) / 100.
BREAK-POINT.
ENDLOOP.

Copy the above code to a temporary program and execute. Everytime you reach the break-point check the amount in TAX_AMT w.r.t the tax amount in PO.

Kind Regards

Eswar

0 Kudos
237

Please check this code:

PARAMETERS: P_EBELN LIKE BAPIEKKO-PO_NUMBER OBLIGATORY.
DATA: L_LAND1 LIKE T001-LAND1,
      L_KALSM LIKE T005-KALSM.
DATA: L_KBETR LIKE BSET-KBETR.

DATA: POHEAD LIKE BAPIEKKOL,
      POITEM LIKE BAPIEKPO OCCURS 0 WITH HEADER LINE,
      IT_KONV LIKE KONV OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF IT_TAX_RATE OCCURS 0,
        KSCHL LIKE KONV-KSCHL,
        MWSK1 LIKE KONV-MWSK1,
        KBETR LIKE KONV-KBETR,
      END OF IT_TAX_RATE.

CALL FUNCTION 'BAPI_PO_GETDETAIL'
  EXPORTING
    PURCHASEORDER                    = P_EBELN
 IMPORTING
   PO_HEADER                        = POHEAD
 TABLES
   PO_ITEMS                         = POITEM.

CALL FUNCTION 'MRM_DBTAB_KONV_READ'
  EXPORTING
    I_KNUMVE       = POHEAD-DOC_COND
    I_KNUMVL       = POHEAD-DOC_COND
  TABLES
    T_KONV         = IT_KONV.

SORT IT_KONV BY KNUMV KPOSN STUNR.
DELETE ADJACENT DUPLICATES FROM IT_KONV.

SELECT SINGLE LAND1 INTO L_LAND1 FROM T001
       WHERE BUKRS EQ POHEAD-CO_CODE.
SELECT SINGLE KALSM INTO L_KALSM FROM T005 WHERE LAND1 = L_LAND1.
LOOP AT IT_KONV WHERE NOT MWSK1 IS INITIAL.
     CALL FUNCTION 'FI_TAX_GET_CONDITION'
      EXPORTING
        I_BUKRS                   = POHEAD-CO_CODE
        I_LAND1                   = L_LAND1
        I_KALSM                   = L_KALSM
        I_MWSKZ                   = IT_KONV-MWSK1
        I_TXJCD                   = ' '
        I_KSCHL                   = IT_KONV-KSCHL
        I_KTOSL                   = ' '
        I_TDATE                   = SY-DATUM
      IMPORTING
        E_KBETR                   = L_KBETR
      EXCEPTIONS
        INPUT_PARAM_INVALID       = 1
        BUKRS_INVALID             = 2
        COUNTRY_INVALID           = 3
        TXJCD_INVALID             = 4
        CONDITION_NOT_FOUND       = 5
        OTHERS                    = 6.

  IT_TAX_RATE-KSCHL = IT_KONV-KSCHL.
  IT_TAX_RATE-MWSK1 = IT_KONV-MWSK1.
  IT_TAX_RATE-KBETR = L_KBETR / 10.
  APPEND IT_TAX_RATE.
ENDLOOP.
SORT IT_TAX_RATE BY KSCHL MWSK1.
DELETE ADJACENT DUPLICATES FROM IT_TAX_RATE.

BREAK-POINT.

Kind Regards

Eswar

former_member186741
Active Contributor
0 Kudos
237

checkout table A080....for vat/gst type tax rates.

Former Member
0 Kudos
237

It is stored in KONP table.