Skip to Content
0
Former Member
Aug 21, 2015 at 12:41 PM

BAPI returns old values

635 Views

Hi,

I'm using FM HU_PER_DOCUMENT_READ to read all handling units

from outbound delivery.

I run this FM several times in my ABAP code (without exiting from

the program) and I get wrong values - even if I modify delivery and HUs

in a separate session.

The FM returns "updated" values only after I exit the program and run the

program again.

I have noticed that this FM also returns "not updated" values when tested

in SE37. I can run it several times - but it always returns old values if

I change outbound delivery in the meantime.

It returns updated and correct values when I exit SE37 and run it again.

This is for me very strange since this FM does not modifies any object so

I think I should not use COMMIT or something like this. Instead - I think

I should clear some buffors but after several hours of searching - I still

haven't found a solution.

Here's my code. As you see I try to clear all variables, tables before

calling FM. Yet, FM returns old values.

DATA: it_objects TYPE hum_object_t. DATA: wa_objects LIKE LINE OF it_objects.

DATA: et_highest TYPE hum_venum_t. DATA: et_header TYPE hum_hu_header_t. DATA: wa_header TYPE vekpvb.

DATA: et_item TYPE hum_hu_item_t. DATA: et_history TYPE hum_history_t. DATA: et_messages TYPE huitem_messages_t.

DATA: wa_item TYPE VEPOVB.

DATA: et_item_temp TYPE hum_hu_item_t. DATA: wa_item_temp TYPE VEPOVB.

CLEAR it_objects[]. CLEAR it_objects. CLEAR wa_objects.

CLEAR et_highest. CLEAR et_header. CLEAR et_item. CLEAR et_history. CLEAR et_messages.

CLEAR et_highest[]. CLEAR et_header[]. CLEAR et_item[]. CLEAR et_history[]. CLEAR et_messages[].

wa_objects-object = '01'. wa_objects-objkey = <fs>-sd_vbeln. APPEND wa_objects TO it_objects.


CALL FUNCTION 'HU_PER_DOCUMENT_READ' EXPORTING it_objects = it_objects IMPORTING it_objects = it_objects et_highest = et_highest et_header = et_header et_item = et_item et_history = et_history et_messages = et_messages EXCEPTIONS error = 01 others = 99.

Best regards,

Kordian