Difference between revisions of "SAP SD BAPI MAP"

From SapWiki
Line 1: Line 1:
==Cabecera==
+
ver INCLUDE L2032FXX, ejemplo:
{| class="wikitable"
+
<nowiki>*---------------------------------------------------------------------*
! Tabla
+
FORM move_item_data_out.
! texto
 
! BAPISDORDER_GETDETAILEDLIST
 
! BAPI_SALESORDER_CREATEFROMDAT2
 
|-
 
| CVBAK-GWLDT
 
| Fecha lĄmite de garantĄa
 
| order_headers_out-WAR_DATE
 
| order_header_in-WAR_DATE
 
|-
 
| CVBAK-PS_PSP_PNR
 
| Elemento del plan de estructura de proyecto (elemento PEP)
 
| order_headers_out-WBS_ELEM
 
| order_header_in-WBS_ELEM
 
|-
 
| CVBAK-SUBMI
 
| N§ de licitaci˘n (SD)
 
| order_headers_out-SD_COL_NUM
 
| order_header_in-COLLECT_NO
 
|-
 
| CVBAK-LIFSK
 
| Bloqueo de nota de entrega cabecera de documento
 
| order_headers_out-DLV_BLOCK
 
| order_header_in-DLV_BLOCK
 
|-
 
| CVBAK-AUGRU
 
| Motivo de pedido (motivo de la operaci˘n)
 
| order_headers_out-ORD_REASON
 
| order_header_in-ORD_REASON
 
|-
 
| CVBAK-FAKSK
 
| Bloqueo de clases de facturas para documento comercial
 
| order_headers_out-BILL_BLOCK
 
| order_header_in-BILL_BLOCK
 
|-
 
| CVBAK-WAERK
 
| Moneda de documento comercial
 
| order_headers_out-CURRENCY
 
| order_header_in-CURRENCY
 
|-
 
| CVBAK-AUTLF
 
| ¨Entrega completa por pedido?
 
| order_headers_out-COMPL_DLV
 
| order_header_in-COMPL_DLV
 
|-
 
| CVBAK-VPRGR
 
| PerĄodo propuesto para la fecha
 
| order_headers_out-DATE_TYPE
 
| order_header_in-DATE_TYPE
 
|-
 
| CVBAK-VDATU
 
| Fecha preferente de entrega
 
| order_headers_out-REQ_DATE_H
 
| order_header_in-REQ_DATE_H
 
|-
 
| CVBAK-KVGR1
 
| Grupo de clientes 1
 
| order_headers_out-CUST_GRP1
 
| order_header_in-CUST_GRP1
 
|-
 
| CVBAK-KVGR2
 
| Grupo de clientes 2
 
| order_headers_out-CUST_GRP2
 
| order_header_in-CUST_GRP2
 
|-
 
| CVBAK-KVGR3
 
| Grupo de clientes 3
 
| order_headers_out-CUST_GRP3
 
| order_header_in-CUST_GRP3
 
|-
 
| CVBAK-KVGR4
 
| Grupo de clientes 4
 
| order_headers_out-CUST_GRP4
 
| order_header_in-CUST_GRP4
 
|-
 
| CVBAK-KVGR5
 
| Grupo de clientes 5
 
| order_headers_out-CUST_GRP5
 
| order_header_in-CUST_GRP5
 
|-
 
| CVBAK-XBLNR
 
| NŁmero de documento de referencia
 
| order_headers_out-REF_DOC_L
 
| order_header_in-REF_DOC_L
 
|-
 
| CVBAK-ZUONR
 
| NŁmero de asignaci˘n
 
| order_headers_out-ASS_NUMBER
 
| order_header_in-ASS_NUMBER
 
|-
 
| CVBAK-TAXK1
 
| Diferente clasificaci˘n fiscal
 
| order_headers_out-ALT_TAX_CL
 
| order_header_in-ALTTAX_CLS
 
|-
 
| CVBAK-TAXK2
 
| Clasificaci˘n fiscal cliente 2
 
| order_headers_out-TAX_CLASS2
 
| order_header_in-TAX_CLASS2
 
|-
 
| CVBAK-TAXK3
 
| Clasificaci˘n fiscal cliente 3
 
| order_headers_out-TAX_CLASS3
 
| order_header_in-TAX_CLASS3
 
|-
 
| CVBAK-TAXK4
 
| Clasificaci˘n fiscal cliente 4
 
| order_headers_out-TAX_CLASS4
 
| order_header_in-TAX_CLASS4
 
|-
 
| CVBAK-TAXK5
 
| Clasificaci˘n fiscal cliente 5
 
| order_headers_out-TAX_CLASS5
 
| order_header_in-TAX_CLASS5
 
|-
 
| CVBAK-TAXK6
 
| Clasificaci˘n fiscal cliente 6
 
| order_headers_out-TAX_CLASS6
 
| order_header_in-TAX_CLASS6
 
|-
 
| CVBAK-TAXK7
 
| Clasificaci˘n fiscal cliente 7
 
| order_headers_out-TAX_CLASS7
 
| order_header_in-TAX_CLASS7
 
|-
 
| CVBAK-TAXK8
 
| Clasificaci˘n fiscal cliente 8
 
| order_headers_out-TAX_CLASS8
 
| order_header_in-TAX_CLASS8
 
|-
 
| CVBAK-TAXK9
 
| Clasificaci˘n fiscal cliente 9
 
| order_headers_out-TAX_CLASS9
 
| order_header_in-TAX_CLASS9
 
|-
 
| CVBAK-XEGDR
 
| Indicador: ¨operaci˘n triangular dentro de la UE?
 
| order_headers_out-EU_TRIANG
 
| order_header_in-EUTRI_DEAL
 
|-
 
| CVBAK-LANDTX
 
| PaĄs de salida para la determinaci˘n de impuestos
 
| order_headers_out-TAX_DEPART
 
| order_header_in-TAXDEP_CTY
 
|-
 
| CVBAK-STCEG_L
 
| PaĄs receptor fiscal
 
| order_headers_out-TAX_DEST_CT
 
| order_header_in-TAXDST_CTY
 
|-
 
| CVBAK-ABRVW
 
| Indicador de utilizaci˘n
 
| order_headers_out-DLVSCHEDUS
 
| order_header_in-DLVSCHDUSE
 
|}
 
  
==Posición==
+
* ITEMS
{| class="wikitable"
+
  REFRESH order_items_bapi_out.
! Tabla
+
  LOOP AT www_order_items_imp.
! texto
 
! BAPISDORDER_GETDETAILEDLIST
 
! BAPI_SALESORDER_CREATEFROMDAT2
 
|-
 
| CVBAP-MATWA
 
| material introducido
 
| order_items_out-MAT_ENTRD
 
| order_items_in-MAT_ENTRD
 
|-
 
| CVBAP-MATKL
 
| grupo de articulos
 
| order_items_out-MATL_GROUP
 
| order_items_in-MATL_GROUP
 
|-
 
| CVBAP-ARKTX
 
| Texto breve posici˘n de pedido de cliente
 
| order_items_out-SHORT_TEXT
 
| order_items_in-SHORT_TEXT
 
|-
 
| CVBAP-BWTAR
 
| clase de valoraci˘n
 
| order_items_out-VAL_TYPE
 
| order_items_in-VAL_TYPE
 
|-
 
| CVBAP-PRODH
 
| jerarquĄa de productos
 
| order_items_out-PROD_HIER
 
| order_items_in-PROD_HIER
 
|-
 
| CVBAP-PMATN
 
| Material determinante del precio
 
| order_items_out-PR_REF_MAT
 
| order_items_in-PR_REF_MAT
 
|-
 
| CVBAP-MEINS
 
| Unidad de medida base
 
| order_items_out-BASE_UOM
 
| order_items_in-BASE_UOM
 
|-
 
| CVBAP-VRKME
 
| Cantidad de pedido acumulada (en unidades de venta)
 
| order_items_out-SALES_UNIT
 
| order_items_in-SALES_UNIT
 
|-
 
| CVBAP-UMVKZ
 
| Numerador (factor) p.conversi˘n cantidad venta en UMA
 
| order_items_out-SALES_QTY1
 
| order_items_in-SALQTYNUM
 
|-
 
| CVBAP-UMVKN
 
| Denominador (divisor) p.conversi˘n ctd.venta en UMA
 
| order_items_out-SALES_QTY2
 
| order_items_in-SALQTYDEN
 
|-
 
| CVBAP-VKAUS
 
| Indicador de utilizaci˘n
 
| order_items_out-DLVSCHEDUS
 
| order_items_in-dlvschduse
 
|-
 
| CVBAP-GRKOR
 
| Grupo de entrega (las pos.se entregan conjuntamente)
 
| order_items_out-DLV_GROUP
 
| order_items_in-DLV_GROUP
 
|-
 
| CVBAP-FMENG
 
| Cantidad fija
 
| order_items_out-FIXED_QUAN
 
|
 
|-
 
| CVBAP-ATPKZ
 
| Pieza de recambio
 
| order_items_out-REPLACE_PT
 
|
 
|-
 
| CVBAP-RKFKF
 
| Forma de facturaci˘n para ˘rdenes RK/PPS
 
| order_items_out-METH_BILL
 
|
 
|-
 
| CVBAP-SPART
 
| Divisi˘n
 
| order_items_out-DIVISION
 
| order_items_in-DIVISION
 
|-
 
| CVBAP-WAERK
 
| Moneda de documento comercial
 
| order_items_out-CURRENCY
 
| order_items_in-CURRENCY
 
|-
 
| CVBAP-PRCTR
 
| Centro de beneficio
 
| order_items_out-PROFIT_CTR
 
| order_items_in-PROFIT_CTR
 
|-
 
| cvbap-pctrf
 
| Centro de beneficio de la factura
 
|
 
|
 
|}
 
  
==Contabilidad==
+
    CLEAR order_items_bapi_out.
{| class="wikitable"
+
 
! Tabla
+
    MOVE www_order_items_imp-posnr  TO order_items_bapi_out-itm_number.
! texto
+
    MOVE www_order_items_imp-posex  TO order_items_bapi_out-po_itm_no.
! BAPISDORDER_GETDETAILEDLIST
+
    MOVE www_order_items_imp-matnr  TO order_items_bapi_out-material.
! BAPI_SALESORDER_CREATEFROMDAT2
+
    MOVE www_order_items_imp-matwa  TO order_items_bapi_out-mat_entrd.
! Tabla
+
    MOVE www_order_items_imp-arktx  TO order_items_bapi_out-short_text.
! texto
+
    MOVE www_order_items_imp-netwr  TO order_items_bapi_out-net_value.
|-
+
    MOVE www_order_items_imp-kzkfg  TO order_items_bapi_out-configured.
| VBKD-VKONT
+
    MOVE www_order_items_imp-waerk  TO order_items_bapi_out-currency.
| Cuenta contrato
+
    MOVE www_order_items_imp-kzwi1  TO order_items_bapi_out-subtotal_1.
| order_business_out-ACCNT_ASGN
+
    MOVE www_order_items_imp-kzwi2  TO order_items_bapi_out-subtotal_2.
| order_header_in-ACCNT_ASGN
+
    MOVE www_order_items_imp-kzwi3  TO order_items_bapi_out-subtotal_3.
| order_business_out-ACCNT_ASGN
+
    MOVE www_order_items_imp-kzwi4  TO order_items_bapi_out-subtotal_4.
| Cuenta contrato
+
    MOVE www_order_items_imp-kzwi5  TO order_items_bapi_out-subtotal_5.
|-
+
    MOVE www_order_items_imp-kzwi6  TO order_items_bapi_out-subtotal_6.
| VBKD-KTGRD
+
    MOVE www_order_items_imp-vrkme  TO order_items_bapi_out-sales_unit.
| grupo de Imputaci˘n
+
    MOVE www_order_items_imp-mngwt  TO order_items_bapi_out-qty_req_dt.
| order_business_out-FKK_CONACCT
+
    MOVE www_order_items_imp-edatu  TO order_items_bapi_out-dlv_date.
| order_header_in-FKK_CONACCT
+
    MOVE www_order_items_imp-wzeitc TO order_items_bapi_out-repl_time.
| order_business_out-FKK_CONACCT
+
 
| grupo de Imputaci˘n
+
    MOVE www_order_items_imp-bstkd  TO order_items_bapi_out-purch_no_c.
|-
+
    MOVE www_order_items_imp-bstdk  TO order_items_bapi_out-purch_date.
| VBKD-ZLSCH
+
    MOVE www_order_items_imp-bsark  TO order_items_bapi_out-po_method.
| VĄa de Pago
+
    MOVE www_order_items_imp-ihrez  TO order_items_bapi_out-ref_1.
| order_business_out-PAYMETHODE
+
    MOVE www_order_items_imp-bstkd_e TO order_items_bapi_out-purch_no_s.
| order_header_in-PYMT_METH
+
    MOVE www_order_items_imp-bstdk_e TO order_items_bapi_out-po_dat_s.
| order_business_out-PAYMETHODE
+
    MOVE www_order_items_imp-bsark_e TO order_items_bapi_out-po_meth_s.
| VĄa de Pago
+
    MOVE www_order_items_imp-ihrez_e TO order_items_bapi_out-ref_1_s.
|-
+
    MOVE www_order_items_imp-posex_e TO order_items_bapi_out-po_itm_no_s.
| VBKD-POPER
+
* 4.0 Erweiterungen1
| Periodo Contable
+
* move internal format  into external format
| order_business_out-POSTPERIOD
+
    IF NOT www_order_items_imp-waerk IS INITIAL.
|
+
      IF NOT www_order_items_imp-netwr IS INITIAL.
| order_business_out-POSTPERIOD
+
        CLEAR order_items_bapi_out-net_value1.
| Periodo Contable
+
        CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL'
|-
+
          EXPORTING
| VBKD-GJAHR
+
            currency        = www_order_items_imp-waerk
| Ejercicio
+
            amount_internal = www_order_items_imp-netwr1
| order_business_out-FISC_YEAR
+
          IMPORTING
|
+
            amount_external = order_items_bapi_out-net_value1.
| order_business_out-FISC_YEAR
+
      ENDIF.
| Ejercicio
+
    ENDIF.
|-
+
* 4.0C Erweiterungen
| VBKD-KURRF
+
    CALL FUNCTION 'UNIT_OF_MEASURE_SAP_TO_ISO'
| Tipo de Cambio
+
      EXPORTING
| order_business_out-EXCHRATEFI
+
        sap_code    = www_order_items_imp-vrkme
| order_header_in-EXRATE_FI
+
      IMPORTING
| order_business_out-EXCHRATEFI
+
        iso_code    = order_items_bapi_out-s_unit_iso
| Tipo de Cambio
+
      EXCEPTIONS
|-
+
        not_found  = 01
| VBKD-MSCHL
+
        no_iso_code = 02.
| Clave de Reclamaci˘n
+
    IF NOT www_order_items_imp-waerk IS INITIAL.
| order_business_out-DUNN_KEY
+
      CALL FUNCTION 'CURRENCY_CODE_SAP_TO_ISO'
| order_header_in-DUNN_KEY
+
        EXPORTING
| order_business_out-DUNN_KEY
+
          sap_code  = www_order_items_imp-waerk
| Clave de Reclamaci˘n
+
        IMPORTING
|-
+
          iso_code  = order_items_bapi_out-curr_iso
| VBKD-MANSP
+
        EXCEPTIONS
| Bloqueo de reclamaci˘n
+
          not_found = 01.
| order_business_out-DUNN_BLOCK
+
    ENDIF.
| order_header_in-DUNN_BLOCK
+
 
| order_business_out-DUNN_BLOCK
+
    MOVE www_order_items_imp-kwmeng  TO order_items_bapi_out-req_qty.
| Bloqueo de reclamaci˘n
+
    MOVE www_order_items_imp-werks  TO order_items_bapi_out-plant.
|}
+
 
 +
