Application Development 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: 

How to use BAPI_OUTB_DELIVERY_CHANGE for updating HEADER_DEADLINES parameters(Changing Dates)?

Former Member
0 Kudos

Hello experts, I am new to ABAP and very new to using BAPIs and need your help. Please pardon me if the solution for this is very simple and I am making silly mistakes.

I am facing this issue for updating the values for the fields WADAT, KODAT, LDDAT AND TDDAT in LIKP table.

I have written the below code just to fill one field i.e. WADAT with some sample values.

DATA: it_header_data  TYPE TABLE OF bapiobdlvhdrchg,
      wa_header_data TYPE bapiobdlvhdrchg.
DATA: it_header_control  TYPE TABLE OF  bapiobdlvhdrctrlchg,
      wa_header_control TYPE bapiobdlvhdrctrlchg.
DATA: it_return  TYPE TABLE OF  bapiret2,    
DATA: it_header_deadlines  TYPE TABLE OF  bapidlvdeadln,
      wa_header_deadlines TYPE bapidlvdeadln.

DATA: l_delivery TYPE vbeln_vl.
wa_header_data-deliv_numb = '0180190163'.
APPEND wa_header_data TO it_header_data.


wa_header_control-deliv_numb = '0180190163'.
wa_header_control-gdsi_date_flg = 'X'.

wa_header_deadlines-deliv_numb = '0180190163'.
wa_header_deadlines-timetype = 'WSHDRWADAT'.
wa_header_deadlines-timestamp_utc = '20180308'.

APPEND wa_header_deadlines TO it_header_deadlines.
l_delivery = '0180190163'.

CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
  EXPORTING
    header_data         = wa_header_data
    header_control      = wa_header_control
    delivery            = l_delivery
  TABLES
    header_deadlines    = it_header_deadlines
    return              = it_return.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

After running this code, the table does not get updated for the given field and the biggest issue is the the table 'it_return' is not getting filled with any error messages.

I think I am doing some mistakes to populate the fields TIMETYPE and TIMESTAMP_UTC.

I have read the documentation for this BAPI but did not get much.

Please let me know if I need to add values for more parameters. A code sample using parameter HEADER_DEADLINES would be appreciated.

Please ignore the fact that the code contains some internal tables and work areas which are not used.

Also, please let me know if there is any better way to update the fields WADAT, KODAT, LDDAT AND TDDAT in LIKP table. I am aware of the fact that we should avoid using MODIFY or INSERT statements for standard tables.

3 REPLIES 3

SimoneMilesi
Active Contributor

Hi Anand,

you are doing it right filling the HEADER_DEADLINES table.

A bit of explain on the logic, if you didn't already debug the BAPI.

Filling more records with the right TIMETYPE in HEADER_DEADLINES table allows you to update those dates.

In fact, the BAPI calls FORM SPAN VBKOK_OBDLV_FILL in include LV50IF04 and processes that table to update CS_VBKOK structures and flags according to the TIMETYPE (if you need the correct one to use, just go in the form and double click the constants).

At the end, the BAPI calls FM WS_DELIVERY_UPDATE which calls WS_DELIVERY_UPDATE_2.

This FM calls FORM DELIVERY_UPDATE_HEADER in include LV50LF01 where the previous filled flags and fields are checked

So, basically, you are on the right path and you just need to add more records on HEADER_DEADLINES table to tell the BAPI the correct fieldss/flag to update.

0 Kudos

Thank you for your reply Simone, really appreciated. But I need to change only one record in the table LIKP.

0 Kudos

The table has the delivery number as key!

You didn't debug the code it seems..

Multiple records with the same delivery number means updating the SAME record (1 in your case) about MULTIPLE FIELDS