Application Development 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: 

Tables used for a Stock-In-Hand Report ?

Former Member
0 Kudos

Hi,

I need to generate a stock in hand report. For this report I only need to consider Purchasing Inventory Stock and not the Sales Order Stock. What tables do I have to use?, if possible the query!

Thanks,

Kishan

1 ACCEPTED SOLUTION

former_member221770
Contributor
0 Kudos

Hi Kishan,

Try and use FM 'BAPI_MATERIAL_AVAILABILITY'. I have used this FM in the past for Stock on Hand reports. Only drawback is that it only runs for one material / plant at a time!

You cold also use FM 'AVAILABILITY_CHECK':

  • Structure to hold ATP Controller: Control Parameters

DATA: BEGIN OF st_atpca.

INCLUDE STRUCTURE atpca.

DATA: END OF st_atpca.

  • Table to hold ATP: Requirements to be Checked/Considered

DATA: BEGIN OF tbl_atpcs OCCURS 0.

INCLUDE STRUCTURE atpcs.

DATA: END OF tbl_atpcs.

  • Table to hold ATP Server: ATP data for display

DATA: BEGIN OF tbl_atpds OCCURS 0.

INCLUDE STRUCTURE atpds.

DATA: END OF tbl_atpds.

  • Table to hold ATP Server: Material Table

DATA: BEGIN OF tbl_atpmat OCCURS 0.

INCLUDE STRUCTURE atpmat.

DATA: END OF tbl_atpmat.

  • Populate ST_ATPCA

CLEAR st_atpca.

st_atpca-anwdg = '8'. "Calling App - Explaination

st_atpca-azerg = 'T'. "ATP Display Result

st_atpca-rdmod = 'A'. "Read Mode - Totals

st_atpca-xenqmd = 'N'. "Do not read Blocks

  • Populate TBL_ATPCS

CLEAR tbl_atpcs.

REFRESH tbl_atpcs.

tbl_atpcs-matnr = p_matnr. "Material

tbl_atpcs-werks = p_werks. "Plant

tbl_atpcs-prreg = 'A'. "Checking Rule for Avail Check

tbl_atpcs-chmod = 'EXP'. "ATP: Check mode

tbl_atpcs-delkz = 'VC'. "MRP element indicator

tbl_atpcs-bdter = sy-datum. "Requirements date for the component

tbl_atpcs-xline = '1'.

tbl_atpcs-trtyp = 'A'. "Transaction type - Display

tbl_atpcs-idxatp = '1'.

tbl_atpcs-resmd = 'X'. "Mode for Results of Check - Proposal

tbl_atpcs-chkflg = 'X'.

APPEND tbl_atpcs.

CALL FUNCTION 'AVAILABILITY_CHECK'

TABLES

p_atpcsx = tbl_atpcs

p_atpdsx = tbl_atpds

p_atpmatx = tbl_atpmat

CHANGING

p_atpca = st_atpca

EXCEPTIONS

error = 1

OTHERS = 2.

Would recommend giving both these FM's a go and see if they have what you want.

Cheers,

Pat.

PS. If you find these suggestions helpful, kindly award Reward Points appropriately.

1 REPLY 1

former_member221770
Contributor
0 Kudos

Hi Kishan,

Try and use FM 'BAPI_MATERIAL_AVAILABILITY'. I have used this FM in the past for Stock on Hand reports. Only drawback is that it only runs for one material / plant at a time!

You cold also use FM 'AVAILABILITY_CHECK':

  • Structure to hold ATP Controller: Control Parameters

DATA: BEGIN OF st_atpca.

INCLUDE STRUCTURE atpca.

DATA: END OF st_atpca.

  • Table to hold ATP: Requirements to be Checked/Considered

DATA: BEGIN OF tbl_atpcs OCCURS 0.

INCLUDE STRUCTURE atpcs.

DATA: END OF tbl_atpcs.

  • Table to hold ATP Server: ATP data for display

DATA: BEGIN OF tbl_atpds OCCURS 0.

INCLUDE STRUCTURE atpds.

DATA: END OF tbl_atpds.

  • Table to hold ATP Server: Material Table

DATA: BEGIN OF tbl_atpmat OCCURS 0.

INCLUDE STRUCTURE atpmat.

DATA: END OF tbl_atpmat.

  • Populate ST_ATPCA

CLEAR st_atpca.

st_atpca-anwdg = '8'. "Calling App - Explaination

st_atpca-azerg = 'T'. "ATP Display Result

st_atpca-rdmod = 'A'. "Read Mode - Totals

st_atpca-xenqmd = 'N'. "Do not read Blocks

  • Populate TBL_ATPCS

CLEAR tbl_atpcs.

REFRESH tbl_atpcs.

tbl_atpcs-matnr = p_matnr. "Material

tbl_atpcs-werks = p_werks. "Plant

tbl_atpcs-prreg = 'A'. "Checking Rule for Avail Check

tbl_atpcs-chmod = 'EXP'. "ATP: Check mode

tbl_atpcs-delkz = 'VC'. "MRP element indicator

tbl_atpcs-bdter = sy-datum. "Requirements date for the component

tbl_atpcs-xline = '1'.

tbl_atpcs-trtyp = 'A'. "Transaction type - Display

tbl_atpcs-idxatp = '1'.

tbl_atpcs-resmd = 'X'. "Mode for Results of Check - Proposal

tbl_atpcs-chkflg = 'X'.

APPEND tbl_atpcs.

CALL FUNCTION 'AVAILABILITY_CHECK'

TABLES

p_atpcsx = tbl_atpcs

p_atpdsx = tbl_atpds

p_atpmatx = tbl_atpmat

CHANGING

p_atpca = st_atpca

EXCEPTIONS

error = 1

OTHERS = 2.

Would recommend giving both these FM's a go and see if they have what you want.

Cheers,

Pat.

PS. If you find these suggestions helpful, kindly award Reward Points appropriately.