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

BAPI_SHIPMENT_CHANGE

jack_thelen
Explorer
0 Likes
1,990

Hello All,

I'm trying to use BAPI_SHIPMENT_CHANGE to remove a delivery from a shipment. The RETURN structure continually returns a message saying that the Shipment could not be changed. Has anyone used this BAPI with any success? Could you help me with the data structures?

I have also tried SD_DELIVERY_ASSIGN_TO_SHIPMENT and SD_SHIPMENTS_SAVE with no proper results.

Has anyone had to programmatically remove a delivery from a shipment?

Thanks in advance.

--Jack

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,459

Hi JACK,

Get the deliveries assigned to a shipment using RV_SHIPMENT_VIEW. Then use SD_DELIVERY_ASSIGN_TO_SHIPMENT to delete or assign delieveries. Then do a save using SD_SHIPMENTS_SAVE.

There is documentation associated with SD_DELIVERY_ASSIGN_TO_SHIPMENT

Regards

Kiran Sure

5 REPLIES 5
Read only

Former Member
0 Likes
1,460

Hi JACK,

Get the deliveries assigned to a shipment using RV_SHIPMENT_VIEW. Then use SD_DELIVERY_ASSIGN_TO_SHIPMENT to delete or assign delieveries. Then do a save using SD_SHIPMENTS_SAVE.

There is documentation associated with SD_DELIVERY_ASSIGN_TO_SHIPMENT

Regards

Kiran Sure

Read only

0 Likes
1,459

Thanks for the help, that's not quite working though. Here's the code I'm using. I'm trying to remove all deliveries from the shipment, so I've left the I_DELIVERIES table blank...

* Remove delivery from shipment
  SELECT SINGLE * FROM vttk WHERE tknum = l_ntknum.

  CALL FUNCTION 'RV_SHIPMENT_VIEW'
    EXPORTING
      shipment_number                   = vttk-tknum
      LANGUAGE                          = SY-LANGU
      OPTION_ITEMS                      = 'X'
    IMPORTING
      F_VTTKVB                          = xvttk
    TABLES
      F_VTTP                            = xvttp.


  CALL FUNCTION 'SD_DELIVERY_ASSIGN_TO_SHIPMENT'
    EXPORTING
      i_tknum                      = vttk-tknum
    TABLES
      c_xvttp                      = xvttp
      c_yvttp                      = yvttp
      c_xvtsp                      = xvtsp
      c_yvtsp                      = yvtsp
      i_deliveries                 = deliveries
      i_xtrlk                      = xtrlk
      i_xtrlp                      = xtrlp
      i_xvtts                      = xvtts
    CHANGING
      c_xvttk                      = xvttk.

  APPEND xvttk to xvttk_t.

  CALL FUNCTION 'SD_SHIPMENTS_SAVE'
    EXPORTING
      i_transaktionstyp            = 'V'
    TABLES
      i_xvttk                      = xvttk_t
      i_yvttk                      = yvttk_t
      i_xvttp                      = xvttp
      i_yvttp                      = yvttp.

See anything wrong? It's having no effect on the shipment at all.

Thanks again.

--Jack

Read only

0 Likes
1,459

Hi Jack,

The only thing missing is COMMIT WORK after all those FMs

Read only

Former Member
0 Likes
1,459

Hi Jack,

make sure that xvttk has update flag UPDKZ = 'U':

...

xvttk-updkz = 'U'.

APPEND xvttk TO xvttk_t.

...

Regards

Christian

Read only

0 Likes
1,459

Hi All!

I´m trying to do the same, unassign deliveries from the shipment using this functions but it does not have any effect on the shipment.

I copied the same code as above, also updkz = 'U' but it does not works...

Can anyone help me?

Thanks!