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: 

abap report Tax Code Determination in SD

former_member445510
Active Participant
0 Kudos

Hello every one,

Can some one gave a link to an ABAP report or abap code / Function module/ Query /t showing how to determinate Tax Code in SD ?

best regard,

Roukbi.

1 ACCEPTED SOLUTION

alejandro_mejias
Active Participant
0 Kudos

Try executing pricing report with report 14 Taxes (tx. V/LD)

Here you can see what fields determines the tax percentage/amount (select a field and press f1), the percentage/amount to be applied and validity dates.

5 REPLIES 5

Former Member
0 Kudos

Please check out this code:

*   determine subtotals

     REFRESH IZSTAB.

     SELECT * INTO TABLE IZSTAB

              FROM       T683S

              WHERE      KVEWE = 'A'                 AND

                         KAPPL = I_APPLICATION (value is 'V')      AND

                         KALSM = I_PRICING_PROCEDURE AND

                         KSCHL = SPACE

              ORDER BY PRIMARY KEY.

     XKALSM = I_PRICING_PROCEDURE.

*   determine from/to steps

     REFRESH LT_SNTAB.

     SELECT * INTO CORRESPONDING FIELDS OF TABLE LT_SNTAB

              FROM       T683S

              WHERE      KVEWE = 'A'                 AND

                         KAPPL = I_APPLICATION       AND

                         KALSM = XKALSM ORDER BY PRIMARY KEY.

     SORT LT_SNTAB BY KSCHL.

XKOMV_KEY-MANDT = SY-MANDT.

   XKOMV_KEY-KNUMV = KEY_KNUMV.

   XKOMV_KEY-KPOSN = KEY_KPOSN.

   READ TABLE XKOMV WITH KEY XKOMV_KEY BINARY SEARCH.

   IF SY-SUBRC IS INITIAL.

     IXKOMV_TABIX = SY-TABIX.

     LOOP AT XKOMV FROM IXKOMV_TABIX.

       IF XKOMV-KNUMV = XKOMV_KEY-KNUMV AND

          XKOMV-KPOSN = XKOMV_KEY-KPOSN.

         IF XKOMV-KOAID NE 'D'.

           IF XKOMV-KSTAT IS INITIAL.

             IF NOT XMWSK1 IS INITIAL AND XKOMV-MWSK1 NE XMWSK1.

               XKOMV-MWSK1 = XMWSK1.

               MODIFY XKOMV.

               O_KONV_CHANGED = 'X'.

             ELSE.

               CONTINUE.

             ENDIF.

           ENDIF.

         ELSE.

           CHECK XKOMV-KINAK IS INITIAL.

           IF XKOMV-IX_KOMT1 IS INITIAL.

             READ TABLE LT_SNTAB WITH KEY KSCHL = XKOMV-KSCHL

                           BINARY SEARCH.

             IF SY-SUBRC IS INITIAL.

               XKOMV-STUNB = LT_SNTAB-STUNB.

               XKOMV-STUN2 = LT_SNTAB-STUN2.

             ENDIF.

           ENDIF.

           YMWSK1 = XKOMV-MWSK1.

           LA_TAX = SY-TABIX.

           XMWSK1 = XKOMV-MWSK1.

           XMWSK2 = XKOMV-MWSK2.

           XSTUNR = XKOMV-STUNB.

           XSTUN2 = XKOMV-STUN2.

           IF XSTUN2 LT XSTUNR.

             XSTUN2 = XSTUNR.

           ENDIF.

           IF XSTUN2 = 0.

             XSTUN2 = XKOMV-STUNR.

           ENDIF.

           KOMV_KEY-MANDT = SY-MANDT.

           KOMV_KEY-KNUMV = KEY_KNUMV.

           KOMV_KEY-KPOSN = KEY_KPOSN.

           KOMV_KEY-STUNR = XSTUNR.

           KOMV_KEY-ZAEHK = 0.

