Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Batch split using BAPI_OUTB_DELIVERY_CHANGE?

vsubbakrishna
Participant
0 Likes
10,336

Hi all,

Has anybody done Batch split using <b>BAPI_OUTB_DELIVERY_CHANGE</b> as we do in <b>VL02N</b>.

To automate the batch split process in VL02N i have two options:

1) BDC for VL02N

2) use BAPI_OUTB_DELIVERY_CHANGE

can BAPI_OUTB_DELIVERY_CHANGE meet my requirements.

valuable inputs needed.

thanks,

subba

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
7,671

Hi krishna,

Check this part of the fm documentation:

Batch Split in the Decentralized WMS

If you change a batch subitem from a distributed outbound delivery in the decentralized WMS, then this batch subitem already exists in the central ERP system.

The fields HIERARITEM and USEHIERITM are empty. The system copies the batch subitem in the DELIV_ITEM field.

If you change the quantity of a batch main item from a distributed outbound delivery in the decentralized WMS, then this batch main item already exists in the central ERP system.

The fields HIERARITEM and USEHIERITM are empty. The system copies the batch subitem into the DELIV_ITEM field.

If you perform a batch split for a distributed outbound delivery in the decentralized WMS, only the batch main item exists at that time in the central ERP system.

If, for example, you create two batch subitems, three item segments ItemData are generated for transmission to the central ERP system:

The item segment for the batch main item HIERARITEM is empty.

The delivery quantity and base quantity are empty.

For each subitem, the system generates an item segment with the following fields:

DELIV_ITEM contains the number of the batch subitem.

HIERARITEM contains the number of the batch main item.

USEHIERITM with value 1 shows that the subitem is used as a batch subitem.

The quantity fields match the quantities in the batch subitems.

The central ERP system performs the batch split subsequently for the distributed outbound delivery.

Regards,

Ravi

13 REPLIES 13
Read only

Former Member
0 Likes
7,672

Hi krishna,

Check this part of the fm documentation:

Batch Split in the Decentralized WMS

If you change a batch subitem from a distributed outbound delivery in the decentralized WMS, then this batch subitem already exists in the central ERP system.

The fields HIERARITEM and USEHIERITM are empty. The system copies the batch subitem in the DELIV_ITEM field.

If you change the quantity of a batch main item from a distributed outbound delivery in the decentralized WMS, then this batch main item already exists in the central ERP system.

The fields HIERARITEM and USEHIERITM are empty. The system copies the batch subitem into the DELIV_ITEM field.

If you perform a batch split for a distributed outbound delivery in the decentralized WMS, only the batch main item exists at that time in the central ERP system.

If, for example, you create two batch subitems, three item segments ItemData are generated for transmission to the central ERP system:

The item segment for the batch main item HIERARITEM is empty.

The delivery quantity and base quantity are empty.

For each subitem, the system generates an item segment with the following fields:

DELIV_ITEM contains the number of the batch subitem.

HIERARITEM contains the number of the batch main item.

USEHIERITM with value 1 shows that the subitem is used as a batch subitem.

The quantity fields match the quantities in the batch subitems.

The central ERP system performs the batch split subsequently for the distributed outbound delivery.

Regards,

Ravi

Read only

0 Likes
7,671

I have been working that problem. I have been trying much test data. One of them was as you mentioned. I have also read the SAP document. It made similiar comments.

In ITEM_DATA,

DELIV_NUMB = 80000093 DELIV_ITEM = 000010

DELIV_NUMB = 80000093 DELIV_ITEM=900001 MATERIAL=3000000090001 BATCH=1000000798 HIERARITEM=000010 USEHIERITM=1 DLV_QTY=4 DLV_QTY_IMUNIT=4

ITEM_CONTROL. DELIV_NUMB=80000093 DELIV_ITEM=000010 CHG_DELQTY DELIV_NUMB80000093 DELIV_ITEM900001 CHG_DELQTYX

When I did it this way, I couldn't run it.

Read only

ferry_lianto
Active Contributor
0 Likes
7,671

Hi,

You might want to try BAPI_OUTB_DELIVERY_SPLIT_DEC instead.

Please check the online documentation for more information.

Regards,

Ferry Lianto

Read only

0 Likes
7,671

Hi all,

1)As per my knowledge BAPI_OUTB_DELIVERY_SPLIT_DEC can split for only one batch item....and not for multiple batches...

2) the documentation of BAPI_OUTB_DELIVERY_CHANGE is not giving a clear picture as to whether what parameters needs to be passed to BAPI_OUTB_DELIVERY_CHANGE to perform a Batch split.

