Group of materials have certain dynamic MRP area which
made in tedious to use the SAP standard program RMMDDIBE – Mass Processing
of MRP Area (Create/Change/Delete).
LSMW – Only 2 sections which
is the core of this mass update is shown here as the rest are normal.
As there are no standard transaction code to do batch
input session, coding had to be used using the CALL FUNCTION 'MD_MRP_LEVEL_CHANGE_DATA'
Source Fields
MAIN
Main
MATNR
C(018) Material
WERKS
C(004) Plant
BERID
C(010) MRP Area
MINBE
C(013) Reorder Point
PLIFZ
C(003) Planned Del Time
DISMM
C(002) MRP Type
DISLS
C(002) Lot Size
BSTMI
C(013) Min Lot Size
Maintain Field Mapping and Conversion Rules
__GLOBAL_DATA__
Global Data Definitions and Declarations
1 * __GLOBAL_DATA__
2 tables: marc .
3 data p_p_data
LIKE sdibe_massfields.
4 data p_p_smdma
LIKE mdma .
5 data p_p_sdpop
LIKE dpop .
6 data tmp_message LIKE bapireturn1 .
7 types:
8 BEGIN OF t_seltab,
9 matnr
LIKE mdma-matnr,
10 werks
LIKE mdma-werks,
11 berid
LIKE mdma-berid,
12 berty
LIKE mdlv-berty,
13 END OF t_seltab.
14 data it_seltab TYPE t_seltab
OCCURS 0 with header line .
15
16 data: Report_only like SPOP-VARVALUE1
, popupanswer(1) .
17
---
__BEGIN_OF_PROCESSING__
Before Data Processing Starts
1 * __BEGIN_OF_PROCESSING__
2 call function 'POPUP_TO_GET_ONE_VALUE'
3 exporting textline1 = 'Report only ? '
4
textline2 = 'Default is Y(es) - anything else ->update'
5
titel = 'Input Value please '
6
valuelength = '1'
7 importing value1 = Report_only .
8 if not Report_only is initial .
9 else.
10 Report_only = 'Y'.
11 endif.
12 write: / .
13 if Report_only = 'Y'.
14
15 write: / '*************** Report only'
, Report_only , '*****' .
16
17 else.
18 write: / '*************** Report + UPDATE'
,
19
Report_only , '*****' .
20 endif.
21 write: / .
22
---
__END_OF_RECORD__ After Using Conversion Rules
1
2 CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
3 EXPORTING
4
INPUT = MAIN-MATNR
5 IMPORTING
6
OUTPUT = MAIN-MATNR.
7
8 refresh
it_seltab .
9 append
it_seltab .
10
11
p_p_smdma-MATNR = MAIN-MATNR.
12
p_p_smdma-WERKS = MAIN-WERKS.
13
p_p_smdma-BERID = MAIN-BERID.
14
p_p_data-xplifz = 'X' .
15
p_p_smdma-plifz = MAIN-PLIFZ. "Planned Delivery Time
16
p_p_data-xdismm = 'X' .
17
p_p_smdma-dismm = MAIN-DISMM. "MRP Type
18
p_p_data-xdisls = 'X' .
19
p_p_smdma-disls = MAIN-DISLS. "Lot Size
20
p_p_data-xminbe = 'X' .
21
p_p_smdma-minbe = MAIN-minbe. "Reorder Point
22
p_p_data-xbstmi = 'X' .
23
p_p_smdma-bstmi = MAIN-bstmi. "Min Lot Size
24
25 if Report_only
ne 'Y' .
26 CALL
FUNCTION 'MD_MRP_LEVEL_CHANGE_DATA'
27
EXPORTING
28
i_matnr = main-matnr
29
i_werk = main-werks
30
i_mrp_area = main-berid
31
i_berty = '02'
32
i_selfields = p_p_data
33
i_mdma = p_p_smdma
34
i_dpop = p_p_sdpop
35 *
I_QUEUE_FLAG = 'X'
36
i_save_flag = 'X'
37
I_EXTERNAL_COMMIT = 'X'
38
IMPORTING
39
e_error_return = tmp_message.
40
if tmp_message-message <> ' '.
41
write: / 'Not Updated rectify error first
42
p_p_smdma-matnr, p_p_smdma-berid, tmp_mess
43
endif.
44 endif.
45
46 commit work .
47 |