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.
Tto confirm the table entries for a document 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 billing document via field VBRK-EXNUM. Whether or not the LIKP-EXNUM KEY and the VBRK-EXNUM are the same as well is dependent 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 organization 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 transaction 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.
- 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.
- 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.