ABAP Development
IF int_edidd-segnam = 'E1EDP01'.
LOOP AT xekpo INTO DATA(is_ekpodata) WHERE ebelp = int_edidd-sdata+0(5).
*&---------------------------------------------------------------------*
*& START - SECTION E1EDP04 FOR TAX CODES
*&---------------------------------------------------------------------*
is_taxcom-bukrs = xekko-bukrs.
is_taxcom-budat = xekko-aedat.
is_taxcom-bldat = xekko-aedat.
is_taxcom-waers = xekko-waers.
is_taxcom-hwaer = xekko-waers.
is_taxcom-kposn = is_ekpodata-ebelp.
is_taxcom-mwskz = is_ekpodata-mwskz.
*IS_TAXCOM-KOART = 'H'.
is_taxcom-shkzg = 'H'.
IF xekko-bstyp EQ 'F'.
is_taxcom-wrbtr = is_ekpodata-netwr.
ELSE.
is_taxcom-wrbtr = is_ekpodata-zwert.
ENDIF.
is_taxcom-xmwst = 'X'."is_ekpodata-xmwst."
is_taxcom-lifnr = xekko-lifnr.
is_taxcom-ekorg = xekko-ekorg.
is_taxcom-llief = xekko-llief.
is_taxcom-bwtar = xekpo-bwtar.
is_taxcom-txjcd = is_ekpodata-txjcd.
is_taxcom-matnr = is_ekpodata-matnr.
is_taxcom-werks = is_ekpodata-werks.
is_taxcom-matkl = is_ekpodata-matkl.
is_taxcom-meins = is_ekpodata-meins.
is_taxcom-mglme = is_ekpodata-menge.
is_taxcom-mtart = is_ekpodata-mtart.
is_taxcom-land1 = xekko-lands.
is_taxcom-ebeln = is_ekpodata-ebeln.
is_taxcom-ebelp = is_ekpodata-ebelp.
IF xekko-bstyp EQ 'F'.
is_taxcom-mglme = is_ekpodata-menge.
ELSE.
IF xekko-bstyp EQ 'K' AND is_ekpodata-abmng GT 0.
is_taxcom-mglme = is_ekpodata-abmng.
ELSE.
is_taxcom-mglme = is_ekpodata-ktmng.
ENDIF.
ENDIF.
IF is_taxcom-mglme EQ 0.
is_taxcom-mglme = 1000.
ENDIF.
CALL FUNCTION 'CALCULATE_TAX_ITEM'
EXPORTING
anzahlung = 'X'
i_taxcom = is_taxcom
* IMPORTING
* E_NAVFW =
* E_TAXCOM =
* E_XSTVR =
* NAV_ANTEIL =
TABLES
t_xkomv = it_komvtab
EXCEPTIONS
mwskz_not_defined = 1
mwskz_not_found = 2
mwskz_not_valid = 3
steuerbetrag_falsch = 4
country_not_found = 5
txjcd_not_valid = 6
amounts_too_large_for_tax = 7
OTHERS = 8.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
*To Populate tax data to Idoc Segment
LOOP AT it_komvtab ASSIGNING FIELD-SYMBOL(<fs_komvtab>) WHERE kschl NE 'BASB'.
"KNTYP = D or KNTYP ne space
ls_e1edp04-mwskz = is_taxcom-mwskz. "<fs_komvtab>-mwsk1.
IF <fs_komvtab>-kbetr IS NOT INITIAL.
ls_e1edp04-msatz = <fs_komvtab>-kbetr / 10.
ENDIF.
ls_e1edp04-mwsbt = <fs_komvtab>-kwert.
ls_e1edp04-txjcd = <fs_komvtab>-kschl.
* SELECT SINGLE vtext FROM t685t INTO ls_e1edp04-ktext WHERE spras = 'S' AND kschl = <fs_komvtab>-kschl.
SELECT SINGLE text1
FROM T007S
INTO ls_e1edp04-ktext
WHERE spras = 'S'
AND MWSKZ = is_taxcom-mwskz.
CONDENSE:ls_e1edp04-mwskz, ls_e1edp04-msatz, ls_e1edp04-mwsbt, ls_e1edp04-txjcd NO-GAPS.
idoc_data-segnam = 'E1EDP04'.
idoc_data-sdata = ls_e1edp04.
APPEND idoc_data TO int_edidd[].
CLEAR : ls_e1edp04,idoc_data.
ENDLOOP.
*&---------------------------------------------------------------------*
*& END - SECTION E1EDP04 FOR TAX CODES
*&---------------------------------------------------------------------*
CIG Mapping (now called MGSN)
ABAP Development
IF int_edidd-segnam = 'E1EDP01'.
LOOP AT xekpo INTO DATA(is_ekpodata) WHERE ebelp = int_edidd-sdata+0(5).
*&---------------------------------------------------------------------*
*& START - SECTION E1EDP05 FOR PRICE COND
*&---------------------------------------------------------------------*
CLEAR komp.
CLEAR tkomv.
CLEAR tkomvd.
*- fill structure KOMK (Pricing Communications-Header) ----------------*
IF komk-knumv NE xekko-knumv.
CLEAR komk.
komk-mandt = xekko-mandt.
IF xekko-kalsm NE space.
komk-kalsm = xekko-kalsm.
ELSE.
komk-kalsm = 'RM0000'.
ENDIF.
komk-kappl = 'M'.
komk-waerk = xekko-waers.
komk-knumv = xekko-knumv.
komk-bukrs = xekko-bukrs.
ENDIF.
* komp-kposn = posnr.
komp-kposn = is_ekpodata-ebelp.
SELECT *
FROM konv
INTO TABLE tkomv
WHERE knumv = xekko-knumv.
*- determine item conditions ------------------------------------------*
CALL FUNCTION 'RV_PRICE_PRINT_ITEM'
EXPORTING
comm_head_i = komk
comm_item_i = komp
language = xekko-spras
IMPORTING
comm_head_e = komk
comm_item_e = komp
TABLES
tkomv = tkomv
tkomvd = tkomvd.
LOOP AT tkomvd.
IF tkomvd-kinak EQ ' ' AND
tkomvd-kwert NE '0'.
CLEAR ykoein_iso.
CLEAR idoc_data_5.
CLEAR ls_e1edp05.
idoc_data_5-segnam = 'E1EDP05'.
*- Surcharge or discount indicator ------------------------------------*
IF tkomvd-kwert LT 0.
tmp_kwert = ( -1 ) * tkomvd-kwert.
ls_e1edp05-alckz = '-'.
ELSE.
tmp_kwert = tkomvd-kwert.
ls_e1edp05-alckz = '+'.
ENDIF.
IF cur_factor IS INITIAL.
CALL FUNCTION 'CURRENCY_CONVERTING_FACTOR'
EXPORTING
currency = tkomvd-koein
IMPORTING
factor = cur_factor
EXCEPTIONS
too_many_decimals = 1.
IF sy-subrc NE 0.
* MESSAGE e855 WITH xekko-waers
* RAISING error_message_received.
ENDIF.
ENDIF.
*- Condition type (coded) ---------------------------------------------*
ls_e1edp05-kschl = tkomvd-kschl.
ls_e1edp05-kotxt = tkomvd-vtext.
*- Fixed surcharge/discount on total gross ----------------------------*
ls_e1edp05-betrg = tmp_kwert * cur_factor.
CONDENSE ls_e1edp05-betrg.
IF tkomvd-koein EQ '%'.
tkomvd-kbetr = tkomvd-kbetr / 10.
ls_e1edp05-kperc = tkomvd-kbetr.
CONDENSE ls_e1edp05-kperc.
ls_e1edp05-mwskz = tkomvd-mwskz.
ELSE.
* compute converting factor, if condition currency <> document currency
IF xekko-waers EQ tkomvd-koein.
h_cond_cur_factor = cur_factor.
ELSE.
IF cond_curcy_save NE tkomvd-koein.
CALL FUNCTION 'CURRENCY_CONVERTING_FACTOR'
EXPORTING
currency = tkomvd-koein
IMPORTING
factor = cond_cur_factor
EXCEPTIONS
too_many_decimals = 1.
IF sy-subrc NE 0.
* MESSAGE e855 WITH xekko-waers
* RAISING error_message_received.
ENDIF.
cond_curcy_save = tkomvd-koein.
ENDIF.
h_cond_cur_factor = cond_cur_factor.
ENDIF.
ls_e1edp05-krate = tkomvd-kbetr * h_cond_cur_factor.
CONDENSE ls_e1edp05-krate.
*- pricing rate -------------------------------------------------------*
IF NOT tkomvd-kpein IS INITIAL.
ls_e1edp05-uprbs = tkomvd-kpein.
ENDIF.
IF NOT tkomvd-kmein IS INITIAL.
CALL FUNCTION 'UNIT_OF_MEASURE_SAP_TO_ISO'
EXPORTING
sap_code = tkomvd-kmein
IMPORTING
iso_code = ls_e1edp05-meaun
EXCEPTIONS
not_found = 1
no_iso_code = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID 'VG' TYPE 'E' NUMBER '500'
WITH tkomvd-kmein is_ekpodata-ebelp 'KMEIN'
RAISING error_message_received.
ENDIF.
ENDIF.
ls_e1edp05-mwskz = tkomvd-mwskz.
*- Konditionseinheit --------------------------------------------------*
*- Rate unit ----------------------------------------------------------*
IF NOT tkomvd-koein IS INITIAL.
CALL FUNCTION 'CURRENCY_CODE_SAP_TO_ISO'
EXPORTING
sap_code = tkomvd-koein
IMPORTING
iso_code = ykoein_iso
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID 'VG' TYPE 'E' NUMBER '531'
WITH tkomvd-koein ekpo-ebelp 'KOEIN'
RAISING error_message_received.
ELSE.
ls_e1edp05-koein = ykoein_iso.
CONDENSE ls_e1edp05-koein.
ENDIF.
ENDIF.
ENDIF.
MOVE ls_e1edp05 TO idoc_data_5-sdata.
APPEND idoc_data_5 TO int_edidd[].
ENDIF.
ENDLOOP.
*&---------------------------------------------------------------------*
*& END - SECTION E1EDP05 FOR PRICE COND
*&---------------------------------------------------------------------*
CIG Mapping (now called MGSN)
As a final result, the supplier will see all the information related to tax indicator and price conditions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
18 | |
10 | |
8 | |
5 | |
4 | |
4 | |
3 | |
2 | |
2 | |
2 |