cancel
Showing results for 
Search instead for 
Did you mean: 

Addition of text line item (Item category: TATX) to existing Delivery (VL02N) using FM

Former Member
0 Kudos

Hello All,

I have a requirement to add a new text line item (w/o SO reference) to the existing outbound delivery using BAPI/FM.

the FM that I checked are:

BAPI_DELIVERYPROCESSING_EXEC

/SPE/OUTB_DLV_CHG_ITEMS_INSERT.

The fact about these FMs are that, the FM do not return any error messages but neither do they add a new line item although using the BAPI:

BAPI_TRANSACTION_COMMIT.

can anyone help me resolving this issue?

Are there any other ways/BAPI/FM to add an item in the existing delivery?

Former Member
0 Kudos

Thank you everyone for your immense support.. but i solved it by myself creating an enhancement in the FM: BAPI_DELIVERYPROCESSING_EXEC.

Accepted Solutions (0)

Answers (3)

Answers (3)

raymond_giuseppi
Active Contributor
  • Didn't you get a single message even 'S', 'I' or 'W' in RETURN parameter?
  • How did you fill the parameters?
Former Member
0 Kudos

Didn't you get a single message even 'S', 'I' or 'W' in RETURN parameter?

No:(

How did you fill the parameters?

This one is for the BAPI:  BAPI_DELIVERYPROCESSING_EXEC
DATA: BEGIN OF it_request OCCURS 0.
 INCLUDE STRUCTURE bapideliciousrequest.
DATA: END OF it_request.

* Table to hold Line Items Created
DATA: BEGIN OF it_items OCCURS 0.
 INCLUDE STRUCTURE bapideliciouscreateditems.
DATA: END OF it_items.

* Table to hold BAPI Return Messages
DATA: BEGIN OF it_return OCCURS 0.
 INCLUDE STRUCTURE bapiret2.
DATA: END OF it_return.
DATA: delivery_extend TYPE bapideliciousdelivery.

delivery_extend-delivery_number = '0080000263'.
delivery_extend-new_delivery_allowed = 'X'.

it_request-document_numb = '0020000167'.
it_request-document_item = '00010'.
it_request-plant = 'HD02'.
it_request-stge_loc = 'FG02'.
it_request-quantity_sales_uom = '1.00'.
it_request-quantity_base__uom = '1.00'.
it_request-sales_unit = 'PC'.
it_request-base_uom = 'PC'.
it_request-material = ''.
it_request-material_shorttext = 'Text Material'.*it_request-document_type = 'L'.
it_request-document_type = 'A'.
it_request-item_category_delivery = 'TATX'.
it_request-document_type_delivery = 'ZALF'.
APPEND it_request.

CALL FUNCTION 'BAPI_DELIVERYPROCESSING_EXEC'
EXPORTING
 delivery_extend = delivery_extend
* TECHN_CONTROL =
TABLES
request = it_request
* PARTNER =
* PARTNER_ADDR =
* TEXT_HEADER =
* TEXT_LINES =
CREATEDITEMS = it_items
return = it_return
* EXTENSION1 =
* EXTENSION2 =
* CO_CHAR_VALUES =
* BATCH_ATTRIBUTES =
* BATCH_VALUES_CHAR =
* BATCH_VALUES_CURR =
* BATCH_VALUES_NUM =
* TOKENREFERENCE =
* EXTENSIONIN =
* ITEM_SERIAL_NO =
.
CHECK it_return[] IS INITIAL.
COMMIT WORK AND WAIT.

Former Member
0 Kudos

And for FM: /SPE/OUTB_DLV_CHG_ITEMS_INSERT

ls_delivery_head-vbeln = '0080000263'.
ls_delivery_head-spe_le_scenario = 'I'.
ls_delivery_head-spe_lifex_type = 'N'.

*ls_new_items-rfpos  = '00020'.
ls_new_items-matnr  = ' ' .
ls_new_items-pstyv  = 'TATX'.
ls_new_items-lfimg  = '1.00'.
ls_new_items-vrkme  = 'PC'.
ls_new_items-meins  = 'PC'.
ls_new_items-umvkz  = '1'.
ls_new_items-umvkn  = '1'.
ls_new_items-arktx  = 'Test NC'.
ls_new_items-werks  = 'HD02'.
ls_new_items-lgort  = 'FG02'.
ls_new_items-vbeln  = '0080000263'.
ls_new_items-posnr  = '00020'.
ls_new_items-meins  = 'PC'.
ls_new_items-vgtyp  = 'J'.
ls_new_items-posar  = 'B'.

APPEND ls_new_items TO lt_new_items.

is_process_steps-dlv_item_insert = 'X'.

ls_process_steps-vbeln = '0080000263'.
ls_process_steps-posnr = '00020'.
ls_process_steps-dlv_item_insert = 'X'.
APPEND ls_process_steps TO it_process_steps.

CALL FUNCTION '/SPE/OUTB_DLV_CHG_ITEMS_INSERT'
  EXPORTING
    if_commit                    = 'X'
*   IF_SYNCHRON                  = ' '
    if_no_messages_update        = ' '
*   IF_UPDATE_PICKING            = ' '
*   IF_NO_LOCK                   = ' '
*   IF_CONFIRM_CENTRAL           = ' '
    if_database_update           = '1'
*   IF_NO_REMOTE_CHG             = ' '
    if_error_messages_send       = ' '
    if_delivery_number           = '0080000100'
*   IT_PARTNER_UPDATE            =
*   IT_SERNR_UPDATE              =
    is_vbkok                     = is_vbkok
    it_process_steps             = it_process_steps
    is_process_steps             = is_process_steps
*    it_delivery_item             = it_delivery_item
*   IS_DELIVERY_HEAD             =
 TABLES
*   it_vbpok                     = it_vbpok
    it_new_items                 = lt_new_items
*   IT_NEW_ITEMS_SKU             =
*   IT_VERKO_TAB                 =
*   IT_VERPO_TAB                 =
*   IT_VBSUPCON_TAB              =
*   IT_VERPO_SERNR               =
*   IT_HANDLING_UNITS            =
*   IT_HU_HEADER_EPC             =
*   IT_HU_ITEMS_EPC              =
*   IT_AAC_ITEM_BLOCK            =
*   IT_TMSTMP                    =
*   IT_TEXTH                     =
*   IT_TEXTL                     =
   et_return                    =  lt_return
          .
CHECK lt_return[] IS INITIAL.
COMMIT WORK AND WAIT.

Jelena
Active Contributor
0 Kudos

Google -> BAPI add item to delivery -> found this old post which is almost the exact same question (adding a new item without a reference). It doesn't have a definitive answer but offers some clues.

It is very odd that return table is completely empty. Maybe there is something specific to the text type item? I'd try with a regular item just out of curiosity.

Former Member
0 Kudos

Hi Neeraja,

Please check Sample code for using BAPI 'BAPI_DELIVERYPROCESSING_EXEC'

number of messages in a bapi return table

Also check FM: BAPI_MESSAGE_GETDETAIL which returns long text also.

Former Member
0 Kudos

I referred to the similar code as per the in the link, but went vain. Is there any other way/BAPI/FM I can add an item in the existing delivery ?

Former Member
0 Kudos

Hi Neeraja,

Please check FM: WS_DELIVERY_UPDATE, WS_DELIVERY_UPDATE_2

Check the link BAPI_DELIVERYPROCESSING_EXEC

Also try using BAPI_OUTB_DELIVERY_CHANGE by filling the parameter: NEW_ITEM_DATA

Former Member
0 Kudos

Hi Neenu,

BAPI: BAPI_OUTB_DELIVERY_CHANGE will allow to only change the existing data in the Outbound Delivery. You cannot add any new items using this BAPI. For that purpose i might have to activate switch LE_SFWS_SC3 which my team didnt allow me to.

WS_DELIVERY_UPDATE / WS_DELIVERY_UPDATE_2: does not work (only changes/deletion of items are supported).