* 4.6A Enhancement                                                    *
 +
    IF NOT www_order_items_imp-waerk IS INITIAL.
 +
      IF NOT www_order_items_imp-mwsbp IS INITIAL.
 +
        CLEAR order_items_bapi_out-tx_doc_cur.
 +
        CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL'
 +
          EXPORTING
 +
            currency        = www_order_items_imp-waerk
 +
            amount_internal = www_order_items_imp-mwsbp
 +
          IMPORTING
 +
            amount_external = order_items_bapi_out-tx_doc_cur.
 +
      ENDIF.
 +
* subtotal 1
 +
      IF NOT www_order_items_imp-kozw1 IS INITIAL.
 +
        CLEAR order_items_bapi_out-subtotal1.
 +
        CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL'
 +
          EXPORTING
 +
            currency        = www_order_items_imp-waerk
 +
            amount_internal = www_order_items_imp-kozw1
 +
          IMPORTING
 +
            amount_external = order_items_bapi_out-subtotal1.
 +
      ENDIF.
 +
* subtotal 2
 +
      IF NOT www_order_items_imp-kozw2 IS INITIAL.
 +
        CLEAR order_items_bapi_out-subtotal2.
 +
        CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL'
 +
          EXPORTING
 +
            currency        = www_order_items_imp-waerk
 +
            amount_internal = www_order_items_imp-kozw2
 +
          IMPORTING
 +
            amount_external = order_items_bapi_out-subtotal2.
 +
      ENDIF.
 +
