Fonction SAP BAPI_CASE_DELETEELEMENTS - Delete Elements from Record

Paramètre Reférence Type Long. Valeur par déf. Facultatif Description
DELETE_ONLY_FIRST BAPISRMREC-BOOLEAN C 1 'X' X Switch: Delete First Element Found or All Elements of this Type
GUID BAPISCMGCASE-CASE_GUID C 32 Technical Case Key (Case GUID)
NEW_VERSION BAPISRMREC-BOOLEAN C 1 X Switch: Save Record as New Version
SKIP_ERRORS BAPISRMREC-BOOLEAN C 1 X Switch: Stop Delete After First Error

Paramètre Reférence Long. Facultatif Description
ELEMENT_IDENT_RECPOS BAPIRECPOS 4 X Node ID in Record
ELEMENT_IDENT_SP_POID BAPIPROPME 324 X SP Part of Element POID, Including Encoded Element Type
RETURN BAPIRET2 548 Return Parameters

Functionality
This BAPI method is used to delete elements from a case record.
There are two ways of deleting a record element from the case: using thenode ID or using the element identification (SPS UD and SP POIDparameters). It is possible to use either of these alternatives or bothof them at once.

Example
* Fill table with node IDs
CLEAR element_ident_recpos.
wa_element_ident_recpos-rec_nodeid = '4'.
APPEND wa_element_ident_recpos TO element_ident_recpos.
* Fill SP POID table
CLEAR element_ident_sp_poid.
wa_element_ident_sp_poid-ELEM_NO = 1.
wa_element_ident_sp_poid-NAME = '%SPS_ID%'.
wa_element_ident_sp_poid-VALUE = 'SCMG_SPS_DOCUMENT'.
APPEND wa_element_ident_sp_poid TO element_ident_sp_poid.
  
wa_element_ident_sp_poid-NAME = 'DOC_ID'.
wa_element_ident_sp_poid-VALUE = 'SRM_DOC0408808EFD85ED7F4B95C91EAAD00CB1BE'.
APPEND wa_element_ident_sp_poid TO element_ident_sp_poid.
  
wa_element_ident_sp_poid-NAME = 'VARIANT'.
wa_element_ident_sp_poid-VALUE = '0'.
APPEND wa_element_ident_sp_poid TO element_ident_sp_poid.
  
wa_element_ident_sp_poid-NAME = 'VERSION'.
wa_element_ident_sp_poid-VALUE = '0'.
APPEND wa_element_ident_sp_poid TO element_ident_sp_poid.
* Call the BAPI
CALL FUNCTION 'BAPI_CASE_DELETEELEMENTS'
     EXPORTING
          GUID                         ='40908A3045BF1A51E10000000A1550FF'
          SKIP_ERROR                   = 'X'
          NEW_VERSION                  = 'X'
          DELETE_ONLY_FIRST            = 'X'
     TABLES
          RETURN                       = return
          ELEMENT_IDENT_RECPOS         = element_ident_recpos
          ELEMENT_IDENT_SP_POID        = element_ident_sp_poid.

Notes
The following prerequisites must be met before this BAPI methodcan be used:

  • The case exists and contains the subcomponent "Record".

  • The following authorizations are required:
    • An authorization for changing cases (authorization object S_SCMG_CAS).

    • The tables ELEM_IDENT_RECORDS and ELEM_IDENT_SP_POID are processed oneafter the other in this order. Any overlaps can therefore lead to errormessages.

      Further information
      See also the documentation for the Record BAPI method '
      BAPI_RECORD_DELETEELEMENTS'.

      Description
      Flag. If set, only the first element with the defined POID ID in a caserecord will be deleted.

      Description
      The GUID of a case whose record elements are to be changed.

      Description
      Flag. If set, the record of a case is stored as a new version.

      Description
      Flag. If set and an error occurs, the method continues from the nextelement. If the flag is not set, an error message is returned an thechanges are not saved.

      Description
      Table ELEMENT_IDENT_RECPOS contains the node IDs of the nodes underwhich all elements are to be deleted.

      Description
      Table ELEMENT_IDENT_SP_POID contains the identification info of theelements to be be deleted.
      The SPS ID parameter must be entered for each element. It is definedusing the key value for the field NAME='%SPS_ID%'. All other name-valuepairs for the element with the same ELEM_NO contain the SP POIDparameters of the element.
      If the element with the defined SPS ID and SP POID is found in the casemore than once, and flag DELETE_ONLY_FIRST is not set, this element isdeleted from all positions in the record. If the flag is set, theelement is deleted only from the first position found.

      Description
      Return value that is empty when no errors occur, or provides informationon any errors that do occur.
      If an error refers to an entry in the table ELEM_IDENT_RECPOS, ROWidentifies the row number in this table.
      If an error refers to an entry in the table ELEM_IDENT_SPPOID, ROWidentifies the sequence number of the element to be inserted, which istransferred in the table field ELEM_NO.