Skip to Content
0
Oct 30, 2008 at 03:03 PM

Changing Partner Function in ORDER SAVE

191 Views

Hi All,

We have a requirement to change the partner function when the order replicates from ISA to CRM. I am writing my code in ORDER_SAVE badi using CRM_ORDER_MAINTAIN. I am getting the partner number from ISA and am also updating the partner and sending it to ORDER_MAINTAIN but for some reason i am not getting the value updated. Here is my code. Please let me know if there is anything wrong with my code.

loop at lt_header into ls_header .

clear: ls_partner_ref.

loop at lt_partner_ref into ls_partner_ref.

clear: lt_input_names,

ls_input_field,

ls_input_names.

IF ls_partner_ref-partner_fct = 'Z0000006'.

if sy-subrc is initial.

IMPORT t_extension to it_extension FROM memory id 'ACT'.

if sy-subrc is initial.

clear: is_extension.

read table it_extension into is_extension WITH KEY NAME = 'ZCARRIER'.

IF SY-SUBRC IS INITIAL.

IF NOT IS_EXTENSION-VALUE IS INITIAL.

ZCARRIER = is_extension-value.

IF sy-subrc = 0.

select single PARTNER_GUID from BUT000 into ZPARTNER_GUID where PARTNER =

ZCARRIER.

select single PARTNER PERSNUMBER

into

(ZPARTNER_NO,

ZADDR_NP)

from BUT000

where partner_guid = ZPARTNER_GUID

group by PARTNER

PERSNUMBER.

select single ADDRNUMBER from BUT020 into ZADDR_NR where partner = ZPARTNER_NO.

ls_partner-ref_guid = ls_header-guid.

ls_partner-ref_kind = 'A'.

ls_partner-ref_partner_fct = 'Z0000006'.

ls_partner-ref_partner_no = is_extension-value.

ls_partner-ref_no_type = 'BP'.

ls_partner-ref_display_type = 'BP'.

ls_partner-kind_of_entry = 'D'.

ls_partner-partner_fct = 'Z0000006'.

ls_partner-partner_no = is_extension-value.

ls_partner-no_type = 'BP'.

ls_partner-display_type = 'BP'.

ls_partner-addr_nr = zaddr_nr.

ls_partner-addr_np = zaddr_np.

insert ls_partner into table lt_partner.

ls_input_field-ref_guid = ls_header-guid.

ls_input_field-objectname = 'PARTNER'.

fs_input_field-ref_partner_handle = '000'.

fs_input_field-ref_partner_fct = 'Z0000006'.

fs_input_field-ref_partner_no = is_extension-value.

fs_input_field-ref_no_type = 'BP'.

fs_input_field-ref_display_type = 'BP'.

move-corresponding fs_input_field to ls_logical_partner_key.

ls_input_field-logical_key = ls_logical_partner_key.

ls_input_names-fieldname = 'PARTNER_NO '.

ls_input_names-changeable = 'X'.

insert ls_input_names into table lt_input_names.

ls_input_names-fieldname = 'DISPLAY_TYPE'.

ls_input_names-changeable = 'X'.

insert ls_input_names into table lt_input_names.

ls_input_names-fieldname = 'NO_TYPE'.

ls_input_names-changeable = 'X'.

insert ls_input_names into table lt_input_names.

ls_input_names-fieldname = 'KIND_OF_ENTRY'.

ls_input_names-changeable = 'X'.

insert ls_input_names into table lt_input_names.

ls_input_names-fieldname = 'ADDR_NR '.

ls_input_names-changeable = 'X'.

insert ls_input_names into table lt_input_names.

insert lines of lt_input_names into table ls_input_field-field_names.

insert ls_input_field into table lt_input_field.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

endif.

endif.

endloop.

endloop.

Thanks,

Karuna.