Application Development 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: 

Change header data of Handling Unit (VEKP)

former_member189059
Active Contributor
0 Kudos

Hello,

I have a requirement to change the BRGEW, NTGEW, TARAG and GEWEI fields of a Handling Unit (Table VEKP).

I found the BAPI, BAPI_HU_CHANGE_HEADER, but I need to change the HUs of VBOBJ = '01' (Outbound Deliveries)

The above BAPI puts a check and allows VPOBJ to be only 05, 06 or 12.

I tried calling the function module HU_HEADER_UPDATE.

This too returns an error (Handling unit to be changed could not be found)

Internally it calls V51P_FIND_HEADER which returns sy-subrc as 1 (Header not found) even though I can see the record in SE11.

Does anyone know how I can change the above header using this function module or any other?

1 ACCEPTED SOLUTION

kesavadas_thekkillath
Active Contributor
0 Kudos

I think the order of execution is like

BAPI_HU_CREATE

BAPI_HU_CHANGE_HEADER

Then commit work.

Refer link:[http://sap.ittoolbox.com/groups/technical-functional/sap-dev/create-and-assign-handling-unit-to-an-outbound-delivery-1520075]

20 REPLIES 20

kesavadas_thekkillath
Active Contributor
0 Kudos

I think the order of execution is like

BAPI_HU_CREATE

BAPI_HU_CHANGE_HEADER

Then commit work.

Refer link:[http://sap.ittoolbox.com/groups/technical-functional/sap-dev/create-and-assign-handling-unit-to-an-outbound-delivery-1520075]

0 Kudos

Hello Keshav,

I already have the HU, and hence would not be creating it.

As I mentioned earlier, the FM BAPI_HU_CHANGE_HEADER has the following code in it

if not ( ls_header-vpobj = '12'  or  ls_header-vpobj = '05'
     or  ls_header-vpobj = '06' ).
*   Liefer- und Transporthus werden nicht gesperrt...
    RETURN-TYPE = 'E'.
    RETURN-ID = 'HUFUNCTIONS'.
    RETURN-NUMBER = '261'.
    APPEND RETURN.
    EXIT.
  endif.

for an outbound delivery, VPOBJ is 01 and hence the BAPI exits

0 Kudos

If already Created HU why we have to create again..

The Best Solution is follow the below pice of code and 3 Fm will work to update the VEKP-INHALT

if any other fields also to update..

DATA: et_messages TYPE huitem_messages_t.
DATA : is_flags TYPE v51p_select_flags.
DATA:lt_hut TYPE hum_exidv_t,
ls_hut LIKE LINE OF lt_hut.
ls_hut-exidv = Your Handling Unit Number.
APPEND ls_hut TO lt_hut.
CALL FUNCTION 'V51P_FILL_GT'
EXPORTING
if_langu = sy-langu
it_hus = lt_hut
IMPORTING
et_messages = et_messages
EXCEPTIONS
hu_locked = 1
no_hu_found = 2
fatal_error = 3
OTHERS = 4.
IF sy-subrc = 0.
BREAK-POINT.
DATA: it_new_values TYPE hum_update_header_t,
wa_new_values LIKE LINE OF it_new_values.
wa_new_values-hdl_unit_exid = ls_hut-exidv .

wa_new_values-field_name = 'INHALT'.

wa_new_values-field_value = 'NEW Values to Pupulate'.

APPEND wa_new_values TO it_new_values.

CALL FUNCTION 'HU_HEADER_UPDATE'
EXPORTING
it_new_values = it_new_values
IMPORTING
et_messages = et_messages
EXCEPTIONS
not_possible = 1
OTHERS = 2.

CALL FUNCTION 'HU_PACKING_UPDATE'
EXPORTING
if_synchron = 'X'.

former_member189059
Active Contributor
0 Kudos

Managed to solve it with the help of my colleague.

The following functions were called

1. V51P_FILL_GT (this fills itab GT_XVEKP)

2. HU_HEADER_UPDATE (does the validations and populates the vekp itab)

3. HU_PACKING_UPDATE (updates the DB with the above vekp itab)

0 Kudos

Hi Kris,

I want to update/change VEKP table field(VHILM_KU) field.

I tried using 1. HU_HEADER_UPDATE(internally calls 2 FM)

2. V51_HU_HEADER_UPDATE (internally calls 3FM)

3. V51P_XVEKP_YVEKP_UPDATE

I got error as below comments

EXIDV

POSNR 000000

HU_ITEM

ZEILE 0

MSGID HUFUNCTIONS

MSGTY E

MSGNO 101

I passed Handling Unit internal no, Handling unit, Field name, Field value to be changed.

As you mentioned that below process will update the VEKP table

1. V51P_FILL_GT (this fills itab GT_XVEKP)

2. HU_HEADER_UPDATE (does the validations and populates the vekp itab)

3. HU_PACKING_UPDATE (updates the DB with the above vekp itab)

what parameters do I have to pass for FM - V51P_FILL_GT ?

If possible can you please provide me some example?

Regards,

Krishna

0 Kudos

How are the 3 function modules related?

1. V51P_FILL_GT (this fills itab GT_XVEKP)

2. HU_HEADER_UPDATE (does the validations and populates the vekp itab)

3. HU_PACKING_UPDATE (updates the DB with the above vekp itab)

what is the relation between 1st and 2nd FM?

Regards,

Krishna

0 Kudos

Hi Chris

Your colleague's solution helped, but next time please be so kind as to post your code. Thank you, Adrian

  • 1.

DATA LS_FLAGS TYPE V51P_SELECT_FLAGS.

DATA LT_HUS TYPE HUM_EXIDV_T.

DATA LS_HU LIKE LINE OF LT_HUS.

DATA LT_OBJECTS TYPE HUM_OBJECT_T.

DATA LS_OBJECT LIKE LINE OF LT_OBJECTS.

DATA LF_RCODE TYPE SYSUBRC.

DATA LT_HEADER TYPE TABLE OF VEKPVB.

DATA LT_ITEMS TYPE TABLE OF VEPOVB.

DATA LT_HISTORY TYPE TABLE OF VEVWVB.

DATA LT_HIGH TYPE HUM_VENUM_T.

DATA ET_MESSAGES TYPE HUITEM_MESSAGES_T.

LS_HU-EXIDV = LS_VEKP-EXIDV.

APPEND LS_HU TO LT_HUS.

LS_FLAGS-NO_DB_SELECT = ' '.

LS_FLAGS-LOCK_HU = 'X'.

LS_FLAGS-ADD_AND_EXP = 'X'.

APPEND LS_OBJECT TO LT_OBJECTS.

CALL FUNCTION 'V51P_FILL_GT'

EXPORTING

IS_FLAGS = LS_FLAGS

IT_HUS = LT_HUS

IMPORTING

EF_RCODE = LF_RCODE

ET_VEKP = LT_HEADER

ET_VEPO = LT_ITEMS

ET_VEVW = LT_HISTORY

ET_HIGHEST_LEVEL = LT_HIGH

ET_MESSAGES = ET_MESSAGES

EXCEPTIONS

HU_LOCKED = 01

NO_HU_FOUND = 02

OTHERS = 99.

  • 2.

DATA LT_NEW_VALUES TYPE HUM_UPDATE_HEADER_T.

DATA LS_NEW_VALUES LIKE LINE OF LT_NEW_VALUES.

DATA LT_MESSAGES TYPE HUITEM_MESSAGES_T.

LS_NEW_VALUES-HDL_UNIT_ITID = LS_VEKP-VENUM. " Internal Handling Unit Number

LS_NEW_VALUES-HDL_UNIT_EXID = LS_VEKP-EXIDV. " External Handling Unit Identification

LS_NEW_VALUES-FIELD_NAME = 'EXIDV2'. " Field name of changed field

LS_NEW_VALUES-FIELD_VALUE = LS_VEKP-EXIDV2. " Value of field to be changed

APPEND LS_NEW_VALUES TO LT_NEW_VALUES.

CALL FUNCTION 'HU_HEADER_UPDATE'

EXPORTING

IT_NEW_VALUES = LT_NEW_VALUES

IMPORTING

ET_MESSAGES = LT_MESSAGES

EXCEPTIONS

NOT_POSSIBLE = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

ENDIF.

  • 3.

CALL FUNCTION 'HU_PACKING_UPDATE'

EXPORTING

IF_SYNCHRON = 'X'.

*

0 Kudos

Hi Ramakrishna and ronald,

I am generating HUs using BAPI_HU_CREATE it is creating HUs fine, values are updated in VEKP and VEPO Table. In VEKP(Header ) Table two fields are there VPOBJ and VPOBJKEY. By deafult after using this BAPI VPOBj - 12(Non-Assigned Handling Unit) and VPOBJKEY is some value (0000001724). After this i am using WS_DELIVERY_UPDATE_1 but delivery is not updating.

So after BAPI_HU_CREATE i used another bapi BAPI_HU_CHANGE_HEADER and i change values of VPOBJ-03 and VPOBJKEY(delivery no). Now WS_DELIVERY_UPDATE_1 is working and delivery is updating successfully.

Now here the problem is in VEPO four records are there with old VPOBJ and VPOBJKEY and new values.I dont want to create first two records, how can i rectify this... Please help me.

I tried before change hu header i used V51P_FILL_GT and tried but no use. Atleast tell me anyone how to delete first 2 records from VEPO Table. Is there any FM is there to update VEPO Table.

Thanks,

Venkat.

kesavadas_thekkillath
Active Contributor
0 Kudos

check V51P_XVEKP_YVEKP_UPDATE, But not sure about the integrity of data.

with if_dont_fix = 'X' , UPDKZ = 'X'

0 Kudos

Hi Kesav,

For FM-HU_HEADER_UPDATE, Input parameter is a table type HUM_UPDATE_HEADER_T

Fields are

VENUM (internal handling unit no)

EXIDV(Handling unit)

CHANGED_F (Field name of which value needs to be changed)

HU_F_VALUE(Field Value)

For FM-V51P_XVEKP_YVEKP_UPDATE, I tried options

IF_DONT_FIX X,space

IF_UPDKZ X,U

Got error message as The table entry to be changed does not exist

Exception NOT_FOUND

Message ID: HUGENERAL

Message number: 111

If possible please provide me an example, how to pass parameters to this FM-V51P_XVEKP_YVEKP_UPDATE ?

Thanks in advance,

Krishna

0 Kudos

Internally it calls V51P_FIND_HEADER which returns sy-subrc as 1 (Header not found) even though I can see the record in SE11.

Can you check why the exception is thrown( for what reason), may be a way to a possible solution

what parameters do I have to pass for FM - V51P_FILL_GT ?

Please check the where used list of this fm, you will get idea.

Edited by: Keshav.T on Jan 29, 2010 12:01 AM

0 Kudos

Keshav,

My requirement is to update VEKP table field (VHILM_KU). I have HU as input.

1.Used FM - V51P_FILL_GT and passed HU as input and got output ET_VEKP,ET_VEPO,ET_VEVW.

2.Used FM - V51F_HU_HEADER_UPDATE and passed Inputs -

IF_WITH_UPDATE = 'U',

IS_HEADER = IS_HEADER

IT_CHANGED_FIELDS = T_ITAB

IT_OVEKP = gt_ovekp (move corresponding fields from 1st FM o/p ET_VEKP to gt_ovekp).

Got error - Sy-subrc = 6 fatal error

What ever function module is used,internally it is checking READ TABLE gt_xvekp. and this table is empty and not sure how this table will be filled. You can find this in V51P_FIND_HEADER "READ TABLE gt_xvekp INTO es_header WITH KEY venum = is_vekp-venum" Line no: 21 or 27.

Regards,

Krishna

Edited by: Ramakrishna Koliparthi on Jan 28, 2010 9:37 AM

0 Kudos

In the function module V51P_FILL_GT, in Line 440, the itab gt_xvekp gets populated.

Check if it reaches there in your scenario.

0 Kudos

Also, I didnt import the table ET_VEKP when I called the FM

0 Kudos

Got it. I resolved my self.

Thanks,

Krishna

Edited by: Ramakrishna Koliparthi on Jan 30, 2010 5:37 PM

0 Kudos

Hi Krishna,

How did you resolve it? I'm also trying to update/change the HU Total Weight and Loading Weight. I'm trying to use FM V51P_XVEKP_YVEKP_UPDATE but I'm getting this error: "The table entry to be changed does not exist".

This is my code:

t_vekpvb-exidv = w_dlvry-exidv.

t_vekpvb-ntgew = w_dlvry-net_wt.

t_vekpvb-brgew = w_dlvry-gross_wt.

CALL FUNCTION 'V51P_XVEKP_YVEKP_UPDATE'

EXPORTING

  • IF_DONT_FIX =

IF_UPDKZ = 'X'

IS_VEKP = t_vekpvb.

  • EXCEPTIONS

  • NOT_FOUND = 1

  • ERROR = 2

  • OTHERS = 3

What FM did you use? What are the correct import parameters to use in said FM?

Thanks in advance.

Jasz

0 Kudos

Jasz,

As mentioned earlier, call the following 3 FMs in sequence

1. V51P_FILL_GT (this fills itab GT_XVEKP)

2. HU_HEADER_UPDATE (does the validations and populates the vekp itab)

3. HU_PACKING_UPDATE (updates the DB with the above vekp itab)

While calling V51P_FILL_GT, do NOT import the table ET_VEKP

This will cause the global table gt_xvekp to be populated instead.

0 Kudos

Hello Rama Krishna,

Can you give me solution how you solved,

I need to updated the field values in VEKP table.

Please share your solution.

thanks,

Suresh

0 Kudos

here is how I did it.

important detail: for group fields (VEGR1 to VEGR5), the data you want to update for any of those group fields (in our example below its VEGR1 and value is '00001'.) should exist in table TVE1, (as ABAPer, I didnt know that) if it doesnt exist you keep getting no found return message.

  wa_venum-venum = int_id.
     append wa_venum to i_venum.
     CALL FUNCTION 'V51P_FILL_GT'
       EXPORTING
         IT_VENUM    = i_venum
       IMPORTING
         ET_MESSAGES = return
       EXCEPTIONS
         HU_LOCKED   = 1
         NO_HU_FOUND = 2
         FATAL_ERROR = 3
         OTHERS      = 4.

     wa_newvalues-HDL_UNIT_ITID = int_id.
     wa_newvalues-HDL_UNIT_EXID = hu_exid.
     wa_newvalues-FIELD_NAME = 'VEGR1'.
     wa_newvalues-FIELD_VALUE = '00001'.
     append wa_newvalues to i_newvalues.

     CALL FUNCTION 'HU_HEADER_UPDATE'
       EXPORTING
         IT_NEW_VALUES = i_newvalues
       IMPORTING
         ET_MESSAGES   = return
       EXCEPTIONS
         NOT_POSSIBLE  = 1
         OTHERS        = 2.
     IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
     ENDIF.
     CALL FUNCTION 'HU_PACKING_UPDATE'
      EXPORTING
        IF_SYNCHRON         = 'X'.

Former Member
0 Kudos

This message was moderated.