on 06-04-2007 1:38 PM
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
Hey...
Good information.
I get an error in trying to add element to record, van you help me out.
The error reads the following:
Source: CL_SRM_GENERIC_SP0============CP , CL_SRM_GENERIC_SP0============CM002 , 102
General error: Could not connect to repository.
This is the code Iam using
*&----
*
*& Report ZTESTPRG
*&
*&----
*
*&
*&
*&----
*
REPORT ZTESTPRG.
Definition of local data types for DOC_ID
types: begin of ty_doc_id,
docclass type bapisrmdoc-docclass,
objectid type bapisrmdoc-guid,
end of ty_doc_id.
Structure of the correct Document-ID
data: ls_doc_id type ty_doc_id,
lt_sp_poid type standard table of bapiproptb,
ls_sp_poid type bapiproptb,
ls_return like bapiret2,
ls_insertion_by_anchor type bapisrmrec_anchorins.
clear: lt_sp_poid, ls_doc_id, ls_doc_id.
ls_doc_id-docclass = 'ZSNG09'.
Document Class des einzufügenden Dokumentes
ls_doc_id-objectid = '466E6A24DED600A100000000AC10A015'.
Objektid des einzufügenden Dokumentes
clear: ls_sp_poid. " clear weg und ls_sp_poid clearen
ls_sp_poid-name = 'DOC_ID'.
ls_sp_poid-value = ls_doc_id.
Document Class und Objektid als Struktur des Dokumentes
append ls_sp_poid to lt_sp_poid.
clear: ls_doc_id.
ls_sp_poid-name = 'VARIANT'.
ls_sp_poid-value = '0'.
append ls_sp_poid to lt_sp_poid.
clear: ls_doc_id.
ls_sp_poid-name = 'VERSION'.
ls_sp_poid-value = '0'.
append ls_sp_poid to lt_sp_poid.
clear: ls_insertion_by_anchor.
ls_insertion_by_anchor-parent_node_id = '5'.
call function 'BAPI_RECORD_ADDELEMENT'
exporting
objectid = '466E9223F887013A00000000AC10A015'
Objectid der Akte
documentclass = 'ZSNG08'
Document Class der Akte
sps_id = 'ZSCMG_SPS_NUCLEAR_PROCEDURE'
Einzufügende Elementart
anchor = 'NP02'
Im Aktenmodell hinterlegt beim Modellknoten
description = 'Test Document'
Beschreibung des Dokumentes in der Akte
element_type = 'I'
Instanz
importing
return = ls_return
tables
element_sp_poid = lt_sp_poid.
write: ls_return-message,
ls_return-type.
.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
About Anchor, as you say it is the place where document needs to be put in.
To tell you my record structure,
I have two subfolders in a folder under the record.
I want to insert the file into the second subfolder.
Now, how do I give the anchor id.
For example, in your code, why did you give the value 'Schriftverkehr' for anchor.
Please help me out.
Thanks,
NSP
Message was edited by:
nsp nsp
Message was edited by:
nsp nsp
sorry that was the wrong code. here's the right one:
*&---------------------------------------------------------------------*
*& 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'
description = 'Testdokument eingefügt mit ABAP'
insertion_by_modelid = wa_insertion_by_modelid
IMPORTING
return = return
Tables
element_sp_poid = element_sp_poid.
write: return-message,
return-type.
*} INSERT
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
with some help, now it works fine
* Store document into selected record
* Definition of local data types for DOC_ID
types: begin of ty_doc_id,
docclass type bapisrmdoc-docclass,
objectid type bapisrmdoc-guid,
end of ty_doc_id.
* Structure of the correct Document-ID
data: ls_doc_id type ty_doc_id,
lt_sp_poid type standard table of bapiproptb,
ls_sp_poid type bapiproptb,
ls_return like bapiret2,
ls_insertion_by_anchor type bapisrmrec_anchorins.
clear: lt_sp_poid, ls_doc_id, ls_doc_id.
ls_doc_id-docclass = 'ZRMSR03'.
** Document Class des einzufügenden Dokumentes
ls_doc_id-objectid = '42B35C4630552864E1000000AC15C293'.
** Objektid des einzufügenden Dokumentes
clear: ls_sp_poid. " clear weg und ls_sp_poid clearen
ls_sp_poid-name = 'DOC_ID'.
ls_sp_poid-value = ls_doc_id.
** Document Class und Objektid als Struktur des Dokumentes
append ls_sp_poid to lt_sp_poid.
clear: ls_doc_id.
ls_sp_poid-name = 'VARIANT'.
ls_sp_poid-value = '0'.
append ls_sp_poid to lt_sp_poid.
clear: ls_doc_id.
ls_sp_poid-name = 'VERSION'.
ls_sp_poid-value = '0'.
append ls_sp_poid to lt_sp_poid.
clear: ls_insertion_by_anchor.
ls_insertion_by_anchor-parent_node_id = '6'.
call function 'BAPI_RECORD_ADDELEMENT'
exporting
objectid = 'E1A55C462F0C790CE1000000AC15C293'
** Objectid der Akte
documentclass = 'ZRMSR04'
** Document Class der Akte
sps_id = 'Z_RM_MIETAKTDOC'
** Einzufügende Elementart
anchor = 'Schriftverkehr'
** Im Aktenmodell hinterlegt beim Modellknoten
description = 'Test eingefügt aus ABAP'
** Beschreibung des Dokumentes in der Akte
element_type = 'I'
** Instanz
importing
return = ls_return
tables
element_sp_poid = lt_sp_poid.
write: ls_return-message,
ls_return-type.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.