* subtotal 3
 +
      IF NOT www_order_items_imp-kozw3 IS INITIAL.
 +
        CLEAR order_items_bapi_out-subtotal3.
 +
        CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL'
 +
          EXPORTING
 +
            currency        = www_order_items_imp-waerk
 +
            amount_internal = www_order_items_imp-kozw3
 +
          IMPORTING
 +
            amount_external = order_items_bapi_out-subtotal3.
 +
      ENDIF.
 +
* subtotal 4
 +
      IF NOT www_order_items_imp-kozw4 IS INITIAL.
 +
        CLEAR order_items_bapi_out-subtotal4.
 +
        CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL'
 +
          EXPORTING
 +
            currency        = www_order_items_imp-waerk
 +
            amount_internal = www_order_items_imp-kozw4
 +
          IMPORTING
 +
            amount_external = order_items_bapi_out-subtotal4.
 +
      ENDIF.
 +
* subtotal 5
 +
      IF NOT www_order_items_imp-kozw5 IS INITIAL.
 +
        CLEAR order_items_bapi_out-subtotal5.
 +
        CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL'
 +
          EXPORTING
 +
            currency        = www_order_items_imp-waerk
 +
            amount_internal = www_order_items_imp-kozw5
 +
          IMPORTING
 +
            amount_external = order_items_bapi_out-subtotal5.
 +
      ENDIF.
 +
