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

Classification and Characteristics



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Function Modules | Функциональные модули
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Tue Sep 18, 2007 4:51 pm    Post subject: Classification and Characteristics Reply with quote

BAPI_OBJCL_CHANGE - Classification BAPI: Change Assignment

BAPI_OBJCL_CHANGE_KEY - Classification BAPI: Change Properties of Assignment (Key)

BAPI_OBJCL_CONCATENATEKEY - Classification BAPI: Generate Concatenated Key

Code:

*1) Ищем  obtab
    CALL FUNCTION 'VB_BATCH_DEFINITION'
      IMPORTING
        obtab = gv_obtab.


* 2) Формируем ключ
  lt_objects-key_field = 'MATNR'.
  lt_objects-value_int = matnr.
  APPEND lt_objects.
  lt_objects-key_field = 'CHARG'.
  lt_objects-value_int = charg.
  APPEND lt_objects.



  CALL FUNCTION 'BAPI_OBJCL_CONCATENATEKEY'
    EXPORTING
      objecttable    = gv_obtab
    IMPORTING
      objectkey_conc = lv_objectkey
    TABLES
      objectkeytable = lt_objects
      return         = lt_return.

  SELECT SINGLE cuobj
           FROM inob
           INTO lv_objek
          WHERE obtab = gv_obtab
            AND objek = lv_objectkey.

  IF sy-subrc EQ 0.

* Классификация партии
    SELECT   a~atinn
             a~adzhl
             a~atwrt
             a~atflv
             b~atnam AS charact
        FROM ausp AS a INNER JOIN cabn AS b ON
                     a~atinn = b~atinn AND
                     a~adzhl = b~adzhl
        INTO
       TABLE lt_prizn
       WHERE objek = lv_objek
         AND mafid = 'O'
         AND klart = '023'.


READ TABLE lt_prizn WITH KEY charact = 'DATAPM'.
..... 


BAPI_OBJCL_CONCATENATEKEY_KEY - Classification BAPI: Generate Concatenated Key (Key)

BAPI_OBJCL_CREATE - Classification BAPI: Create Assignment

BAPI_OBJCL_CREATE_KEY - BAPI classification: Create assignment (key)

BAPI_OBJCL_DELETE - Classification BAPI: Delete Assignment

BAPI_OBJCL_DELETE_KEY - Classification BAPI: Delete Assignment (Key)

BAPI_OBJCL_EXISTENCECHECK - Classification BAPI: Check Existence of Classification

BAPI_OBJCL_EXISTENCECHECK_KEY - Classification BAPI: Check Existence of a Classification (Key)

BAPI_OBJCL_GETCLASSES - Classification BAPI: Classes for Object

BAPI_OBJCL_GETCLASSES_KEY - Classification BAPI: Classes for Object (Key)

BAPI_OBJCL_GETDETAIL - Classification BAPI: Read Classification Information on Object
Code:
DATA: i_allocvaluesnum LIKE bapi1003_alloc_values_num
                          OCCURS 0 WITH HEADER LINE,
       i_allocvalueschar LIKE bapi1003_alloc_values_char
                          OCCURS 0 WITH HEADER LINE,
       i_allocvaluescurr LIKE bapi1003_alloc_values_curr
                          OCCURS 0 WITH HEADER LINE,
       i_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
 DATA l_classnum LIKE  bapi1003_key-classnum.

 DEFINE caract_char.
   read table i_allocvalueschar with key charact = '&1'.
   if sy-subrc = 0.
     i_listado-&1 = i_allocvalueschar-value_char.
   endif.
 END-OF-DEFINITION.

   SELECT SINGLE * FROM  kssk
    WHERE objek  = i_docs(33)
      AND mafid  = 'O'.
   IF sy-subrc = 0.
     SELECT SINGLE class FROM klah
       INTO l_classnum
      WHERE clint = kssk-clint.
     CALL FUNCTION 'BAPI_OBJCL_GETDETAIL'
          EXPORTING
               objectkey       = kssk-objek
               objecttable     = 'DRAW'
               classnum        = l_classnum
               classtype       = kssk-klart
          TABLES
               allocvaluesnum  = i_allocvaluesnum
               allocvalueschar = i_allocvalueschar
               allocvaluescurr = i_allocvaluescurr
               return          = i_return.


BAPI_OBJCL_GETDETAIL_KEY - Classification BAPI: Read Classification Information (Key)

