01-10-2006 2:39 PM
I am converting some BDC logic to a BAPI call. The BDC is used to PACK with Handling Units. From the limited documentation, BAPI function module BAPI_OUTB_DELIVERY_CONFIRM_DEC provides the same functionality.
I have tried and re-tried several parameters. Keep getting errors returned in the RETURN table.
The BDC only used a few fields...
LIKP-VBELN (delivery)
VEKP-EXIDV (external id of handling unit)
HUMV4-MATNR (material numbers)
HUMV4-QUANTITY (pack quantity)
HUMV4-POSNR (item number on delivery)
I am using several parameters in the BAPI, including...
HANDLING_UNIT_ITEM-DELIV_NUMB
HANDLING_UNIT_ITEM-HDL_UNIT_EXID_INTO
HANDLING_UNIT_ITEM-MATERIAL
HANDLING_UNIT_ITEM-PACK_QTY
HANDLING_UNIT_ITEM-DELIV_ITEM
I am getting error message HUGENERAL 052. The HU for INTO cannot be found. It is there. It has leading zeroes as defined in the database table.
Any ideas? Any examples?
Thanks in advance.
Norm
01-11-2006 9:40 AM
Hi Norman,
not sure if this will be any help or not - but this is what I fill when calling the same BAPI, we don't have any posting issues - maybe you could copy this filling in dummy values for the values that you dont have - then strip them out 1 by 1 until you get your error... :
CLEAR HAND_UN_HDR.
HAND_UN_HDR-DELIV_NUMB = P_DEL_NO.
HAND_UN_HDR-HDL_UNIT_EXID = I_IDOC_SU-EXIDV.
HAND_UN_HDR-HDL_UNIT_EXID_TY = 'B'.
HAND_UN_HDR-TOTAL_WGHT = I_IDOC_SU-BTGEW.
HAND_UN_HDR-LOAD_WGHT = I_IDOC_SU-NTGEW.
HAND_UN_HDR-TARE_WGHT = I_IDOC_SU-TARAG.
HAND_UN_HDR-TARE_UNIT_WT = I_IDOC_SU-GEWEI.
HAND_UN_HDR-TOTAL_VOL = I_IDOC_SU-BTVOL.
HAND_UN_HDR-VOLUMEUNIT = I_IDOC_SU-VOLEH.
HAND_UN_HDR-SHIP_MAT = C_SHIP_MAT. HAND_UN_HDR-LENGTH = I_IDOC_SU-LAENG.
HAND_UN_HDR-WIDTH = I_IDOC_SU-BREIT.
HAND_UN_HDR-HEIGHT = I_IDOC_SU-HOEHE.
HAND_UN_HDR-UNIT_DIM = I_IDOC_SU-MEABM.
HAND_UN_HDR-WT_VOL_FIX = 'X'.
APPEND HAND_UN_HDR.
CLEAR HAND_UN_ITM.
HAND_UN_ITM-HDL_UNIT_EXID = I_IDOC_SU-EXIDV.
HAND_UN_ITM-HDL_UNIT_EXID_INTO = I_IDOC_SU-EXIDV.
HAND_UN_ITM-DELIV_NUMB = P_DEL_NO.
HAND_UN_ITM-DELIV_ITEM = P_EBELP.
HAND_UN_ITM-PACK_QTY = P_LFIMG.
*hand_un_itm-material = I_IDOC_ITEMS-. not needed anyway
HAND_UN_ITM-HU_ITEM_TYPE = '1'.
APPEND HAND_UN_ITM.
and the call:
Note EXT2_TAB, BAPI_RET, HDR_CTRL, HDR_DATA, ITEM_DATA and ITEM_CONTROL are just empty tables, DELIV_NUM is specified.
We also copied the original bapi - and changed it slightly so that it does not set the decentralised flag - which prevents subsequent changes to the picking data and delivery header data - if you need to do this too - let me know by replying on this topic- and I can paste the change needed.
CALL FUNCTION 'Z_BAPI_OUTB_DELIVERY_CONFIRM_DEC'
EXPORTING
HEADER_DATA = HDR_DATA
HEADER_CONTROL = HDR_CTRL
DELIVERY = DELIV_NUM
TECHN_CONTROL =
TABLES
HEADER_DEADLINES =
ITEM_DATA = ITEM_DATA
ITEM_CONTROL = ITEM_CONTROL
SUPPLIER_CONS_DATA =
HANDLING_UNIT_HEADER = HAND_UN_HDR
HANDLING_UNIT_ITEM = HAND_UN_ITM
EXTENSION1 =
EXTENSION2 = EXT2_TAB
RETURN = BAPI_RET.
//Julian
01-11-2006 9:40 AM
Hi Norman,
not sure if this will be any help or not - but this is what I fill when calling the same BAPI, we don't have any posting issues - maybe you could copy this filling in dummy values for the values that you dont have - then strip them out 1 by 1 until you get your error... :
CLEAR HAND_UN_HDR.
HAND_UN_HDR-DELIV_NUMB = P_DEL_NO.
HAND_UN_HDR-HDL_UNIT_EXID = I_IDOC_SU-EXIDV.
HAND_UN_HDR-HDL_UNIT_EXID_TY = 'B'.
HAND_UN_HDR-TOTAL_WGHT = I_IDOC_SU-BTGEW.
HAND_UN_HDR-LOAD_WGHT = I_IDOC_SU-NTGEW.
HAND_UN_HDR-TARE_WGHT = I_IDOC_SU-TARAG.
HAND_UN_HDR-TARE_UNIT_WT = I_IDOC_SU-GEWEI.
HAND_UN_HDR-TOTAL_VOL = I_IDOC_SU-BTVOL.
HAND_UN_HDR-VOLUMEUNIT = I_IDOC_SU-VOLEH.
HAND_UN_HDR-SHIP_MAT = C_SHIP_MAT. HAND_UN_HDR-LENGTH = I_IDOC_SU-LAENG.
HAND_UN_HDR-WIDTH = I_IDOC_SU-BREIT.
HAND_UN_HDR-HEIGHT = I_IDOC_SU-HOEHE.
HAND_UN_HDR-UNIT_DIM = I_IDOC_SU-MEABM.
HAND_UN_HDR-WT_VOL_FIX = 'X'.
APPEND HAND_UN_HDR.
CLEAR HAND_UN_ITM.
HAND_UN_ITM-HDL_UNIT_EXID = I_IDOC_SU-EXIDV.
HAND_UN_ITM-HDL_UNIT_EXID_INTO = I_IDOC_SU-EXIDV.
HAND_UN_ITM-DELIV_NUMB = P_DEL_NO.
HAND_UN_ITM-DELIV_ITEM = P_EBELP.
HAND_UN_ITM-PACK_QTY = P_LFIMG.
*hand_un_itm-material = I_IDOC_ITEMS-. not needed anyway
HAND_UN_ITM-HU_ITEM_TYPE = '1'.
APPEND HAND_UN_ITM.
and the call:
Note EXT2_TAB, BAPI_RET, HDR_CTRL, HDR_DATA, ITEM_DATA and ITEM_CONTROL are just empty tables, DELIV_NUM is specified.
We also copied the original bapi - and changed it slightly so that it does not set the decentralised flag - which prevents subsequent changes to the picking data and delivery header data - if you need to do this too - let me know by replying on this topic- and I can paste the change needed.
CALL FUNCTION 'Z_BAPI_OUTB_DELIVERY_CONFIRM_DEC'
EXPORTING
HEADER_DATA = HDR_DATA
HEADER_CONTROL = HDR_CTRL
DELIVERY = DELIV_NUM
TECHN_CONTROL =
TABLES
HEADER_DEADLINES =
ITEM_DATA = ITEM_DATA
ITEM_CONTROL = ITEM_CONTROL
SUPPLIER_CONS_DATA =
HANDLING_UNIT_HEADER = HAND_UN_HDR
HANDLING_UNIT_ITEM = HAND_UN_ITM
EXTENSION1 =
EXTENSION2 = EXT2_TAB
RETURN = BAPI_RET.
//Julian
01-11-2006 2:38 PM
Thank you Julian. It is great to have a working example. There are definitely differences in your code and mine. I won't be able to try any changes until this evening, but will let you know the results.
Thanks again.
Norm
01-12-2006 2:31 PM
It didn't work. Julian, can I ask you a couple of questions?
What release are you on? I'm using a new 4.6C system with a high/recent level of support packages.
I have access to a 5.0 system and notice the code has changed greatly.
You are NOT filling out the DELIV_NUM field in HEADER_DATA or HEADER_CONTROL?
For the EXPORT fields, you only put the delivery number in the DELIVERY parameter?
When I do this, message VL 302 is received.... delivery " " does not exist.
If I fill out the DELIV_NUM field in both of the header structures, the BAPI call returns no records in the RETURN table and no process takes place.
If I fill out HEADER_DATA-DELIV_NUM, the delivery is found, but I receive message HUGENERAL 153 (There is no handling unit with identification 1234567890). The number passed is a valid HU number. I can use it interactively in VL02. When I pass the EXIDV field, it has leading zeroes.
During debugging, it looks like the HU values are placed in an internal table, and then removed before the HUGENERAL 153 message is received. Will have to dig down deeper to determine why they are deleted from the table. When a call is made to function module V51P_FIND_HEADER, internal table GT_XVEKP is empty.
01-13-2006 9:03 AM
Hi Norm,
this is implemented on a 4.6C system - so the code should be very similar / the same...
Unfortunately I'm working offsite today without access to the system where the code resides. I'm pretty sure however that the delivery number is only set in that exporting parameter - can double check this on monday. Make sure that you zero pad out the delivery number - I think that might make a difference. ie '0080000000' instead of '80000000 '.
I seem to recall having hu issues as well when I first coded this (a few years ago now) - will look into on Monday too - maybe I can find something quickly then...
01-19-2006 1:46 PM
I was able to get it working. Copied the BAPI function module, changed the call to WS_DELIVERY_UPDATE to skip the centralized system verification.
Thanks!