* subtotal 6
 +
      IF NOT www_order_items_imp-kozw6 IS INITIAL.
 +
        CLEAR order_items_bapi_out-subtotal6.
 +
        CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL'
 +
          EXPORTING
 +
            currency        = www_order_items_imp-waerk
 +
            amount_internal = www_order_items_imp-kozw6
 +
          IMPORTING
 +
            amount_external = order_items_bapi_out-subtotal6.
 +
      ENDIF.
 +
    ENDIF.
 +
 
 +
    PACK www_order_items_imp-zmengc  TO order_items_bapi_out-target_qty.
 +
    MOVE www_order_items_imp-zieme  TO order_items_bapi_out-target_qu.
 +
 
 +
    CALL FUNCTION 'UNIT_OF_MEASURE_SAP_TO_ISO'
 +
      EXPORTING
 +
        sap_code    = www_order_items_imp-zieme
 +
      IMPORTING
 +
        iso_code    = order_items_bapi_out-t_unit_iso
 +
      EXCEPTIONS
 +
        not_found  = 01
 +
        no_iso_code = 02.
 +
 
 +
    MOVE www_order_items_imp-pstyv TO order_items_bapi_out-item_categ.
 +
    MOVE www_order_items_imp-vstel TO order_items_bapi_out-ship_point.
 +
    MOVE www_order_items_imp-uepos TO order_items_bapi_out-hg_lv_item.
 +
 
 +
    MOVE www_order_items_imp-kdmat TO order_items_bapi_out-cust_mat.
 +
    MOVE www_order_items_imp-kztlf TO order_items_bapi_out-part_dlv.
 +
    MOVE www_order_items_imp-abgru TO order_items_bapi_out-reason_rej.
 +
    MOVE www_order_items_imp-faksp TO order_items_bapi_out-bill_block.
 +
    MOVE www_order_items_imp-lgort TO order_items_bapi_out-stge_loc.
 +
    MOVE www_order_items_imp-prodh TO order_items_bapi_out-prod_hier.
 +
    MOVE www_order_items_imp-matkl TO order_items_bapi_out-matl_group.
 +
    MOVE www_order_items_imp-sgt_rcat TO order_items_bapi_out-req_segment."Segmentation
 +
 
 +
    APPEND order_items_bapi_out.
 +
 
 +
  ENDLOOP.
 +
 
 +