*       Check if reference field refers to a subtotal

           READ TABLE IZSTAB WITH KEY KVEWE = 'A'

                                      KAPPL = I_APPLICATION

                                      KALSM = XKALSM

                                      STUNR = XSTUNR

                                      BINARY SEARCH.

           BEZUG_IST_ZWISU = NO.

           IF SY-SUBRC IS INITIAL.

             BEZUG_IST_ZWISU = YES.

           ENDIF.

           READ TABLE XKOMV WITH KEY KOMV_KEY BINARY SEARCH.

           IF SY-SUBRC LT 8.

             READ TABLE XKOMV INDEX SY-TABIX.

             IF XKOMV-STUNR GT XSTUN2 AND BEZUG_IST_ZWISU = NO.

               CONTINUE.

             ELSE.

               XKOMV_KEY-MANDT = SY-MANDT.

               XKOMV_KEY-KNUMV = KEY_KNUMV.

               XKOMV_KEY-KPOSN = KEY_KPOSN.

               READ TABLE XKOMV WITH KEY XKOMV_KEY BINARY SEARCH.

               CHECK SY-SUBRC IS INITIAL.

               LOOP AT XKOMV FROM SY-TABIX.

                 IF XKOMV-KNUMV = XKOMV_KEY-KNUMV AND

                    XKOMV-KPOSN = XKOMV_KEY-KPOSN.

                   IF XKOMV-STUNR GT XSTUN2.

                     CONTINUE.

                   ENDIF.

                   SELECT SINGLE * FROM T685A WHERE KAPPL = XKOMV-KAPPL

                                              AND   KSCHL = XKOMV-KSCHL.

                   IF BEZUG_IST_ZWISU = YES                        AND

                      XMWSK1 NE SPACE                              AND

                      ( XKOMV-KSTAT = SPACE OR XKOMV-KNTYP = 'R'

                                            OR T685A-KRELI = 'X' ) AND

                      XKOMV-KOAID NE 'D'                           .

                     IF ( XKOMV-MWSK1 NE XMWSK1 OR

                        ( XKOMV-MWSK2 NE XMWSK2 ).

                       XKOMV-MWSK1 = XMWSK1.

                       XKOMV-MWSK2 = XMWSK2.

                       MODIFY XKOMV.

                       O_KONV_CHANGED = 'X'.

                     ENDIF.

                   ENDIF.

                   IF XKOMV-STUNR GE XSTUNR AND

                      XKOMV-STUNR LE XSTUN2 AND

                      XKOMV-KINAK NA 'AMX'.

                     IF BEZUG_IST_ZWISU = NO                         AND

                        XMWSK1 NE SPACE                              AND

                        ( XKOMV-KSTAT = SPACE OR XKOMV-KNTYP = 'R'

                                              OR T685A-KRELI = 'X' ) AND

                        XKOMV-KOAID NE 'D'                           .

                       IF ( XKOMV-MWSK1 NE XMWSK1 OR

                          ( XKOMV-MWSK2 NE XMWSK2 ).

                         XKOMV-MWSK1 = XMWSK1.

                         XKOMV-MWSK2 = XMWSK2.

                         MODIFY XKOMV.

                         O_KONV_CHANGED = 'X'.

                       ENDIF.

                     ENDIF.

                   ENDIF.

                 ELSE.

                   EXIT.

                 ENDIF.

               ENDLOOP.

             ENDIF.

           ENDIF.

         ENDIF.

       ELSE.

         EXIT.

       ENDIF.

     ENDLOOP.

   ENDIF.

0 Kudos

Thank you very much,

But if i want to import (external) XML file with those info :

<SupplierCountry> BE </SupplierCountry>

<Material> m-213 </Material>

<CustomerContry> DE </CustomerContry>

......

........

.......

<TaxCode>  ? </TaxCode>

To SD Table, To determinate the tax code by SD, how can i do that ?

Please... I'm waiting for your reactions.

Roukbi

Former Member
0 Kudos

Hi

The TAX code is managed by the conditions as all elements of the pricing,

I suppose it's used the condition standard MWST, so you need to check which access sequences are defined for that condition.

Max

former_member339717
Active Participant
0 Kudos

data: TAXCODE TYPE  J_1BSDICA-TXSDC.

CALL FUNCTION 'J_1B_SD_TAXCODE'

   EXPORTING

     ORDERTYPE          = 'ZO'

     ITEMCATEGORY       = 'ZAN'

    CUSTOMER           = '0000001736'

    MATERIAL           = '000000000000190100'

*   SALESORG           =

*   DIVISION           =

*   DISTCHANNEL        =

  IMPORTING

    TAXCODE            = taxcode

           .

write: taxcode.

alejandro_mejias
Active Participant
0 Kudos

Try executing pricing report with report 14 Taxes (tx. V/LD)

Here you can see what fields determines the tax percentage/amount (select a field and press f1), the percentage/amount to be applied and validity dates.