Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2161

Re: BAPI for change sales order

$
0
0

Hi Gàbor,

 

thank you for your response.

At the moment all my code is working fine (insert items, update item quantities, delete items) only if I run my FM directly in SAPR3 or if I test it from SE37.

 

I created a custom FM in order to wrap SD_SALESDOCUMENT_CHANGE and BAPI_TRANSACTION_COMMIT in a single unit of work: this custom FM is called from external RFC.

 

In this way, I can create items and modify items, but deletion is not working fine. The return structure contains a successful message but the order is unmodified.

 

My code for deletion is here below:

 

DATA:

    lw_itm TYPE bapisditm,

    lt_itm TYPE TABLE OF bapisditm,

 

 

    lw_itmx TYPE BAPISDITMX,

    lt_itmx TYPE TABLE OF BAPISDITMX,

 

 

    ls_item LIKE LINE OF sales_items_in,

    ls_itemx LIKE LINE OF sales_items_inx,

 

LOOP at sales_items_in INTO ls_item.

  MOVE-CORRESPONDING ls_item TO lw_itm. " popolated lw_item-itm_number

  APPEND lw_itm TO lt_itm.

ENDLOOP.

                                                                                                                                                                                                                                                              

LOOP at sales_items_inx INTO ls_itemx.

  MOVE-CORRESPONDING ls_itemx TO lw_itmx.

" popolated lw_itemx-itm_number and lw_itemx-updateflag to 'D'

  APPEND lw_itmx TO lt_itmx.

ENDLOOP.

                                                                                                                                                 sales_header_inx-updateflag = 'U'.

                                                                                                                                                                                                                                                              

  CALL FUNCTION 'SD_SALESDOCUMENT_CHANGE'

    EXPORTING

     salesdocument               = salesdocument

     order_header_inx            = sales_header_inx

    TABLES

      return                     = return

      ITEM_IN                    = lt_itm

      ITEM_INX                   = lt_itmx

     items_ex                    = items_ex.

  

   CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

 

 

Best regards,

 

Francesca


Viewing all articles
Browse latest Browse all 2161

Trending Articles



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