ENDFORM.</nowiki>

Revision as of 16:51, 6 April 2020

ver INCLUDE L2032FXX, ejemplo:

*---------------------------------------------------------------------*
FORM move_item_data_out.

* ITEMS
  REFRESH order_items_bapi_out.
  LOOP AT www_order_items_imp.

    CLEAR order_items_bapi_out.

    MOVE www_order_items_imp-posnr  TO order_items_bapi_out-itm_number.
    MOVE www_order_items_imp-posex  TO order_items_bapi_out-po_itm_no.
    MOVE www_order_items_imp-matnr  TO order_items_bapi_out-material.
    MOVE www_order_items_imp-matwa  TO order_items_bapi_out-mat_entrd.
    MOVE www_order_items_imp-arktx  TO order_items_bapi_out-short_text.
    MOVE www_order_items_imp-netwr  TO order_items_bapi_out-net_value.
    MOVE www_order_items_imp-kzkfg  TO order_items_bapi_out-configured.
    MOVE www_order_items_imp-waerk  TO order_items_bapi_out-currency.
    MOVE www_order_items_imp-kzwi1  TO order_items_bapi_out-subtotal_1.
    MOVE www_order_items_imp-kzwi2  TO order_items_bapi_out-subtotal_2.
    MOVE www_order_items_imp-kzwi3  TO order_items_bapi_out-subtotal_3.
    MOVE www_order_items_imp-kzwi4  TO order_items_bapi_out-subtotal_4.
    MOVE www_order_items_imp-kzwi5  TO order_items_bapi_out-subtotal_5.
    MOVE www_order_items_imp-kzwi6  TO order_items_bapi_out-subtotal_6.
    MOVE www_order_items_imp-vrkme  TO order_items_bapi_out-sales_unit.
    MOVE www_order_items_imp-mngwt  TO order_items_bapi_out-qty_req_dt.
    MOVE www_order_items_imp-edatu  TO order_items_bapi_out-dlv_date.
    MOVE www_order_items_imp-wzeitc TO order_items_bapi_out-repl_time.

    MOVE www_order_items_imp-bstkd   TO order_items_bapi_out-purch_no_c.
    MOVE www_order_items_imp-bstdk   TO order_items_bapi_out-purch_date.
    MOVE www_order_items_imp-bsark   TO order_items_bapi_out-po_method.
    MOVE www_order_items_imp-ihrez   TO order_items_bapi_out-ref_1.
    MOVE www_order_items_imp-bstkd_e TO order_items_bapi_out-purch_no_s.
    MOVE www_order_items_imp-bstdk_e TO order_items_bapi_out-po_dat_s.
    MOVE www_order_items_imp-bsark_e TO order_items_bapi_out-po_meth_s.
    MOVE www_order_items_imp-ihrez_e TO order_items_bapi_out-ref_1_s.
    MOVE www_order_items_imp-posex_e TO order_items_bapi_out-po_itm_no_s.
