2006 Jun 14 3:17 PM
Can anyone suggest a function module or bapi I can use to get values for characteristics.
We are using characteristics to store additional information about fleet vehicles that are not included as standard SAP fields.
At the moment, I am using a couple of database calls, using tables 'CABN' and 'AUSP' to find values of these characteristics for a particular vehicle.
There must be an easier way, using a function module or bapi. Could anyone shed some light?
2006 Jun 19 2:05 PM
Hi Stuart,
You can use 'BAPI_OBJCL_GETCLASSES' and 'BAPI_OBJCL_GETDETAIL' to get the value of the characteristics.
See the Example.
(I am assuming that you are mentioning about the characteristics of an Equipment)
ws_equipment = 1012122.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = ws_equipment
IMPORTING
output = ws_equipment.
i_object-object = ws_equipment.
i_object-objecttable = EQUI.
i_object-classtype = 002.
APPEND i_object.
CALL FUNCTION 'BAPI_OBJCL_GETCLASSES'
EXPORTING
objectkey_imp = i_object-object
objecttable_imp = i_object-objecttable
classtype_imp = i_object-classtype
read_valuations = 'X'
TABLES
alloclist = i_alloclist
allocvalueschar = i_allocvaluescharnew
allocvaluesnum = i_allocvaluesnumnew
allocvaluescurr = i_allocvaluescurrnew
return = i_return.
LOOP AT i_alloclist.
CASE i_alloclist-classnum.
WHEN "classname".
CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
EXPORTING
objectkey = i_object-object
objecttable = i_object-objecttable
classnum = i_alloclist-classnum
classtype = i_object-classtype
unvaluated_chars = 'X'
TABLES
allocvaluesnum = i_allocvaluesnumnew
allocvalueschar = i_allocvaluescharnew
allocvaluescurr = i_allocvaluescurrnew
return = i_return.
LOOP AT i_allocvaluescharnew.
CASE i_allocvaluescharnew-charact.
WHEN characteristic name
Fetch the current value of the characteristic from i_allocvaluescharnew-value_char
ENDCASE.
ENDLOOP.
Tip: If the characteristic is NUM, then get the corresponding value from i_allocvaluesnumnew
Regards,
Bittu
2006 Jun 14 3:20 PM
2006 Jun 14 3:21 PM
You can use the bapi: BAPI_CLASS_GET_CHARACTERISTIC
Regards,
ravi
2006 Jun 14 3:22 PM
Have you tried...... CUOBJ is the internal object number. This works good for us when getting characteristics for a sales doc item(VBAP-CUOBJ).
* Internal Table for Characteristic Data
data: begin of i_char occurs 0.
include structure comw.
data: end of i_char.
clear i_char. refresh i_char.
* Retrieve Characteristics.
call function 'CUD0_GET_VAL_FROM_INSTANCE'
exporting
instance = cuobj
tables
attributes = i_char
exceptions
instance_not_found = 1.
Is this what you are looking for?
Regards,
Rich Heilman
2007 Feb 28 5:38 AM
2006 Jun 14 4:29 PM
Hi,
you can try this BAPI <b>BAPI_CLASS_GET_CLASSIFICATIONS</b>
Regards
vijay
2006 Jun 19 9:48 AM
Thanks for the replies guys.
I have had a look at
CLAF_CLASSIFICATION_OF_OBJECTS
BAPI_CLASS_GET_CHARACTERISTIC
BAPI_CLASS_GET_CLASSIFICATIONS
but either they don't do what I want, or my knowledge is insufficient :oP
As for CUOBJ - I am using equipment that have classifications, however the CUOBJ field in table EQUI is not filled.
2006 Jun 19 9:55 AM
Hi,
For a given object, the following functions should give the details of the classification / characteristic values.
BAPI_OBJCL_GETDETAIL
This will give the details of the classes to which the Equipement belongs
BAPI_OBJCL_GETCLASSES
Pass the Equipment number as the object number to the function modules.
Regards,
Ravi
2006 Jun 19 9:59 AM
Just check Function Modules <b>CLSE_SELECT_CABN and CLSE_SELECT_CAWN</b> for Reading characteristic attributes and Reading characteristic values respectively.
Also have a look at <b>BAPI_OBJCL_GETDETAIL</b> for which object table as 'MARA'.
rgds,
TM.
Please mark point if helpful.
2006 Jun 19 2:05 PM
Hi Stuart,
You can use 'BAPI_OBJCL_GETCLASSES' and 'BAPI_OBJCL_GETDETAIL' to get the value of the characteristics.
See the Example.
(I am assuming that you are mentioning about the characteristics of an Equipment)
ws_equipment = 1012122.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = ws_equipment
IMPORTING
output = ws_equipment.
i_object-object = ws_equipment.
i_object-objecttable = EQUI.
i_object-classtype = 002.
APPEND i_object.
CALL FUNCTION 'BAPI_OBJCL_GETCLASSES'
EXPORTING
objectkey_imp = i_object-object
objecttable_imp = i_object-objecttable
classtype_imp = i_object-classtype
read_valuations = 'X'
TABLES
alloclist = i_alloclist
allocvalueschar = i_allocvaluescharnew
allocvaluesnum = i_allocvaluesnumnew
allocvaluescurr = i_allocvaluescurrnew
return = i_return.
LOOP AT i_alloclist.
CASE i_alloclist-classnum.
WHEN "classname".
CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
EXPORTING
objectkey = i_object-object
objecttable = i_object-objecttable
classnum = i_alloclist-classnum
classtype = i_object-classtype
unvaluated_chars = 'X'
TABLES
allocvaluesnum = i_allocvaluesnumnew
allocvalueschar = i_allocvaluescharnew
allocvaluescurr = i_allocvaluescurrnew
return = i_return.
LOOP AT i_allocvaluescharnew.
CASE i_allocvaluescharnew-charact.
WHEN characteristic name
Fetch the current value of the characteristic from i_allocvaluescharnew-value_char
ENDCASE.
ENDLOOP.
Tip: If the characteristic is NUM, then get the corresponding value from i_allocvaluesnumnew
Regards,
Bittu
2006 Jun 20 8:41 AM
Here's what I currently use
SELECT SINGLE atinn FROM cabn INTO char_no
WHERE atnam = 'WARRANTY_SUPPLIER1'.
SELECT SINGLE atwrt FROM ausp INTO wa_vehicle-warr_supp1
WHERE objek = wa_vehicle-equnr
AND atinn = char_no.
Are there any reasons why I shouldn't do it this way?
It seems quicker than calling two BAPIs
2006 Jun 20 8:45 AM
There is no issue using your won select statement. Infact, if you drill down BAPI also will be fetching values from the same tables.
However, the BAPI will give you far more details. So, if you need more details you can use the BAPI without worrying about from which table they are coming.
In fact your SELECT statements might be more efficient in this case as the data you are selecting is limited.
Regards,
Ravi
Note : Please mark the helpful answers and close the thread if the issue is resolved.
2006 Jun 20 8:46 AM
You can do this way also...
The table which you are using are correct tables. classifications/characteristics values present in those tables.
Regards
vijay