cancel
Showing results for 
Search instead for 
Did you mean: 

How to report total stock quantity by storage type (LGTYP)

0 Kudos

I want to report stock quantity (which I have in (LIME/NQUAN.QUAN) by Storage Type (/SCWM/LAGP.LGTYP) but I'm struggling to find a set of tables to relate the two. LIME/NQUAN has a GUID_STOCK which I can only think is the only identifier to link somewhere to get LGTYP but I cannot find that set of table(s) to join them.

Frustratingly for 'Available' stock it's all in one place /SCWM/AQUA, here we have LGTYP and QUAN in one table, but it's only 'Available' stock not total stock.

Any help would be gratefully appreciated

Accepted Solutions (0)

Answers (4)

Answers (4)

PatrickMueller
Employee
Employee

Without knowing your actual use case:

1) Warehouse Management Monitor -> Stock and Bin -> Physical Stock

^^ That query can just be started by storage type. although you did not mention it in your request, I guess you are not interested on the single bins but you are looking for an aggregation among the storage type.

2) EWM also offers BI extractor 0WM_STOCK

0 Kudos

Thanks Patrick, I am trying to build a HANA Calculation view to report directly ontop of EWM in Webi. So I cannot use a T-Code as that uses a function module nor 0WM_STOCK as I cannot use BW.

So I'm trying to work out what EWM tables in need to use/join to get LIME/NQUAN by MATID and LGTYP. I have no ABAP skills so trying to interrogate the function module /SCWM/SELECT_STOCK behind the warehouse monitor is beyond my knowledge

former_member792141
Discoverer
0 Kudos

derekjones thanks for your answer! I tried your suggestion and indeed could succesfully join NTREE.GUID with the PARENT_GUID of NQUAN. Unfortunately, if I use NTREE-PARENT_GUID to the GUID_LOC of /SCWM/LOC_IW01 I'll get 0 results.

Question remains where we can find the storage bin of the physical stock to connect to /SCWM/LAGP, can be either a GUID or the storage bin number.

0 Kudos

Apologies it;s a little more complicated LIME/NTREE is hierarchical, use a calculated field...

If("TYPE_PARENT"='H',"GUID","GUID_PARENT")

as your join to GUID_LOC

former_member792141
Discoverer
0 Kudos

Hi derekjones ,

That would imply that I can directly take the GUID_PARENT of NQUAN to GUID_LOC of LOC_IW01, since you use the GUID_PARENT in the LIME/NTREE-GUID, and that GUID in the GUID_LOC in cases that TYPE_PARENT = 'H' .

The results still return a 0

0 Kudos

Oh, mine works OK i've attached a copy of my HANA view, i've had to change to .txt, you need to resave as .calculationview and edit any folder strings that might be different in your DB. Then you can try importing?

atilay1
Participant
0 Kudos

Hello Derek,

You can use physical stock method to get storage type stocks.

I shared example code below.

CREATE OBJECT lcl_mon_stock
EXPORTING
iv_lgnum = p_lgnum.

IF NOT s_lgtyp IS INITIAL.
ls_lgtyp-sign = 'I'.
ls_lgtyp-option = 'EQ'.
ls_lgtyp-low = s_lgtyp.
APPEND ls_lgtyp TO lt_lgtyp_r.
ENDIF.

IF s_matnr IS NOT INITIAL.
ls_matnr-option = wmegc_option_eq.
ls_matnr-sign = wmegc_sign_inclusive.
ls_matnr-low = s_matnr.
APPEND ls_matnr TO lr_matnr.

SORT lr_matnr BY low.
DELETE ADJACENT DUPLICATES FROM lr_matnr COMPARING low.
ENDIF.

CALL FUNCTION '/SCWM/ENTITLED_FOR_LGNUM_READ'
EXPORTING
iv_lgnum = mv_lgnum
IMPORTING
et_entitled = gt_entitled_all.

CALL METHOD lcl_mon_stock->get_physical_stock
EXPORTING
it_entitled_r = gt_entitled_all
it_matnr_r = lr_matnr
it_lgtyp_r = lt_lgtyp_r
IMPORTING
et_stock_mon = ET_STOCK_MON.



Best regards,

Atılay

0 Kudos

Thanks, I think we are both trying to achieve this in a HANA Calculation view, I assume the above is ABAP, I'm not aware how we can convert that to a HANA View, have you got any suggestions?

former_member792141
Discoverer
0 Kudos

Same issue here, in trying to get the physical stock by storage bin, thus linking LIME/NQUAN with /SCWM/LGAP. All is available in /SCWM/AQUA, but I cannot join NQUAN and AQUA by GUID_STOCK, since there is no clear 1:1 relationship between these. Hope someone can help.

0 Kudos

Hi there. I did manage to solve this.

To get Stock Quantity

is in /LIME/NQUAN field 'QUAN' (I've put a condition where > 0 to remove 0 stock records)

To get Material ID

/LIME/NQUAN has GUID_STOCK, that can join to tables /SCWM/STOCK_IW01 + /SCWM/STOCK_IW02 + /SCWM/STOCK_IW03 + /SCWM/STOCK_IW04, each one of these has MATID

To get Storage Bin (or Resource or Warehouse or TU as not all stock is on Bin/LGTYP)

/LIME/NQUAN has GUID_PARENT, join to LIME/NTREE.GUID where "TYPE_PARENT" = 'H' to get GUID_PARENT, join this GUID_PARENT to 'GUID_LOC' in /SCWM/LOC_IW01 (for LGTYP) + /SCWM/LOC_IW02 (for RSRC) + /SCWM/LOC_IW03 (for LGNUM) + /SCWM/LOC_IW04 (for TU_NUM)

Hopefully yours should be structured similarly