Sample Code

Updating fields in Outbound Delivery

Let’s demystify – BAPI_OUTB_DELIVERY_CHANGE today. We can use this BAPI to update delivery quantity – Correct. But we can also use this BAPI to update other fields – such as Batch, Storage Location etc. Let’s have a sample code.

      ls_header_data-deliv_numb = <deliverynumber>.
      ls_header_control-deliv_numb = <deliverynumber>.


      ls_item_data-deliv_numb = <deliverynumber>.
      ls_item_data-deliv_item = <deliveryitem>.
      ls_item_data-dlv_qty = <quantity>.
      ls_item_data-sales_unit = <unit>.
      ls_item_data-fact_unit_nom = <getfromlips>.
      ls_item_data-fact_unit_denom = <getfromlips>.

      APPEND ls_item_data TO lt_item_data.

      ls_item_control-deliv_numb = <deliverynumber>.
      ls_item_control-deliv_item = <deliveryitem>.
      ls_item_control-chg_delqty = abap_true.

      APPEND ls_item_control TO lt_item_control.

      CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
        EXPORTING
          header_data    = ls_header_data
          header_control = ls_header_control
          delivery       = <deliverynumber>
        TABLES
          item_data      = lt_item_data
          item_control   = lt_item_control
          return         = lt_return.

Reasons, why I am writing a blog on this BAPI, are following:

  • You need to mention numerator and demonitor for this BAPI to work.
  • The item control table has only field so it seems like it can only change the quantiy, but it can change other fields as well. There is just one control field. So always check chg_delqty, even if quantity is not changing but you want to change other fields.
  • The storage location is not even in the item_data field. It is another table structure – ITEM_DATA_SPL. It does not have control table but it will change the storage location if the chg_delqty field is checked.

Similarly, there are other fields in so many other table structures present. Give this BAPI a shot, it may be used to change more fields than you may have imagined this one to do.

If you like our post, please spread the word around. Follow our LinkedIn page and blog for the updates.

Leave a Reply

Your email address will not be published. Required fields are marked *

error

Enjoy this blog? Please spread the word :)

Follow by Email
Twitter
LinkedIn
LinkedIn
Share