Creating a Tax Indicator Export to SAP Sales Documents
The content of many fields in the document, the logic of many fields and texts in forms, and also follow-on actions depend on whether the transaction is internal or has been exported abroad in SAP sales documents (order-delivery – billing document).
The following case distinction must often be made:
– No export
– Export from EU to EU country
– Export from EU to a third country
– Export from third countries in the EU
– Export of third countries to a third country
So that these cases do not have to be recalculated every time in terms and formulas or in every form and program, it is advisable to create a “Tax Indicator Export” in a userexit in the customer order and to append this as a ZZ field to the table VBAK . This “control indicator export” can then be transferred as a ZZ field into the delivery (table LIKP) and the billing document (table VBRK) via a data transfer routine in the copy control.
By means of such a “tax indicator export”, conditions, messages and processes for Intercompany can then be conveniently controlled by Customizing.
The coding of a function module for the determination of a “Tax indicator export” is presented below.
Create a domain ZZTAXEL_DOM
- Length CHAR 1
Creating a Data Element ZZTAXEL_E
Extend the VBAK table by the ZZTAXEL field
– Append on table VBAK
Creating a Function Module Z_SD_DETERMINE_TAXEL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
FUNCTION Z_SD_DETERMINE_TAXEL. *“———————————————————————- „„Lokale Schnittstelle: *“ IMPORTING *“ VALUE(IV_ALAND) TYPE ALAND OPTIONAL *“ VALUE(IV_LLAND) TYPE LLAND OPTIONAL *“ EXPORTING *“ VALUE(EV_TAXEL) TYPE ZZTAXEL_D *“———————————————————————- Deklarationen —————————————————— * DATA: lv_xegld_aland TYPE xegld, lv_xegld_lland TYPE xegld. Fall 1) Kein Export ———————————————— * IF iv_aland = iv_lland. ev_taxel = ‚0‘. EXIT. ENDIF. Ermittlung der EU-Kennzeichen für die Länder ———————– * SELECT SINGLE xegld INTO lv_xegld_aland FROM t005 WHERE land1 = iv_aland. SELECT SINGLE xegld INTO lv_xegld_lland FROM t005 WHERE land1 = iv_lland. Fall 2) Export in EU ———————————————– * IF iv_aland NE iv_lland. IF lv_xegld_aland NE space AND lv_xegld_lland NE space. ev_taxel = ‚2‘. EXIT. ENDIF. ENDIF. Fall 3) Export EU – Drittland ————————————– * IF iv_aland NE iv_lland. IF lv_xegld_aland NE space AND lv_xegld_lland = space. ev_taxel = ‚1‘. EXIT. ENDIF. ENDIF. Fall 4) Export aus einem Drittland in EU ————————— * IF iv_aland NE iv_lland. IF lv_xegld_aland = space AND lv_xegld_lland NE space. ev_taxel = ‚4‘. EXIT. ENDIF. ENDIF. Fall 5) Export aus einem Drittland in Drittland ——————– * IF iv_aland NE iv_lland. ev_taxel = ‚5‘. ENDIF. ENDFUNCTION. |
Installing the function module in the userexit SAVE_DOCUMENT_PREPARE in the program MV45AFZZ
1 2 3 4 5 6 7 8 9 10 |
IF t180-trtyp = ‚H‘. „Anlegen IF z_ca_cl_ue_control=>aktiv( ‚SD_FILL_LIKP_ZZTAXEL‘ ) = ‚X‘. CALL FUNCTION ‚Z_SD_DETERMINE_TAXEL‘ EXPORTING iv_aland = t001-land1 iv_lland = kuwev-land1 IMPORTING ev_taxel = vbak-zztaxel. ENDIF. ENDIF. |
Display the field VBAK-ZZTAXEL in the customer order in the additional data B
– Dynpro
Completion of data transfer routines for delivery and billing
- Extend the tables LIKP and VBRK by the ZZTAXEL field
- Completing the data transfer routines header delivery and header billing to fill the field LIKP-ZZTAXEL or VBRK-ZZTAXEL
Further information
Spezial topics to SAP forms
Fixed price SAP forms
SAP form development