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

Regarding "BAPI_MATERIAL_AVAILABILITY" (important)

Former Member
0 Likes
624

Hi,

In my program, I use BAPI_MATERIAL_AVAILABILITY to get the <u><b>on-hand quantity in CSE.</b></u>

The following is my code:

CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY'

EXPORTING

plant = I_ZDAILY_MVMT-WERKS

material = I_ZDAILY_MVMT-MATNR

unit = 'CSE'

IMPORTING

av_qty_plt = bapi_onhand

return = return

TABLES

wmdvsx = atp1

wmdvex = atp2.

IF return IS INITIAL.

READ TABLE atp2 WITH TABLE KEY bdcnt = 0

req_date = sy-datum

com_date = sy-datum.

  • IF atp2-com_qty <> '9999999999.000'.

  • I_ZDAILY_MVMT-ONHAND_VAL = atp2-com_qty.

  • ELSE.

I_ZDAILY_MVMT-ONHAND_VAL = bapi_onhand.

  • ENDIF.

ENDIF.

-


The problem is that if the commented section above is uncommented, i get extremely large and unreliable data (for example 163,333,333,333,333 - which doesn't make sense.)

On the other hand, when the commented sections are left commented, i get data that seems real.

Which is the right way and what am i doing wrong? How do i check if the data that i am getting is correct?

Thanks,

John

  • Responses will be rewarded and highly appreciated

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
541

Hi,

What are the characteristics of I_ZDAILY_MVMT-ONHAND_VAL? Are you referencing bapi_on_hand with the section commented as being a correct value and I_ZDAILY_MVMT-ONHAND_VAL with the section not commented being an incorrect value?

Warren

Hi,

In my program, I use BAPI_MATERIAL_AVAILABILITY to get the <u><b>on-hand quantity in CSE.</b></u>

The following is my code:

CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY'

EXPORTING

plant = I_ZDAILY_MVMT-WERKS

material = I_ZDAILY_MVMT-MATNR

unit = 'CSE'

IMPORTING

av_qty_plt = bapi_onhand

return = return

TABLES

wmdvsx = atp1

wmdvex = atp2.

IF return IS INITIAL.

READ TABLE atp2 WITH TABLE KEY bdcnt = 0

req_date = sy-datum

com_date = sy-datum.

  • IF atp2-com_qty <> '9999999999.000'.

  • I_ZDAILY_MVMT-ONHAND_VAL = atp2-com_qty.

  • ELSE.

I_ZDAILY_MVMT-ONHAND_VAL = bapi_onhand.

  • ENDIF.

ENDIF.

-


The problem is that if the commented section above is uncommented, i get extremely large and unreliable data (for example 163,333,333,333,333 - which doesn't make sense.)

On the other hand, when the commented sections are left commented, i get data that seems real.

Which is the right way and what am i doing wrong? How do i check if the data that i am getting is correct?

Thanks,

John

  • Responses will be rewarded and highly appreciated

1 REPLY 1
Read only

Former Member
0 Likes
542

Hi,

What are the characteristics of I_ZDAILY_MVMT-ONHAND_VAL? Are you referencing bapi_on_hand with the section commented as being a correct value and I_ZDAILY_MVMT-ONHAND_VAL with the section not commented being an incorrect value?

Warren