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

Using BAPI ====> BAPI_MATPHYSINV_COUNT

Former Member
0 Likes
2,098

Hi All

I am using the BAPI <b>BAPI_MATPHYSINV_COUNT</b> in a Z-Prog. Evrything is working fine when all the materials in the count is counted. When 1 or more is not counted of the count - the count creates an error in the return itab. What do I do wrong or are there another BAPI that can be used.

Thanks

2 REPLIES 2
Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
924

Frans, what kind of error does it return exactly?

I use BAPI_MATPHYSINV_COUNT successfully and haven't had any problems with it. I populate ITEMS table (i_count in this example) as follows:

CLEAR i_count.
  i_count-item = [line item number from the phys. inv. document].
  i_count-material = [material number MATNR].

  IF p_qty = 0.
    i_count-zero_count = 'X'.
  ELSE.
    i_count-entry_qnt = p_qty.
    i_count-entry_uom = [base unit of measure].
  ENDIF.
  APPEND i_count.

Then I call BAPI:

  CALL FUNCTION 'BAPI_MATPHYSINV_COUNT'
    EXPORTING
      physinventory = p_iblnr
      fiscalyear    = current_year
    TABLES
      items         = i_count
      return        = i_return.

It's pretty straight forward. Maybe you should pass 'zero count' if material wasn't counted?

Read only

0 Likes
924

This message was moderated.