thanks,

Subba

Read only

vsubbakrishna
Participant
0 Likes
7,671

Answered!!

Read only

0 Likes
7,671

Hi Subba,

I am facing the same kind of issue. If you have resolved the issue, kindly let me know with a sample piece of code

Thanks.

Regards,

Senthil G.

Read only

Former Member
0 Likes
7,671

Did you ever get a resolution to this problem. I am trying to determine how to update a standard Inventory Managed delivery (no WM, decentralized warehouses, or ALE systems).

I have a program I am wanting to program that will need to update the delivery line with multiple batch splits per line item. Sounds like you got your questions answered. Am very interested in which BAPI you finally used and which tables you had to populate to pass the material, batch, quantities, unit of measure.....

Any help would be greatly appreciated.

thanks,

Chip

Read only

0 Likes
7,671

Hello Sanders,

I have resolved the issue and the batch split happens using the BAPI BAPI_OUTB_DELIVERY_CHANGE. I have replied back in your thread. Check out and award points if helpful.

Regards,

Senthil G.

Read only

Former Member
0 Likes
7,671

Give this a try.

REPORT  z_delivery_batch_split.

DATA:header_data  LIKE  bapiibdlvhdrchg,

header_control  LIKE  bapiibdlvhdrctrlchg,

delivery  LIKE  bapiibdlvhdrchg-deliv_numb,

ls_return LIKE bapiret2,

item_data  TYPE TABLE OF  bapiibdlvitemchg,

item_control  TYPE TABLE OF bapiibdlvitemctrlchg,

ls_item_data  LIKE  bapiibdlvitemchg,

ls_item_control LIKE  bapiibdlvitemctrlchg,

return TYPE TABLE OF bapiret2 WITH NON-UNIQUE KEY type.

header_data-deliv_numb = '1800005005'.

header_control-deliv_numb = '1800005005'.

delivery = '1800005005'.

ls_item_data-deliv_numb = '1800005005'.

ls_item_data-deliv_item = '900001'.

ls_item_data-material = '000000000020067722'.

PERFORM create_batch CHANGING ls_item_data-batch.

ls_item_data-hieraritem = '000010'.

ls_item_data-usehieritm = '1'.

ls_item_data-dlv_qty = 80.

ls_item_data-dlv_qty_imunit = 80.

ls_item_data-fact_unit_nom = '1'.

ls_item_data-fact_unit_denom = '1'.

ls_item_data-sales_unit = 'EA'.

ls_item_data-base_uom = 'EA'.

APPEND ls_item_data TO item_data.

ls_item_data-deliv_numb = '1800005005'.

ls_item_data-deliv_item = '900002'.

ls_item_data-material = '000000000020067722'.

PERFORM create_batch CHANGING ls_item_data-batch.

ls_item_data-hieraritem = '000010'.

ls_item_data-usehieritm = '1'.

ls_item_data-dlv_qty = 60.

ls_item_data-dlv_qty_imunit = 60.

ls_item_data-fact_unit_nom = '1'.

ls_item_data-fact_unit_denom = '1'.

ls_item_data-sales_unit = 'EA'.

ls_item_data-base_uom = 'EA'.

APPEND ls_item_data TO item_data.

ls_item_control-deliv_numb = '1800005005'.

ls_item_control-deliv_item = '900001'.

ls_item_control-chg_delqty = 'X'.

APPEND ls_item_control TO item_control.

ls_item_control-deliv_numb = '1800005005'.

ls_item_control-deliv_item = '900002'.

ls_item_control-chg_delqty = 'X'.

APPEND ls_item_control TO item_control.

break cgavin.

CALL FUNCTION 'BAPI_INB_DELIVERY_CHANGE'

   EXPORTING

     header_data          = header_data

     header_control       = header_control

     delivery             = delivery

*   TECHN_CONTROL        = TECHN_CONTROL

   TABLES

*   HEADER_PARTNER       = HEADER_PARTNER

*   HEADER_PARTNER_ADDR  = HEADER_PARTNER_ADDR

*   HEADER_DEADLINES     = HEADER_DEADLINES

     item_data            = item_data

     item_control         = item_control

*   ITEM_SERIAL_NO       = ITEM_SERIAL_NO

*   EXTENSION1           = EXTENSION1

*   EXTENSION2           = EXTENSION2

     return               = return

*   TOKENREFERENCE       = TOKENREFERENCE

*   HANDLING_UNIT_HEADER = HANDLING_UNIT_HEADER

*   HANDLING_UNIT_ITEM   = HANDLING_UNIT_ITEM

