2009 Jan 05 11:04 AM
hi ppl,
I need material characteristics..so is it feasiable to compare objkey with matnr.does it work???
2009 Jan 05 11:07 AM
hi ppl,
I need material characteristics..so is it feasiable to compare objkey with matnr.does it work???
2009 Jan 05 11:07 AM
2009 Jan 05 11:08 AM
2009 Jan 05 11:11 AM
how about mseg-matnr = ausp-objkey...but some objkey in ausp does not exists in mseg table even though the classification view is selected...
2009 Jan 05 11:14 AM
hI,
Yes u can compare with ausp objeck with mara-matnr
also try with FM CLAF_CLASSIFICATION_OF_OBJECTS.
by giving class type->001..
Regards,
Nagaraj
2014 Mar 24 11:31 AM
Compare ausp-objeck with mara-matnr dont worked for me.
I used the FM CLAF_CLASSIFICATION_OF_OBJECTS and works fine.
Thanks!
2009 Jan 05 11:18 AM
Hi,
You can compare.
Please find the below for piece of code
Regards,
Jyothi CH.
2009 Jan 05 11:21 AM
below is the code i did so far..please tell me how to use that FM
REPORT zp_non_onco_drug_purch12.
TYPES: BEGIN OF ausp,
objek TYPE cuobn,
atinn TYPE atinn,
END OF ausp,
tt TYPE STANDARD TABLE OF ausp.
DATA: itab_ausp TYPE tt,
wa_ausp TYPE ausp.
TYPES: BEGIN OF mseg,
matnr TYPE matnr,
END OF mseg,
tt1 TYPE STANDARD TABLE OF mseg.
DATA: itab_mseg TYPE tt1,
wa_mseg TYPE mseg.
TYPES: BEGIN OF dummy,
matnr TYPE matnr,
atinn TYPE atinn,
END OF dummy,
tt2 TYPE STANDARD TABLE OF dummy.
DATA: itab_atwtb TYPE atwtb OCCURS 0 WITH HEADER LINE.
DATA: itab_dummy TYPE tt2,
wa_dummy TYPE dummy.
DATA: lf_objek LIKE inob-objek.
DATA: lf_matnr TYPE matnr.
SELECT-OPTIONS: so_objek FOR lf_objek.
SELECT-OPTIONS: so_matnr FOR lf_matnr.
SELECT matnr FROM mseg INTO TABLE itab_mseg WHERE matnr IN so_matnr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = so_objek
IMPORTING
output = so_objek.
SELECT objek atinn FROM ausp INTO TABLE itab_ausp "FOR ALL ENTRIES IN ITAB_MSEG
WHERE objek IN so_objek. "ITAB_MSEG-MATNR.
LOOP AT itab_ausp INTO wa_ausp.
READ TABLE itab_mseg INTO wa_mseg WITH KEY matnr = wa_ausp-objek.
IF sy-subrc = 0.
MOVE wa_ausp-objek TO wa_dummy-matnr.
MOVE wa_ausp-atinn TO wa_dummy-atinn.
APPEND wa_dummy TO itab_dummy.
ENDIF.
ENDLOOP.
SELECT atwtb FROM cawnt INTO TABLE itab_atwtb FOR ALL ENTRIES IN
itab_dummy WHERE atinn = itab_dummy-atinn.
LOOP AT itab_atwtb. "INTO WA_DUMMY.
WRITE:/ itab_atwtb.
ENDLOOP.
2009 Jan 05 11:44 AM
1) Yes definitely you can compare MARA-MATNR and AUSP-OBJEK.
But keep in mind that MATNR is 18 char in length and OBJEK is 50 char in length.
In some cases you need to get a compatibility between the two using customized field MATNR of 50 char.
2) You can also refer FMs like 'CLAF_CLASSIFICATION_OF_OBJECTS' and 'CTMS_OBJECT_HAS_STANDARDCLASS'.
refer to code below using both the above points:
&----
*& Form SUB_GET_LIPS
&----
To get the Material Number and the Batch Number and also for
bringing compatibility between Material Number (LIPS-MATNR)
and Key of object to be classified (AUSP-OBJEK).
----
FORM sub_get_lips .
Local Declaration:
-------------------
DATA: lit_vttp TYPE STANDARD TABLE OF gty_vttp.
Check for INITIAL
-------------------
IF NOT git_vttp[] IS INITIAL.
Passing the Value to Local Internal Table
-------------------------------------------
lit_vttp[] = git_vttp[].
SORT lit_vttp[] BY vbeln.
Removing the Duplicate Entries
--------------------------------
DELETE ADJACENT DUPLICATES FROM lit_vttp COMPARING vbeln.
SELECT vbeln "Delivery Number
matnr "Material Number
charg "Batch Number
FROM lips
INTO TABLE git_lips
FOR ALL ENTRIES IN lit_vttp
WHERE vbeln = lit_vttp-vbeln.
IF sy-subrc EQ 0 .
SORT git_lips ASCENDING BY vbeln.
ENDIF .
Clearing the Local Internal Table
----------------------------------
Refresh: lit_vttp[].
ENDIF.
To avoid the type mismatch between git_LIPS-MATNR and git_AUSP-OBJEK.
----------------------------------------------------------------------
Check for INITIAL
-------------------
IF NOT git_lips[] IS INITIAL.
LOOP AT git_lips INTO gwa_lips.
gwa_lips_temp-vbeln = gwa_lips-vbeln.
gwa_lips_temp-objek = gwa_lips-matnr.
gwa_lips_temp-charg = gwa_lips-charg.
APPEND gwa_lips_temp TO git_lips_temp.
Clearing the Work Areas
------------------------
CLEAR : gwa_lips_temp,
gwa_lips.
ENDLOOP.
IF sy-subrc EQ 0 .
SORT git_lips_temp ASCENDING BY vbeln.
ENDIF.
ENDIF.
ENDFORM. " SUB_GET_LIPS
&----
*& Form SUB_MATERIAL_CHARACTERISTICS
&----
Getting the Material Characteristics Values.
----
FORM sub_material_characteristics .
Check for INITIAL
-------------------
IF NOT git_lips_temp[] IS INITIAL.
SELECT objek "Key of Object to be Classified
atinn "Internal Characteristic
atwrt "Material Characteristic Value
FROM ausp
INTO TABLE git_ausp
FOR ALL ENTRIES IN git_lips_temp
WHERE objek = git_lips_temp-objek
AND klart = gc_classtype. "klart = 001
IF sy-subrc EQ 0 .
SORT git_ausp ASCENDING BY objek atinn.
ENDIF .
ENDIF.
ENDFORM. " SUB_MATERIAL_CHARACTERISTICS
&----
*& Form SUB_BATCH_CHARACTERISTICS
&----
Getting the Batch Characteristics Values.
----
FORM sub_batch_characteristics .
LOOP AT git_lips_temp INTO gwa_lips_temp.
To build the Object Key.
--------------------------
gwa_objk-matnr = gwa_lips_temp-objek.
gwa_objk-charg = gwa_lips_temp-charg.
For Concatenating
-------------------
CONCATENATE gwa_objk-matnr gwa_objk-charg INTO gwa_objk-objectkey.
To get the Class Number
------------------------
Checks for INITIAL
--------------------
IF NOT gwa_lips_temp-charg IS INITIAL.
IF NOT gwa_lips_temp-objek IS INITIAL.
CALL FUNCTION 'CTMS_OBJECT_HAS_STANDARDCLASS'
EXPORTING
object = gwa_objk-objectkey "Object Key
table = gc_batches "MCH1
classtype = gc_classtype2 "023
IMPORTING
class = gv_class "Class Number
EXCEPTIONS
no_classification = 1
table_not_allowed = 2
internal_error = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
ENDIF.
CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
EXPORTING
class = gv_class "Class Number
classtype = gc_classtype2 "023
object = gwa_objk-objectkey "Object Key
objecttable = gc_batches "MCH1
TABLES
t_class = git_class
t_objectdata = git_objectdata
EXCEPTIONS
no_classification = 1
no_classtypes = 2
invalid_class_type = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
ENDIF.
ENDIF.
ENDIF.
Appending the Work Area data to the Internal Table
---------------------------------------------------
APPEND gwa_objk TO git_objk.
loop at git_objectdata into gwa_objectdata.
if gwa_objectdata-ausp1 is not initial.
move gwa_objk-objectkey to gwa_charval-objectkey .
move gwa_objectdata-ausp1 to gwa_charval-ausp1.
move gwa_objectdata-atnam to gwa_charval-atnam.
append gwa_charval to git_charval.
endif.
endloop.
Refreshing Internal Tables
---------------------------
REFRESH git_objectdata .
Clearing the Work Area
-----------------------
CLEAR gwa_objk.
ENDLOOP.
ENDFORM. " SUB_BATCH_CHARACTERISTICS
2009 Jan 05 11:46 AM
thank you people..last one more.we have to tick mark for charesteristic value..so only the ticked charestristic value should be displayed..can anybody tell me the logic..
2009 Jan 06 10:47 AM