BAPI_OBJCL_GETOBJECTS - Classification BAPI: Find by Assignment

BAPI_OBJCL_GETOBJECTS_KEY - Classification BAPI: Find Assignment (Key)

BAPI_OBJCL_GETSTATUS - Classification BAPI: Classification Status of Object

BAPI_OBJCL_GETSTATUS_KEY - Classification BAPI: Classification Status for Object (Key)

BAPI_OBJCL_GET_KEY_OF_OBJECT - Classification BAPI: Key of Object

BAPI_OBJCL_GET_OBJECT_OF_KEY - Classification BAPI: Object for Key

BAPI_OBJCL_PROXY_CREATE - Proxy BAPI for Sales Order Upload in SFA Context: Create

BAPI_OBJCL_SPLITKEY - Classification BAPI: Decomposition of Concatenated Key

BAPI_OBJCL_SPLITKEY_KEY - Classification BAPI: Decomposition of Concatenated Key

BAPI_OBJID_GETLIST - Get new object IDs

BAPI_CLASS_SELECT_OBJECTS - Find Objects in Class

BAPI_CLASS_GET_CHARACTERISTICS - Import Characteristics and Allowed Values for Class

BAPI_CLASS_GET_CLASSIFICATIONS - Read Values Assigned to Objects in Class

CLAF_CLASSIFICATION_OF_OBJECTS - Classification Data for Object
Code:

data: t_class like sclass occurs 0 with header line,
      t_objectdata like clobjdat occurs 0 with header line,
      object like ausp-objek.
...
move i_mara-matnr to object.
...
call function 'CLAF_CLASSIFICATION_OF_OBJECTS'
               exporting
                              class = 'ИМЯ КЛАССА'
                           classtext = 'X'
                           classtype = '001'
                            language = sy-langu
                              object = object
                  tables
                             t_class = t_class
                        t_objectdata = t_objectdata
              exceptions
                   no_classification = 1
                       no_classtypes = 2
                  invalid_class_type = 3.


Code:
  DATA:
    l_objek TYPE ausp-objek,
    lt_class_p    TYPE sclass OCCURS 0,
    lt_objectdata_p TYPE clobjdat OCCURS 0 WITH HEADER LINE,
    lt_sel_char TYPE sel_char OCCURS 0 WITH HEADER LINE.

    REFRESH lt_sel_char.
    CALL FUNCTION 'CONVERSION_EXIT_ATINN_INPUT'
      EXPORTING
        input  = 'IPDM_PARPR'
      IMPORTING
        output = lt_sel_char-atinn.

    APPEND lt_sel_char.

    l_objek = vbdpr-matnr.
    CHECK NOT l_objek IS INITIAL.

    CALL FUNCTION 'CLAF_CLASSIFICATION_OF_OBJECTS'
      EXPORTING
        class                = 'IPDM_PRVAR'  "Product Variant Code
        classtext            = 'X'
        classtype            = '001'
        features             = 'X'
*        clint                = '0000000032'
        language             = sy-langu
        object               = l_objek
        key_date             = sy-datum
        initial_charact      = 'X'
        no_value_descript    = 'X'
        inherited_char       = 'X'
        objecttable          = 'MARA'
      TABLES
        t_class              = lt_class_p
        t_objectdata         = lt_objectdata_p
        i_sel_characteristic = lt_sel_char
      EXCEPTIONS
        no_classification    = 1
        invalid_class_type   = 2.

    IF sy-subrc IS INITIAL.
      READ TABLE lt_objectdata_p INDEX 1.
      IF sy-subrc IS INITIAL.
        form_items-prodcode = lt_objectdata_p-ausp1.
      ENDIF.
    ENDIF.


CACL_OBJECT_READ_VALIDATION - Klassifizierung: Bewertungen zum Objekt lesen (ХЗ, сами переводите)

CLSD_CALL_SEARCH_DIALOG - Aufruf der Objektsuche im Dialog (ХЗ, сами переводите)

CLSC_SEARCH_OBJECTS - Suche nach klassifizierten Objekten innerhalb einer Klasse/ Hierachie (см. коммент выше)

CLSC_SEARCH_IN_CLASSTYPE - Suchen von Objekten innerhalb einer Klassenart

CLFM_SELECT_AUSP - Klassifizierung: Lesen AUSP

CLSE_REFRESH_TMP - Clear buffers of FM below

