You are on page 1of 6

TYPES : BEGIN OF t_mara, matnr TYPE matnr, "Material Number mtart TYPE mtart, "Material Type matkl TYPE

matkl, "Material Group xchpf TYPE xchpf, "Batch Management Indicator END OF t_mara, ===Records from MARC=== BEGIN OF t_marc, matnr TYPE matnr, "Material Number werks TYPE werks_d, "Plant ekgrp TYPE ekgrp, "Purchasing Group dispo TYPE dispo, "MRP Controller END OF t_marc, DATA : i_mara TYPE STANDARD TABLE OF t_mara INITIAL SIZE 0, i_marc TYPE STANDARD TABLE OF t_marc INITIAL SIZE 0. SELECT matnr "Material Number mtart "Material Type matkl "Material Group xchpf "Batch Management FROM mara "Material Master INTO TABLE i_mara WHERE matnr IN s_matnr AND mtart IN s_mtart AND matkl IN s_matkl . *--Check Subrc IF sy-subrc EQ 0. *--Sort table by Material Number SORT i_mara BY matnr. ENDIF. IF NOT i_mara[] IS INITIAL. *--Select query to pick the material number plant purchasing group & MRP controller from table MARC SELECT matnr "Material Number werks "Plant ekgrp "Purchasing Group dispo "MRP Controller FROM marc "Material Master INTO TABLE i_marc FOR ALL ENTRIES IN i_mara WHERE matnr = i_mara-matnr AND werks IN s_werks AND ekgrp IN s_ekgrp

AND dispo IN s_dispo. *--Check Subrc IF sy-subrc EQ 0. *--Sort table by Material Number Plant SORT i_marc BY matnr werks. ENDIF. ENDIF. Exporting all flight data for a specified departure city. The relevant airlines and flight numbers are first put in an internal table entry_tab, which is evaluated in the WHERE condition of the subsquent SELECT statement. PARAMETERS p_city TYPE spfli-cityfrom. TYPES: BEGIN OF entry_tab_type, carrid TYPE spfli-carrid, connid TYPE spfli-connid, END OF entry_tab_type. DATA: entry_tab TYPE TABLE OF entry_tab_type, sflight_tab TYPE SORTED TABLE OF sflight WITH UNIQUE KEY carrid connid fldate. SELECT carrid connid FROM spfli INTO CORRESPONDING FIELDS OF TABLE entry_tab WHERE cityfrom = p_city. SELECT carrid connid fldate FROM sflight INTO CORRESPONDING FIELDS OF TABLE sflight_tab FOR ALL ENTRIES IN entry_tab WHERE carrid = entry_tab-carrid AND connid = entry_tab-connid.

TYPES : BEGIN OF str_mard, matnr TYPE mard-matnr, lgort TYPE mard-lgort, werks TYPE mard-werks, END OF str_mard. DATA : wa_mard TYPE str_mard, it_mard TYPE TABLE OF str_mard. TYPES : BEGIN OF str_makt, matnr TYPE makt-matnr, maktg TYPE makt-maktg, END OF str_makt. DATA : wa_makt TYPE str_makt, it_makt TYPE TABLE OF str_makt. TYPES : BEGIN OF str_mara, matnr TYPE mara-matnr, ersda TYPE mara-ersda, ernam TYPE mara-ernam, laeda TYPE mara-laeda, mtart TYPE mara-mtart, matkl TYPE mara-matkl, meins TYPE mara-meins, END OF str_mara. DATA : wa_mara TYPE str_mara, it_mara TYPE TABLE OF str_mara. TYPES : BEGIN OF str_final, matnr TYPE mara-matnr, ersda TYPE mara-ersda, ernam TYPE mara-ernam, laeda TYPE mara-laeda, mtart TYPE mara-mtart, matkl TYPE mara-matkl, meins TYPE mara-meins, lgort TYPE mard-lgort, werks TYPE mard-werks, END OF str_final. DATA: wa_final TYPE str_final, it_final TYPE TABLE OF str_final. PARAMETERS : plant TYPE mard-werks, stor LIKE mard-lgort. SELECT matnr lgort werks FROM mard INTO TABLE it_mard WHERE lgort = stor AND werks = plant.

SELECT matnr maktg FROM makt INTO TABLE it_makt FOR ALL ENTRIES IN it_mard WHERE matnr = it_mard-matnr AND spras = 'E'. SELECT matnr ersda ernam laeda mtart matkl meins FROM mara INTO TABLE it_mara FOR ALL ENTRIES IN it_makt WHERE matnr = it_makt-matnr. LOOP AT it_makt INTO wa_makt. WRITE : /1 wa_makt-matnr COLOR 1, 40 wa_makt-maktg COLOR 2. HIDE wa_makt-matnr. ENDLOOP. CLEAR wa_mard-matnr. AT LINE-SELECTION. REFRESH it_final. CLEAR wa_final. ULINE. IF sy-lsind = 1. WRITE: /1 'MATERIAL NO' COLOR 2, 20 'CREATION DATE' COLOR 3, 32 'PERSON CREATED', 50 'DATE OF LIST' , 65 'MATERIALTYPE', 80 'MATGROUP' , 90 'UNITOFMEASURE', 110 'STORLOCATION' COLOR 4, 130 'PLANT' COLOR 5. ULINE. ENDIF. LOOP AT it_mara INTO wa_mara WHERE matnr = wa_makt-matnr. wa_final-matnr = wa_mara-matnr. wa_final-ersda = wa_mara-ersda. wa_final-ernam = wa_mara-ernam. wa_final-laeda = wa_mara-laeda. wa_final-mtart = wa_mara-mtart. wa_final-matkl = wa_mara-matkl. wa_final-meins = wa_mara-meins. READ TABLE it_mard INTO wa_mard WITH KEY matnr = wa_maktmatnr. wa_final-lgort = wa_mard-lgort. wa_final-werks = wa_mard-werks. APPEND wa_final TO it_final. ENDLOOP. LOOP AT it_final INTO wa_final.

WRITE :

/1 wa_final-matnr COLOR 2, 20 wa_final-ersda COLOR 3, 37 wa_final-ernam, 50 wa_final-laeda , 70 wa_final-mtart , 85 wa_final-matkl , 95 wa_final-meins, 115 wa_final-lgort COLOR 4, 130 wa_final-werks COLOR 5.

ENDLOOP. TOP-OF-PAGE. WRITE : /1 'MATERIAL NO' COLOR 1, 40 'DISCRIPTION' COLOR 2. ULINE . Result Enter the Plant and Storage Location

Press the Execute Button.

Double Click on require Material No which displays secondary list to corresponding material information.

The result shown below