Dönem başı stok tabloları
MARDH Malzeme dönem stokları
MCHBH Malzeme(partili) dönem stok
types: begin of ty_mardh,
MATNR type MATNR,
WERKS type WERKS_D,
LGORT type LGORT_D,
LFGJA type LFGJA,
LFMON type LFMON,
LABST type LABST,
end of ty_mardh.
types: tty_mardh type SORTED TABLE OF ty_mardh WITH UNIQUE key MATNR WERKS LGORT LFGJA LFMON.
types: begin of ty_mardh_coll,
MATNR type MATNR,
* LFGJA type LFGJA, bu sabit
* LFMON type LFMON, bu da sabit
LABST type LABST,
end of ty_mardh_coll.
types: tty_mardh_coll type SORTED TABLE OF ty_mardh_coll WITH UNIQUE key MATNR ."LFGJA LFMON.
data: lt_mardh type tty_mardh.
data: lt_mardh_coll type tty_mardh_coll.
data: ls_mardh type ty_mardh.
data: ls_mardh_coll type ty_mardh_coll.
*Dönem başı stok
SELECT MATNR
WERKS
LGORT
LFGJA
LFMON
LABST
into TABLE lt_mardh
from mardh
FOR ALL ENTRIES IN lt_mara
where matnr = lt_mara-matnr
and werks = `3400`
and LFGJA = P_SPMON+0(4)
and LFMON = P_SPMON+4(2).
loop at lt_mardh into ls_mardh.
CLEAR ls_mardh_coll.
move-CORRESPONDING ls_mardh to ls_mardh_coll.
COLLECT ls_mardh_coll into lt_mardh_coll.
ENDLOOP.
CLEAR ls_mardh.
READ TABLE lt_mardh_coll into ls_mardh_coll WITH TABLE KEY matnr = ls_out-matnr.
if sy-subrc eq 0.
ls_out-labst = ls_mardh_coll-labst.
endif.
SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; }.L0S52 { color: #0000FF; }.L0S55 { color: #800080; }