* 4.0 Erweiterungen1
* move internal format  into external format
    IF NOT www_order_items_imp-waerk IS INITIAL.
      IF NOT www_order_items_imp-netwr IS INITIAL.
        CLEAR order_items_bapi_out-net_value1.
        CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL'
          EXPORTING
            currency        = www_order_items_imp-waerk
            amount_internal = www_order_items_imp-netwr1
          IMPORTING
            amount_external = order_items_bapi_out-net_value1.
      ENDIF.
    ENDIF.
* 4.0C Erweiterungen
    CALL FUNCTION 'UNIT_OF_MEASURE_SAP_TO_ISO'
      EXPORTING
        sap_code    = www_order_items_imp-vrkme
      IMPORTING
        iso_code    = order_items_bapi_out-s_unit_iso
      EXCEPTIONS
        not_found   = 01
        no_iso_code = 02.
    IF NOT www_order_items_imp-waerk IS INITIAL.
      CALL FUNCTION 'CURRENCY_CODE_SAP_TO_ISO'
        EXPORTING
          sap_code  = www_order_items_imp-waerk
        IMPORTING
          iso_code  = order_items_bapi_out-curr_iso
        EXCEPTIONS
          not_found = 01.
    ENDIF.

    MOVE www_order_items_imp-kwmeng  TO order_items_bapi_out-req_qty.
    MOVE www_order_items_imp-werks   TO order_items_bapi_out-plant.

