Also ich hatte die Neuanlage über diese Methode umgesetzt (innerhalb eines Workflows) und muss unter anderem auch noch weitere Felder updaten... deshalb bin ich auf diese Methode gegangen.
Code: Alles auswählen.
REPORT.
DATA:
l_data TYPE cvis_ei_extern_t,
l_data_line LIKE LINE OF l_data,
l_return TYPE bapiretm,
l_error TYPE abap_bool,
l_address TYPE bus_ei_bupa_address.
SELECT SINGLE * FROM but000
WHERE partner EQ '0001000000'
INTO @DATA(l_but000).
SELECT SINGLE b~address_guid FROM but021_fs AS a
INNER JOIN but020 AS b ON a~addrnumber = b~addrnumber
WHERE a~partner = @l_but000-partner
AND adr_kind = 'XXDEFAULT'
INTO @DATA(l_address_guid).
l_data_line = VALUE #(
partner-header-object_instance-bpartnerguid = l_but000-partner_guid
partner-header-object_task = 'U'
).
IF l_address_guid IS INITIAL.
l_address-task = 'I'.
ELSE.
l_address-task = 'U'.
l_address-data_key-guid = l_address_guid.
ENDIF.
l_address-data-communication-phone-phone = VALUE #( (
contact-task = 'U'
contact-data-telephone = '0221 10 30 30'
contact-data-country = 'DE'
contact-data-std_no = abap_true
contact-datax-telephone = 'X'
contact-datax-country = 'X'
contact-datax-std_no = 'X' ) ).
l_data_line-partner-central_data-address-addresses = VALUE #( ( l_address ) ).
INSERT L_data_line INTO TABLE l_data.
cl_md_bp_maintain=>maintain(
EXPORTING
i_data = l_data
IMPORTING
e_return = l_return ).
LOOP AT l_return ASSIGNING FIELD-SYMBOL(<return>).
LOOP AT <return>-object_msg ASSIGNING FIELD-SYMBOL(<msg>).
IF <msg>-type EQ 'E' OR <msg>-type EQ 'A'.
l_error = abap_true.
EXIT.
ENDIF.
ENDLOOP.
IF l_error EQ abap_true.
EXIT.
ENDIF.
ENDLOOP.
IF l_error IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
cl_demo_output=>write( 'GP geändert' ).
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
cl_demo_output=>write( 'Änderung fehlgeschlagen' ).
ENDIF.
cl_demo_output=>write( l_return ).
cl_demo_output=>display( ).
Folgende Benutzer bedankten sich beim Autor rob_abc für den Beitrag (Insgesamt 2):
littleJohn • Romaniac