SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Obtaining material characteristic value



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ММ
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sat Jan 31, 2009 12:01 pm    Post subject: Obtaining material characteristic value Reply with quote

Extracting Material classification Equipment No.

CLAF_CLASSIFICATION_OF_OBJECTS extracts all characteristics for a material and so is very slow. For a single characteristic e.g. EQUIPMENT NO a direct read on tables AUSP and CAWNT can be used instead.
The internal key for characteristic EQUIPMENTNO is read in INITIALIZATION. This is fixed within a client.
This and the material number is used to read the characteristic value from AUSP. The value is translated to external format by using this value as a key to CAWNT.

Code:
FORM get_classification
   changing p_display type ty_display.

  data: l_object type objnum,
        lt_class type table of sclass,
        lt_objectdata type table of clobjdat,
        l_objectdata type clobjdat,
        l_atwrt type atwrt,
        l_atwtb type atwtb.

  l_object = p_display-matnr.
  select single atwrt from ausp into l_atwrt
    where objek = l_object
      and atinn = g_equipment
      and mafid = 'O'
      and klart = '001'.

  if sy-subrc = 0.
    concatenate l_atwrt '%' into l_atwrt.
    select single atwtb from cawnt into l_atwtb
      where atinn = g_equipment
        and spras = sy-langu
        and atwtb like l_atwrt.

    if sy-subrc = 0.
      p_display-ausp1 = l_atwtb.
    endif.
  endif.
ENDFORM.


Code:
DATA: class like sclass occurs 0 with header line,
           objectdata like clobjdat occurs 0 with header line,
           classobject like ausp-objek,
           W_CHARACTERISTIC_VALUE like clobjdat-ausp1.

classobject = tvbdpa-matnr.

call function 'CLAF_CLASSIFICATION_OF_OBJECTS'
  exporting
    classtype = '001'
    features = 'X'
    language = sy-langu
    object = classobject
    objecttable = 'MARA'
  tables
    t_class = class
    t_objectdata = objectdata
  exceptions
    no_classification = 1
    no_classtypes = 2
    invalid_class_type = 3
    others = 4.

read table objectdata with key smbez = 'CLASS_NAME'.

if sy-subrc = 0.
  W_CHARACTERISTIC_VALUE = objectdata-ausp1.
endif.

if W_CHARACTERISTIC_VALUE = '?'.
  clear W_CHARACTERISTIC_VALUE.
endif.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ММ All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.