Date post: | 12-Nov-2014 |
Category: |
Documents |
Upload: | martin-schlegel |
View: | 1,643 times |
Download: | 8 times |
Using BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH i
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 BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH 1
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 BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH 2
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 BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH 3
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 BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH 4
The screen with test data is shown:
We enter the delivery number in HEADER_DATA (with leading zeros):
In HEADER_CONTROL:
Using BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH 5
in DELIVERY:
Using BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH 6
We open HANDLING_UNIT_HEADER_CROSS:
We enter the delivery number:
Using BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH 7
We enter the HU number in HDL_UNIT_EXID:
and the material number of the HU:
We run the FUNCTION:
Using BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH 8
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 BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH 9
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 BAPID LVHDUNHDR.
data gs_HANDLING_UNIT_HEADER_CROSS type BAPIDLVHDUN HDR.
data RETURN type table of BAPIRET2.
parameters:
* Delivery number
p_deliv like BAPIOBDLVHDRCON-DELIV_NUMB default '00 80015271',
* External Handling Unit Identifikation
p_hunr like BAPIDLVHDUNHDR-HDL_UNIT_EXID default '6 0000000000000000000',
* Handling Unit Material Number
p_humat like BAPIDLVHDUNHDR-SHIP_MAT default '00000 0000000002387'.
Using BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH 10
* 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_contr ol
DELIVERY = p_deliv
TABLES
RETURN = return
HANDLING_UNIT_HEADER_CROSS = HANDLING_UNI T_HEADER_CROSS
.
commit work.
write: 'Fertig'.
Using BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH 11
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 BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH 12
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 BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH 13
We try to tell the system again that if_confirm_central is blank:
Using BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH 14
Using BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH 15
Setting if_confirm_central to blank doesn’t help:
Using BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH 16
After some research we find that the error comes from FUNCTION V51S_FIND_HU_HEADER_DB:
Using BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH 17
We change vekp-hu_system and vekp-vpobj in the debugger:
and we have packed our second delivery:
Using BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH 18
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 BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH 19
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 BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH 20
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 BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH 21
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 BAPI_OUTB_DELIVERY_CONFIRM_DEC Cross-HU
© 2009 BearingPoint GmbH 22
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.