Difference between revisions of "SAP SD BAPI MAP"

From SapWiki
 
Line 1: Line 1:
−
ver INCLUDE L2032FXX, ejemplo:
+
ver INCLUDE LVBAKF0C, forms:
−
<nowiki>*---------------------------------------------------------------------*
+
*ms_move_header_in
−
FORM move_item_data_out.
+
*ms_move_item_in
 +
*ms_move_partner_in
 +
*ms_move_schedule_in
 +
*ms_move_conditions_in
 +
*ms_move_ccard_in
 +
*ms_move_sales_text_in
 +
*ms_move_veda_in
 +
*ms_move_extensionin
 +
ejemplo:
 +
  <nowiki>loop at item_in.
  
−
* ITEMS
+
    clear: ex_vbapkom.
−
  REFRESH order_items_bapi_out.
 
−
  LOOP AT www_order_items_imp.
 
  
−
     CLEAR order_items_bapi_out.
+
     move item_in-itm_number  to ex_vbapkom-posnr.
−
 
+
     move item_in-hg_lv_item to ex_vbapkom-uepos.
−
    MOVE www_order_items_imp-posnr  TO order_items_bapi_out-itm_number.
+
     move item_in-po_itm_no  to ex_vbapkom-posex.
−
    MOVE www_order_items_imp-posex TO order_items_bapi_out-po_itm_no.
+
     move item_in-material    to ex_vbapkom-matnr.
−
     MOVE www_order_items_imp-matnr TO order_items_bapi_out-material.
+
     move item_in-alt_to_itm to ex_vbapkom-grpos.
−
     MOVE www_order_items_imp-matwa  TO order_items_bapi_out-mat_entrd.
+
     move item_in-batch      to ex_vbapkom-charg.
−
     MOVE www_order_items_imp-arktx  TO order_items_bapi_out-short_text.
+
     move item_in-dlv_group  to ex_vbapkom-grkor.
−
     MOVE www_order_items_imp-netwr TO order_items_bapi_out-net_value.
+
     move item_in-part_dlv    to ex_vbapkom-kztlf.
−
     MOVE www_order_items_imp-kzkfg  TO order_items_bapi_out-configured.
+
     move item_in-reason_rej to ex_vbapkom-abgru.
−
     MOVE www_order_items_imp-waerk  TO order_items_bapi_out-currency.
+
     move item_in-bill_block to ex_vbapkom-faksp.
−
     MOVE www_order_items_imp-kzwi1  TO order_items_bapi_out-subtotal_1.
+
     move item_in-bill_date   to ex_vbapkom-fkdat.
−
     MOVE www_order_items_imp-kzwi2 TO order_items_bapi_out-subtotal_2.
+
     move item_in-plant       to ex_vbapkom-werks.
−
     MOVE www_order_items_imp-kzwi3 TO order_items_bapi_out-subtotal_3.
+
     move item_in-store_loc   to ex_vbapkom-lgort.
−
     MOVE www_order_items_imp-kzwi4  TO order_items_bapi_out-subtotal_4.
+
     move item_in-matfrgtgrp to ex_vbapkom-mfrgr.
−
    MOVE www_order_items_imp-kzwi5  TO order_items_bapi_out-subtotal_5.
+
     move item_in-target_qty to ex_vbapkom-zmeng.
−
    MOVE www_order_items_imp-kzwi6  TO order_items_bapi_out-subtotal_6.
+
     move item_in-target_qu   to ex_vbapkom-zieme.</nowiki>
−
    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.</nowiki>
 

Latest revision as of 17:03, 6 April 2020

ver INCLUDE LVBAKF0C, forms:

  • ms_move_header_in
  • ms_move_item_in
  • ms_move_partner_in
  • ms_move_schedule_in
  • ms_move_conditions_in
  • ms_move_ccard_in
  • ms_move_sales_text_in
  • ms_move_veda_in
  • ms_move_extensionin

ejemplo:

 loop at item_in.

    clear: ex_vbapkom.

    move item_in-itm_number  to ex_vbapkom-posnr.
    move item_in-hg_lv_item  to ex_vbapkom-uepos.
    move item_in-po_itm_no   to ex_vbapkom-posex.
    move item_in-material    to ex_vbapkom-matnr.
    move item_in-alt_to_itm  to ex_vbapkom-grpos.
    move item_in-batch       to ex_vbapkom-charg.
    move item_in-dlv_group   to ex_vbapkom-grkor.
    move item_in-part_dlv    to ex_vbapkom-kztlf.
    move item_in-reason_rej  to ex_vbapkom-abgru.
    move item_in-bill_block  to ex_vbapkom-faksp.
    move item_in-bill_date   to ex_vbapkom-fkdat.
    move item_in-plant       to ex_vbapkom-werks.
    move item_in-store_loc   to ex_vbapkom-lgort.
    move item_in-matfrgtgrp  to ex_vbapkom-mfrgr.
    move item_in-target_qty  to ex_vbapkom-zmeng.
    move item_in-target_qu   to ex_vbapkom-zieme.