Dear colleagues,
I have a problem with SRM BAPIs. I need to insert a pdf document into a record using SAP BAPIs, This document is already in a table in a binary format
I am trying with these BAPIs:
1.
CALL FUNCTION 'BAPI_SRM_DOC_CREATE'
EXPORTING
rms_id = rms_id
sps_id = sps_id
documentid = documentid
description = 'DESCRIPTION'
do_commit = 'X'
documentid_check_unique = 'X'
IMPORTING
return = return
objectid = objectid
documentclass = documentclass
TABLES
required_properties = required_properties.
This BAPI is working as expected. It returns objectid for the new document.
2. Now I'm using BAPI_RECORD_ADDELEMENT:
ls_doc_id-objectid = objectid.
CLEAR: ls_sp_poid. " clear weg und ls_sp_poid clearen
ls_sp_poid-name = 'DOC_ID'.
ls_sp_poid-value = ls_doc_id.
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.
ls_insertion_by_anchor-anchor = 'DECRET'.
ls_insertion_by_anchor-parent_node_id = '5'.
ls_insertion_by_anchor-parent_node_attr_name = 'DECRETAT'.
ls_insertion_by_anchor-parent_node_attr_value = '40'.
CALL FUNCTION 'BAPI_RECORD_ADDELEMENT'
EXPORTING
objectid = zrm_attcab_scr-phio_id
documentclass = documentclass
sps_id = 'ZRM_SPS_DOCVAR'
anchor = 'DECRETS'
description = 'Descripcion'
store_as_new_version = 'X' "Si X se crea vacio
* STACKED = ''
* DOC_CONTEXT =
element_type = 'I'
* insertion_by_anchor = ls_insertion_by_anchor
* insertion_by_modelid = insertion_by_modelid
* INSERTION_BY_REFERENCE_NODE =
* ALL_SAME_NAME_ANCHOR = 'X'
* SET_ELEM_DESCR_HARD = ' '
* omit_authority_check = 'X'
IMPORTING
return = ls_return
TABLES
element_sp_poid = lt_sp_poid.
* ELEMENT_PROPERTIES =
* ELEMENT_VISIBILITY =
.
This BAPI returns an internal error
Am I following the correct steps or am I skipping anything?
Could anyone help me?
Thanks in advance!!