*   PARTIAL_GR_OBJECTS   =          PARTIAL_GR_OBJECTS

   .

READ TABLE return

INTO ls_return

WITH TABLE KEY type = 'E'.

IF sy-subrc = 0.

   MESSAGE ID ls_return-id TYPE ls_return-type NUMBER ls_return-number WITH ls_return-message_v1 ls_return-message_v2

   ls_return-message_v3 ls_return-message_v4.

ENDIF.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  EXPORTING

    wait          = 'X'.

break cgavin.

*&---------------------------------------------------------------------*

*&      Form  CREATE_BATCH

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      <--P_LS_ITEM_DATA_BATCH  text

*----------------------------------------------------------------------*

FORM create_batch  CHANGING p_ls_item_data_batch.

   DATA: ls_bncom TYPE bncom.

   ls_bncom-matnr = ls_item_data-material.

   ls_bncom-werks = 'C333'.

   ls_bncom-lgort = '3000'.

   SELECT SINGLE mtart

     FROM mara

     INTO ls_bncom-mtart

     WHERE matnr = ls_bncom-matnr.

   CALL FUNCTION 'VB_NEXT_BATCH_NUMBER'

     EXPORTING

       matnr                          = ls_bncom-matnr

       werks                          = ls_bncom-werks

       check_batch                    = 'X'

       check_material                 = ''

       message_when_auto              = ' '

       x_bncom                        = ls_bncom

       lock_batch                     = ' '

     IMPORTING

       new_charg                      = p_ls_item_data_batch

     EXCEPTIONS

       no_material                    = 1

       no_plant                       = 2

       material_not_found             = 3

       plant_not_found                = 4

       no_batch_handling              = 5

       batch_exist                    = 6

       no_number                      = 7

       illegal_batch_number           = 8

       interval_not_found             = 9

       object_not_found               = 10

       interval_overflow              = 11

       error_automatic_batch_number   = 12

       cancelled                      = 13

       automatic_batch_num_not_active = 14

       OTHERS                         = 15.

   IF sy-subrc = 0.

     CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

       EXPORTING

         wait = 'X'.

   ENDIF.

ENDFORM.                    " CREATE_BATCH

Read only

UserV
Discoverer
0 Likes
7,275

 

This code splits the main item, but creates a new picking request for line item 90001.

How can I use this BAPI to split the batch item and update the initial picking request?

 ls_header_data-deliv_numb = gs_delivery_item-vbeln.
  ls_header_ctrl-deliv_numb = gs_delivery_item-vbeln.
  lv_delivery_number = gs_delivery_item-vbeln.

  ls_tech_ctrl-upd_ind = 'U'.

  APPEND INITIAL LINE TO lt_item_data ASSIGNING FIELD-SYMBOL(<ls_item_data>).
  IF sy-subrc = 0.
    <ls_item_data> = VALUE #( deliv_numb      = gs_delivery_item-vbeln
                              deliv_item      = gs_delivery_item-posnr
                              material        = gs_delivery_item-matnr
                              dlv_qty         = gs_delivery_item-lfimg
                              dlv_qty_imunit  = lv_quantity * ( gs_delivery_item-umrez / gs_delivery_item-umren )
                              fact_unit_nom   = gs_delivery_item-umrez
                              fact_unit_denom = gs_delivery_item-umren
                              gross_wt        = gs_delivery_item-brgew
                              net_weight      = gs_delivery_item-ntgew
                              unit_of_wt      = gs_delivery_item-gewei
                              volume          = gs_delivery_item-volum
                              volumeunit      = gs_delivery_item-voleh
                              sales_unit      = gs_delivery_item-vrkme
                               ).
  ENDIF.

  APPEND INITIAL LINE TO lt_item_ctrl ASSIGNING FIELD-SYMBOL(<ls_item_ctrl>).
  IF sy-subrc = 0.
    <ls_item_ctrl> = VALUE #( deliv_numb      = gs_delivery_item-vbeln
                              deliv_item      = gs_delivery_item-posnr
                              chg_delqty      = abap_true ).
  ENDIF.

  APPEND INITIAL LINE TO lt_item_data ASSIGNING <ls_item_data>.
  IF sy-subrc = 0.
    <ls_item_data> = VALUE #( deliv_numb      = gs_delivery_item-vbeln
                              deliv_item      = '900001'
                              material        = gs_delivery_item-matnr
                              batch           = zpp_batch_allocation_0100-charg
                              dlv_qty         = lv_quantity
                              fact_unit_nom   = gs_delivery_item-umrez
                              fact_unit_denom = gs_delivery_item-umren
                              usehieritm      = 1
                              hieraritem      = gs_delivery_item-posnr ).
  ENDIF.

  APPEND INITIAL LINE TO lt_item_ctrl ASSIGNING <ls_item_ctrl>.
  IF sy-subrc = 0.
    <ls_item_ctrl> = VALUE #( deliv_numb      = gs_delivery_item-vbeln
                              deliv_item      = '900001'
                              chg_delqty      = abap_true ).
  ENDIF.

  CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
    EXPORTING
      header_data    = ls_header_data
      header_control = ls_header_ctrl
      delivery       = lv_delivery_number
      techn_control  = ls_tech_ctrl
    TABLES
      item_data      = lt_item_data
      item_control   = lt_item_ctrl
      return         = lt_return.

  IF lt_return IS INITIAL.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        wait = abap_true.

