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

RFC bapi function to get stock quantity

Former Member
0 Likes
6,424

Hi guys,

I'm looking for a bapi function which gives me some data like MMBE or MB52.

Input is: material and plant

Output should be: Storage location, special stock number (if exists), unrestr. use stock qty.

I tried a couple of functions like:

MD_STOCK_REQUIREMENTS_LIST_API (no good, does not support storage location)

MARD_GENERIC_READ_MATNR_PLANT (no good, it does not support "special stock qty")

BAPI_MATERIAL_AVAILABILITY (no good, does not deliver storage location)

Any ideas?

Thanks a lot !!!

Regards

Wolf.

10 REPLIES 10
Read only

Former Member
0 Likes
2,120

try... BAPI_WHSE_STOCK_GET_DETAIL

Read only

Former Member
0 Likes
2,120

Thanx for your response.

I do not have Warehouse nor quant!

Any other ideas?

Read only

0 Likes
2,120

try... MB_READ_MATERIAL_STOCKS.... I tried.. its working

Read only

Former Member
0 Likes
2,120

Hello Summet,

thx. for your reply.

Tried function w/o getting a result.

This are the requested parameter of the function:

I entered item and plant into MTCOM but don't know what to enter into the other fields?

-


MTCOM 4-001-02-0007 9991

TRTYP

XNEUP

XAENP

MBEQU

SHKZG

XENQU

KZDZV

XMBWL

MBVAL

XWERT

-


What did you enter into this fields? Just blanks doesn't seem to work!

Thx again.

Read only

Former Member
0 Likes
2,120

For MD04:


* Initial screen
  CALL FUNCTION 'MD_STOCK_REQUIREMENTS_LIST_API'
    EXPORTING
      matnr   = '...'
      werks   = '...'
    IMPORTING
      e_mt61d = wa_mt61d
    TABLES
      mdpsx   = t_mdpsx
      mdezx   = t_mdezx
      mdsux   = t_mdsux
    EXCEPTIONS
      OTHERS  = 1.

  CHECK sy-subrc = 0.

* Switch to period totals button
  CALL FUNCTION 'ATP_BERECHNEN_MDEZX'
    EXPORTING
      emt61d = wa_mt61d
    TABLES
      mdezx  = t_mdezx
      mdinx  = t_mdinx
      mdpsx  = t_mdpsx.

Darley

Read only

Former Member
0 Likes
2,120

Thx Darley,

do you also have the declaration section for me?

Thx.

Read only

0 Likes
2,120

yeah.


DATA: t_mdpsx  TYPE TABLE OF mdps,
      t_mdezx  TYPE TABLE OF mdez,
      t_mdsux  TYPE TABLE OF mdsu,
      t_mdinx  TYPE TABLE OF mdin.

DATA: wa_mt61d TYPE mt61d,
      wa_mdezx TYPE mdez.

* Initial screen
CALL FUNCTION 'MD_STOCK_REQUIREMENTS_LIST_API'
  EXPORTING
    matnr   = '000000000000000175'
    werks   = '1100'
  IMPORTING
    e_mt61d = wa_mt61d
  TABLES
    mdpsx   = t_mdpsx
    mdezx   = t_mdezx
    mdsux   = t_mdsux
  EXCEPTIONS
    OTHERS  = 1.

* Switch to period totals button
CALL FUNCTION 'ATP_BERECHNEN_MDEZX'
  EXPORTING
    emt61d = wa_mt61d
  TABLES
    mdezx  = t_mdezx
    mdinx  = t_mdinx
    mdpsx  = t_mdpsx.

READ TABLE t_mdezx INTO wa_mdezx INDEX 1.
IF sy-subrc EQ 0.
  WRITE: wa_mdezx-mng04.
ENDIF.

Darley

Read only

0 Likes
2,120

ca u provide this code in foxpro code

Read only

Former Member
0 Likes
2,120

Sorry,

result is not what I wanted!

Got no storage location nor special stock quantity.

Thx. anyway !!!

Read only

0 Likes
2,120

fields that are in need mard table, use the FM MARD_SINGLE_READ

The field of free stock is LABST.