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

Error while using BAPI_SHIPMENT_CHANGE?

Former Member
0 Likes
3,884

Hi all,

I am using BAPI_SHIPMENT_CHANGE to change shipment details like FwdAgent , GC / Way Bill N and Dead Line Tab from

Planning to Shiment end. I am getting following error... in BAPI Return ..

Action table and data table have different numbers of entries (HDR_DLINE ) Can anybody tel where is the problem..

And i am using following code..

* Headerdeadline
  DATA : ttype(10) VALUE 'HDRSTPLDT', "= End of planning
              utc  TYPE bapishipmentheaderdeadline-time_stamp_utc,
              zone TYPE bapishipmentheaderdeadline-time_zone.

...... and up to endof shpment

  DATA : ttype13(10) VALUE 'HDRSTSEADT',"= actual date f. end shpmnt
              utc13  TYPE bapishipmentheaderdeadline-time_stamp_utc,
              zone13 TYPE bapishipmentheaderdeadline-time_zone.
*
  WA_HEADERDATA-SHIPMENT_NUM     = ls_it_vttk-TKNUM.
  WA_HEADERDATA-SHIPMENT_TYPE       = ls_it_vttk-SHTYP.
  WA_HEADERDATA-TRANS_PLAN_PT       = ls_it_vttk-TPLST.
  WA_HEADERDATA-EXTERNAL_ID_1       = ls_it_vttk-EXTI1.
  WA_HEADERDATA-SERVICE_AGENT_ID    = ls_it_vttk-TDLNR.
  WA_HEADERDATA-STATUS_PLAN         = ls_it_vttk-STDIS.
  WA_HEADERDATA-STATUS_CHECKIN      = ls_it_vttk-STREG.
  WA_HEADERDATA-STATUS_LOAD_START   = ls_it_vttk-STLBG.
  WA_HEADERDATA-STATUS_LOAD_END     = ls_it_vttk-STLAD.
  WA_HEADERDATA-STATUS_COMPL        = ls_it_vttk-STABF.
  WA_HEADERDATA-STATUS_SHPMNT_START = ls_it_vttk-STTBG.
  WA_HEADERDATA-STATUS_SHPMNT_END   = ls_it_vttk-STTEN.

  MOVE WA_HEADERDATA TO HEADERDATA.

  WA_HEADERDATAACTION-SHIPMENT_TYPE    = 'X'.
  WA_HEADERDATAACTION-TRANS_PLAN_PT    = 'X'.
  WA_HEADERDATAACTION-SHIPPING_TYPE    = 'X'.
  WA_HEADERDATAACTION-EXTERNAL_ID_1    = 'X'.
  WA_HEADERDATAACTION-STATUS_PLAN    = 'X'.
  WA_HEADERDATAACTION-STATUS_CHECKIN    = 'X'.
  WA_HEADERDATAACTION-STATUS_LOAD_START    = 'X'.
  WA_HEADERDATAACTION-STATUS_LOAD_END    = 'X'.
  WA_HEADERDATAACTION-STATUS_COMPL    = 'X'.
  WA_HEADERDATAACTION-STATUS_SHPMNT_START    = 'X'.
  WA_HEADERDATAACTION-STATUS_SHPMNT_END    = 'X'.
  WA_HEADERDATAACTION-SERVICE_AGENT_ID    = 'X'.

  MOVE WA_HEADERDATAACTION to HEADERDATAACTION.

***** HEADERDEADLINE END OF PLANNING
  wa_headerdeadline-time_type = ttype.
  wa_headerdeadline-time_stamp_utc = utc. "ls_it_vttk-DTDIS.
  wa_headerdeadline-time_zone = zone. "ls_it_vttk-UZDIS.
  APPEND wa_headerdeadline to headerdeadline.

and upto...
***** HEADERDEADLINE PLANNED DATE OF CHECK-IN
  wa_headerdeadline-time_type = ttype13.
  wa_headerdeadline-time_stamp_utc = utc2. "ls_it_vttk-DPREG.
  wa_headerdeadline-time_zone = zone2. "ls_it_vttk-UPREG.
  APPEND wa_headerdeadline to headerdeadline.

