Add custom column in SAP MD04 Tcode

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.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

method IF_EX_MD_ADD_COL_EZPS~ACTIVATE_ADD_COLUMNS.

CLEAR:button1_ez,button2_ez,button3_ez,

ez1_mode,ez2_mode,ez3_mode.

button1_ez=text-ez1.

*Define an icon forbutton2,but text only asquickinfo

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'.

endmethod.

Step 2. Add this code to FILL_ADD_COLUMNS method

1

2

3

4

5

6

7

8

9

10

11

12

METHOD if_ex_md_add_col_ezps~fill_add_columns.

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.