11-26-2011 10:34 PM
Hello,
For mateiral in MM02 in tab MPR3 we have KMAT material and classification button.
That classification is different for many materials with the same KMAT material.
Could you advice me how can I get that classification?
Thanks in advance
11-27-2011 10:02 AM
Hi,
There is no Classification field in MRP3 view.
Can you please elaborate what are you looking for?
Is it the classification View you are talking about ???
If yes, then use the below code to get the values of the class...
*--Get the class values from the BAPI
CALL FUNCTION 'BAPI_OBJCL_GETCLASSES'
EXPORTING
objectkey_imp = 'Material number'
objecttable_imp = 'MARA'
classtype_imp = '001'
keydate = sy-datum
language = sy-langu
TABLES
alloclist = lt_alloc
return = t_return.
*--Get the characteristics values from the BAPI
CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
EXPORTING
objectkey = 'Material Number'
objecttable = 'MARA'
classnum = lw_alloc-classnum
classtype = lw_alloc-classtype
keydate = sy-datum
language = sy-langu
Unevaluated_chars = u2018Xu2019
TABLES
allocvaluesnum = lt_dummy1
allocvalueschar = lt_values
allocvaluescurr = lt_dummy
return = t_return.
you can also refer to the below tables:
CABN/CABNT--> Characteristic name description
CAWN/CAWNT--> Characteristic Name
Thanks,
Manish
11-27-2011 10:02 AM
Hi,
There is no Classification field in MRP3 view.
Can you please elaborate what are you looking for?
Is it the classification View you are talking about ???
If yes, then use the below code to get the values of the class...
*--Get the class values from the BAPI
CALL FUNCTION 'BAPI_OBJCL_GETCLASSES'
EXPORTING
objectkey_imp = 'Material number'
objecttable_imp = 'MARA'
classtype_imp = '001'
keydate = sy-datum
language = sy-langu
TABLES
alloclist = lt_alloc
return = t_return.
*--Get the characteristics values from the BAPI
CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
EXPORTING
objectkey = 'Material Number'
objecttable = 'MARA'
classnum = lw_alloc-classnum
classtype = lw_alloc-classtype
keydate = sy-datum
language = sy-langu
Unevaluated_chars = u2018Xu2019
TABLES
allocvaluesnum = lt_dummy1
allocvalueschar = lt_values
allocvaluescurr = lt_dummy
return = t_return.
you can also refer to the below tables:
CABN/CABNT--> Characteristic name description
CAWN/CAWNT--> Characteristic Name
Thanks,
Manish
11-27-2011 2:34 PM
This classification is variant for Configurable material.
It's not simple classification for material but based on configurable material -> it's like instance of classification based on Configurable material.
11-28-2011 6:25 AM
Hi Edward,
Just try with tcode CL30N, enter class name, class type (should be 300), select the material code and get the related characteristic values.
Hope this could help.
Bye,
Flavio
11-28-2011 8:50 AM
Hi,
Thanks for your input Flavio. I know that i can see that using CL30N or CU44.
So maybe i will ask in another way.
Do you know FM which I can use to get data for "Configure variant" for material and than update theme?
Thanks in advance,
E
Edited by: edward_WW on Nov 28, 2011 10:15 AM
11-30-2011 6:41 AM
Hi Edward,
I believe you can try with VC_I_GET_CONFIGURATION_IBASE, giving CUOBJ from MARC for that material.
Bye,
Flavio
11-30-2011 2:41 PM
Hi Edward,
I think thej following code will help:
Get configuration MARA
lv_cuobj = ls_mara-cuobf.
lv_object = ls_mara-satnr.
Start Balluff
CALL FUNCTION 'CUXM_GET_CONFIGURATION'
EXPORTING
instance = ls_mara-cuobf
WERKS =
IMPORTING
ET_RETURN =
TABLES
t_e1cucfg = i_e1cucfg
t_e1cuins = i_e1cuins
t_e1cuval = i_e1cuval
t_e1cucom = i_e1cucom
EXCEPTIONS
instance_not_found = 1
internal_error = 2
instance_is_a_classification = 3
OTHERS = 4
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SELECT * FROM marc INTO TABLE lt_marc
WHERE matnr = ls_mara-matnr
AND werks IN r_plant
AND stdpd IN r_stdpd.
LOOP AT lt_marc INTO ls_marc.
Konfiguration aus MARC lesen
CLEAR: ic_e1cucfg, ic_e1cuins, ic_e1cuval, ic_e1cucom.
REFRESH: ic_e1cucfg, ic_e1cuins, ic_e1cuval, ic_e1cucom.
CALL FUNCTION 'CUXM_GET_CONFIGURATION'
EXPORTING
instance = ls_marc-cuobj
werks = ls_marc-werks
IMPORTING
ET_RETURN =
TABLES
t_e1cucfg = ic_e1cucfg
t_e1cuins = ic_e1cuins
t_e1cuval = ic_e1cuval
t_e1cucom = ic_e1cucom
EXCEPTIONS
instance_not_found = 1
internal_error = 2
instance_is_a_classification = 3
OTHERS = 4.
IF sy-subrc <> 0.
neu anlegen
CALL FUNCTION 'MATERIAL_SAVE_CONFIGURATION'
EXPORTING
material = ls_marc-matnr
conf_matl = ls_mara-satnr
plant = ls_marc-werks
conf_matl_plant = ls_mara-satnr
IMPORTING
return = h_return
TABLES
E1CUCFG = i_e1cucfg
E1CUINS = i_e1cuins
E1CUVAL = i_e1cuval
E1CUCOM = i_e1cucom
e1cucfg_w = i_e1cucfg
e1cuins_w = i_e1cuins
e1cuval_w = i_e1cuval
e1cucom_w = i_e1cucom
E1CUCFG_V =
E1CUINS_V =
E1CUVAL_V =
E1CUCOM_V =
returnmessages = i_returnmessages.
ELSE.
MARC AENDERN
CALL FUNCTION 'MATERIAL_SAVE_CONFIGURATION'
EXPORTING
material = ls_marc-matnr
conf_matl = ls_mara-satnr
plant = ls_marc-werks
conf_matl_plant = ls_mara-satnr
IMPORTING
return = h_return
TABLES
E1CUCFG = i_e1cucfg
E1CUINS = i_e1cuins
E1CUVAL = i_e1cuval
E1CUCOM = i_e1cucom
e1cucfg_w = ic_e1cucfg
e1cuins_w = ic_e1cuins
e1cuval_w = i_e1cuval
e1cucom_w = ic_e1cucom
E1CUCFG_V =
E1CUINS_V =
E1CUVAL_V =
E1CUCOM_V =
returnmessages = i_returnmessages.
ENDIF.
COMMIT WORK AND WAIT.
best regards
Gerd