ABAP Forum
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Using WS_DELIVERY_UPDATE_2 in a Loop

rmn1
Explorer
0 Likes
539

Hi All,

I've stumbled upon a strange behaviour when calling WS_DELIVERY_UPDATE_2 in a loop.
Given 2 valid vbeln, when being executed individually both gave success response and VL33N showed an intended result.
But when using it in a loop, somehow the 2nd document gave error message instead, which consists of HU of the 1st document, even though no HU is provided in the parameter. Any ideas on successfully solving this?

Existing pseudocode looks like:

LOOP AT lt_payload_grouped INTO ls_payload_grouped.
"Some assignment logic here...
  CALL FUNCTION 'WS_DELIVERY_UPDATE_2'
      EXPORTING
        vbkok_wa               = lw_fm_head
        commit                 = 'X'
        synchron               = 'X'
        delivery               = lv_fm_delivery
        if_database_update_1   = '1'
        if_error_messages_send = ''
      TABLES
        vbpok_tab              = lt_fm_item
        prot                   = lt_fm_prott
      EXCEPTIONS
        error_message          = 4
        OTHERS                 = 99.
    READ TABLE lt_fm_prott WITH KEY msgty = 'E' TRANSPORTING NO FIELDS.
    IF sy-subrc = 0.
      CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
    ELSE.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
    ENDIF.
ENDLOOP.


Thanks,
Rahman.

1 ACCEPTED SOLUTION
Read only

0 Likes
341

Incase you are still planning to use same Fm, make sure you refresh the buffer by using 

CALL FUNCTION 'LE_DELIVERY_REFRESH_BUFFER'

View solution in original post

Incase you are still planning to use same Fm, make sure you refresh the buffer by using 

CALL FUNCTION 'LE_DELIVERY_REFRESH_BUFFER'

2 REPLIES 2
Read only

VXLozano
Active Contributor
0 Likes
502

That FM is not released for public use. It's unwise to use it if you have any other alternative.

Did you checked BAPI_*_DELIVERY_CHANGE? (* for INB or OUTB)

Read only

0 Likes
342

Incase you are still planning to use same Fm, make sure you refresh the buffer by using 

CALL FUNCTION 'LE_DELIVERY_REFRESH_BUFFER'