Add custom field in Material Master
1.Add fields in the Append Structure of table MARA.
2.Configure
SPRO IMG -> Logistics General -> Material Master -> Configuring the Material Master -> Create Programs for Customized Subscreens
SE80 display FUGR MGD1 and select the screen (MM View sub-screen) you want to enhance with your own fields – in our case it will be screen 2701 (Storage data: general data) Copy the selected screen from MGD1 to your FUGR (keep its current number)
3.Paint
4.Coding
process before output.
module modify_screen.
module get_data.
process after input.
chain.
field:
mara-zz_tl_fot_status,
mara-zz_tl_fot_date,
mara-zz_tl_fot_time.
module check_fot_input.
endchain.
chain.
field:
mara-zz_tl_isi_status,
mara-zz_tl_isi_date,
mara-zz_tl_isi_time.
module check_isi_input.
endchain.
field mara-zz_tl_fot_status.
field mara-zz_tl_fot_date.
field mara-zz_tl_fot_time.
field mara-zz_tl_isi_status.
field mara-zz_tl_isi_date.
field mara-zz_tl_isi_time.
module set_data_output.
module modify_screen output.
case sy-tcode.
when 'MM03'.
loop at screen.
case screen-group1.
when 'G1'.
screen-input = 0.
modify screen.
endcase.
endloop.
when 'MM01' or 'MM02'.
loop at screen.
case screen-group1.
when 'G1'.
screen-input = 1.
modify screen.
endcase.
endloop.
endcase.
endmodule. " MODIFY_SCREEN OUTPUT
module get_data output.
call function 'MARA_GET_SUB'
importing
wmara = mara
xmara = *mara
ymara = lmara
.
endmodule. " GET_DATA OUTPUT
module check_isi_input input.
if mara-zz_tl_isi_status is initial
and ( mara-zz_tl_isi_date is not initial or mara-zz_tl_isi_time is not initial ).
clear: mara-zz_tl_isi_date,mara-zz_tl_isi_time.
message 'Select the the ISI status first' type 'E'.
endif.
if mara-zz_tl_isi_status is not initial
and ( mara-zz_tl_isi_date is initial or mara-zz_tl_isi_time is initial )..
message 'Please fill in the ISI status date and time' type 'E'.
endif.
endmodule. " CHECK_DATA_INPUT INPUT
module set_data_output input.
data:
lv_fot_status type mara-zz_tl_fot_status,
lv_fot_date type mara-zz_tl_fot_date,
lv_fot_time type mara-zz_tl_fot_time,
lv_isi_status type mara-zz_tl_isi_status,
lv_isi_date type mara-zz_tl_isi_date,
lv_isi_time type mara-zz_tl_isi_time.
data lv_mail_flag type flag.
check sy-tcode eq 'MM01' or sy-tcode eq 'MM02'.
lv_fot_status = mara-zz_tl_fot_status.
lv_fot_date = mara-zz_tl_fot_date.
lv_fot_time = mara-zz_tl_fot_time.
lv_isi_status = mara-zz_tl_isi_status.
lv_isi_date = mara-zz_tl_isi_date.
lv_isi_time = mara-zz_tl_isi_time.
export lv_fot_status to memory id 'MARA_FOT_STATUS'.
export lv_fot_date to memory id 'MARA_FOT_DATE'.
export lv_fot_time to memory id 'MARA_FOT_TIME'.
export lv_isi_status to memory id 'MARA_ISI_STATUS'.
export lv_isi_date to memory id 'MARA_ISI_DATE'.
export lv_isi_time to memory id 'MARA_ISI_TIME'.
endmodule. " SET_DATA_OUTPUT INPUT
4.Configure
Go to customizing for the MM views in SPRO IMG -> Logistics
General -> Material Master -> Configuring the Material Master
-> Define Structure of Data Screens for Each Screen Sequence (Tcode OMT3)
5.In FM:EXIT_SAPLMGMU_001.include zxmg0u02.
This user exit is called every time PAI is triggered.
if ( sy-tcode eq 'MM01' or sy-tcode eq 'MM02' ) and cmara-matnr cp 'T01*'.
data:
lv_fot_status type mara-zz_tl_fot_status,
lv_fot_date type mara-zz_tl_fot_date,
lv_fot_time type mara-zz_tl_fot_time,
lv_isi_status type mara-zz_tl_isi_status,
lv_isi_date type mara-zz_tl_isi_date,
lv_isi_time type mara-zz_tl_isi_time.
"To be easily understand
"import lv_fot_status from memory id 'MARA_FOT_STATUS'.
"cmara-zz_tl_fot_status = lv_fot_status.
import lv_fot_status = cmara-zz_tl_fot_status from memory id 'MARA_FOT_STATUS'.
import lv_fot_date = cmara-zz_tl_fot_date from memory id 'MARA_FOT_DATE'.
import lv_fot_time = cmara-zz_tl_fot_time from memory id 'MARA_FOT_TIME'.
import lv_isi_status from memory id 'MARA_ISI_STATUS'.
if 'X' eq lv_isi_status and 'X' ne cmara-zz_tl_isi_status.
call function 'ZZXMG0U02_SEND_MAIL'
exporting
iv_material = cmara-matnr
.
endif.
cmara-zz_tl_isi_status = lv_isi_status.
import lv_isi_date = cmara-zz_tl_isi_date from memory id 'MARA_ISI_DATE'.
import lv_isi_time = cmara-zz_tl_isi_time from memory id 'MARA_ISI_TIME'.
endif.
Parameter ID must be same in “export” and “import”
4. Another example.
process before output.
module liste_initialisieren.
loop at extract with control
tctrl_zcustomer_name cursor nextline.
module liste_show_liste.
endloop.
*
process after input.
module liste_exit_command at exit-command.
module liste_before_loop.
loop at extract.
module liste_init_workarea.
chain.
field zcustomer_name-zcustomer_name .
module set_update_flag on chain-request.
endchain.
field vim_marked module liste_mark_checkbox.
chain.
field zcustomer_name-zcustomer_name .
module liste_update_liste.
endchain.
endloop.
module liste_after_loop.