Activation of Batch Characteristics in Material Master
Dear Gurus
In Material Master the character values are in grey mode and not allowing to select.can anyone suggest how to activate this.
other characters are in Blue colour.
Thnk in Advance
MK
Hi There
In material master you can assign the class in the classification view, it will provide the characteristics, that will flow when you do the receipt there you can enter the values or Create Batch-MSC1n and Change batch MSC2n, you can enter the characteristics values,,
I dont have clue why you are trying to enter the values in material master,,,
In CL02- Create the class and assign the characteristics (Create the Charac T code CT04)
Provide more details to check further,,,
Thanks
Senthil
Similar Messages
-
How to Change Batch Classification of material master
Hi,
How to Change Batch Classification of material master in a production system,Pl note that there is no stock and no open qty still system is not allowing me to delete the old Classification and add my new classification.
Guys any solution for this.
Thanks in advance
rgds
bijaya pradhanI believe there is a FM VB_CHANGE_BATCH for this, any body tried this FM?
-
How to deactivate batch management at material master?
Dear Sir/Madam,
At the configuration,I have set "Batch Management" to be activated in plant level. I have a problem which some of the plants do not use batch management.I understand that if you tick "Batch Management" field in material master, batch management is activated for the material in that plant.
1. How do prevent user to tick "Batch Management" field in the material master which appears in the following views (depending on the material types):?
- Sales: General/Plant
- Purchasing
- Plant data/Stor.1
- Work Scheduling
2. Is there any alternate way to prevent user to activate "Batch Management" in that material of their own plant despite it is activated at plant level in the configuration?
Please advise.
Thanks.
Rgds,
Esther Chongbatch status management is just what its name says, you manage your batches with status (unreastricted use, restricted use).
But his comes only into place after you have activated batch managment, it is not causing batch managment, it is only working with batch managment.
Removing batch managment is almost impossible, you have to archive all batches first, to be able to archive the batches, you have to archive the production orders...creation of a new material is in most cases easier and quicker.
Wit batch managment at plant level each plant can independently decide if a material is batch managed or not.
if you want to restrict the entry of the batch management flag, then you have to customize your material master field selection at plant level. -
Need to activate batch mangement in material master
Hi MM Experts,
Need your all help in the below issue
We need to select batch management for the material code but system will not allow selecting in material master, as per SAP note 30656; we removed complete stock from the same plant but some previous month stock exist for that we posted stock in current month using 561 movement and while reversing the stock in previous month posting date system not allowing to reveres getting an standard and moving price error message because they changed material price control from Moving to standard price in the current month.
Now the current situation is system not allowing reversing the stock due to moving and standard price control change Please suggest us, what are the steps we need to carry out to flag batch management for that material code.Hi Jorgen,
The complete steps mentioned for that material.
1.Raw Material code created previousely (In the month of FEB 2011)with price control (V) withought batch management
2.In the month of Mrach 2011 Price control changed from V to S
2,In the month FEB 2011 some Good movement document posted for the same material.
3.From the month of March 2011 now they want to actiavte batch management for the same material
4.We sujjested user to make nill stock for that material and activate the batch management.
5.Then they removed the complete stock for the same material evn they getting some previous stock error.
6.then we find out the note in sap 30656 and advised below steps.
1. Post the same amount to current period stock (for example, using movement type 561) so that previous period stock and current period stock are identical.
2. Make a withdrawal posting in the previous period for the stock together with posting date (for example, using movement type 562).
7.while doing second step we are getting an error as price control changed from V TO S,due to changed in price control
Please let me know if,you need any additonal Information
Regards
Dilipkumar -
Create Characteristics in Material Master
Hello!!
I'm trying to create the characteristics and the values into a material master with FM 'BAPI_CFGINST_CHARCS_VALS_SET'..
but this function don't creates characteristics into my material master...
Have I other way to do this?:(.. I want create a Characteristic value assignment into a client -specific configuration(Configure variant)
.. i can't use this FM because it's required a batch -
Unmark batch management at Material Master Record.
Hi all:
Is it possible to unflag the batch management mark from a material (with an existent batch) and use it again?
The material is already marked for batch management use. An initial stock (with batch) was made.
Then a necessity to unflag (batch management) the material; arised.
Stock was deleted and batch marked for deletion at Plant and batch stock level.
The system doesn't permit to unmark the batch management because it says that "Batches already exist".
Thanks for any help.Hi
It is not simple task. Make sure you don't have any stock left in the concerned plant(s) for the present and the previous month (the batch management flag is valid for all storage locations of a plant).
Archive/delete all existing batches for the concerned plant(s).
Now you should be able to unflag batch management.
regards
Srinivas -
How to Remeove Batch Management in Material Master
hi!
I want to remove the 'Batch management* for a material
Made stock as 0 and reversed all its relating documents.
but its display error as
*The batch management requirement cannot *
be changed for the following reasons:
Batches already exist.
how to remove the Batch management
Regards,
KvHi
The error tells that some documents are stii pending in previous /current posting period.
Pl.find that through Mb 51 ( Input only plant).
Reverse these document also and proceed -
Create Batch Class in Material Master
I need to create the Batch class for n number of materials.
I am using the BAPI BAPI_OBJCL_CHANGE but it is not createing the Class. It says no Batch exists.
There are no Batches created for the Materials which FM or BAPI can be used to create the Batch Class which don't have the Batches.
I tried manually though MM02 it is working like for class 023 Class FERT03 it is createing but not via BAPI BAPI_OBJCL_CHANGE.Hi Abhishek
I had a simillar isssue last year trying to create an equipment class. I had to finally use bdc.
Why dont u try to use bdc on mm02, or if u 've that much of patience u can debug mm02 to see how its being done in sap.
Best of luck. -
Copy of Batch characteristics value from material master to Batch
Hi Gurus,
I have maintained some values in the characteristics under batch classification in material master and want to copy the values in batch characteristics during batch creation at process order release.
Can any one help me to achieve this in standard way?
Thanks
SandipHi,
Try to understand the batch classification functionality...In batch classification characteristic values changes from batch to batch...Values should not be maintained in the material master...it does not have any meaning...in the material master we need to assign only the batch class with class type 023 in classification view ...no need to assign the values there....Batch classification means characteristics values differs from batch to batch...
Thanks
Kumar -
Automatic activation of batch during material master creation
Dear All
Is it possible to activate batch management in material master while creation. This is required for specific material type and field MARA-XCHPF should be set automatically.
Thanks in advance
Regards
YogeshDear,
In OMS9 field for batch management MARC-XCHPF
first check which field selection key is assigned to your material type in the filed slection group 212 (OMSR) there is field called MARA-XCHPF, and MARC-XCHPF.
couble click on these fields and there is an indicator " prapose field content" , you need to select that indicator.
Regards,
R.Brahmankar -
Material batch characteristics
Hi all,
I have a requirement to fetch the material batch characteristics with delivery number as input and print the characteristics for the corresponding batches. Can you please say me the logic to fetch the details ? It is an urgent requirement..
Thanks & Regards,
RamaKrishnan .THi
See the sample code for fetching the BAtch characteristics of Material
report z21311r_batch_char no standard page heading
line-size 132
line-count 58(1)
message-id mm.
Declaration for Tables
tables: mara, " Material Master
mard, " Storage Location Data for Material
t001w, " Plants/Branches
t001l, " Storage Locations
cabn, " Characteristics
inob. " Link between Internal Number and Object
Declaration for Constants
constants : c_klart like ausp-klart value '023', " Class Type
c_obtab like inob-obtab value 'MCH1', " Database Table
c_flag type c value 'X', " Flag
c_c23 type i value '23', " Ratio
Constants for Ratio Categories
c_13 type p decimals 2 value '13.00', " For Ratio 13
c_1499 type p decimals 2 value '14.99', " For Ratio 14.99
c_15 type p decimals 2 value '15.00', " For Ratio 15
c_1699 type p decimals 2 value '16.99', " For Ratio 16.99
c_17 type p decimals 2 value '17.00', " For Ratio 17
c_1899 type p decimals 2 value '18.99', " For Ratio 18.99
c_19 type p decimals 2 value '19.00', " For Ratio 19
c_2099 type p decimals 2 value '20.99', " For Ratio 20.99
c_21 type p decimals 2 value '21.00', " For Ratio 21
c_2299 type p decimals 2 value '22.99', " For Ratio 22.99
c_23 type p decimals 2 value '23.00', " For Ratio 23
c_g23(4) type c value '>=23', " For Ratio >=23
c_ratio(5) value 'RATIO', " For Ratio
Constants for Storing Selected item field information
c_cursor1(15) value 'I_OUTPUT1-MEINS', " For Selected Base
" Unit of Measure
c_cursor2(15) value 'I_OUTPUT1-MATNR', " For Selected Base
" Material Number
c_cursor3(15) value 'I_OUTPUT1-MAKTX', " For Selected Base
" Material Des.
c_cursor4(15) value 'I_OUTPUT1-CLABS', "For Selected Base
" Stock Value
c_cursor5(15) value 'I_OUTPUT1-ATFLV', " For Selected Base
" Char.Value (Ratio)
c_cursor6(5) value 'C_G23'.
Declaration for Global Variables
data : g_exit type c, " Flag
g_clabs1(16) type c, " Quantity
g_clabs(18) type c, " Quantity
g_cursor(15) type c, " Cursor field name
g_matnr type mara-matnr, " Material Number
g_werks type mchb-werks, " Plant
g_atinn(30) type c. " Character.
Declaration for Internal tables
Internal table to hold Batch Stock data
data : begin of i_mchb occurs 0,
matnr like mchb-matnr, " Material Number
werks like mchb-werks, " Plant
lgort like mchb-lgort, " Storage Location
charg like mchb-charg, " Batch Number
clabs like mchb-clabs, " Stock Value
meins like mara-meins, " Unit of measure
atflo like ausp-atflv, " Char.Value (Ratio)
atflv like ausp-atflv, " Char.Value (Ratio)
end of i_mchb.
Internal table to hold Secondary List data
data : begin of i_mchb1 occurs 0,
werks like mchb-werks, " Plant
matnr like mchb-matnr, " Material Number
lgort like mchb-lgort, " Storage Location
charg like mchb-charg, " Batch Number
atinn like ausp-atinn, " Char.Value
clabs like mchb-clabs, " Stock Value
atflo like ausp-atflv, " Char.Value (Ratio)
atflv like ausp-atflv, " Char.Value (Ratio)
end of i_mchb1.
Internal table to get the Plant Name
data : begin of i_plant occurs 0,
werks like t001w-werks, " Plant
name1 like t001w-name1, " Name
end of i_plant.
Internal table to get the Material Description
data : begin of i_makt occurs 0,
matnr like makt-matnr, " Material
maktx like makt-maktx, " Description
end of i_makt.
Internal table to hold AUSP data
data : begin of i_ausp occurs 0,
objek like ausp-objek, " Object No
atinn like cabn-atinn, " Characteric value
atflv like ausp-atflv, " Characteristic Value
end of i_ausp.
Internal table to hold output data
data : begin of i_output occurs 0,
atinn like cabn-atinn, " Characteric value
werks like mchb-werks, " Plant
matnr like mchb-matnr, " Material Number
atnam like cabn-atnam, " Characteristic
atflv like ausp-atflv, " Char.Value (Ratio)
name1 like t001w-name1, " Plant Description
maktx like makt-maktx, " Material Description
clabs like mchb-clabs, " Stock Value
meins like mara-meins, " Base Unit of Measure
end of i_output.
Internal table to hold final Output data
data : begin of i_output1 occurs 0,
atinn like cabn-atinn, " Characteric value
werks like mchb-werks, " Plant
matnr like mchb-matnr, " Material Number
atnam like cabn-atnam, " Characteristic
atflv(32) type c, " Char.Value (Ratio)
name1 like t001w-name1, " Plant Description
maktx like makt-maktx, " Material Description
clabs like mchb-clabs, " Stock Value
meins like mara-meins, " Base Unit of Measure
end of i_output1.
Selection screen
selection-screen begin of block b1 with frame title text-001.
select-options: s_werks for t001w-werks obligatory, " Plant
s_lgort for t001l-lgort, " Stor.Location
s_matnr for mara-matnr obligatory, " Material No
s_atinn for cabn-atinn. " Character.
selection-screen end of block b1.
At selection screen
at selection-screen.
Validation of Selection Screen Fields
perform validate_screen.
Start of selection
start-of-selection.
Get the Material and Batch Stock data from MARA and MCHB Tables
perform get_mat_stock_data.
Get the Material Group Text and Plant Name from T023T and T001W Tables
perform get_plant_grp_data.
Append the data into final Output Internal Table after getting the
Characteristic Values data from INOB and AUSP Tables
perform append_final_data.
Processing if the Characteristics contain 'RATIO'
perform collect_ratio.
End-of-Page
end-of-page.
write /1(125) sy-uline.
End of selection
end-of-selection.
if g_exit <> c_flag.
Display the Report Output data
perform display_report.
endif.
Top-of-Page
top-of-page.
Write the Report and Column Headings
perform get_headings.
at line-selection
at line-selection.
if sy-lsind = 1.
perform display_batch.
endif.
Top of page during line-selection
top-of-page during line-selection.
perform heading_seclist.
Form validate_screen
Validation of Selection Screen fields
form validate_screen.
Validation of Plant
clear t001w.
if not s_werks[] is initial.
select werks
into t001w-werks
from t001w
up to 1 rows
where werks in s_werks.
endselect.
if sy-subrc <> 0.
message e899 with 'Enter Valid Plant'(002).
endif.
endif.
Validation of Material Number
clear mara.
if not s_matnr[] is initial.
select matnr
into mara-matnr
from mara
up to 1 rows
where matnr in s_matnr.
endselect.
if sy-subrc <> 0.
message e899 with 'Enter Valid Material'(003).
endif.
endif.
Validation of Storage Location
clear t001l.
if not s_lgort[] is initial.
select lgort
into t001l-lgort
from t001l
up to 1 rows
where lgort in s_lgort.
endselect.
if sy-subrc <> 0.
message e899 with 'Enter Valid Storage Location'(004).
endif.
endif.
Validation of Characteristic Value
clear cabn.
if not s_atinn[] is initial.
select atinn
into cabn-atinn
from cabn
up to 1 rows
where atinn in s_atinn.
endselect.
if sy-subrc <> 0.
message e899 with 'Enter Valid Characteristic Value'(005).
endif.
endif.
Validation of Plant, Material and Storage Location
clear mard.
select matnr werks lgort
into (mard-matnr, mard-werks, mard-lgort)
from mard
up to 1 rows
where matnr in s_matnr and
werks in s_werks and
lgort in s_lgort.
endselect.
if sy-subrc <> 0.
message e899 with 'No Data found for the Selection Criteria'(006).
endif.
endform. "validate_screen
*& Form get_headings
Write the Report and Column Headings
form get_headings.
data: l_repid type sy-repid.
l_repid = sy-repid.
call function 'Y_STANDARD_HEADING'
exporting
repid = l_repid
heading1 = sy-title.
write:/1(125) sy-uline.
format color col_heading on.
write : /1 sy-vline, 2(18) 'Material Number'(008) centered,
20 sy-vline, 21(40) 'Material Description'(011) centered,
61 sy-vline, 62(22) 'Ratio'(009) centered,
84 sy-vline, 85(18) 'Quantity'(010) centered,
103 sy-vline, 104(20) 'Base Unit of Measure'(015) centered,
125 sy-vline.
write:/1(125) sy-uline.
format color off.
endform. "get_headings
*& Form get_mat_stock_data
Get the Material and Batch Stock data from MARA and MCHB Tables
form get_mat_stock_data.
clear: i_mchb,i_output, i_output1.
refresh: i_mchb,i_output, i_output1.
select a~matnr " Material Number
b~werks " Plant
b~lgort " Storage Location
b~charg " Batch Number
b~clabs " Stock Value
a~meins " Base Unit of Measure
into table i_mchb
from mara as a inner join mchb as b
on amatnr eq bmatnr
where b~matnr in s_matnr and
b~werks in s_werks and
b~lgort in s_lgort.
if sy-subrc <> 0.
g_exit = c_flag.
message s899 with 'No Data found for the Selection Criteria'(006).
stop.
endif.
sort i_mchb by matnr werks lgort charg.
endform. " get_mat_stock_data
*& Form get_plant_grp_data
Get the Material Group Text and Plant Name from T023T and T001W
form get_plant_grp_data.
if not i_mchb[] is initial.
Get the Plant Description from t001w Table
clear i_plant.
refresh i_plant.
select werks " Plant
name1 " Name
into table i_plant
from t001w
for all entries in i_mchb
where werks = i_mchb-werks.
Get the Material Description from MAKT Table
clear i_makt.
refresh i_makt.
select matnr " Material number
maktx " Material Description
into table i_makt
from makt
for all entries in i_mchb
where matnr = i_mchb-matnr and
spras = sy-langu.
sort i_plant by werks.
delete adjacent duplicates from i_plant comparing werks.
sort i_makt by matnr.
delete adjacent duplicates from i_makt comparing matnr.
endif.
endform. "form get_plant_grp_data.
*& Form append_final_data
Append the data into final Internal Table
form append_final_data.
data : l_matbatch(28),
l_tabix like sy-tabix.
if not i_mchb[] is initial.
loop at i_mchb.
l_tabix = sy-tabix.
clear l_matbatch.
concatenate i_mchb-matnr i_mchb-charg into l_matbatch.
move-corresponding i_mchb to i_output.
Get the Plant Description from i_plant Table
read table i_plant with key werks = i_mchb-werks binary search.
if sy-subrc = 0.
i_output-name1 = i_plant-name1.
endif.
Get the Material Description from i_makt Table
read table i_makt with key matnr = i_mchb-matnr binary search.
if sy-subrc = 0.
i_output-maktx = i_makt-maktx.
endif.
Get the Characteristic Values data from INOB and AUSP Tables
clear inob.
select single cuobj from inob
into inob-cuobj
where klart = c_klart and
obtab = c_obtab and
objek = l_matbatch.
if sy-subrc = 0.
select objek
atinn
atflv
from ausp
into table i_ausp
where objek = inob-cuobj and
atinn in s_atinn and
klart = c_klart.
sort i_ausp by objek atinn.
loop at i_ausp.
clear cabn.
select single atinn atnam from cabn
into (cabn-atinn,cabn-atnam)
where atinn = i_ausp-atinn.
if sy-subrc = 0.
If the ratio value is between 13-14.99, display 13
if cabn-atnam cs c_ratio.
if i_ausp-atflv between c_13 and c_1499.
i_mchb-atflo = i_ausp-atflv.
i_mchb-atflv = c_13.
If the ratio value is between 15-16.99, display 15
elseif i_ausp-atflv between c_15 and c_1699.
i_mchb-atflo = i_ausp-atflv.
i_mchb-atflv = c_15.
If the ratio value is between 17-18.99, display 17
elseif i_ausp-atflv between c_17 and c_1899.
i_mchb-atflo = i_ausp-atflv.
i_mchb-atflv = c_17.
If the ratio value is between 19-20.99, display 19
elseif i_ausp-atflv between c_19 and c_2099.
i_mchb-atflo = i_ausp-atflv.
i_mchb-atflv = c_19.
If the ratio value is between 21-22.99, display 21
elseif i_ausp-atflv between c_21 and c_2299.
i_mchb-atflo = i_ausp-atflv.
i_mchb-atflv = c_21.
If the ratio value is greater than or equal to 23, display 23
elseif i_ausp-atflv >= c_23.
i_mchb-atflo = i_ausp-atflv.
i_mchb-atflv = c_23.
endif. " Condition for RATIO values
else. " If characteristic does contain RATIO
i_mchb-atflv = i_ausp-atflv.
endif.
i_output-atinn = cabn-atinn.
i_output-atnam = cabn-atnam.
i_output-atflv = i_ausp-atflv.
i_mchb1-matnr = i_mchb-matnr.
i_mchb1-werks = i_mchb-werks.
i_mchb1-lgort = i_mchb-lgort.
i_mchb1-charg = i_mchb-charg.
i_mchb1-clabs = i_mchb-clabs.
i_mchb1-atinn = i_ausp-atinn.
i_mchb1-atflo = i_mchb-atflv.
i_mchb1-atflv = i_ausp-atflv.
append : i_output, i_mchb1.
clear i_mchb1.
modify i_mchb index l_tabix transporting atflo atflv .
endif.
endloop.
endif.
endloop.
endif.
Checking whether the table is filled or not
if not i_output[] is initial.
sort i_output by atinn werks matnr atflv.
else.
g_exit = c_flag.
message s899 with 'No Data found for the Selection Criteria'(006).
endif.
Delete the records where RATIO is less than 13.
delete i_output where atnam cs c_ratio and atflv lt c_13.
endform. "append_final_data
*& Form display_report
Display the Report Output data
form display_report.
data: l_tabix like sy-tabix.
loop at i_output1.
l_tabix = sy-tabix.
At new Characteristic
at new atinn.
read table i_output1 index l_tabix.
format color 1 intensified on.
write: /1 sy-vline, 2(20) 'Characteristic Name:'(007),
23(40) i_output1-atnam,
125 sy-vline.
format color off.
format color 4 intensified on.
write: /1 sy-vline, 2(20) 'Plant Name :'(022),
23(4) i_output1-werks, 29(30) i_output1-name1,
125 sy-vline.
format color off.
write /1(125) sy-uline.
endat.
clear: g_clabs, g_clabs1.
format color col_normal.
write :/1 sy-vline, 2(18) i_output1-matnr,
20 sy-vline, 21(40) i_output1-maktx,
61 sy-vline.
if i_output1-atflv = c_c23.
write: 62(22) c_g23 centered.
else.
shift i_output1-atflv left deleting leading space.
write: 62(22) i_output1-atflv centered.
endif.
write: 84 sy-vline,
103 sy-vline,
110(5) i_output1-meins.
If the quantity value is negative
if i_output1-clabs ge 0.
write: 85(18) i_output1-clabs unit i_mchb-meins,
125 sy-vline.
else.
i_output1-clabs = - i_output1-clabs.
write i_output1-clabs unit i_mchb-meins to g_clabs1.
condense g_clabs1.
concatenate '(' g_clabs1 ')' into g_clabs separated by space.
write: 85(18) g_clabs right-justified,
125 sy-vline.
endif.
format color off.
hide : i_output1.
new-line.
At end of material
at end of matnr.
sum.
move : i_output1-matnr to g_matnr.
format color 3 intensified on.
write /1(125) sy-uline.
write :/1 sy-vline, 2(25) 'Total for Material :'(012),
28(18) g_matnr.
if i_output1-clabs ge 0.
write: 85(18) i_output1-clabs unit i_mchb-meins,
125 sy-vline.
else.
i_output1-clabs = - i_output1-clabs.
write i_output1-clabs unit i_mchb-meins to g_clabs1.
condense g_clabs1.
concatenate '(' g_clabs1 ')' into g_clabs separated by space.
write: 85(18) g_clabs right-justified,
125 sy-vline.
endif.
write: 125 sy-vline.
format color off.
write /1(125) sy-uline.
endat.
At end of plant
at end of werks.
sum.
move : i_output1-werks to g_werks.
format color 3 intensified off.
write :/1 sy-vline, 2(25) 'Total for Plant :'(013),
28(4) g_werks.
if i_output1-clabs ge 0.
write: 85(18) i_output1-clabs unit i_mchb-meins,
125 sy-vline.
else.
i_output1-clabs = - i_output1-clabs.
write i_output1-clabs unit i_mchb-meins to g_clabs1.
condense g_clabs1.
concatenate '(' g_clabs1 ')' into g_clabs separated by space.
write: 85(18) g_clabs right-justified,
125 sy-vline.
endif.
format color off.
write /1(125) sy-uline.
endat.
At end of characteristic
at end of atinn.
read table i_output1 index l_tabix.
sum.
format color 3 intensified on.
write :/1 sy-vline, 2(25) 'Total for Characteristic:'(014),
28(25) i_output1-atnam.
if i_output1-clabs ge 0.
write: 85(18) i_output1-clabs unit i_mchb-meins,
125 sy-vline.
else.
i_output1-clabs = - i_output1-clabs.
write i_output1-clabs unit i_mchb-meins to g_clabs1.
condense g_clabs1.
concatenate '(' g_clabs1 ')' into g_clabs separated by space.
write: 85(18) g_clabs right-justified,
125 sy-vline.
endif.
format color off.
write /1(125) sy-uline.
endat.
endloop.
endform. " display_report
*& Form DISPLAY_BATCH
Display the batch details for the seclected material *
form display_batch.
Get the batch details for the selected material
get cursor field g_cursor.
if g_cursor = c_cursor1 or
g_cursor = c_cursor2 or
g_cursor = c_cursor3 or
g_cursor = c_cursor4 or
g_cursor = c_cursor5 or
g_cursor = c_cursor6.
format color 3.
write: /1 sy-vline,
2(17) 'Material Number :'(020),
20(17) i_output1-matnr,
94 sy-vline.
format color off.
write /1(94) sy-uline.
loop at i_mchb1 where matnr = i_output1-matnr and
atinn = i_output1-atinn and
atflo = i_output1-atflv.
format color col_normal.
shift i_mchb1-charg left deleting leading '0'.
write :/1 sy-vline, 2(16) i_mchb1-lgort centered,
18 sy-vline, 19(17) i_mchb1-charg centered,
36 sy-vline.
if i_output1-atnam cs c_ratio.
write: 37(29) i_mchb1-atflv
exponent 0 decimals 2 centered.
else.
write : 37(29) i_mchb1-atflv
exponent 0 decimals 0 centered.
endif.
write : 66 sy-vline, 67(27) i_mchb1-clabs unit i_mchb-meins,
94 sy-vline.
format color off.
endloop.
write /1(94) sy-uline.
else.
message s899 with 'Invalid cursor position'(016).
exit.
endif.
endform. " DISPLAY_BATCH
*& Form HEADING_SECLIST
Write the Column Headings for Interactive Report
form heading_seclist.
write /1(94) sy-uline.
format color col_heading on.
write :/1 sy-vline, 2(16) 'Storage Location'(021),
18 sy-vline, 19(17) 'Batch Number'(017) centered,
36 sy-vline, 37(29) 'Characteristic Value'(018) centered,
66 sy-vline, 67(27) 'Quantity'(019) centered,
94 sy-vline.
write /1(94) sy-uline.
format color off.
endform. " HEADING_SECLIST
*& Form COLLECT_RATIO
Display the Characteristic ratio data
form collect_ratio.
loop at i_output.
clear g_atinn.
i_output1-atinn = i_output-atinn.
i_output1-atnam = i_output-atnam .
i_output1-werks = i_output-werks.
i_output1-name1 = i_output-name1.
i_output1-matnr = i_output-matnr.
i_output1-maktx = i_output-maktx.
i_output1-clabs = i_output-clabs.
i_output1-meins = i_output-meins.
call function 'CONVERSION_EXIT_ATINN_OUTPUT'
exporting
input = i_output-atinn
importing
output = g_atinn.
if g_atinn cs c_ratio.
If the ratio value is between 13-14.99, display 13
if i_output-atflv between c_13 and c_1499.
i_output1-atflv = c_13.
If the ratio value is between 15-16.99, display 15
elseif i_output-atflv between c_15 and c_1699.
i_output1-atflv = c_15.
If the ratio value is between 17-18.99, display 17
elseif i_output-atflv between c_17 and c_1899.
i_output1-atflv = c_17.
If the ratio value is between 19-20.99, display 19
elseif i_output-atflv between c_19 and c_2099.
i_output1-atflv = c_19.
If the ratio value is between 21-22.99, display 21
elseif i_output-atflv between c_21 and c_2299.
i_output1-atflv = c_21.
If the ratio value is greater than or equal to 23, display 23
elseif i_output-atflv >= c_23.
i_output1-atflv = c_23.
endif.
write i_output1-atflv to i_output1-atflv .
else.
write i_output-atflv to i_output1-atflv exponent 0 decimals 0.
endif.
collect i_output1.
clear i_output1.
endloop.
sort i_output1 by atinn werks matnr atflv.
endform. " COLLECT_RATIO
<b>Reward points for useful Answers</b>
Regards
Anji -
Copy of Material Master charac. values to the batch classif. in GR for PO
Dear gurus,
Could you please help me with the following issue. I have a material managed in batches, and it has a classification type 023 in material master. I fill one chaacteristic of this classification with some value. Now I want this value to be copied to the batch classification during the creation of new batch while making GR to production order.
Is it possible?Hi Nikolaj,
What I am understand your requirement is like,
You want to fetch the value of Characteristic maintain in Batch class in Material master to the Batches, correct?
But my Friend if you maintain value of characteristic in Batch Class in material master then it will works as a validation.
For Example,
Suppose your Characteristic is Colour and in Material Master Batch classification view you have maintain value as Red.Then system will not allow you any other colour in Batches.You will find that value in Drop Down list.
Regards,
Dhaval -
About material master data batch input
hello
i wrote a batch input for material master data. but it can't work ,i can't use it to create material.hope someone help me!thanks.code is below.
report z_mat_batchinput no standard page heading
line-size 255 message-id YB.
mat batch input
include bdcrecx1.
include .
tables: mara,marm,MARC,MARD,T134,NRIV,T006A,T023,T001W,T001L,
TVKO,TVTW,T025,TTGR,TLGR,TVKWZ,T006.
data: DIMID like t006-DIMID.
data: flag, K, tmp.
DATA: X TYPE I.
************ÉÏÔØÎļþÄÚ±í************************
data: begin of record occurs 0,
MATNR(018), " ÎïÁϺÅ
MTART(004), " ÎïÁÏÀàÐÍ
**generaldata1**
MAKTX(040), " ÎïÁÏÃèÊö
EAKTX(040), " Ó¢ÎÄÃèÊö
MEINS(003), " »ù±¾¼ÆÁ¿µ¥Î»
MATKL(009), " ÎïÁÏ×é
BISMT(018), " ¾ÉÎïÁϺÅ
EXTWG(018), " ÍⲿÎïÁÏ×é
SPART(002), " ²¿ÃÅ
MTPOS_MARA(004), " ÆÕͨÏîÄ¿Àà±ð×é
BRGEW(017), " ëÖØ
GEWEI(003), " ÖØÁ¿µ¥Î»
NTGEW(017), " ¾»ÖØ
VOLUM(017), " Ìå»ý
VOLEH(003), " Ìå»ýµ¥Î»
GROES(032), " Á¿¸Ù
MAGRV(004), " ÎïÁÏ×éµÄ°ü×°Îï
**generaldata2**
NORMT(018), " ¹¤Òµ±ê×¼ÃèÊö
FERTH(018), " ÀàÐÍ
WRKST(048), " ¹æ¸ñ
**generaldata1**
EAN11(018), " ²úÆ·±íʶÂë
**generaldata2**
ZEIAR(003), " ÎĵµÀàÐÍ£¬ºÏÀí´¢±¸ÖÜתÆÚ
WERKS(004), " ¹¤³§
VKORG(004), " ÏúÊÛ×éÖ¯
VTWEG(002), " ·ÖÏúÇþµÀ
**salesorg 1**
VRKME(003), " ÏúÊÛµ¥Î»
VMREN(006), " ÏúÊÛµ¥Î»×ª»»Òò×Ó
VMREZ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó
SPART(002), " ²úÆ·×é
DWERK(004), " ½»»õ¹¤³§
TAXKM(001), " ÎïÁÏË°·ÖÀà
**salesorg 2**
KONDM(002), " ÎïÁ϶¨¼Û×é
KTGRM(002), " ¿ÆÄ¿ÉèÖÃ×é
MVGR1(003), " ÎïÁÏ×é 1
MVGR2(003), " ÎïÁÏ×é 2
MTPOS(004), " ÏîÄ¿Àà±ð×é
VERSG(001), " ÎïÁÏͳ¼Æ×é
**ÏúÊÛ£ºÒ»°ã/¹¤³§Êý¾Ý**
MTVFP(002), " ¿ÉÓÃÐÔ¼ì²é
XCHPF(001), " Åú´Î¹ÜÀí
YCHPF(001), " ÅúÁ¿¹ÜÀí
TRAGR(004), " ÔËÊä×é
ladgr(004), " ×°ÔØ×é
**pur**
BSTME(003), " ¶©µ¥µ¥Î»
UMREZ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó
UMREN(006), " ¶©µ¥µ¥Î»×ª»»Òò×Ó
WEBAZ(003), " ÊÕ»õ´¦Àíʱ¼ä
EKGRP(003), " ²É¹º×é
LGORT(004), " ¿â´æµØ
**Ò»°ã¹¤³§Êý¾Ý/²Ö´¢1**
AUSME(003), " ·¢»õµ¥Î»
UMREJ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó
UMREF(006), " ·¢»õµ¥Î»×ª»»Òò×Ó
XCHPF(001), " ÅúÁ¿¹ÜÀí
**MRP 1**
DISGR(004), " MRP×é
DISMM(002), " MRPÀàÐÍ
FXHOR(003), " ¼Æ»®µÄʱ½ì
DISPO(003), " MRP¿ØÖÆÕß
DISLS(002), " ÅúÁ¿
MAABC(001), " ABC±êʶ
BSTFE(018), " ¹Ì¶¨ÅúÁ¿´óС
**MRP 2**
RESKZ(001), " »ñÈ¡ÀàÐÍ
BESKZ(001), " ²É¹ºÀàÐÍ
SOBSL(002), " ÌØÊâ²É¹ºÀà
LGPRO(004), " ·¢»õ²Ö´¢µØµã
RGEKZ(001), " ·´³å
PLIFZ(003), " ¼Æ»®½»»õʱ¼ä
VEBAZ(003), " ÊÕ»õ´¦Àíʱ¼ä
DZEIT(008), "×ÔÖÆÉú²ú
FHORI(003), " ¼Æ»®±ß¼ÊÂë
EISBE(018), " °²È«¿â´æ
**MRP 3**
PERKZ(001), " ÆÚ¼ä±êʶ
STRGR(002), " ²ßÂÔ×é
VRMOD(001), " ÏûºÄģʽ
VINT1(003), " ÄæÏòÏûºÄÆÚ¼ä
VINT2(003), " ÏòÇ°ÏûºÄÆÚ¼ä
NTVFP(002), " ¿ÉÓÃÐÔ¼ì²é
**MRP 4**
SAUFT(001), " Öظ´ÖÆÔì±êÖ¾
SFEPR(004), " Öظ´Éú²ú²ÎÊýÎļþ
**¹¤×÷¼Æ»®**
FEVOR(003), " Éú²úµ÷¶ÈÔ±
FRTME(003), " Éú²úµ¥Î»
SMREZ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó
SMREN(006), " Éú²úµ¥Î»×ª»»Òò×Ó
UEETK(001), " ÎÞÏÞÖƹýÁ¿½»»õ
**»á¼Æ 1**
BKLAS(004), " ÆÀ¹ÀÀà
BWTTY(001), " ¹À¼Û·ÖÀà
VPRSV(001), " ¼Û¸ñ¿ØÖÆ
PEINH(006), " ¼Û¸ñµ¥Î»
VERPR(015), " Òƶ¯Æ½¾ù¼Û
STPRS(015), " ±ê×¼¼Û
**»á¼Æ 2**
BWPRH(014), " ÉÌÒµ¼Û¸ñ 1
**³É±¾ 1**
LOSGR(018), " ÅúÁ¿³É±¾ºËËã
**³É±¾ 2**
ZPLP1(014), " ¼Æ»®¼Û¸ñ 1
ZPLD1(010), " ¼Æ»®ÈÕÆÚ 1
**qm**
ART1(8), "¼ìÑéÀàÐÍ1
AKTIV1(1), "ÒѼ¤»î
QMPUR(1), "¼¤»î²É¹ºÖÐµÄ QM
SSQSS(8), "QM ¿ØÖÆÂë¡¢
QMATV(8), "QM¼ìÑéÉèÖÃ
ART2(8), "¼ìÑéÀàÐÍ2
AKTIV2(6), "ÒѼ¤»î
ART3(8), "¼ìÑéÀàÐÍ3
AKTIV3(6), "ÒѼ¤»î
end of record.
************ÏÂÔظñʽ/´íÎóÎļþÄÚ±í**************
data: begin of record1 occurs 0,
MATNR(018), " ÎïÁϺÅ
MTART(008), " ÎïÁÏÀàÐÍ
**»ù±¾Êý¾Ý1**
MAKTX(040), " ÎïÁÏÃèÊö
EAKTX(040), " Ó¢ÎÄÃèÊö
MEINS(013), " »ù±¾¼ÆÁ¿µ¥Î»
MATKL(009), " ÎïÁÏ×é
BISMT(018), " ¾ÉÎïÁϺÅ
EXTWG(018), " ÍⲿÎïÁÏ×é
SPART(002), " ²¿ÃÅ
MTPOS_MARA(004), " ÆÕͨÏîÄ¿Àà±ð×é
BRGEW(017), " ëÖØ
GEWEI(008), " ÖØÁ¿µ¥Î»
NTGEW(017), " ¾»ÖØ
VOLUM(017), " Ìå»ý
VOLEH(008), " Ìå»ýµ¥Î»
GROES(032), " Á¿¸Ù
MAGRV(014), " ÎïÁÏ×éµÄ°ü×°Îï
**»ù±¾Êý¾Ý2**
NORMT(018), " ¹¤Òµ±ê×¼ÃèÊö
FERTH(018), " ÀàÐÍ
WRKST(048), " ¹æ¸ñ
**»ù±¾Êý¾Ý1**
EAN11(018), " ²úÆ·±íʶÂë
**»ù±¾Êý¾Ý2**
ZEIAR(003), " ÎĵµÀàÐÍ£¬ºÏÀí´¢±¸ÖÜתÆÚ
WERKS(004), " ¹¤³§
VKORG(008), " ÏúÊÛ×éÖ¯
VTWEG(008), " ·ÖÏúÇþµÀ
**ÏúÊÛ×éÖ¯ 1**
VRKME(003), " ÏúÊÛµ¥Î»
VMREN(006), " ÏúÊÛµ¥Î»×ª»»Òò×Ó
VMREZ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó
SPART(006), " ²úÆ·×é
DWERK(008), " ½»»õ¹¤³§
TAXKM(010), " ÎïÁÏË°·ÖÀà
**ÏúÊÛ×éÖ¯ 2**
KONDM(010), " ÎïÁ϶¨¼Û×é
KTGRM(010), " ¿ÆÄ¿ÉèÖÃ×é
MVGR1(003), " ÎïÁÏ×é 1
MVGR2(003), " ÎïÁÏ×é 2
MTPOS(010), " ÏîÄ¿Àà±ð×é
VERSG(001), " ÎïÁÏͳ¼Æ×é
**ÏúÊÛ£ºÒ»°ã/¹¤³§Êý¾Ý**
MTVFP(010), " ¿ÉÓÃÐÔ¼ì²é
XCHPF(008), " Åú´Î¹ÜÀí
YCHPF(001), " ÅúÁ¿¹ÜÀí
TRAGR(006), " ÔËÊä×é
ladgr(006), " ×°ÔØ×é
**²É¹º**
BSTME(003), " ¶©µ¥µ¥Î»
UMREZ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó
UMREN(006), " ¶©µ¥µ¥Î»×ª»»Òò×Ó
WEBAZ(003), " ÊÕ»õ´¦Àíʱ¼ä
EKGRP(006), " ²É¹º×é
LGORT(004), " ¿â´æµØ
**Ò»°ã¹¤³§Êý¾Ý/²Ö´¢1**
AUSME(003), " ·¢»õµ¥Î»
UMREJ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó
UMREF(006), " ·¢»õµ¥Î»×ª»»Òò×Ó
XCHPF(001), " ÅúÁ¿¹ÜÀí
**MRP 1**
DISGR(004), " MRP×é
DISMM(009), " MRPÀàÐÍ
FXHOR(003), " ¼Æ»®µÄʱ½ì
DISPO(011), " MRP¿ØÖÆÕß
DISLS(004), " ÅúÁ¿
MAABC(007), " ABC±êʶ
BSTFE(018), " ¹Ì¶¨ÅúÁ¿´óС
**MRP 2**
RESKZ(001), " »ñÈ¡ÀàÐÍ
BESKZ(008), " ²É¹ºÀàÐÍ
SOBSL(002), " ÌØÊâ²É¹ºÀà
LGPRO(004), " ·¢»õ²Ö´¢µØµã
RGEKZ(001), " ·´³å
PLIFZ(012), " ¼Æ»®½»»õʱ¼ä
VEBAZ(003), " ÊÕ»õ´¦Àíʱ¼ä
DZEIT(008), "×ÔÖÆÉú²ú
FHORI(010), " ¼Æ»®±ß¼ÊÂë
EISBE(018), " °²È«¿â´æ
**MRP 3**
PERKZ(008), " ÆÚ¼ä±êʶ
STRGR(006), " ²ßÂÔ×é
VRMOD(001), " ÏûºÄģʽ
VINT1(003), " ÄæÏòÏûºÄÆÚ¼ä
VINT2(003), " ÏòÇ°ÏûºÄÆÚ¼ä
NTVFP(010), " ¿ÉÓÃÐÔ¼ì²é
**MRP 4**
SAUFT(001), " Öظ´ÖÆÔì±êÖ¾
SFEPR(004), " Öظ´Éú²ú²ÎÊýÎļþ
**¹¤×÷¼Æ»®**
FEVOR(003), " Éú²úµ÷¶ÈÔ±
FRTME(003), " Éú²úµ¥Î»
SMREZ(006), " »ù±¾µ¥Î»×ª»»Òò×Ó
SMREN(006), " Éú²úµ¥Î»×ª»»Òò×Ó
UEETK(001), " ÎÞÏÞÖƹýÁ¿½»»õ
**»á¼Æ 1**
BKLAS(006), " ÆÀ¹ÀÀà
BWTTY(001), " ¹À¼Û·ÖÀà
VPRSV(008), " ¼Û¸ñ¿ØÖÆ
PEINH(008), " ¼Û¸ñµ¥Î»
VERPR(015), " Òƶ¯Æ½¾ù¼Û
STPRS(015), " ±ê×¼¼Û
**»á¼Æ 2**
BWPRH(014), " ÉÌÒµ¼Û¸ñ 1
**³É±¾ 1**
LOSGR(018), " ÅúÁ¿³É±¾ºËËã
**³É±¾ 2**
ZPLP1(014), " ¼Æ»®¼Û¸ñ 1
ZPLD1(010), " ¼Æ»®ÈÕÆÚ 1
**ÖÊÁ¿¹ÜÀí**
ART1(8), "¼ìÑéÀàÐÍ1
AKTIV1(6), "ÒѼ¤»î
QMPUR(010), "¼¤»î²É¹ºÖÐµÄ QM
SSQSS(8), "QM ¿ØÖÆÂë¡¢
QMATV(8), "QM¼ìÑéÉèÖÃ
ART2(8), "¼ìÑéÀàÐÍ2
AKTIV2(6), "ÒѼ¤»î
ART3(8), "¼ìÑéÀàÐÍ3
AKTIV3(6), "ÒѼ¤»î
end of record1.
selection-screen begin of block 0 with frame title text-001.
selection-screen begin of line .
selection-screen position 1.
parameters: test like rkec1-test .
selection-screen
comment 3(4) text-004 for field test.
selection-screen position 26.
parameters: oldfile like rlgrap-filename.
selection-screen
comment 9(17) text-003 for field oldfile.
selection-screen: end of line.
selection-screen begin of line.
selection-screen position 1.
parameters: dnldflag like rkec1-test default 'X'.
selection-screen
comment 3(4) text-005 for field dnldflag.
selection-screen position 26.
parameters: outfile like rlgrap-filename .
selection-screen
comment 9(17) text-006 for field outfile.
selection-screen: end of line.
selection-screen end of block 0 .
SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE TEXT-002.
selection-screen begin of line.
selection-screen position 1.
PARAMETERS: GEN1 LIKE RKEC1-TEST.
selection-screen
comment 3(9) text-007 for field GEN1.
selection-screen position 26.
PARAMETERS: GEN2 LIKE RKEC1-TEST.
selection-screen
comment 28(9) text-008 for field GEN2.
selection-screen end of line.
selection-screen begin of line.
selection-screen position 1.
PARAMETERS: SALORG1 LIKE RKEC1-TEST.
selection-screen
comment 3(21) text-009 for field SALORG1.
selection-screen position 26.
PARAMETERS: SALORG2 LIKE RKEC1-TEST.
selection-screen
comment 28(21) text-010 for field SALORG2.
selection-screen position 51.
PARAMETERS: SALPLANT LIKE RKEC1-TEST.
selection-screen
comment 53(19) text-011 for field SALPLANT.
selection-screen end of line.
selection-screen begin of line.
selection-screen position 1.
PARAMETERS: PURCHASE LIKE RKEC1-TEST.
selection-screen
comment 3(21) text-012 for field PURCHASE.
selection-screen position 26.
PARAMETERS: PLTSTRG1 LIKE RKEC1-TEST.
selection-screen
comment 28(21) text-018 for field PLTSTRG1.
selection-screen end of line.
selection-screen begin of line.
selection-screen position 1.
PARAMETERS: MRP1 LIKE RKEC1-TEST.
selection-screen
comment 3(4) text-013 for field MRP1.
selection-screen position 13.
PARAMETERS: MRP2 LIKE RKEC1-TEST.
selection-screen
comment 15(4) text-014 for field MRP2.
selection-screen position 26.
PARAMETERS: MRP3 LIKE RKEC1-TEST.
selection-screen
comment 28(4) text-015 for field MRP3.
selection-screen position 37.
PARAMETERS: MRP4 LIKE RKEC1-TEST.
selection-screen
comment 39(4) text-016 for field MRP4.
selection-screen position 51.
PARAMETERS: PLANTSTR LIKE RKEC1-TEST.
selection-screen
comment 53(8) text-017 for field PLANTSTR.
selection-screen end of line.
selection-screen begin of line.
selection-screen position 1.
PARAMETERS: QAU LIKE RKEC1-TEST.
selection-screen
comment 3(8) text-023 for field QAU.
selection-screen position 13.
PARAMETERS: ACC1 LIKE RKEC1-TEST.
selection-screen
comment 15(5) text-019 for field ACC1.
selection-screen position 26.
PARAMETERS: ACC2 LIKE RKEC1-TEST.
selection-screen
comment 28(5) text-020 for field ACC2.
selection-screen position 37.
PARAMETERS: COR1 LIKE RKEC1-TEST.
selection-screen
comment 39(5) text-021 for field COR1.
selection-screen position 51.
PARAMETERS: COR2 LIKE RKEC1-TEST.
selection-screen
comment 53(5) text-022 for field COR2.
selection-screen end of line.
SELECTION-SCREEN END OF BLOCK 1.
at selection-screen on value-request for oldfile.
call function 'KD_GET_FILENAME_ON_F4'
EXPORTING
mask = ',Îı¾Îļþ(ÖƱí·û·Ö¸ô),*.txt'
static = 'X'
CHANGING
file_name = oldfile.
at selection-screen on value-request for outfile.
call function 'KD_GET_FILENAME_ON_F4'
EXPORTING
mask = ',Microsoft Excel¹¤×÷²¾,*.xls'
static = 'X'
CHANGING
file_name = outfile.
initialization.
******µÃµ½ÎļþĿ¼*******
call function 'WS_QUERY'
EXPORTING
query = 'CD'
IMPORTING
return = outfile.
if sy-subrc <> 0.
message e005 with outfile.
endif.
oldfile = outfile.
concatenate outfile 'mat_fat' into outfile.
*ÅúÊäÈëĬÈÏÃû³Æ
group = 'MATBATCHIN'.
start-of-selection.
if dnldflag eq 'X' and not ( outfile is initial ).
perform download_data.
stop.
endif.
perform upload_data.
if test = ' '.
*ÊÓͼ²ÎÊý¼ì²é
IF ( GEN1 NE 'X' AND GEN2 NE 'X' AND SALORG1 NE 'X'
AND SALORG2 NE 'X' AND SALPLANT NE 'X'
AND PURCHASE NE 'X' AND PLTSTRG1 NE 'X'
AND MRP1 NE 'X' AND MRP2 NE 'X' AND MRP3 NE 'X'
AND MRP4 NE 'X' AND PLANTSTR NE 'X'
AND ACC1 NE 'X' AND ACC2 NE 'X'
AND COR1 NE 'X' AND COR2 NE 'X' and qau ne 'X' ) .
MESSAGE E000 WITH 'ÇëÑ¡ÔñÐèά»¤ÊÓͼ'.
ENDIF.
perform open_group.
SORT RECORD BY WERKS MATNR.
loop at record.
perform bdc_fill.
perform bdc_transaction using 'MM01'.
clear: bdcdata.
refresh: bdcdata.
endloop.
perform close_group.
else.
perform file_check.
endif.
end-of-selection.
*& Form UPLOAD_DATA
ÉÏÔØÅúÊäÈëÊý¾Ý
--> p1 text
<-- p2 text
form upload_data.
call function 'WS_UPLOAD'
EXPORTING
filename = oldfile
filetype = 'DAT'
TABLES
data_tab = record
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_table_width = 4
invalid_type = 5
no_batch = 6
unknown_error = 7
gui_refuse_filetransfer = 8
customer_error = 9
others = 10.
if sy-subrc <> 0.
message E000 with 'ÇëÊäÈëÉÏÔØÎļþ'.
endif.
read table record with key MATNR = '**'.
if sy-tabix lt 1.
message E000 with 'ÉÏÔØÎļþÎļþÍ·ÓëÊý¾ÝÖ®¼äÎÞ**'.
endif.
delete record from 1 to sy-tabix.
endform. " UPLOAD_DATA
*& Form BDC_FILL
ÅúÊäÈë
--> p1 text
<-- p2 text
form bdc_fill.
data: N type I,
M type I,
S_MATNR(018),
test(1) type N.
PERFORM BDC_FILL_INITALSCR. "³õʼÆÁÄ»
tmp = '0'.
condense record-matnr no-gaps.
test = record-matnr(1).
if test <> ''.
M = STRLEN( RECORD-MATNR ).
M = 18 - M.
DO M TIMES.
CONCATENATE '0' RECORD-MATNR INTO S_MATNR.
RECORD-MATNR = S_MATNR.
ENDDO.
endif.
**ÅжÏÎïÁÏ»ù±¾ÊÓͼÊÇ·ñÒѾ±»Î¬»¤¹ý**
SELECT SINGLE * FROM MARA WHERE MATNR = RECORD-MATNR.
IF SY-SUBRC NE 0.
K = '0'.
Else.
condense MARA-PSTAT no-gaps.
N = strlen( mara-pstat ).
M = 0.
record-meins = mara-meins.
do N times.
K = MARA-PSTAT+M.
IF K = 'K'.
EXIT.
ENDIF.
M = M + 1.
enddo.
ENDIF.
IF ( ( GEN1 EQ 'X' OR GEN2 EQ 'X' ) AND SALORG1 NE 'X'
AND SALORG2 NE 'X' AND SALPLANT NE 'X'
AND PURCHASE NE 'X' AND PLTSTRG1 NE 'X'
AND MRP1 NE 'X' AND MRP2 NE 'X' AND MRP3 NE 'X'
AND MRP4 NE 'X' AND PLANTSTR NE 'X'
AND ACC1 NE 'X' AND ACC2 NE 'X'
AND COR1 NE 'X' AND COR2 NE 'X' and qau ne 'X' ) .
IF K EQ 'K'.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(15)'.
perform bdc_field using 'BDC_OKCODE'
'/N'.
ELSE.
PERFORM BDC_FILL_CHOICEVIEW. "Ñ¡ÔñÊÓͼ
ENDIF.
ELSE.
PERFORM BDC_FILL_CHOICEVIEW. "Ñ¡ÔñÊÓͼ
PERFORM BDC_FILL_ORGVIEW. "×éÖ¯¼¶±ð
ENDIF.
TRANSLATE record-MEINS TO UPPER CASE.
TRANSLATE record-BSTME TO UPPER CASE.
TRANSLATE record-VRKME TO UPPER CASE.
TRANSLATE record-FRTME TO UPPER CASE.
TRANSLATE record-AUSME TO UPPER CASE.
if gen1 eq 'X'.
IF K NE 'K'.
PERFORM GENERALDATA1.
ENDIF.
endif.
if gen2 eq 'X'.
IF K NE 'K'.
perform generaldata2.
ENDIF.
endif.
if salorg1 eq 'X'.
perform salorg1.
endif.
if salorg2 eq 'X'.
perform salorg2.
endif.
if salplant eq 'X'.
perform salplant.
endif.
if purchase eq 'X'.
perform purchasedata.
endif.
if mrp1 eq 'X'.
perform MRP1.
endif.
if mrp2 eq 'X'.
perform MRP2.
endif.
if mrp3 eq 'X'.
perform MRP3.
endif.
if mrp4 eq 'X'.
perform MRP4.
endif.
if PLANTSTR eq 'X'.
perform PLANTSTR.
endif.
if PLTSTRG1 eq 'X'.
perform PLTSTRG1.
endif.
if qau eq 'X'.
perform qualitydata.
endif.
if ACC1 eq 'X'.
perform ACC1DATA.
endif.
if ACC2 eq 'X'.
perform ACC2DATA.
endif.
if COR1 eq 'X'.
perform COR1DATA.
endif.
if COR2 eq 'X'.
perform COR2DATA.
endif.
perform BDC_SAVE.
endform. " BDC_FILL
*& Form GENERALDATA1
Ò»°ãÊý¾Ý 1
--> p1 text
<-- p2 text
form generaldata1.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
"'=ZU01'.
'/00'.
perform bdc_field using 'MAKT-MAKTX'
record-MAKTX. " ÎïÁÏÃèÊö
perform bdc_field using 'MARA-MEINS'
record-MEINS. " »ù±¾¼ÆÁ¿µ¥Î»
perform bdc_field using 'MARA-MATKL'
record-MATKL. " ÎïÁÏ×é
perform bdc_field using 'MARA-BISMT'
record-BISMT.
perform bdc_field using 'MARA-EXTWG'
record-EXTWG.
perform bdc_field using 'MARA-SPART'
record-SPART.
perform bdc_field using 'MARA-MTPOS_MARA'
record-MTPOS_MARA.
perform bdc_field using 'BDC_CURSOR'
'MARA-GROES'.
perform bdc_field using 'MARA-BRGEW'
record-BRGEW.
if record-gewei = '' and ( salorg1 = 'X' or salorg2 = 'X'
or salplant = 'X' ).
perform bdc_field using 'MARA-GEWEI'
'KG'. " ÖØÁ¿µ¥Î»
else.
perform bdc_field using 'MARA-GEWEI'
record-GEWEI. " ÖØÁ¿µ¥Î»
endif.
perform bdc_field using 'MARA-NTGEW'
record-NTGEW.
perform bdc_field using 'MARA-VOLUM'
record-VOLUM.
perform bdc_field using 'MARA-VOLEH'
record-VOLEH.
perform bdc_field using 'MARA-GROES'
record-GROES.
condense record-EAN11 no-gaps.
if record-EAN11 <> ''.
perform bdc_field using 'MARA-EAN11'
record-EAN11.
perform bdc_field using 'MARA-NUMTP'
'HT'.
endif.
perform bdc_field using 'MARA-MAGRV'
record-MAGRV.
perform bdc_dynpro using 'SAPLMGMM' '4300'.
perform bdc_field using 'BDC_OKCODE'
'=ZU02'.
condense record-EAKTX no-gaps.
if record-EAKTX <> ''.
perform bdc_field using 'SKTEXT-SPRAS(2)'
'EN'.
perform bdc_field using 'SKTEXT-MAKTX(2)'
record-EAKTX.
endif.
perform bdc_dynpro using 'SAPLMGMM' '4300'.
perform bdc_field using 'BDC_OKCODE'
'=MAIN'.
if record-meins <> 'PAK'.
perform bdc_field using 'SMEINH-UMREN(05)'
'1'.
perform bdc_field using 'SMEINH-MEINH(05)'
'PAK'.
perform bdc_field using 'SMEINH-UMREZ(05)'
'1'.
endif.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
endform. " GENERALDATA
*& Form generaldata2
Ò»°ãÊý¾Ý 2
--> p1 text
<-- p2 text
FORM generaldata2.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MAKT-MAKTX'
record-MAKTX.
perform bdc_field using 'BDC_CURSOR'
'MARA-NORMT'.
condense record-ferth no-gaps.
if record-ferth <> ''.
perform bdc_field using 'MARA-FERTH'
record-FERTH.
endif.
perform bdc_field using 'MARA-NORMT'
record-NORMT.
perform bdc_field using 'MARA-WRKST'
record-WRKST.
perform bdc_field using 'MARA-ZEIAR'
record-ZEIAR.
ENDFORM. " generaldata2
*& Form salorg1
ÏúÊÛ×éÖ¯ 1
--> p1 text
<-- p2 text
FORM salorg1.
condense RECORD-SPART no-gaps.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'MAKT-MAKTX'
RECORD-MAKTX. " ÎïÁÏÃèÊö
IF K NE 'K'.
perform bdc_field using 'MARA-MEINS'
record-MEINS. " »ù±¾¼ÆÁ¿µ¥Î»
ENDIF.
perform bdc_field using 'MARA-SPART'
record-SPART. " ²úÆ·×é
perform bdc_field using 'MVKE-DWERK'
record-DWERK. " ½»»õ¹¤³§
PERFORM BDC_FIELD USING 'MG03STEUER-TAXKM(01)'
RECORD-TAXKM. " ÎïÁÏË°·ÖÀà
condense RECORD-VRKME no-gaps.
IF RECORD-MEINS <> RECORD-VRKME and RECORD-VRKME <> ''.
perform bdc_field using 'MVKE-VRKME'
record-VRKME. " ÏúÊÛµ¥Î»
select single * from MARM where matnr = record-matnr
and meinh = record-vrkme.
if SY-SUBRC NE 0.
tmp = 'W'.
select single * from t006 where MSEHI = record-meins.
if t006-DIMID = 'AAAADL'.
DIMID = ''.
else.
DIMID = t006-DIMID.
endif.
select single * from t006 where MSEHI = record-vrkme.
if dimid <> t006-DIMID.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0510'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'RMMZU-UMREN'
record-VMREN. "ÏúÊÛµ¥Î»×ª»»Òò×Ó
perform bdc_field using 'RMMZU-UMREZ'
record-VMREZ. "»ù±¾µ¥Î»×ª»»Òò×Ó
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
endif.
endif.
ENDIF.
perform bdc_dynpro using 'SAPLMGMM' '4200'.
perform bdc_field using 'BDC_OKCODE' " µ÷ÓÃË°Àà×ÓÆÁÄ»
'/00'.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.
PERFORM BDC_FIELD USING 'BDC_OKCODE' " ·µ»ØÏúÊÛ×éÖ¯ 1ÆÁÄ»
'/00'.
ENDFORM. " salorg1
*& Form salorg2
ÏúÊÛ×éÖ¯ 2
--> p1 text
<-- p2 text
FORM salorg2.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'MVKE-KTGRM'.
PERFORM BDC_FIELD USING 'MVKE-VERSG'
RECORD-VERSG. " ÎïÁÏͳ¼Æ×é
PERFORM BDC_FIELD USING 'MVKE-KTGRM'
RECORD-KTGRM. " ¿ÆÄ¿ÉèÖÃ×é
PERFORM BDC_FIELD USING 'MVKE-KONDM'
RECORD-KONDM. " ÎïÁ϶¨¼Û×é
perform bdc_field using 'MVKE-MTPOS'
RECORD-MTPOS. " ÏîÄ¿Àà±ð×é
PERFORM BDC_FIELD USING 'MVKE-MVGR1'
RECORD-MVGR1. " ÎïÁÏ×é 1
PERFORM BDC_FIELD USING 'MVKE-MVGR2'
RECORD-MVGR2. " ÎïÁÏ×é 2
ENDFORM. " salorg2
*& Form salplant
ÏúÊÛ£ºÒ»°ã/¹¤³§Êý¾Ý
--> p1 text
<-- p2 text
FORM salplant.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
select single * from marc where matnr = record-matnr
and werks = record-werks.
if SY-SUBRC NE 0 OR MARC-MTVFP = ''.
PERFORM BDC_FIELD USING 'MARC-MTVFP'
RECORD-MTVFP. " ¿ÉÓÃÐÔ¼ì²é
endif.
PERFORM BDC_FIELD USING 'MARA-TRAGR'
RECORD-TRAGR. " ÔËÊä×é
PERFORM BDC_FIELD USING 'MARC-LADGR'
RECORD-LADGR. " ×°ÔØ×é
perform bdc_field using 'MARC-XCHPF'
record-XCHPF. " ÅúÁ¿¹ÜÀí
ENDFORM. " salplant
*& Form PURCHASEDATA
²É¹ºÊý¾Ý
--> p1 text
<-- p2 text
form purchasedata.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MARC-WEBAZ'.
perform bdc_field using 'MAKT-MAKTX'
record-MAKTX.
IF K NE 'K'.
perform bdc_field using 'MARA-MEINS'
record-MEINS. " »ù±¾¼ÆÁ¿µ¥Î»
perform bdc_field using 'MARA-MATKL'
record-MATKL. " ÎïÁÏ×é
ENDIF.
condense RECORD-BSTME no-gaps.
IF RECORD-MEINS <> RECORD-BSTME and RECORD-BSTME <> ''.
perform bdc_field using 'MARA-BSTME'
record-BSTME. " ¶©µ¥µ¥Î»
select single * from MARM where matnr = record-matnr
and meinh = record-bstme.
if SY-SUBRC NE 0 and
( record-vrkme <> record-bstme or tmp <> 'W' ).
tmp = 'W'.
select single * from t006 where MSEHI = record-meins.
if t006-DIMID = 'AAAADL'.
DIMID = ''.
else.
DIMID = t006-DIMID.
endif.
select single * from t006 where MSEHI = record-bstme.
if dimid <> t006-DIMID.
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0510'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'RMMZU-UMREN'
record-UMREN. "¶©µ¥µ¥Î»×ª»»Òò×Ó
perform bdc_field using 'RMMZU-UMREZ'
record-UMREZ. "»ù±¾µ¥Î»×ª»»Òò×Ó
PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
endif.
endif.
ENDIF.
perform bdc_field using 'MARC-EKGRP'
record-EKGRP. " ²É¹º×é
perform bdc_field using 'MARC-WEBAZ'
record-WEBAZ. " ÊÕ»õ´¦Àíʱ¼ä
endform. " PURCHASEDATA
*& Form MRP1
text
--> p1 text
<-- p2 text
FORM MRP1.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'MAKT-MAKTX'
record-MAKTX. " ÎïÁÏÃèÊö
IF K NE 'K'.
perform bdc_field using 'MARA-MEINS'
record-MEINS. " »ù±¾µ¥Î»
ENDIF.
perform bdc_field using 'MARC-DISGR'
record-DISGR. " MRP×é
perform bdc_field using 'MARC-MAABC'
record-MAABC. " ABC±êʶ
perform bdc_field using 'MARC-DISMM'
record-DISMM. " MRPÀàÐÍ
perform bdc_field using 'MARC-FXHOR'
record-FXHOR. " ¼Æ»®µÄʱ½ì
perform bdc_field using 'MARC-DISPO'
record-DISPO. " MRP¿ØÖÆÕß
perform bdc_field using 'MARC-DISLS'
record-DISLS. " ÅúÁ¿
perform bdc_field using 'MARC-BSTFE'
Here is a sample program which creates a material with the bare minmal fields, this will get you started.
report zrich_0003 .
data: headdata type bapimathead.
data: clientdata type bapi_mara.
data: clientdatax type bapi_marax.
data: descdata type table of BAPI_MAKT with header line.
data: return type bapiret2 .
data: returnm type table of bapi_matreturn2 with header line.
data: xmara type mara.
parameters: p_matnr type mara-matnr.
headdata-material = p_matnr.
headdata-ind_sector = 'M'.
headdata-matl_type = 'FERT'.
headdata-basic_view = 'X'.
clientdata-BASE_UOM = 'EA'.
clientdatax-BASE_UOM = 'X'.
clientdata-old_mat_no = 'Old Material'.
clientdatax-old_mat_no = 'X'.
clientdata-division = '00'.
clientdatax-division = 'X'.
descdata-LANGU = sy-langu.
descdata-MATL_DESC = 'This is the description'.
append descdata.
call function 'BAPI_MATERIAL_SAVEDATA'
exporting
headdata = headdata
clientdata = clientdata
clientdatax = clientdatax
* PLANTDATA =
* PLANTDATAX =
* FORECASTPARAMETERS =
* FORECASTPARAMETERSX =
* PLANNINGDATA =
* PLANNINGDATAX =
* STORAGELOCATIONDATA =
* STORAGELOCATIONDATAX =
* VALUATIONDATA =
* VALUATIONDATAX =
* WAREHOUSENUMBERDATA =
* WAREHOUSENUMBERDATAX =
* SALESDATA =
* SALESDATAX =
* STORAGETYPEDATA =
* STORAGETYPEDATAX =
importing
return = return
tables
MATERIALDESCRIPTION = descdata
* UNITSOFMEASURE =
* UNITSOFMEASUREX =
* INTERNATIONALARTNOS =
* MATERIALLONGTEXT =
* TAXCLASSIFICATIONS =
returnmessages = returnm
* PRTDATA =
* PRTDATAX =
* EXTENSIONIN =
* EXTENSIONINX =
check sy-subrc = 0.
Regards,
Rich Heilman -
How to change price determination form blank to 2 on the material master?
Hi expert,
I had a difficult problem:
Material ledger is active in our company Normally, in material master data accounting view 1, we always set price determination 2 and price control V. Price determination 2 is set default if creating a material master by entering no price determination.
Today, my Key user came accross a prblem: In our company, for batch processing of material master, we made a mistake that price determination were set blank (neither 2 or 3, In MBEW table, field MLAST is blank) when inputting material master. all data were imported without error warnings. But ,acturally, all materials' price determination in accounting view 1 was set Blank! This is a big problem that we can not release standard price or do any other price changing~~~.
I have used CKMM to try to change price determination. But it failed: it can not identify this situation because old price determination must be set a word rather than blank in CKMM.
I don't know any other solutions to change price determination from Blank into 2.
Hope you can help me out. Very thankful!Hello,
I have the same problem with a type material, the material ledger is active but the price determination were set blank.
I already checked the OMX1 transaction... and all configurations of ML and type material and apparently is ok.
Has anyone knows the solution?
(maybe with applying a program or SAP note).
Please help.
Regards,
Eliana -
Inspection Characteristic in the material master (Classification)
Dear All,
Please anyone tell me the cycle for maintaining the characteristics in the material master (classification tab) using batch classification.
or give me a link for the same.
regards,
RishabhHi Rishab,
Below links can help you
http://help.sap.com/saphelp_470/helpdata/en/4d/2b8bd043ad11d189410000e829fbbd/content.htm
http://scn.sap.com/thread/1783839
http://help.sap.com/saphelp_470/helpdata/en/2d/350a19448c11d189420000e829fbbd/content.htm
http://scn.sap.com/thread/2046143
http://help.sap.com/saphelp_46c/helpdata/en/2d/350a19448c11d189420000e829fbbd/content.htm
below steps will help
Creation of Batch Class in (CL01)
Assignment of above created classed characteristic to the Batch Class at the time of class creation. (CL01)
Assignment of batch class to material master in classification view. (MM01)
Creation of MIC with reference to above created Class characteristic (QS21)
Creation of inspection plan with above MIC (QP01)
Follow your business process cycle for creation of inspection lot
Result recording and usage decision (QA32)
You can see in MSC2N that batch characteristic will get updated.
Best regards,
Sharat
Maybe you are looking for
-
Hi Experts, We have one scenario W/C in PP(wc category m/c) = Equipment in Plant maintenance Is it possible to block the W/C automatically whenever there is creation of maintenance order for equipment(w/c for PP) so that it is blocked in routing and
-
Oracle Traspostion of Col to Rows
Hi I have A table after processing a file like Building Person B New P AMit B Old P Raj B Old P akshay B
-
FTP Transport Method in Data Services SAP Applications Datastore
Hi, We have SAP ECC and we are trying to install Rapidmarts for SD and Finance.When we try to run the Rapidmart Job.. We are getting the error Error opening the file c:\temp\billingblock.daa We are using FTP transport method as our SAP servers are U
-
I've a scenerio where i've to updated LIKP table, when user save the HUPAST. I've created the BDC program which update the likp table using VL02N transacton. but when i'm calling the BDC from a BADI its giving a error, as i'm trying to update the sam
-
Photoshop CC gets stuck on scanning for plugins
Windows 8.1 i7 256Gb SSHD Photoshop Creative Cloud newly updated On clicking photoshop icon task manager show photoshop stuck in Background Process doesn't move up to Apps if photoshop later starts after many minutes then it gets stuck for min