Using-Bapi Outb Delivery Confirm Dec-Cross-Hu

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

2009-01

Using BAPI_OUTB_DELIVERY_CONFIRM_DEC
for packing several deliveries
into one HU

Submitted By:

Martin Schlegel
BearingPoint
Oberbaumbrücke 1
20457 Hamburg, Germany

http://www.bearingpoint.de/

Using © 2009 BearingPoint GmbH i


BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU
Table of Contents
1. Introduction ............................................................................................................. 2
1.1 Requirement .................................................................................................................2
1.2 Possible solution ............................................................................................................2
1.3 Objective of this paper ...................................................................................................2
2. Prepare: Create deliveries ........................................................................................ 3
3. Put data into BAPI_OUTB_DELIVERY_CONFIRM_DEC .............................................. 3
3.1 Testrun with delivery one ...............................................................................................3
3.2 Program a program........................................................................................................9
3.3 Pack second delivery .................................................................................................... 11
4. Check table VEKP ................................................................................................... 18
5. Search for vekp-vpobj ............................................................................................ 18
5.1 Search for vekp-vpobj in BAPI_OUTB_DELIVERY_CONFIRM_DEC ....................................... 18
5.2 Search for vekp-vpobj in FUNCTION V51S_FIND_HU_HEADER_DB..................................... 19
6. Cross-HU Check ...................................................................................................... 21
7. Result..................................................................................................................... 22

Using © 2009 BearingPoint GmbH 1


BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU
1. Introduction

1.1 Requirement
In SAP, normally one would use the shipment (transaction VT01, German: “Transport”) in order to put
several deliveries into one Handling Unit (“HU”). In our case, the user wants to put several deliveries
into one HU without transport. And he wants to this in any warehouse or storage location.

That leads us to the following requirement:

Put several deliveries into one Handling Unit (HU) without using shipment.

1.2 Possible solution


We know that it is possible to put several deliveries into one HU in the Extended Warehouse
Management (“EWM”) from SAP. EWM reports this back to SAP ERP using
BAPI_OUTB_DELIVERY_CONFIRM_DEC. Maybe we could use this FUNCTION to fulfill the requirement.
So we will try to put several deliveries into one Handling Unit (HU) using
BAPI_OUTB_DELIVERY_CONFIRM_DEC.

1.3 Objective of this paper


This paper has two objectives:
• Explore the possibilities of packing with the help of BAPI_OUTB_DELIVERY_CONFIRM_DEC
• Demonstrate the way how the author would handle this task

Using © 2009 BearingPoint GmbH 2


BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU
2. Prepare: Create deliveries
We create two different deliveries for different customers:

3. Put data into BAPI_OUTB_DELIVERY_CONFIRM_DEC

3.1 Testrun with delivery one


At first and most simple attempt, we start the FUNCTION BAPI_OUTB_DELIVERY_CONFIRM_DEC in
test mode:

Using © 2009 BearingPoint GmbH 3


BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU
The screen with test data is shown:

We enter the delivery number in HEADER_DATA (with leading zeros):

In HEADER_CONTROL:

Using © 2009 BearingPoint GmbH 4


BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU
in DELIVERY:

Using © 2009 BearingPoint GmbH 5


BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU
We open HANDLING_UNIT_HEADER_CROSS:

We enter the delivery number:

Using © 2009 BearingPoint GmbH 6


BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU
We enter the HU number in HDL_UNIT_EXID:

and the material number of the HU:

We run the FUNCTION:

Using © 2009 BearingPoint GmbH 7


BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU
From some reading in SDN, we think that maybe we have to set if_confirm_central to space when the
FUNCTION “WS_DELIVERY_UPDATE_2” is called. We do so in the debugger:

Using © 2009 BearingPoint GmbH 8


BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU
In RETURN, we get no error.

But the delivery has no HU. Probably we have to send a COMMIT WORK.

3.2 Program a program


So we do some programming:

*&---------------------------------------------------------------------*

*& Report ZZ_BAPI_OUTB_DELIVERY_CONF_DEC


*&---------------------------------------------------------------------*

REPORT ZZ_BAPI_OUTB_DELIVERY_CONF_DEC.

data HEADER_DATA like BAPIOBDLVHDRCON.


data HEADER_CONTROL like BAPIOBDLVHDRCTRLCON.

data DELIVERY like BAPIOBDLVHDRCON-DELIV_NUMB.


data HANDLING_UNIT_HEADER_CROSS type table of BAPIDLVHDUNHDR.
data gs_HANDLING_UNIT_HEADER_CROSS type BAPIDLVHDUNHDR.
data RETURN type table of BAPIRET2.

parameters:
* Delivery number
p_deliv like BAPIOBDLVHDRCON-DELIV_NUMB default '0080015271',

