Quantcast
Channel: SCN: Message List - ABAP Connectivity
Viewing all articles
Browse latest Browse all 3125

Cost Center missing in BAPI_SALESORDER_CREATEFROMDAT2

$
0
0

Hi,

I use BAPI_SALESORDER_CREATEFROMDAT2 to create sales orders from external system.

It is working so far but I have problems transferring cost centers.

Normally the cost center in SAP ERP is derived from customizing assignment to order reason (vbak-augru).

In my case the cost center in VA01 is entered directly in the Account Assignment subscreen (order item field COBL-KOSTL).

Field KOSTL is not supported in the BAPI but I followed the instructions from the field documentation EXTENSIONIN of the BAPI and several threads in SCN about it.

I have extended BAPE_VBAP and BAPE_VBAPX accordingly. KOSTL is already available in VBAPKOM and VBAPKOMX.

When I run my program the sales order is created with all data but cost center is still missing.

What might be the reason?

Here is the essential part of the coding:

 

  DATA: lt_extension  TYPETABLEOF bapiparex,
        ls_extension 
TYPE bapiparex,
        ls_bape_vbap 
TYPE bape_vbap,
        ls_bape_vbapx
TYPE bape_vbapx.

.

.

.

 

    IFNOT ls_alv-kostl ISINITIAL.
      ls_bape_vbap-posnr = ls_items-itm_number.
      ls_bape_vbap-kostl = ls_alv-kostl.
      ls_extension-
structure = 'BAPE_VBAP'.
      ls_extension+
30 = ls_bape_vbap.
     
APPEND ls_extension TO lt_extension.
     
CLEAR ls_extension.
      ls_bape_vbapx-posnr = ls_items-itm_number.
      ls_bape_vbapx-kostl = abap_true.
      ls_extension-
structure = 'BAPE_VBAPX'.
     
ls_extension+30 = ls_bape_vbapx.
     
APPEND ls_extension TO lt_extension.
   
ENDIF.

  CALLFUNCTION'BAPI_SALESORDER_CREATEFROMDAT2'
   
EXPORTING
      order_header_in               = ls_header
  
IMPORTING
      salesdocument                 = lv_order
  
TABLES
     
return                        = lt_return
      order_items_in                = lt_items
      order_partners                = lt_partner
      order_schedules_in            = lt_schedules
      order_conditions_in           = lt_conds

      order_keys                    = lt_keys
      extensionin                   = lt_extension.

 

 

Thanks in advance

Volker


Viewing all articles
Browse latest Browse all 3125

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>