Application Development and Automation 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: 
Read only

BAPI_MATPHYSINV_COUNT and fields WSTI_COUNTDATE, WSTI_COUNTTIME

Former Member
0 Likes
1,422

Hi All,

I am using in a Report BAPI_MATPHYSINV_COUNT for Retail.

After calling this BAPI the fields WSTI_COUNTDATE and WSTI_COUNTTIME are not filled(space) in the table ISEG.

The other fields are okay.

But when I use the transaction MI04 all fields are filled.

Can anybody help me and tell me what I must do?

Thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
716

Hi Vedat,

After the BAPI have you included

CALL FUNCTION BAPI_TRANSACTION_COMMIT.

or

pass 'zero count' if material wasn't counted

OR check the below link

Edited by: Raj on [BAPI_MATPHYSINV_COUNT|http://sapass.metro.client.jp/Bapi/BUS2028.htm]

Edited by: Raj on May 22, 2008 4:21 AM

2 REPLIES 2
Read only

Former Member
0 Likes
717

Hi Vedat,

After the BAPI have you included

CALL FUNCTION BAPI_TRANSACTION_COMMIT.

or

pass 'zero count' if material wasn't counted

OR check the below link

Edited by: Raj on [BAPI_MATPHYSINV_COUNT|http://sapass.metro.client.jp/Bapi/BUS2028.htm]

Edited by: Raj on May 22, 2008 4:21 AM

Read only

Former Member
0 Likes
716

Hi Raj,

CALL FUNCTION BAPI_TRANSACTION_COMMIT is included.

When I call the BAPI the items are booked correctly but WSTI_COUNTDATE and WSTI_COUNTTIME are not filled.

I tried first this:

CALL FUNCTION 'BAPI_MATPHYSINV_COUNT'

EXPORTING

physinventory = lv_iblnr

fiscalyear = p_gjahr

count_date = p_datum

TABLES

items = lt_items

return = lt_bapiret2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO ls_bapiret2-message.

WRITE / ls_bapiret2-message.

RETURN.

ENDIF.

LOOP AT lt_bapiret2 WHERE type = 'E' OR type = 'A'.

MOVE-CORRESPONDING lt_bapiret2 TO ls_bapiret2.

WRITE / ls_bapiret2-message.

EXIT.

ENDLOOP.

CHECK ls_bapiret2 IS INITIAL.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'

IMPORTING

return = ls_bapiret2.

IF ls_bapiret2 IS NOT INITIAL.

CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'

IMPORTING

return = ls_bapiret2.

ENDIF.

Correctly booked without WSTI_COUNTDATE and WSTI_COUNTTIME .

I already debugged and found this different between MI04 and BAPI_MATPHYSINV_COUNT:

Both call the same BADI ES_MB_PHYSINV_COUNT_TST -> method GET_TIMESTAMPS-> lm_fill_count_timestamps

In method LM_FILL_COUNT_TIMESTAMPS at line 35 is the problem. When I call with MI04 l_lines is 0 and with BAPI is l_lines 1 (when I try with 1 position)

  • read buffer with timestamps

call function 'WSTI_GET_COUNT_DATETIME'

importing

et_iseg = lt_iseg

e_ignore_wsti_time_select = l_ignore_wsti_time_select.

describe table lt_iseg lines l_lines.

if l_lines = 0.

  • get system time information

get time.

  • there are no timestamps given: set sy- fields per default

l_countdate = sy-datlo.

l_counttime = sy-timlo.

loop at xt_iseg_new assigning <xt_iseg_new>

where xzael = true.

  • read corresponding entry in old iseg

read table it_iseg_old assigning <it_iseg_old>

index sy-tabix.

if sy-subrc is initial.

if <it_iseg_old>-xzael = false.

<xt_iseg_new>-wsti_countdate = l_countdate.

<xt_iseg_new>-wsti_counttime = l_counttime.

endif.

else.

<xt_iseg_new>-wsti_countdate = l_countdate.

<xt_iseg_new>-wsti_counttime = l_counttime.

endif.

endloop.

else.

Then I tried this:

  • initialize buffer with timestamps

CALL FUNCTION 'WSTI_INIT_COUNT_DATETIME'.

CALL FUNCTION 'BAPI_MATPHYSINV_COUNT'

EXPORTING

physinventory = lv_iblnr

fiscalyear = p_gjahr

count_date = p_datum

TABLES

items = lt_items

return = lt_bapiret2.

But the fields WSTI_COUNTDATE and WSTI_COUNTTIME are always still empty.

Do you know why?