Endif.

Read only

UserV
Discoverer
0 Likes
7,242

This code splits the main item, but creates a new picking request for line item 90001.

How can I use this BAPI to split the batch item and update the initial picking request?

  ls_header_data-deliv_numb = gs_delivery_item-vbeln.
  ls_header_ctrl-deliv_numb = gs_delivery_item-vbeln.
  lv_delivery_number = gs_delivery_item-vbeln.

  ls_tech_ctrl-upd_ind = 'U'.

  APPEND INITIAL LINE TO lt_item_data ASSIGNING FIELD-SYMBOL(<ls_item_data>).
  IF sy-subrc = 0.
    <ls_item_data> = VALUE #( deliv_numb      = gs_delivery_item-vbeln
                              deliv_item      = gs_delivery_item-posnr
                              material        = gs_delivery_item-matnr
                              dlv_qty         = gs_delivery_item-lfimg
                              dlv_qty_imunit  = lv_quantity * ( gs_delivery_item-umrez / gs_delivery_item-umren )
                              fact_unit_nom   = gs_delivery_item-umrez
                              fact_unit_denom = gs_delivery_item-umren
                              gross_wt        = gs_delivery_item-brgew
                              net_weight      = gs_delivery_item-ntgew
                              unit_of_wt      = gs_delivery_item-gewei
                              volume          = gs_delivery_item-volum
                              volumeunit      = gs_delivery_item-voleh
                              sales_unit      = gs_delivery_item-vrkme
                               ).
  ENDIF.

  APPEND INITIAL LINE TO lt_item_ctrl ASSIGNING FIELD-SYMBOL(<ls_item_ctrl>).
  IF sy-subrc = 0.
    <ls_item_ctrl> = VALUE #( deliv_numb      = gs_delivery_item-vbeln
                              deliv_item      = gs_delivery_item-posnr
                              chg_delqty      = abap_true ).
  ENDIF.

  APPEND INITIAL LINE TO lt_item_data ASSIGNING <ls_item_data>.
  IF sy-subrc = 0.
    <ls_item_data> = VALUE #( deliv_numb      = gs_delivery_item-vbeln
                              deliv_item      = '900001'
                              material        = gs_delivery_item-matnr
                              batch           = zpp_batch_allocation_0100-charg
                              dlv_qty         = lv_quantity
                              fact_unit_nom   = gs_delivery_item-umrez
                              fact_unit_denom = gs_delivery_item-umren
                              usehieritm      = 1
                              hieraritem      = gs_delivery_item-posnr ).
  ENDIF.

  APPEND INITIAL LINE TO lt_item_ctrl ASSIGNING <ls_item_ctrl>.
  IF sy-subrc = 0.
    <ls_item_ctrl> = VALUE #( deliv_numb      = gs_delivery_item-vbeln
                              deliv_item      = '900001'
                              chg_delqty      = abap_true ).
  ENDIF.

  CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
    EXPORTING
      header_data    = ls_header_data
      header_control = ls_header_ctrl
      delivery       = lv_delivery_number
      techn_control  = ls_tech_ctrl
    TABLES
      item_data      = lt_item_data
      item_control   = lt_item_ctrl
      return         = lt_return.

  IF lt_return IS INITIAL.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      EXPORTING
        wait = abap_true.

Endif.

Read only

nsikka
Active Participant
0 Likes
5,861

Hello, I am also facing the same problem - To create a batch split (Multiple) for outbound delivery item.

Did you succeed with this solution. Please, assist.

Regards,
Nitin

Read only

Sangram_Sethi
Discoverer
0 Likes
4,252

Hi All,

I'm also facing the same batch issue, please help with the solution.

bapi_outb_delivery_change.Its urgent.

Thanks,

Vasuki.R