What’s SAP MD04 Transaction code.
Ok i will explain a little about MD04, MD04 can be called a Material Ledger and SAP Call it Stock/Requirement List, In any materials planning system (buying, selling, making, transferring. moving, writing off, adjusting etc), a material can be planned or not planned. As a large manufacturing company making cars, you probably do not plan for toilet rolls used in employees washrooms in SAP (some people do that too but they are in Govt) but you need to plan for paint, engines and tires depending on the demand of cars in the form of orders from customer OR as a forecast or sometimes both…but those are details not directly related to MD04. MD04 is the FINAL outcome.
HOW (the method/strategy) the material is planned is identified by MRP Type. e.g. ND is an MRP Type that means material is not planned. That means you will see nothing in MD04 for this material at a said location (Plant or MRP area).
SAP has its own cryptic keys and text labels for various MRP type to confuse the hell out of first timers like you, who expect knowledge without attending expensive training classes.PD means the material is planned using the MRP run (e.g. MD01). There are other ways of planning materials like consumption based planning, re-order point based planning, time phased planning. This is the science part of planning that you will need to master separately if you want to know why the plan created by each of these methods does not fit all or why one MRP type can be BETTER than others. One size doesn’t fit all. You need a strategy specific for material, may be location (plant) or some other consideration.
Ok that’s is a little explaination. but today i want to share how to add custom column to MD04 tcode, because in some client, client need to display a column or data on this transaction.
Use MD_ADD_COL_EZPS Badi
I hope you familiar with this enhancement, as you know SAP have variety of enhancement. after you create new implementation in this BaDi ( SE18 Tcode ).
In my requirement i, my functional team ask to add VTWEG ( Distribution Channel ) Columns to this MD04 transaction, so you need to adjust according to your requirement.
Step 1. Add this code to ACTIVATE_ADD_COLUMNS method.
CLEAR: button1_ez, button2_ez, button3_ez,
ez1_mode, ez2_mode, ez3_mode.
button1_ez = text-ez1.
* Define an icon for button 2, but text only as quickinfo
button2_ez-icon_id = '@3O@'. " ICON_FINAL_DATE
button2_ez-icon_text = space.
button2_ez-quickinfo = text-ez2.
* The column with the batch number should always be visible
ez1_mode = '1'.
Step 2. Add this code to FILL_ADD_COLUMNS method
DATA : lv_vtweg TYPE vtweg,
lv_vtext TYPE vtxtk.
CLEAR : lv_vtweg, lv_vtext.
SELECT SINGLE vtweg INTO lv_vtweg FROM vbak WHERE vbeln = ie3mdpslx-delnr.
IF sy-subrc EQ 0.
SELECT SINGLE vtext INTO lv_vtext FROM tvtwt WHERE spras = 'E'
AND vtweg = lv_vtweg.
emdezx_usex1 = lv_vtext.