Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3184

Change Sales Order using BAPI_SALESORDER_CHANGE but Without Creating Condition

$
0
0

Hi guys,

 

Please, could anyone help me?

 

I'm using the BAPI_SALESORDER_CHANGE in order to change the Sales Order and after I delete an Item I need to create another with a different Material Number, but with same Conditions. I've been trying to create them but I can't because an error occurs and it can be seen through the attached Log image (SLG1).

 

I have tried to use UPDATEFLAG with both options 'I' OR 'U'...

 

The Condition's code is below:

 

* New Material

     IF wa_ov_save-matnr NE gs_ov_ant-matnr.

       v_posnr = v_posnr + 10.

 

       wa_iteminx-updateflag  = c_u.

       wa_itemin-material     = wa_ov_save-matnr.            

       wa_itemin-target_qty   = wa_ov_save-kwmeng.

       wa_itemin-itm_number   = v_posnr.

       wa_ztbsd_log_ov-posnr  = wa_ov_save-posnr.

 

 

       APPEND wa_iteminx TO iteminx.

       APPEND wa_itemin  TO itemin.

 

ENDIF.

 

* Conditions

         step_nr    = '302'.

         cond_count = '01'.

         cond_type  = c_zid0.

 

         conditions_inx-itm_number v_posnr.

         conditions_inx-updateflag   = c_i.

         conditions_inx-cond_st_no = step_nr.

         conditions_inx-cond_count = cond_count.

         conditions_inx-cond_type   = c_x.

         conditions_inx-cond_value = c_x.

         conditions_inx-currency     = c_x.

         APPEND conditions_inx.

 

         conditions_in-itm_number = v_posnr.

         conditions_in-cond_st_no = step_nr.

         conditions_in-cond_count = cond_count.

         conditions_in-cond_type  = cond_type.

         conditions_in-cond_value = wa_konv-kbetr.

         conditions_in-currency   = 'BRL'.

         APPEND conditions_in.

 

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

         EXPORTING

           salesdocument    = salesdocument

           order_header_in  = order_header_in

           order_header_inx = order_header_inx

           logic_switch     = logic_switch

         TABLES

           return           = return

           order_item_in    = itemin

           order_item_inx   = iteminx

           partnerchanges   = partnerchange

           schedule_lines   = schedule_lin

           schedule_linesx  = schedule_linx

           conditions_in    = conditions_in

           conditions_inx   = conditions_inx.

 

         CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

           EXPORTING

             wait = c_x.


Thanks!!


Best regards,


Marcos F. Dotta


Viewing all articles
Browse latest Browse all 3184

Trending Articles