* 4.6A Enhancement                                                     *
    IF NOT www_order_items_imp-waerk IS INITIAL.
      IF NOT www_order_items_imp-mwsbp IS INITIAL.
        CLEAR order_items_bapi_out-tx_doc_cur.
        CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL'
          EXPORTING
            currency        = www_order_items_imp-waerk
            amount_internal = www_order_items_imp-mwsbp
          IMPORTING
            amount_external = order_items_bapi_out-tx_doc_cur.
      ENDIF.
* subtotal 1
      IF NOT www_order_items_imp-kozw1 IS INITIAL.
        CLEAR order_items_bapi_out-subtotal1.
        CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL'
          EXPORTING
            currency        = www_order_items_imp-waerk
            amount_internal = www_order_items_imp-kozw1
          IMPORTING
            amount_external = order_items_bapi_out-subtotal1.
      ENDIF.
* subtotal 2
      IF NOT www_order_items_imp-kozw2 IS INITIAL.
        CLEAR order_items_bapi_out-subtotal2.
        CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL'
          EXPORTING
            currency        = www_order_items_imp-waerk
            amount_internal = www_order_items_imp-kozw2
          IMPORTING
            amount_external = order_items_bapi_out-subtotal2.
      ENDIF.
* subtotal 3
      IF NOT www_order_items_imp-kozw3 IS INITIAL.
        CLEAR order_items_bapi_out-subtotal3.
        CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL'
          EXPORTING
            currency        = www_order_items_imp-waerk
            amount_internal = www_order_items_imp-kozw3
          IMPORTING
            amount_external = order_items_bapi_out-subtotal3.
      ENDIF.
* subtotal 4
      IF NOT www_order_items_imp-kozw4 IS INITIAL.
        CLEAR order_items_bapi_out-subtotal4.
        CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL'
          EXPORTING
            currency        = www_order_items_imp-waerk
            amount_internal = www_order_items_imp-kozw4
          IMPORTING
            amount_external = order_items_bapi_out-subtotal4.
      ENDIF.
* subtotal 5
      IF NOT www_order_items_imp-kozw5 IS INITIAL.
        CLEAR order_items_bapi_out-subtotal5.
        CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL'
          EXPORTING
            currency        = www_order_items_imp-waerk
            amount_internal = www_order_items_imp-kozw5
          IMPORTING
            amount_external = order_items_bapi_out-subtotal5.
      ENDIF.
* subtotal 6
      IF NOT www_order_items_imp-kozw6 IS INITIAL.
        CLEAR order_items_bapi_out-subtotal6.
        CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL'
          EXPORTING
            currency        = www_order_items_imp-waerk
            amount_internal = www_order_items_imp-kozw6
          IMPORTING
            amount_external = order_items_bapi_out-subtotal6.
      ENDIF.
    ENDIF.

    PACK www_order_items_imp-zmengc  TO order_items_bapi_out-target_qty.
    MOVE www_order_items_imp-zieme   TO order_items_bapi_out-target_qu.

    CALL FUNCTION 'UNIT_OF_MEASURE_SAP_TO_ISO'
      EXPORTING
        sap_code    = www_order_items_imp-zieme
      IMPORTING
        iso_code    = order_items_bapi_out-t_unit_iso
      EXCEPTIONS
        not_found   = 01
        no_iso_code = 02.

    MOVE www_order_items_imp-pstyv TO order_items_bapi_out-item_categ.
    MOVE www_order_items_imp-vstel TO order_items_bapi_out-ship_point.
    MOVE www_order_items_imp-uepos TO order_items_bapi_out-hg_lv_item.

    MOVE www_order_items_imp-kdmat TO order_items_bapi_out-cust_mat.
    MOVE www_order_items_imp-kztlf TO order_items_bapi_out-part_dlv.
    MOVE www_order_items_imp-abgru TO order_items_bapi_out-reason_rej.
    MOVE www_order_items_imp-faksp TO order_items_bapi_out-bill_block.
    MOVE www_order_items_imp-lgort TO order_items_bapi_out-stge_loc.
    MOVE www_order_items_imp-prodh TO order_items_bapi_out-prod_hier.
    MOVE www_order_items_imp-matkl TO order_items_bapi_out-matl_group.
    MOVE www_order_items_imp-sgt_rcat TO order_items_bapi_out-req_segment."Segmentation

    APPEND order_items_bapi_out.

  ENDLOOP.

ENDFORM.