ABAP Program to Extract the
Units of Measure
* Extract the Unit of Conversion from Material Master
REPORT ZUNT MESSAGE-ID Z1
LINE-SIZE 195 NO STANDARD
PAGE HEADING LINE-COUNT 060(001).
TABLES: MARM, " Units
of Measure
MARC,
" Material Master: C Segment
MARA,
" Material Master: General Data
EINE,
" Purchasing Info Record - Purchasing Organization
EINA.
" Purchasing Info Record - General Data
SELECT-OPTIONS X_WERKS FOR MARC-WERKS.
SELECT-OPTIONS X_MTART FOR MARA-MTART.
SELECT-OPTIONS X_MEINS FOR MARA-MEINS.
SELECT-OPTIONS X_MATNR FOR MARM-MATNR.
SELECT-OPTIONS X_ESOKZ FOR EINE-ESOKZ.
DATA: BEGIN OF INT_MARC OCCURS 0,
WERKS LIKE MARC-WERKS,
MTART LIKE MARA-MTART,
MATNR LIKE MARC-MATNR,
MEINS LIKE MARA-MEINS,
UMREN LIKE MARM-UMREN,
UMREZ LIKE MARM-UMREZ,
MEINH LIKE MARM-MEINH,
ESOKZ LIKE EINE-ESOKZ,
END OF INT_MARC.
SELECT * FROM MARC.
CHECK X_WERKS.
CLEAR MARM.
SELECT SINGLE * FROM MARM WHERE MATNR = MARC-MATNR.
CHECK SY-SUBRC = 0.
CLEAR MARA.
SELECT SINGLE * FROM MARA WHERE MATNR = MARC-MATNR.
CHECK X_MTART.
CHECK X_MEINS.
CHECK MARA-LVORM = SPACE.
CLEAR EINA.
SELECT SINGLE * FROM EINA WHERE MATNR = MARC-MATNR
AND LOEKZ = SPACE.
CLEAR EINE.
SELECT SINGLE * FROM EINE WHERE INFNR = EINA-INFNR
AND LOEKZ = SPACE.
CHECK X_ESOKZ.
INT_MARC-WERKS = MARC-WERKS.
INT_MARC-MTART = MARA-MTART.
INT_MARC-MATNR = MARC-MATNR.
INT_MARC-MEINS = MARA-MEINS.
INT_MARC-UMREN = MARM-UMREN.
INT_MARC-UMREZ = MARM-UMREZ.
INT_MARC-MEINH = MARM-MEINH.
INT_MARC-ESOKZ = EINE-ESOKZ.
APPEND INT_MARC.
CLEAR INT_MARC.
ENDSELECT.
SORT INT_MARC BY WERKS ESOKZ MTART MATNR.
MESSAGE I086 WITH 'loop at int_marc'.
LOOP AT INT_MARC.
FORMAT COLOR COL_GROUP.
WRITE: / INT_MARC-WERKS UNDER 'Plt',
INT_MARC-MTART
UNDER 'M.Type',
INT_MARC-MATNR
UNDER 'Material',
INT_MARC-MEINS
UNDER 'Unit',
INT_MARC-UMREN
UNDER 'Denom',
INT_MARC-UMREZ
UNDER 'Numer',
INT_MARC-MEINH
UNDER 'Alt',
INT_MARC-ESOKZ
UNDER 'Cat'.
ENDLOOP.
TOP-OF-PAGE.
FORMAT COLOR COL_TOTAL.
WRITE: / SY-DATUM, SY-UZEIT, SY-REPID, SY-UNAME,
'Material Unit Conversion',
SY-PAGNO.
SKIP.
WRITE: /1 'Plt',
5 'M.Type',
12 'Material',
32 'Unit',
37 'Denom',
47 'Numer',
57 'Alt',
61 'Cat'.
SKIP.
More Function Module
Functions / SAP
Script / ALV
Tables
Database Table
ABAP Books List
ABAP/4 Certification,
Programming, Smartforms, Sapscripts and Object Oriented Programming Books
Smart Forms
SAP Smartforms
ABAP Menu:
ABAP Example Hints
and Tips
Return to Index:-
SAP ABAP/4 Programming,
Basis Administration, Configuration Hints and Tips
(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.
Information used on this site is at your own risk.
All product names are trademarks of their respective
companies. The site www.gotothings.com is in no way affiliated with
SAP AG.
Any unauthorised copying or mirroring is prohibited.
|