* External Handling Unit Identifikation


p_hunr like BAPIDLVHDUNHDR-HDL_UNIT_EXID default '60000000000000000000',
* Handling Unit Material Number
p_humat like BAPIDLVHDUNHDR-SHIP_MAT default '000000000000002387'.

Using © 2009 BearingPoint GmbH 9


BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU
* Work on clean data. Allways.
clear:

header_data,
header_control,
delivery,
gs_HANDLING_UNIT_HEADER_CROSS.

refresh:
HANDLING_UNIT_HEADER_CROSS.

* set data values

header_data-DELIV_NUMB = p_deliv.
header_control-DELIV_NUMB = p_deliv.

delivery = p_deliv.

gs_HANDLING_UNIT_HEADER_CROSS-DELIV_NUMB = p_deliv.
gs_HANDLING_UNIT_HEADER_CROSS-HDL_UNIT_EXID = p_hunr.

gs_HANDLING_UNIT_HEADER_CROSS-SHIP_MAT = p_humat.
append

gs_HANDLING_UNIT_HEADER_CROSS
to

HANDLING_UNIT_HEADER_CROSS.

* Call Function

CALL FUNCTION 'BAPI_OUTB_DELIVERY_CONFIRM_DEC'


EXPORTING
HEADER_DATA = header_data
HEADER_CONTROL = header_control

DELIVERY = p_deliv
TABLES
RETURN = return

HANDLING_UNIT_HEADER_CROSS = HANDLING_UNIT_HEADER_CROSS
.
commit work.

write: 'Fertig'.

Using © 2009 BearingPoint GmbH 10


BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU
We run the program:

And our first delivery is packed:

3.3 Pack second delivery


Try to put the second delivery into the same HU:

Using © 2009 BearingPoint GmbH 11


BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU
We get a return message. We check the message in our little program using the debugger:

The message tells us that the HU already exists:

Using © 2009 BearingPoint GmbH 12


BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU
We try to tell the system again that if_confirm_central is blank:

Using © 2009 BearingPoint GmbH 13


BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU
Using © 2009 BearingPoint GmbH 14
BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU
Setting if_confirm_central to blank doesn’t help:

Using © 2009 BearingPoint GmbH 15


BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU
After some research we find that the error comes from FUNCTION V51S_FIND_HU_HEADER_DB:

Using © 2009 BearingPoint GmbH 16


BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU
We change vekp-hu_system and vekp-vpobj in the debugger:

and we have packed our second delivery:

Using © 2009 BearingPoint GmbH 17


BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU
4. Check table VEKP
When we check table VEKP, we find two HUs with the same external number:

This is not what we wanted.

5. Search for vekp-vpobj


From what we have seen so far, we think that we need to set vekp-vpobj to “21” or “23” somewhere.

5.1 Search for vekp-vpobj in BAPI_OUTB_DELIVERY_CONFIRM_DEC


At first, we look for vekp-vpobj in BAPI_OUTB_DELIVERY_CONFIRM_DEC:

Using © 2009 BearingPoint GmbH 18


BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU
Not found:

5.2 Search for vekp-vpobj in FUNCTION V51S_FIND_HU_HEADER_DB


Second, we want look for vekp-vpobj in FUNCTION V51S_FIND_HU_HEADER_DB. We go to the main
program:

Before we start the search, something hits our curiosity: The letters “XHU” in the statement “INCLUDE
/SPE/XHU_LV51SF01.”:

Using © 2009 BearingPoint GmbH 19


BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU
We double-click the include to see what is inside:

In the comment, we read:


* Call control framework to check if warehouse is a EWM
* -> Only in this case X-HUs are allowed

It seems like we can stop searching for vkep-vpobj. Let us check if this form is called from our
BAPI_OUTB_DELIVERY_CONFIRM_DEC.

Using © 2009 BearingPoint GmbH 20


BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU
6. Cross-HU Check
In order to find out if Form x_hu_allowed_check is also called from
BAPI_OUTB_DELIVERY_CONFIRM_DEC, we set a breakpoint in the form and run our little program
again. The check is executed:

Form: x_hu_active_check
Include: /SPE/XHU_LV51SF01
This FORM is called when we execute our program.

Using © 2009 BearingPoint GmbH 21


BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU
7. Result
In the form: x_hu_active_check it is checked if the warehouse where the Cross-HU comes from an
EWM system:

In SAP standard, several deliveries can only be packed into on HU if EWM is used.

Without EWM, several deliveries can only be packed into one HU using shipments (Transaction VT01)
in SAP standard.

Using © 2009 BearingPoint GmbH 22


BAPI_OUTB_DELIVERY_CONFIRM_DEC
Cross-HU

You might also like