cancel
Showing results for 
Search instead for 
Did you mean: 

how to get the ATP quantity in a query?

Former Member
0 Kudos

Hi teams,

now , I have a request , and I want to serch a material's available quantity in a query link vbak,

if I select document NO. or created date of SO and plant ,act..

then i can get the result as below.

may be BAPI_MATERIAL_AVAILABILITY can help ,

but there is no abaper.

any one can give the code...

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Ding,

Use RV_AVAILABILITY_CHECK

This is the standard function module used by SAP.

or otherwise you can use the  BAPI_MATERIAL_AVAILABILITY

for code search for where used list in your system , you should be able to find the usegae in many places.

Thanks,

Siva.

Shiva_Ram
Active Contributor
0 Kudos

Why don't you try to use standard transaction codes like CO09?

Regards,

Former Member
0 Kudos

hi,

thank you

I want the quantity as available stock quantity subtract all confirm quantity.

former_member223981
Active Contributor
0 Kudos

Hi Ding,

This is exactly what CO09 displays in the Cumul. ATP Quantity.

In the "Cumul ATP Qty" column, the quantity = Total Receipts - (Total Issues OR Confirmed Issues).

The system will consider total issues if the "With Req Qty" flag is set in the initial screen of CO09, otherwise it considers the confirmed issues.

You should be able to see the figure you want in CO09 on the "Stock" line in the "Cumul ATP Qty" column.

The calculation of these values is somewhat complex as it involves adding values from a variety of sources. The value you see in the total receipts field is not actually stored in the database but it is calculated at runtime [by CO09] by gathering all the stock / receipts on your system and summing them up. The issue fields are calculated in a similar way. This happens via the following call stack:

SAPLATP3 FORM BUILD_ATP_STACK_05

SAPLATP3 FORM CALC_ATP_BASIS_06

SAPLATP3 FUNCTION ATP_CHECK_BASIS

SAPLATP0 FORM ATP_CHECK

SAPLATP0 FORM SEGMENT_CHECK

SAPLATP0 FUNCTION AVAILABILITY_CHECK_EXECUTE

SAPLATP3 FORM BUILD_ATP_STACK_05  < Pretty much happens in here if you want to check the code yourself [data objects P_SUM_R / P_SUM_I]

Hope this helps.

eduardo_hinojosa
Active Contributor
0 Kudos

Hi

Check the values in table VBBE. I believe the values in fields OMENG and VMENG are the information you are looking for.

I hope this helps you

Regards

Eduardo

former_member223981
Active Contributor
0 Kudos

The problem with looking at VBBE is that it shall only consider the issues - it will not consider the planned stock receipts (like production orders, or planned orders for example).

From the CO09 screenshot, it is apparent that receipts are being considered (as the value in the total receipts is > than the on hand stock). Therefore, to calculate the value that you want, these need to be considered. This is actually done in FM STOCK_RECEIPT_ISSUE_READ (not released). I do not think the calculation is as simple as you think it is...... If you were not considering receipts in your system, then the calculation could be much simpler (something like MARD-LABST [unrestricted stock] - VBBE-VMENG). The BAPI that you mention at the beginning could actually be the easiest solution to this.

eduardo_hinojosa
Active Contributor
0 Kudos

Hi

Do you want the same information you have in MRP monitor (ie: tcode MD04)?. If the answer is yes, you can do it with function module MD_STOCK_REQUIREMENTS_LIST_API.

Regards

Eduardo

former_member186385
Active Contributor
0 Kudos

Hi,

You will not get the ATP quantity from Transaction document

if you want the confirmed quantity then you can get this from VBEP-BMENG

regards,

santosh

former_member211108
Contributor
0 Kudos

Hi Ding,

Can you please elaborate your requirement ??

Do you mean to say that : You want the quantity that is made available for a line item in given sales order ? If that is the case then this is readily available in schedule line. The table for schedule line is VBEP. VBEP -BMENG  will be ATP quantity i.e confirmed quantity. There can be a situation where multiple schedule lines exists. The gross confirmed quantity can be read from VBAP also.

Hope this will help you.

Thanks and Regards,

Atulkumar Dagade

Former Member
0 Kudos

hi Atul,

I want the quantity as available stock quantity subtract all confirm quantity as I reply Mr Siva.

siva_vasireddy2
Active Contributor
0 Kudos

Hi,

   Confirmed Qty can be Checked at VBAP  Table.

Former Member
0 Kudos

hi Siva,

maybe , I do not elaborate my requirement,

how to say, I want the quantity as available stock quantity subtract all confirm quantity..

maybe as 1765-348 or 1765-322.