Skip to Content
0
Jun 15, 2009 at 11:06 AM

BAPI_MATERIAL_AVAILABILITY

124 Views

Hi,

I need BAPI like BAPI_MATERIAL_AVAILABILITY, but for all plants and materials.

The case is like this: We have 3 plants and we would like to have material availability by material for all plants in one report.

In our case we are looping in internal table with all materials and we import into BAPI parameters like material and plant.Based on this of course performance is too slow. How can we solve the problem. Below is my code.

LOOP AT it_final.

*--


ATP Check--


CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY'

EXPORTING

PLANT = '1100'

MATERIAL = it_final-matnr

UNIT = it_final-meins

CHECK_RULE = 'A'

IMPORTING

AV_QTY_PLT = d_WKBST

TABLES

WMDVSX = int_wmdvsx

WMDVEX = int_wmdvex.

it_final-labst1 = d_WKBST.

*modify it_final.

  • when '1200'.

CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY'

EXPORTING

PLANT = '1200'

MATERIAL = it_final-matnr

UNIT = it_final-meins

CHECK_RULE = 'A'

IMPORTING

AV_QTY_PLT = d_WKBST

TABLES

WMDVSX = int_wmdvsx

WMDVEX = int_wmdvex.

it_final-labst2 = d_WKBST.

*modify it_final.

  • when '1300'.

CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY'

EXPORTING

PLANT = '1300'

MATERIAL = it_final-matnr

UNIT = it_final-meins

CHECK_RULE = 'A'

IMPORTING

AV_QTY_PLT = d_WKBST

TABLES

WMDVSX = int_wmdvsx

WMDVEX = int_wmdvex.

it_final-labst3 = d_WKBST.

*----


record_tab-string+0(18) = it_final-matnr.

record_tab-string+18(40) = it_final-maktx.

record_tab-string+58(3) = it_final-meins.

record_tab-string+61(13) = it_final-labst1.

record_tab-string+74(13) = it_final-labst2.

record_tab-string+87(13) = it_final-labst3.

append record_tab.

*break skolev.

endloop.

Regards,

Stefan