Skip to Content
0
Former Member
Jun 04, 2007 at 12:38 PM

Records Management - automaticaly add element to record

277 Views

Hello,

I try to add an element to a record using the bapi "bapi_record_addelement", but I get an error-message that the number of poid-parameters is not equal to those in the registry information.

My ABAP-Code is the following:

*&---------------------------------------------------------------------*
*& Report  Z_RECORD_ADDELEMENT
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  Z_RECORD_ADDELEMENT.
*{   INSERT         I50K900139                                        1
data:
wa_ELEMENT_SP_POID     type      BAPIPROPTB,
wa_ELEMENT_PROPERTIES  type      BAPIPROPTB,
wa_ELEMENT_VISIBILITY  type      BAPIPROPTB,
element_sp_poid type standard table of BAPIPROPTB,
element_properties type standard table of BAPIPROPTB,
wa_insertion_by_modelid type BAPISRMREC_MODELIDINS,
return like BAPIRET2.

* Fill SP POID table

start-of-selection.
CLEAR element_sp_poid.

wa_element_sp_poid-NAME  = 'DOC_ID'.

wa_element_sp_poid-VALUE = '03F65C4630552864E1000000AC15C293'.

APPEND wa_element_sp_poid TO element_sp_poid.

wa_element_sp_poid-NAME  = 'VARIANT'.

wa_element_sp_poid-VALUE = '0'.

APPEND wa_element_sp_poid TO element_sp_poid.

wa_element_sp_poid-NAME  = 'VERSION'.

wa_element_sp_poid-VALUE = '2'.

APPEND wa_element_sp_poid TO element_sp_poid.

wa_insertion_by_modelid-MODEL_ID = 'D7F85C462E55770CE1000000AC15C293'.

wa_insertion_by_modelid-PARENT_NODE_ID = '3'.

*********************************************************************
** add element
CALL FUNCTION 'BAPI_RECORD_ADDELEMENT'
        EXPORTING

          objectid = 'E1A55C462F0C790CE1000000AC15C293'

          DocumentClass = 'ZRMSR04'

          sps_id = 'Z_RM_MIETAKT'

          anchor = 'Schriftverkehr'

          description = 'Testdokument eingefügt mit ABAP'

         IMPORTING
          return        = return.

write: return-message,
       return-type.

*}   INSERT

I hope someone can help me because I am trying for one week.

hootzter