CLSE_SELECT_AUSP - Database access for table AUSP

CLSE_SELECT_CABN - Read and buffer CABN entries for classification system

CLSE_SELECT_CABNT - Read and buffer CABNT entries for classification system

CLSE_SELECT_CABN_VIA_NAME - Lesen eines Merkmalssatzes _ber den Merkmalnamen

CLSE_SELECT_CABN_VIA_NAMERANGE - Read and buffer CABN entries for classification system

CLSE_SELECT_CABN_VIA_OBJECTTAB - Lesen alle Objektmerkmale zu den Objekten in T_TABLES

CLSE_SELECT_CAWN - Read and buffer CAWN entries for classification system

CLSE_SELECT_CAWNT - Read and buffer CAWNT entries for classification system

CLSE_SELECT_KLAH - Read and buffer KLAH entries for classification system

CLSE_SELECT_KLAH_VIA_NAMERANGE - Read and buffer KLAH entries for classification system

CLSE_SELECT_KLAT - Read and buffer KLAT entries for classification system

CLSE_SELECT_KSML - Read and buffer KSML entries for classification system

CLSE_SELECT_KSSK - Read and buffer KSSK entries for classification system

CLSE_SELECT_KSSK_0 - Read and buffer KSSK entries for classification system

CLSE_SELECT_KSSK_CP - Klassifizierung: Lesen KSSK mit Objektnummer maskiert(f_r F4-Suche)

CLSE_SELECT_SWOR - Read and buffer SWOR entries for classification system

CLSE_SELECT_TCME - Read and buffer TCME entries for classification system

CLSE_SELECT_USR01 - Read and buffer USR01 entries for classification system

CUCB_GET_VALUES_FROM_INSTANCE - Receives configuration number (and, optionally, business object and timestamp of configuration version).
Returns table of characteristic values.

Code:
*get and print characteristics and their values for the sales order item. 
report z.
parameters: p_vbeln like vbap-vbeln obligatory memory id aun,
p_posnr like vbap-posnr obligatory memory id apo.

data: begin of characteristics occurs 0,
atnam like cabn-atnam,
atwrt like ausp-atwrt,
atval like ausp-atwrt,
end of characteristics.

data characteristic_value like ausp-atwrt.

types: ibco2_value_rec like ibvalue0.
types: ibco2_value_tab type ibco2_value_rec occurs 100.
data: lt_values type ibco2_value_tab,
w_values like line of lt_values.

data: w_cuobj like vbap-cuobj,
w_atinn like ausp-atinn.

*******************
start-of-selection.
*******************
*I. get configuration number for the SO item:
select single cuobj into w_cuobj from vbap
where vbeln = p_vbeln
and posnr = p_posnr.
if sy-subrc <> 0.
write: 'Sales Order not found'.
stop.
endif.
if w_cuobj is initial.
write: 'Sales Order has no configuration'.
stop.
endif.

*II. first try to get Internal characteristic # and value from AUSP
* (ver 3.1 or older)
select atinn atwrt into (w_atinn, characteristics-atval) from ausp
where objek = w_cuobj.
select atnam into characteristics-atnam from cabn
where atinn = w_atinn.
select atwrt into characteristics-atwrt from ausp
where objek = characteristics-atnam.
append characteristics.
endselect.
endselect.
endselect.

*III. for 4.5 and 4.6 version use BAPI call
* to replace AUSP to get char name and char value
if characteristics[] is initial.
call function 'CUCB_GET_VALUES_FROM_INSTANCE'
exporting
iv_instance = w_cuobj
importing
et_values = lt_values
exceptions
invalid_instance = 1
others = 2.
if sy-subrc ne 0.
write: 'Sales Order configuration not found'.
stop.
endif.
loop at lt_values into w_values.
characteristics-atval = w_values-atwrt.
select atnam into characteristics-atnam from cabn
where atinn = w_values-atinn.
select atwrt into characteristics-atwrt from ausp
where objek = characteristics-atnam.
append characteristics.
endselect.
endselect.
endloop.
endif.

************
top-of-page.
************
write: /(30) 'Characteristic name',
(30) 'Characteristic',
(30) 'Characteristic value'.


*****************
end-of-selection.
*****************

loop at characteristics.
write: / characteristics-atnam,
characteristics-atwrt,
characteristics-atval.
endloop.
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 -> Function Modules | Функциональные модули 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 can 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.