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

BAPI_OBJCL_CHANGE



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Interfaces | Интерфейсы -> BAPI
View previous topic :: View next topic  
Author Message
vga
Мастер
Мастер


Age: 70
Joined: 04 Oct 2007
Posts: 1218
Location: Санкт-Петербург

PostPosted: Sat Nov 29, 2008 4:30 pm    Post subject: BAPI_OBJCL_CHANGE Reply with quote

BAPI_OBJCL_CHANGE - Classification BAPI: Change Assignment

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 Smile ].

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


* Tabellen
*neue Bewertungen NUM,DATE,TIME
*ALLOCVALUESNUMNEW LIKE BAPI1003_ALLOC_VALUES_NUM
**
*CHARACT ATNAM CHAR 30 0 Merkmalname
*VALUE_FROM ATFLV FLTP 16 16 interner Fließkomma-Wert von
*VALUE_TO ATFLB FLTP 16 16 interner Fließkomma-Wert bis
*VALUE_RELATION ATCOD CHAR 1 0 Code für Wertebeziehung
*UNIT_FROM MEINS UNIT 3 0 Basismengeneinheit
*UNIT_TO MEINS UNIT 3 0 Basismengeneinheit
*UNIT_FROM_ISO MEINS_ISO CHAR 3 0
* Basismengeneinheit im ISO-Code
*UNIT_TO_ISO MEINS_ISO CHAR 3 0 Basismengeneinheit im
*ISO-Code
*INHERITED FLINH CHAR 1 0 Kennzeichen: Merkmal ererbt
*INSTANCE ATZIS NUMC 3 0 Instanzenzähler
*CHARACT_DESCR ATBEZ CHAR 30 0 Merkmalbezeichnung


* neue Bewertungen CHAR,BOOL
*ALLOCVALUESCHARNEW LIKE BAPI1003_ALLOC_VALUES_CHAR
**
*CHARACT ATNAM CHAR 30 0 Merkmalname
*VALUE_CHAR ATWRT CHAR 30 0 Merkmalwert
*INHERITED FLINH CHAR 1 0 Kennzeichen: Merkmal ererbt
*INSTANCE ATZIS NUMC 3 0 Instanzenzähler
*VALUE_NEUTRAL ATWRT CHAR 30 0 Merkmalwert
*CHARACT_DESCR ATBEZ CHAR 30 0 Merkmalbezeichnung


* neue Bewertungen CURR
*ALLOCVALUESCURRNEW LIKE BAPI1003_ALLOC_VALUES_CURR
**
*CHARACT ATNAM CHAR 30 0 Merkmalname
*VALUE_FROM ATFLV FLTP 16 16 interner Fließkomma-Wert von
*VALUE_TO ATFLB FLTP 16 16 interner Fließkomma-Wert bis
*VALUE_RELATION ATCOD CHAR 1 0 Code für Wertebeziehung
*CURRENCY_FROM WAERS CUKY 5 0 Währungsschlüssel
*CURRENCY_TO WAERS CUKY 5 0 Währungsschlüssel
*CURRENCY_FROM_ISO ISOCD CHAR 3 0 Iso-Code Währung
*CURRENCY_TO_ISO ISOCD CHAR 3 0 Iso-Code Währung
*INHERITED FLINH CHAR 1 0 Kennzeichen: Merkmal ererbt
*INSTANCE ATZIS NUMC 3 0 Instanzenzähler
*CHARACT_DESCR ATBEZ CHAR 30 0 Merkmalbezeichnung

  CLEAR: charnew. REFRESH: charnew.
  charnew-charact    = 'S_02_SCHADKZ'.     " Schadenskennziffer
  charnew-value_char = split_tab-kziff.    " Merkmalwert
  APPEND charnew.
  charnew-charact    = 'S_02_KOSTL'.       " Merkmalname  Kostenstelle
  charnew-value_char = split_tab-kostl.    " Merkmalwert
  APPEND charnew.
  charnew-charact    = 'S_02_BELNR'.       " Merkmalname  Belegnummer
  charnew-value_char = split_tab-belnr.    " Merkmalwert
  APPEND charnew.
  charnew-charact    = 'S_02_WERT'.        " Merkmalname
  charnew-value_char = split_tab-wert.     " Merkmalwert  Wert
  APPEND charnew.

ENDFORM.                    " prepare_data_CLASSIFICATION


*---------------------------------------------------------------------*
*      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
Back to top
View user's profile Send private message Blog Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Interfaces | Интерфейсы -> BAPI 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.