CALL FUNCTION 'BAPI_SHIPMENT_CHANGE'
  EXPORTING
    HEADERDATA                 = HEADERDATA
    HEADERDATAACTION           = HEADERDATAACTION
  TABLES
   HEADERDEADLINE              = HEADERDEADLINE
    RETURN                     =   RETURN.

* Commit Work
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .

Thanks,

Venkat.

8 REPLIES 8
Read only

Former Member
0 Likes
2,145

Hi,

You need to fill up the table - HEADERDEADLINEACTION, accordingly. Below is the standard code which is causing this error.


*- check synchronicity of action and reference table
  DESCRIBE TABLE it_hdr_dline LINES lv_num_tab.
  DESCRIBE TABLE it_hdr_dline_action LINES lv_num_act.
  IF lv_num_tab NE lv_num_act.
    MESSAGE e200(vtbapi) WITH 'HDR_DLINE' RAISING input_inconsistent.
  ENDIF.

Regards,

Chen

Read only

0 Likes
2,145

Hi K.V.

thanks for your reply...

I tried like you suggested but still getting same error.

WA_HEADERDEADLINEACTION-TIME_TYPE = 'X'.
  WA_HEADERDEADLINEACTION-TIME_STAMP_UTC = 'X'.
  WA_HEADERDEADLINEACTION-TIME_ZONE = 'X'.
  APPEND  WA_HEADERDEADLINEACTION TO HEADERDEADLINEACTION.

CALL FUNCTION 'BAPI_SHIPMENT_CHANGE'
  EXPORTING
    HEADERDATA                 = HEADERDATA
    HEADERDATAACTION           = HEADERDATAACTION
*   TECHNCONTROL               =
  TABLES
   HEADERDEADLINE              = HEADERDEADLINE
   HEADERDEADLINEACTION        = HEADERDEADLINEACTION
    RETURN                     =   RETURN.

Thanks,

Venkat.

Read only

0 Likes
2,145

Hi Venkat,

In your OP, i see that you have two lines in the table - HEADERDEADLINE, and in your previous post you just have one line..as you can see that the standard code expects the number of lines in both the tables HEADERDEADLINE and HEADERDEADLINEACTIONto be equal.


*- check synchronicity of action and reference table
  DESCRIBE TABLE it_hdr_dline LINES lv_num_tab.    " No of lines in headerdeadline
  DESCRIBE TABLE it_hdr_dline_action LINES lv_num_act.  " No of lines in headerdeadlineaction
  IF lv_num_tab NE lv_num_act.
    MESSAGE e200(vtbapi) WITH 'HDR_DLINE' RAISING input_inconsistent.
  ENDIF.

Regards,

Chen

Read only

0 Likes
2,145

Hi chen,

Actually, in HEADERDEADLINE total 14 ttypes are there, and HEADERDEADLINEACTION is contains 3 fields and the type is

CHAR1, fields are same type is different. how can i define that many lines? I am not getting can you tell me how to do this please?

Thanks,

Venkat.

Read only

0 Likes
2,145

Hi chen,

Now i rectified that error, now bapi returns success msg. But Shipment is not updated in ecc. BAPI Executed successfully, but not updating. I am using BAPI_TRANSACTION_COMMIT after BAPI, still not updating. any more key fields i have to pass??

Pleae suggest.

Thanks,

Venkat.

Read only

0 Likes
2,145

Hi Venkat,

1) Look at the return table completely, go through the messages once see if it has any messages that might give more information?

2) Go into SM13 and see if you have any update terminations?

3) Pass an X to the wait parameter BAPI_transaction_commit and try.

Regards,

Chen

Read only

0 Likes
2,145

Hi chen,

I done what you said. There are only 4 messages, Ship start, read, end and saved.

I tried in SM13, there is no list, and i check by passing 'X' to Commit also. Still not updating Shipment. I think somewhere i missed

something.

Thanks,

Venkat

Read only

0 Likes
2,145

Hi chen,

Thanks for your support.

I solved it. I have to pass some constat 'C' to parameters. I did it

Thanks,

Venkat