02-12-2015 1:25 PM
Hi,
I need to retrieve the value pointed to in the image below from MM03. It's seems to be stored in Structure SMEINH, but I can't seem to find how to read that structure.
Can anyone help?
Thanks very much!
Andy
02-12-2015 2:46 PM
02-12-2015 2:46 PM
02-12-2015 3:48 PM
Thanks Venkat.
I am aware of MARM, but I think this requirement is for me to get at the SMEINH structure. That's the one I'm having trouble retrieving from.
Thx,
Andy
02-12-2015 4:03 PM
The data is not actually "stored" in the structure, structure values are volatile, only living during program execution.
So are you working in an exit or BAdI of the transaction, else forget or reformulate your requirement.
(Or reverse engineering on FM MATERIAL_READ_ALL?)
Regards,
Raymond
02-13-2015 7:18 AM
Hi,
Check the table MARM entries by giving the MM03 input.
Hope it helpful,
Regards,
Venkat.
02-13-2015 7:27 AM
Hello Andrew!
Raymond is right, this data only exists during program execution. To retreive this data you should implement the following steps:
1. Run the functional module MATERIAL_READ_ALL and get content of MEINH table from it.
2. MEINH-AZSUB field calculates in include LMGD1O1H in module ME_ANZAHL_SUB_BERECHNEN (see picture).
So, you can use this algorithm to retreive the value of MEINH-AZSUB field.
MODULE ME_ANZAHL_SUB_BERECHNEN OUTPUT.
DATA: WA_MEINH LIKE SMEINH,
SUB_MEINH LIKE SMEINH.
check not mara-meins is initial.
if not ME_FEHLERFLG IS INITIAL.
loop at meinh into wa_meinh where mesub is initial.
wa_meinh-mesub = mara-meins.
modify meinh from wa_meinh.
endloop.
else.
LOOP AT MEINH INTO WA_MEINH.
IF WA_MEINH-MESUB IS INITIAL.
WA_MEINH-MESUB = mara-meins.
MODIFY MEINH FROM WA_MEINH.
ENDIF.
CHECK WA_MEINH-UMREN NE 0.
IF WA_MEINH-MESUB = mara-meins.
WA_MEINH-AZSUB = WA_MEINH-UMREZ / WA_MEINH-UMREN.
ELSE.
READ TABLE MEINH WITH KEY meinh = WA_MEINH-MESUB
INTO SUB_MEINH.
IF SY-SUBRC = 0.
CHECK SUB_MEINH-UMREZ <> 0.
WA_MEINH-AZSUB = ( WA_MEINH-UMREZ * SUB_MEINH-UMREN ) /
( WA_MEINH-UMREN * SUB_MEINH-UMREZ ).
ELSE.
* error Subeinheit ex. nicht.
ENDIF.
ENDIF.
MODIFY MEINH FROM WA_MEINH.
ENDLOOP.
endif.
ENDMODULE.
ABAP source code in this document was coloured using the ABAP code lighter for SCN.
Best regards,
George Shlyahov
02-13-2015 12:16 PM
03-30-2023 7:40 AM