The creation of a classification done with the BAPI_OBJCL_CHANGE. The biggest problem is to find out how the object key (ObjectKey) together, and which table (table object) must be filled.
The following approach can be applied:
Classification 'by hand' in the respective transaction create example when this happens in the transaction IW52 (Change service announcement) on the tab "positions" and mark the location of the LOWER 'LUPE' clicking (detail). In an opening window to the classification may be [the module consultant knows how each of them is the classification ].
After creating a classification with the classification name (in this example 'S_02_BELNR') in the field of the table ATNAM CABN the just-ranging search entry. For the record found the box in the table ATINN AUSP looking for (the maximum number of matches to 1 limit!). The record contains as found objects in the field the object key. In the example of the code, for example, the position of 0010 (so) in the database with'0001 'weggeschrieben!
The class number one takes when creating the classes offered here 'S_MELD_MIG'.
The table (table object) can be found on the customizing, transaction SPRO, Cross-application components, class system, classes, maintain key object or object types and class types. So here QMFE [the module advisers should also know) (memorized].
Code:
* für BAPI_OBJCL_CHANGE
DATA:
* export
objectkey LIKE bapi1003_key-object, " Objektschlüssel,
* konkateniert
objecttable LIKE bapi1003_key-objecttable, " Objekttabelle
classnum LIKE bapi1003_key-classnum, " Klassennummer
classtype LIKE bapi1003_key-classtype, " Klassenart
status LIKE bapi1003_key-status, " '1' Status der
* Klassifizierung
standardclass LIKE bapi1003_key-stdclass, " Kennzeichen:
* Standardklasse
changenumber LIKE bapi1003_key-changenumber, " Änderungsnummer
keydate LIKE bapi1003_key-keydate, " SY-DATUM Stichtag
no_default_values LIKE bapi1003_key-flag, " SPACE Vorschlagswerte
* import
classif_status LIKE bapi1003_key-status, " Status der
* Klassifizierung
* tables
* neue Bewertungen NUM,DATE,TIME
numnew LIKE bapi1003_alloc_values_num
OCCURS 0 WITH HEADER LINE,
* neue Bewertungen CHAR,BOOL
charnew LIKE bapi1003_alloc_values_char
OCCURS 0 WITH HEADER LINE,
* neue Bewertungen CURR
currnew LIKE bapi1003_alloc_values_curr
OCCURS 0 WITH HEADER LINE,
* Fehlermeldungen
return_bapi_objcl_change LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
*<SNIP>
* KLASSIFIKATION
PERFORM prepare_data_classification USING fname.
PERFORM bapi_objcl_change USING fname. " Klassifikation
*<SNIP>
*---------------------------------------------------------------------*
* Form prepare_data_CLASSIFICATION
*---------------------------------------------------------------------*
FORM prepare_data_classification USING objectkey.
* Export
*OBJECTKEY LIKE BAPI1003_KEY-OBJECT Objektschlüssel,
*konkateniert
*OBJECTTABLE LIKE BAPI1003_KEY-OBJECTTABLE Objekttabelle
*CLASSNUM LIKE BAPI1003_KEY-CLASSNUM Klassennummer
*CLASSTYPE LIKE BAPI1003_KEY-CLASSTYPE Klassenart
*STATUS LIKE BAPI1003_KEY-STATUS '1' Status der
* Klassifizierung
*STANDARDCLASS LIKE BAPI1003_KEY-STDCLASS
* Kennzeichen: Standardklasse
*CHANGENUMBER LIKE BAPI1003_KEY-CHANGENUMBER Änderungsnummer
*KEYDATE LIKE BAPI1003_KEY-KEYDATE SY-DATUM Stichtag
*NO_DEFAULT_VALUES LIKE BAPI1003_KEY-FLAG SPACE Vorschlagswerte
DATA: help_objkey(16).
help_objkey(12) = objectkey.
help_objkey+12(4) = '0001'.
MOVE help_objkey TO objectkey.
objecttable = 'QMFE'. " Name der Datenbanktabelle d. Objektes
classtype = '015'. " Fix für Meldungsposition
classnum = 'S_MELD_MIG'.
status = ''.
standardclass = ''.
keydate = sy-datum.
* Import
* CLASSIF_STATUS LIKE BAPI1003_KEY-STATUS Status der
* Klassifizierung
*---------------------------------------------------------------------*
* Form BAPI_OBJCL_CHANGE
*---------------------------------------------------------------------*
FORM bapi_objcl_change USING fname.
* wir sind im loop at split_tab.
MOVE fname TO objectkey.
* analog ZS3KLASSIFIZIERUNG
CALL FUNCTION 'BAPI_OBJCL_CHANGE'
EXPORTING
objectkey = objectkey
objecttable = objecttable
classnum = classnum
classtype = classtype
status = status
standardclass = standardclass
changenumber = changenumber
keydate = keydate
no_default_values = no_default_values
IMPORTING
classif_status = classif_status
TABLES
allocvaluesnumnew = numnew
allocvaluescharnew = charnew
allocvaluescurrnew = currnew
return = return_bapi_objcl_change
. " PUNKT !!
*Wenn das BAPI fehlerfrei abläuft, enthält die Tabelle Return keine
*Meldung des Typs 'E'.
*Zuordnung wurde angelegt: Meldung CL735
*Zuordnung wurde geändert: Meldung CL737
*Zuordnung wurde nicht geändert: Meldung CL738
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
* alles wird gut
*Dieses BAPI führt keine Änderung auf der Datenbank durch, dazu muß
*anschließend das BAPI BapiService.TransactionCommit aufgerufen werden!
PERFORM bapi_commit USING 'CLAF_CLASSIFICATION_OF_OBJECTS'.
ENDIF.
ENDFORM. " BAPI_OBJCL_CHANGE
*---------------------------------------------------------------------*
* Form bapi_commit
*---------------------------------------------------------------------*
FORM bapi_commit USING aufrufer.
DATA:
bapi_return TYPE bapiret2 OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = bapi_return.
* save_subrc = sy-subrc.
IF NOT bapi_return[] IS INITIAL.
LOOP AT bapi_return.
WRITE: / bapi_return-message.
ENDLOOP.
ELSE. " not bapi_return[] is initial
** Import
* EQUIPMENT LIKE BAPI_ITOB_PARMS-EQUIPMENT,
* DATA_GENERAL_EXP LIKE BAPI_ITOB,
* DATA_SPECIFIC_EXP LIKE BAPI_ITOB_EQ_ONLY,
* RETURN LIKE BAPIRET2,
CASE aufrufer.
* WHEN 'BAPI_EQUI_CREATE'.
* WRITE: /
* 'Equipment erfolgreich angelegt:'(011), equipment.
WHEN 'CLAF_CLASSIFICATION_OF_OBJECTS'.
WRITE: /
'Klassifikation erfolgreich angelegt:'(014), objectkey.
ENDCASE.
ENDIF. " not bapi_return[] is initial
ENDFORM. " bapi_commit
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.