Purpose:
To provide an insight into how to analyse a case where unexpected, incorrect or missing foreign trade data arises in the generation of a sales and distribution delivery document or a billing document
Overview:
As outlined in a related page the foreign trade data in the documents is always derived from either the material master data or from the foreign trade customising. In a situation where it is not clear where or why a value is determined below you find the main touch points and analysis points you can use to check the origin of the data further with some hints on how you can check the foreign trade data in the database tables or debug the creation of a delivery or a billing document to further analyse the origin and root cause of the incorrect data..
How to analyse issues in foreign trade data determination:
Check the document links and tables
The delivery header table is LIKP and the Foreign trade header table is EIKP both tables share the same EXNUM key LIKP-EXNUM = EIKP-EXNUM. to confirm the table entries for a docuemnt go to LIKP with the delivery number and confirm the LIKP-EXNUM value then you can use that to check the foreign trade tables EIKP, EIPO or EIUV as required
The same rational applies to the the billing document via field VBRK-EXNUM. Whether or not theLIKP-EXNUM KEY and the VBRK-EXNUM are the same as well is dependant on the copy control setting, so you check each document individually until this is established
Delivery creation
The export indicator LIKP-EXPKZ gets filled here when the delivery is created. From VL01n or VL10* you can check this here:
Program: SAPFV50K, FORM LIKP_EXPORT_BESTIMMEN
...
IF LIKP-VSTEL NE SPACE.
IF ( TVST-ALAND NE KUWEV-LAND1 and
not tvst-aland is initial and
not kuwev-land1 is initial ) or
( kuwev-land1 eq 'US' and
kuwev-regio eq 'PR' ).
Once a delivery header has been flagged as an export relevant document (LIKP-EXPKZ)
Function modules EXPORT_GENERAL_DATA_PROPOSE for the header data and function module EXPORT_ITEM_DATA_PROPOSE for item data are always used to determine the foreign trade data in the delivery and often in the creation of the billing document (depending on the copy control setting)
The Foreign trade tables are populated with the relevant information
EIKP Header table
EIPO Item table
EIUV Holds any incomplete entries detected
All relevant information is under the delivery header under header > foreign trade. In the organisation tab you find the EXNUM field In the billing document the foreign trade data itself is determined in function modules EXPORT_GENERAL_DATA_PROPOSE and EXPORT_ITEM_DATA_PROPOSE when the copy control setting is either 'A' or 'B' In a case where the copy control setting in VTFL is ' ' the data is copied from the delivery is done so using function 'EXPIMP_GENERAL_DATA_READ'
When a billing document is created you can follow the flow of the data from here in a delivery related and order related case.
1) Delivery related case
LV60AA21 -> form EXPORT_DATEN_VORSCHLAG
...
* Exportdaten ermitteln
IF vbrk-expkz = 'Z'.
PERFORM export_daten_vorschlag USING likp-route likp-vstel.
ELSEIF vbrk-expkz CA 'XY'.
PERFORM export_daten_lesen USING likp-exnum lips-posnr.
ENDIF.
2) Order related case
LV60AA29 -> form FAKTURAPOSI_AUFTRAGSBEZOGEN
...
* Exportdaten ermitteln
PERFORM exportkz_auftragsbezogen USING *tvcpf-expim.
IF vbrk-expkz CA 'YZ'.
PERFORM export_daten_vorschlag USING vbap-route vbap-vstel.
ENDIF.