This website is not affiliated with, sponsored by, or approved by SAP AG.

BAPI_SALESORDER_CHANGE : Characteristics

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

BAPI_SALESORDER_CHANGE : Characteristics

Postby stjacqd » Mon Aug 21, 2017 10:28 am

hello everyone

I am using BAPI_SALESORDER_CHANGE to copy a SO item to a new item. The new item is an exact copy of the previous one with small differences like the values in the item details configuration.

I am trying to fulfill the tables order_cfgs_ref, order_cfgs_inst and order_cfgs_value. But the execution of the BAPI is ending with a DUMP.

Code: Select all
   
    DATA: lv_posnr type posnr value '000010',
             lv_posnr2  type posnr value '000020'.

    CALL FUNCTION 'BAPI_SALESORDER_GETDETAILBOS'
      EXPORTING
        salesdocument   = gv_vbeln   " VBELN
      TABLES
        ordercfgscurefs = st_ordercfgscurefs
        ordercfgscucfgs = st_ordercfgscucfgs
        ordercfgscuins  = st_ordercfgscuins
        ordercfgscuprts = st_ordercfgscuprts
        ordercfgscuvals = st_ordercfgscuvals
        orderconditem   = st_orderconditem.

    READ TABLE st_ordercfgscurefs INTO ls_ordercfgscurefs WITH KEY posex = lv_posnr.
    IF sy-subrc = 0.
      CLEAR ls_order_cfgs_ref.
      ls_order_cfgs_ref-posex = p_posnr_next_phase.
      ls_order_cfgs_ref-config_id = ls_ordercfgscurefs-config_id.
      CLEAR ls_ordercfgscucfgs.
      READ TABLE st_ordercfgscucfgs INTO ls_ordercfgscucfgs WITH KEY posex = lv_posnr.
      IF ls_ordercfgscucfgs-root_id IS NOT INITIAL.
        ls_order_cfgs_ref-root_id = ls_ordercfgscurefs-inst_id.
      ENDIF.
      APPEND ls_order_cfgs_ref TO pt_order_cfgs_ref.

    ENDIF.


    ls_logic_switch-pricing = 'C'.

   ls_order_header_inx-updateflag = 'U'.
   CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
    EXPORTING
      salesdocument    = gv_vbeln
      order_header_in  = ls_order_header_in
      order_header_inx = ls_order_header_inx
      logic_switch     = ls_logic_switch
    TABLES
      return           = lt_return
      order_item_in    = lt_order_item_in
      order_item_inx   = lt_order_item_inx
      order_cfgs_ref   = lt_order_cfgs_ref
      order_cfgs_inst  = lt_order_cfgs_inst
      order_cfgs_value = lt_order_cfgs_value
    .


It is ending by a dump:
ABAP programming error
MESSAGE_TYPE_X
CL_CBASE_SPECIAL_ERP==========CP
LO-VC

If I am copying the item without trying to copy the item detail configuration, the field CUOBJ of VBAP is not fulfilled. It is not possible to change the value of the configuration because no configuration is assign to the item.

When the field cuobj of the new item is assigned, I can copy/create all the configurations without any problem.

My question is, how can we assign a right value to the new item field VBAP-CUOBJ ?

Or, how can I copy the item detail configuration to the new item.


Regards
stjacqd
 
Posts: 253
Joined: Tue Oct 22, 2002 9:10 am
Location: Montreal, Qc, Canada

Re: BAPI_SALESORDER_CHANGE : Characteristics

Postby stjacqd » Wed Aug 23, 2017 3:48 pm

For the benefits of all.


The dump is an SAP issue.

S4/HANA
========
When a sales order item has been deleted, it is no longer mark as deletion, it is physically deleted from vbap.

The dump occured when the same posnr is used by the same item again.

So, don't make a mistake by deleting a SO item and recreate it after under the same POSNR, it will dump.
stjacqd
 
Posts: 253
Joined: Tue Oct 22, 2002 9:10 am
Location: Montreal, Qc, Canada

Re: BAPI_SALESORDER_CHANGE : Characteristics

Postby stjacqd » Thu Aug 24, 2017 10:44 am

Now another problem occured.

When we are creating a new item, the configuration is not copied.

I then try to create a new configuration using FM CUXI_SET_SINGLE_CONFIGURATION and CUKO_CONFIGURATION_TO_DB where that has generated the Ibase number to assign to VBAP-CUOBJ.

But the FM BAPI_SALESORDER_CHANGE doesn't have the field listed to update.

All suggestions to update the VBAP-CUOBJ field will be appreciated.

Regards
stjacqd
 
Posts: 253
Joined: Tue Oct 22, 2002 9:10 am
Location: Montreal, Qc, Canada

Re: BAPI_SALESORDER_CHANGE : Characteristics

Postby stjacqd » Tue Aug 29, 2017 7:56 am

Again for the benefits of all

The problem was related to 2 facts.

BAPI_SALESORDER_CHANGE:
1. The field config_id in Itab order_cfgs_ref, order_cfgs_inst and order_cfgs_value most be unique for the posnr. So, be sure to not assign the same config_id to 2 different posnr.

2. The field po_itm_no of itab order_item_in most be fulfill with the posnr and the field po_itm_no from itab order_item_inx most be set with 'X" to allow SAP to update the idem detail configuration.

Example:
order_cfgs_ref
POSEX CONFIG_ID ROOT_ID
000010 000001 00000001
000020 000002 00000001

order_cfgs_inst
CONFIG_ID Inst_id OBJ_TYPE CLASS_TYPE OBJ_KEY
000001 00000001 MARA 300 000000000000000001
000002 00000001 MARA 300 000000000000000002

Note: OBJ_TYPE, CLASS_TYPE and OBJ_KEY depend of the configuration. Can be seen by using FM


order_cfgs_value
CONFIG_ID INST_ID CHARC VALUE
000001 00000001 <Name of the characteristic> <Value of the characteristic>
000002 00000001 <Name of the characteristic> <Value of the characteristic>

The FM BAPI_SALESORDER_GETDETAILBOS can provide detail information of the OBJ_TYPE, CLASS_TYPE and OBJ_KEY as well as the CHARC and VALUE fields.
stjacqd
 
Posts: 253
Joined: Tue Oct 22, 2002 9:10 am
Location: Montreal, Qc, Canada


Return to ABAP

Who is online

Users browsing this forum: Google [Bot], Google Adsense [Bot] and 6 guests





loading...


This website is not affiliated with, sponsored by, or approved by SAP AG.